aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AsmParser/Lexer.l24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l
index f342d2fe34..47c067ba8c 100644
--- a/lib/AsmParser/Lexer.l
+++ b/lib/AsmParser/Lexer.l
@@ -48,10 +48,7 @@ static uint64_t atoull(const char *Buffer) {
return Result;
}
-// HexToFP - Convert the ascii string in hexidecimal format to the floating
-// point representation of it.
-//
-static double HexToFP(const char *Buffer) {
+static uint64_t HexIntToVal(const char *Buffer) {
uint64_t Result = 0;
for (; *Buffer; ++Buffer) {
uint64_t OldRes = Result;
@@ -67,6 +64,15 @@ static double HexToFP(const char *Buffer) {
if (Result < OldRes) // Uh, oh, overflow detected!!!
ThrowException("constant bigger than 64 bits detected!");
}
+ return Result;
+}
+
+
+// HexToFP - Convert the ascii string in hexidecimal format to the floating
+// point representation of it.
+//
+static double HexToFP(const char *Buffer) {
+ uint64_t Result = HexIntToVal(Buffer);
assert(sizeof(double) == sizeof(Result) &&
"Data sizes incompatible on this target!");
@@ -142,6 +148,11 @@ FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
* hexadecimal number for when exponential notation is not precise enough.
*/
HexFPConstant 0x[0-9A-Fa-f]+
+
+/* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
+ * it to deal with 64 bit numbers.
+ */
+HexIntConstant [us]0x[0-9A-Fa-f]+
%%
{Comment} { /* Ignore comments for now */ }
@@ -249,7 +260,10 @@ getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
llvmAsmlval.SInt64Val = -Val;
return ESINT64VAL;
}
-
+{HexIntConstant} {
+ llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
+ return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
+ }
{EPInteger} { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; }
{ENInteger} {