1 //===- LLLexer.cpp - Lexer for .ll Files ----------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Implement the Lexer for .ll files.
12 //===----------------------------------------------------------------------===//
15 #include "llvm/DerivedTypes.h"
16 #include "llvm/Instruction.h"
17 #include "llvm/Support/MemoryBuffer.h"
18 #include "llvm/Support/MathExtras.h"
19 #include "llvm/Support/raw_ostream.h"
20 #include "llvm/Assembly/Parser.h"
25 bool LLLexer::Error(LocTy ErrorLoc, const std::string &Msg) const {
26 // Scan backward to find the start of the line.
27 const char *LineStart = ErrorLoc;
28 while (LineStart != CurBuf->getBufferStart() &&
29 LineStart[-1] != '\n' && LineStart[-1] != '\r')
31 // Get the end of the line.
32 const char *LineEnd = ErrorLoc;
33 while (LineEnd != CurBuf->getBufferEnd() &&
34 LineEnd[0] != '\n' && LineEnd[0] != '\r')
38 for (const char *FP = CurBuf->getBufferStart(); FP != ErrorLoc; ++FP)
39 if (*FP == '\n') ++LineNo;
41 std::string LineContents(LineStart, LineEnd);
42 ErrorInfo.setError(Msg, LineNo, ErrorLoc-LineStart, LineContents);
46 //===----------------------------------------------------------------------===//
48 //===----------------------------------------------------------------------===//
50 // atoull - Convert an ascii string of decimal digits into the unsigned long
51 // long representation... this does not have to do input error checking,
52 // because we know that the input will be matched by a suitable regex...
54 uint64_t LLLexer::atoull(const char *Buffer, const char *End) {
56 for (; Buffer != End; Buffer++) {
57 uint64_t OldRes = Result;
59 Result += *Buffer-'0';
60 if (Result < OldRes) { // Uh, oh, overflow detected!!!
61 Error("constant bigger than 64 bits detected!");
68 uint64_t LLLexer::HexIntToVal(const char *Buffer, const char *End) {
70 for (; Buffer != End; ++Buffer) {
71 uint64_t OldRes = Result;
74 if (C >= '0' && C <= '9')
76 else if (C >= 'A' && C <= 'F')
78 else if (C >= 'a' && C <= 'f')
81 if (Result < OldRes) { // Uh, oh, overflow detected!!!
82 Error("constant bigger than 64 bits detected!");
89 void LLLexer::HexToIntPair(const char *Buffer, const char *End,
92 for (int i=0; i<16; i++, Buffer++) {
93 assert(Buffer != End);
96 if (C >= '0' && C <= '9')
98 else if (C >= 'A' && C <= 'F')
100 else if (C >= 'a' && C <= 'f')
104 for (int i=0; i<16 && Buffer != End; i++, Buffer++) {
107 if (C >= '0' && C <= '9')
109 else if (C >= 'A' && C <= 'F')
111 else if (C >= 'a' && C <= 'f')
115 Error("constant bigger than 128 bits detected!");
118 // UnEscapeLexed - Run through the specified buffer and change \xx codes to the
119 // appropriate character.
120 static void UnEscapeLexed(std::string &Str) {
121 if (Str.empty()) return;
123 char *Buffer = &Str[0], *EndBuffer = Buffer+Str.size();
125 for (char *BIn = Buffer; BIn != EndBuffer; ) {
126 if (BIn[0] == '\\') {
127 if (BIn < EndBuffer-1 && BIn[1] == '\\') {
128 *BOut++ = '\\'; // Two \ becomes one
130 } else if (BIn < EndBuffer-2 && isxdigit(BIn[1]) && isxdigit(BIn[2])) {
131 char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
132 *BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
133 BIn[3] = Tmp; // Restore character
134 BIn += 3; // Skip over handled chars
143 Str.resize(BOut-Buffer);
146 /// isLabelChar - Return true for [-a-zA-Z$._0-9].
147 static bool isLabelChar(char C) {
148 return isalnum(C) || C == '-' || C == '$' || C == '.' || C == '_';
152 /// isLabelTail - Return true if this pointer points to a valid end of a label.
153 static const char *isLabelTail(const char *CurPtr) {
155 if (CurPtr[0] == ':') return CurPtr+1;
156 if (!isLabelChar(CurPtr[0])) return 0;
163 //===----------------------------------------------------------------------===//
165 //===----------------------------------------------------------------------===//
167 LLLexer::LLLexer(MemoryBuffer *StartBuf, ParseError &Err)
168 : CurBuf(StartBuf), ErrorInfo(Err), APFloatVal(0.0) {
169 CurPtr = CurBuf->getBufferStart();
172 std::string LLLexer::getFilename() const {
173 return CurBuf->getBufferIdentifier();
176 int LLLexer::getNextChar() {
177 char CurChar = *CurPtr++;
179 default: return (unsigned char)CurChar;
181 // A nul character in the stream is either the end of the current buffer or
182 // a random nul in the file. Disambiguate that here.
183 if (CurPtr-1 != CurBuf->getBufferEnd())
184 return 0; // Just whitespace.
186 // Otherwise, return end of file.
187 --CurPtr; // Another call to lex will return EOF again.
193 lltok::Kind LLLexer::LexToken() {
196 int CurChar = getNextChar();
199 // Handle letters: [a-zA-Z_]
200 if (isalpha(CurChar) || CurChar == '_')
201 return LexIdentifier();
204 case EOF: return lltok::Eof;
210 // Ignore whitespace.
212 case '+': return LexPositive();
213 case '@': return LexAt();
214 case '%': return LexPercent();
215 case '"': return LexQuote();
217 if (const char *Ptr = isLabelTail(CurPtr)) {
219 StrVal.assign(TokStart, CurPtr-1);
220 return lltok::LabelStr;
222 if (CurPtr[0] == '.' && CurPtr[1] == '.') {
224 return lltok::dotdotdot;
228 if (const char *Ptr = isLabelTail(CurPtr)) {
230 StrVal.assign(TokStart, CurPtr-1);
231 return lltok::LabelStr;
237 case '0': case '1': case '2': case '3': case '4':
238 case '5': case '6': case '7': case '8': case '9':
240 return LexDigitOrNegative();
241 case '=': return lltok::equal;
242 case '[': return lltok::lsquare;
243 case ']': return lltok::rsquare;
244 case '{': return lltok::lbrace;
245 case '}': return lltok::rbrace;
246 case '<': return lltok::less;
247 case '>': return lltok::greater;
248 case '(': return lltok::lparen;
249 case ')': return lltok::rparen;
250 case ',': return lltok::comma;
251 case '*': return lltok::star;
252 case '\\': return lltok::backslash;
256 void LLLexer::SkipLineComment() {
258 if (CurPtr[0] == '\n' || CurPtr[0] == '\r' || getNextChar() == EOF)
263 /// LexAt - Lex all tokens that start with an @ character:
264 /// GlobalVar @\"[^\"]*\"
265 /// GlobalVar @[-a-zA-Z$._][-a-zA-Z$._0-9]*
266 /// GlobalVarID @[0-9]+
267 lltok::Kind LLLexer::LexAt() {
268 // Handle AtStringConstant: @\"[^\"]*\"
269 if (CurPtr[0] == '"') {
273 int CurChar = getNextChar();
275 if (CurChar == EOF) {
276 Error("end of file in global variable name");
279 if (CurChar == '"') {
280 StrVal.assign(TokStart+2, CurPtr-1);
281 UnEscapeLexed(StrVal);
282 return lltok::GlobalVar;
287 // Handle GlobalVarName: @[-a-zA-Z$._][-a-zA-Z$._0-9]*
288 if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
289 CurPtr[0] == '.' || CurPtr[0] == '_') {
291 while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
292 CurPtr[0] == '.' || CurPtr[0] == '_')
295 StrVal.assign(TokStart+1, CurPtr); // Skip @
296 return lltok::GlobalVar;
299 // Handle GlobalVarID: @[0-9]+
300 if (isdigit(CurPtr[0])) {
301 for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr)
304 uint64_t Val = atoull(TokStart+1, CurPtr);
305 if ((unsigned)Val != Val)
306 Error("invalid value number (too large)!");
307 UIntVal = unsigned(Val);
308 return lltok::GlobalID;
315 /// LexPercent - Lex all tokens that start with a % character:
316 /// LocalVar ::= %\"[^\"]*\"
317 /// LocalVar ::= %[-a-zA-Z$._][-a-zA-Z$._0-9]*
318 /// LocalVarID ::= %[0-9]+
319 lltok::Kind LLLexer::LexPercent() {
320 // Handle LocalVarName: %\"[^\"]*\"
321 if (CurPtr[0] == '"') {
325 int CurChar = getNextChar();
327 if (CurChar == EOF) {
328 Error("end of file in string constant");
331 if (CurChar == '"') {
332 StrVal.assign(TokStart+2, CurPtr-1);
333 UnEscapeLexed(StrVal);
334 return lltok::LocalVar;
339 // Handle LocalVarName: %[-a-zA-Z$._][-a-zA-Z$._0-9]*
340 if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
341 CurPtr[0] == '.' || CurPtr[0] == '_') {
343 while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' ||
344 CurPtr[0] == '.' || CurPtr[0] == '_')
347 StrVal.assign(TokStart+1, CurPtr); // Skip %
348 return lltok::LocalVar;
351 // Handle LocalVarID: %[0-9]+
352 if (isdigit(CurPtr[0])) {
353 for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr)
356 uint64_t Val = atoull(TokStart+1, CurPtr);
357 if ((unsigned)Val != Val)
358 Error("invalid value number (too large)!");
359 UIntVal = unsigned(Val);
360 return lltok::LocalVarID;
366 /// LexQuote - Lex all tokens that start with a " character:
367 /// QuoteLabel "[^"]+":
368 /// StringConstant "[^"]*"
369 lltok::Kind LLLexer::LexQuote() {
371 int CurChar = getNextChar();
373 if (CurChar == EOF) {
374 Error("end of file in quoted string");
378 if (CurChar != '"') continue;
380 if (CurPtr[0] != ':') {
381 StrVal.assign(TokStart+1, CurPtr-1);
382 UnEscapeLexed(StrVal);
383 return lltok::StringConstant;
387 StrVal.assign(TokStart+1, CurPtr-2);
388 UnEscapeLexed(StrVal);
389 return lltok::LabelStr;
393 static bool JustWhitespaceNewLine(const char *&Ptr) {
394 const char *ThisPtr = Ptr;
395 while (*ThisPtr == ' ' || *ThisPtr == '\t')
397 if (*ThisPtr == '\n' || *ThisPtr == '\r') {
405 /// LexIdentifier: Handle several related productions:
406 /// Label [-a-zA-Z$._0-9]+:
407 /// IntegerType i[0-9]+
408 /// Keyword sdiv, float, ...
409 /// HexIntConstant [us]0x[0-9A-Fa-f]+
410 lltok::Kind LLLexer::LexIdentifier() {
411 const char *StartChar = CurPtr;
412 const char *IntEnd = CurPtr[-1] == 'i' ? 0 : StartChar;
413 const char *KeywordEnd = 0;
415 for (; isLabelChar(*CurPtr); ++CurPtr) {
416 // If we decide this is an integer, remember the end of the sequence.
417 if (!IntEnd && !isdigit(*CurPtr)) IntEnd = CurPtr;
418 if (!KeywordEnd && !isalnum(*CurPtr) && *CurPtr != '_') KeywordEnd = CurPtr;
421 // If we stopped due to a colon, this really is a label.
422 if (*CurPtr == ':') {
423 StrVal.assign(StartChar-1, CurPtr++);
424 return lltok::LabelStr;
427 // Otherwise, this wasn't a label. If this was valid as an integer type,
429 if (IntEnd == 0) IntEnd = CurPtr;
430 if (IntEnd != StartChar) {
432 uint64_t NumBits = atoull(StartChar, CurPtr);
433 if (NumBits < IntegerType::MIN_INT_BITS ||
434 NumBits > IntegerType::MAX_INT_BITS) {
435 Error("bitwidth for integer type out of range!");
438 TyVal = IntegerType::get(NumBits);
442 // Otherwise, this was a letter sequence. See which keyword this is.
443 if (KeywordEnd == 0) KeywordEnd = CurPtr;
446 unsigned Len = CurPtr-StartChar;
447 #define KEYWORD(STR) \
448 if (Len == strlen(#STR) && !memcmp(StartChar, #STR, strlen(#STR))) \
449 return lltok::kw_##STR;
451 KEYWORD(begin); KEYWORD(end);
452 KEYWORD(true); KEYWORD(false);
453 KEYWORD(declare); KEYWORD(define);
454 KEYWORD(global); KEYWORD(constant);
459 KEYWORD(linkonce_odr);
470 KEYWORD(extern_weak);
472 KEYWORD(thread_local);
473 KEYWORD(zeroinitializer);
495 KEYWORD(x86_stdcallcc);
496 KEYWORD(x86_fastcallcc);
514 KEYWORD(alwaysinline);
522 KEYWORD(eq); KEYWORD(ne); KEYWORD(slt); KEYWORD(sgt); KEYWORD(sle);
523 KEYWORD(sge); KEYWORD(ult); KEYWORD(ugt); KEYWORD(ule); KEYWORD(uge);
524 KEYWORD(oeq); KEYWORD(one); KEYWORD(olt); KEYWORD(ogt); KEYWORD(ole);
525 KEYWORD(oge); KEYWORD(ord); KEYWORD(uno); KEYWORD(ueq); KEYWORD(une);
530 // Keywords for types.
531 #define TYPEKEYWORD(STR, LLVMTY) \
532 if (Len == strlen(STR) && !memcmp(StartChar, STR, strlen(STR))) { \
533 TyVal = LLVMTY; return lltok::Type; }
534 TYPEKEYWORD("void", Type::VoidTy);
535 TYPEKEYWORD("float", Type::FloatTy);
536 TYPEKEYWORD("double", Type::DoubleTy);
537 TYPEKEYWORD("x86_fp80", Type::X86_FP80Ty);
538 TYPEKEYWORD("fp128", Type::FP128Ty);
539 TYPEKEYWORD("ppc_fp128", Type::PPC_FP128Ty);
540 TYPEKEYWORD("label", Type::LabelTy);
543 // Handle special forms for autoupgrading. Drop these in LLVM 3.0. This is
544 // to avoid conflicting with the sext/zext instructions, below.
545 if (Len == 4 && !memcmp(StartChar, "sext", 4)) {
546 // Scan CurPtr ahead, seeing if there is just whitespace before the newline.
547 if (JustWhitespaceNewLine(CurPtr))
548 return lltok::kw_signext;
549 } else if (Len == 4 && !memcmp(StartChar, "zext", 4)) {
550 // Scan CurPtr ahead, seeing if there is just whitespace before the newline.
551 if (JustWhitespaceNewLine(CurPtr))
552 return lltok::kw_zeroext;
555 // Keywords for instructions.
556 #define INSTKEYWORD(STR, Enum) \
557 if (Len == strlen(#STR) && !memcmp(StartChar, #STR, strlen(#STR))) { \
558 UIntVal = Instruction::Enum; return lltok::kw_##STR; }
560 INSTKEYWORD(add, Add); INSTKEYWORD(sub, Sub); INSTKEYWORD(mul, Mul);
561 INSTKEYWORD(udiv, UDiv); INSTKEYWORD(sdiv, SDiv); INSTKEYWORD(fdiv, FDiv);
562 INSTKEYWORD(urem, URem); INSTKEYWORD(srem, SRem); INSTKEYWORD(frem, FRem);
563 INSTKEYWORD(shl, Shl); INSTKEYWORD(lshr, LShr); INSTKEYWORD(ashr, AShr);
564 INSTKEYWORD(and, And); INSTKEYWORD(or, Or); INSTKEYWORD(xor, Xor);
565 INSTKEYWORD(icmp, ICmp); INSTKEYWORD(fcmp, FCmp);
566 INSTKEYWORD(vicmp, VICmp); INSTKEYWORD(vfcmp, VFCmp);
568 INSTKEYWORD(phi, PHI);
569 INSTKEYWORD(call, Call);
570 INSTKEYWORD(trunc, Trunc);
571 INSTKEYWORD(zext, ZExt);
572 INSTKEYWORD(sext, SExt);
573 INSTKEYWORD(fptrunc, FPTrunc);
574 INSTKEYWORD(fpext, FPExt);
575 INSTKEYWORD(uitofp, UIToFP);
576 INSTKEYWORD(sitofp, SIToFP);
577 INSTKEYWORD(fptoui, FPToUI);
578 INSTKEYWORD(fptosi, FPToSI);
579 INSTKEYWORD(inttoptr, IntToPtr);
580 INSTKEYWORD(ptrtoint, PtrToInt);
581 INSTKEYWORD(bitcast, BitCast);
582 INSTKEYWORD(select, Select);
583 INSTKEYWORD(va_arg, VAArg);
584 INSTKEYWORD(ret, Ret);
586 INSTKEYWORD(switch, Switch);
587 INSTKEYWORD(invoke, Invoke);
588 INSTKEYWORD(unwind, Unwind);
589 INSTKEYWORD(unreachable, Unreachable);
591 INSTKEYWORD(malloc, Malloc);
592 INSTKEYWORD(alloca, Alloca);
593 INSTKEYWORD(free, Free);
594 INSTKEYWORD(load, Load);
595 INSTKEYWORD(store, Store);
596 INSTKEYWORD(getelementptr, GetElementPtr);
598 INSTKEYWORD(extractelement, ExtractElement);
599 INSTKEYWORD(insertelement, InsertElement);
600 INSTKEYWORD(shufflevector, ShuffleVector);
601 INSTKEYWORD(getresult, ExtractValue);
602 INSTKEYWORD(extractvalue, ExtractValue);
603 INSTKEYWORD(insertvalue, InsertValue);
606 // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by
607 // the CFE to avoid forcing it to deal with 64-bit numbers.
608 if ((TokStart[0] == 'u' || TokStart[0] == 's') &&
609 TokStart[1] == '0' && TokStart[2] == 'x' && isxdigit(TokStart[3])) {
610 int len = CurPtr-TokStart-3;
611 uint32_t bits = len * 4;
612 APInt Tmp(bits, TokStart+3, len, 16);
613 uint32_t activeBits = Tmp.getActiveBits();
614 if (activeBits > 0 && activeBits < bits)
615 Tmp.trunc(activeBits);
616 APSIntVal = APSInt(Tmp, TokStart[0] == 'u');
617 return lltok::APSInt;
620 // If this is "cc1234", return this as just "cc".
621 if (TokStart[0] == 'c' && TokStart[1] == 'c') {
626 // If this starts with "call", return it as CALL. This is to support old
627 // broken .ll files. FIXME: remove this with LLVM 3.0.
628 if (CurPtr-TokStart > 4 && !memcmp(TokStart, "call", 4)) {
630 UIntVal = Instruction::Call;
631 return lltok::kw_call;
634 // Finally, if this isn't known, return an error.
640 /// Lex0x: Handle productions that start with 0x, knowing that it matches and
641 /// that this is not a label:
642 /// HexFPConstant 0x[0-9A-Fa-f]+
643 /// HexFP80Constant 0xK[0-9A-Fa-f]+
644 /// HexFP128Constant 0xL[0-9A-Fa-f]+
645 /// HexPPC128Constant 0xM[0-9A-Fa-f]+
646 lltok::Kind LLLexer::Lex0x() {
647 CurPtr = TokStart + 2;
650 if (CurPtr[0] >= 'K' && CurPtr[0] <= 'M') {
656 if (!isxdigit(CurPtr[0])) {
657 // Bad token, return it as an error.
662 while (isxdigit(CurPtr[0]))
666 // HexFPConstant - Floating point constant represented in IEEE format as a
667 // hexadecimal number for when exponential notation is not precise enough.
668 // Float and double only.
669 APFloatVal = APFloat(BitsToDouble(HexIntToVal(TokStart+2, CurPtr)));
670 return lltok::APFloat;
674 HexToIntPair(TokStart+3, CurPtr, Pair);
676 default: assert(0 && "Unknown kind!");
678 // F80HexFPConstant - x87 long double in hexadecimal format (10 bytes)
679 APFloatVal = APFloat(APInt(80, 2, Pair));
680 return lltok::APFloat;
682 // F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes)
683 APFloatVal = APFloat(APInt(128, 2, Pair), true);
684 return lltok::APFloat;
686 // PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes)
687 APFloatVal = APFloat(APInt(128, 2, Pair));
688 return lltok::APFloat;
692 /// LexIdentifier: Handle several related productions:
693 /// Label [-a-zA-Z$._0-9]+:
695 /// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
697 /// HexFPConstant 0x[0-9A-Fa-f]+
698 /// HexFP80Constant 0xK[0-9A-Fa-f]+
699 /// HexFP128Constant 0xL[0-9A-Fa-f]+
700 /// HexPPC128Constant 0xM[0-9A-Fa-f]+
701 lltok::Kind LLLexer::LexDigitOrNegative() {
702 // If the letter after the negative is a number, this is probably a label.
703 if (!isdigit(TokStart[0]) && !isdigit(CurPtr[0])) {
704 // Okay, this is not a number after the -, it's probably a label.
705 if (const char *End = isLabelTail(CurPtr)) {
706 StrVal.assign(TokStart, End-1);
708 return lltok::LabelStr;
714 // At this point, it is either a label, int or fp constant.
716 // Skip digits, we have at least one.
717 for (; isdigit(CurPtr[0]); ++CurPtr)
720 // Check to see if this really is a label afterall, e.g. "-1:".
721 if (isLabelChar(CurPtr[0]) || CurPtr[0] == ':') {
722 if (const char *End = isLabelTail(CurPtr)) {
723 StrVal.assign(TokStart, End-1);
725 return lltok::LabelStr;
729 // If the next character is a '.', then it is a fp value, otherwise its
731 if (CurPtr[0] != '.') {
732 if (TokStart[0] == '0' && TokStart[1] == 'x')
734 unsigned Len = CurPtr-TokStart;
735 uint32_t numBits = ((Len * 64) / 19) + 2;
736 APInt Tmp(numBits, TokStart, Len, 10);
737 if (TokStart[0] == '-') {
738 uint32_t minBits = Tmp.getMinSignedBits();
739 if (minBits > 0 && minBits < numBits)
741 APSIntVal = APSInt(Tmp, false);
743 uint32_t activeBits = Tmp.getActiveBits();
744 if (activeBits > 0 && activeBits < numBits)
745 Tmp.trunc(activeBits);
746 APSIntVal = APSInt(Tmp, true);
748 return lltok::APSInt;
753 // Skip over [0-9]*([eE][-+]?[0-9]+)?
754 while (isdigit(CurPtr[0])) ++CurPtr;
756 if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
757 if (isdigit(CurPtr[1]) ||
758 ((CurPtr[1] == '-' || CurPtr[1] == '+') && isdigit(CurPtr[2]))) {
760 while (isdigit(CurPtr[0])) ++CurPtr;
764 APFloatVal = APFloat(atof(TokStart));
765 return lltok::APFloat;
768 /// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)?
769 lltok::Kind LLLexer::LexPositive() {
770 // If the letter after the negative is a number, this is probably not a
772 if (!isdigit(CurPtr[0]))
776 for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr)
779 // At this point, we need a '.'.
780 if (CurPtr[0] != '.') {
787 // Skip over [0-9]*([eE][-+]?[0-9]+)?
788 while (isdigit(CurPtr[0])) ++CurPtr;
790 if (CurPtr[0] == 'e' || CurPtr[0] == 'E') {
791 if (isdigit(CurPtr[1]) ||
792 ((CurPtr[1] == '-' || CurPtr[1] == '+') && isdigit(CurPtr[2]))) {
794 while (isdigit(CurPtr[0])) ++CurPtr;
798 APFloatVal = APFloat(atof(TokStart));
799 return lltok::APFloat;