llvm.org GIT mirror llvm / 43421b3
Next round of APFloat changes. Use APFloat in UpgradeParser and AsmParser. Change all references to ConstantFP to use the APFloat interface rather than double. Remove the ConstantFP double interfaces. Use APFloat functions for constant folding arithmetic and comparisons. (There are still way too many places APFloat is just a wrapper around host float/double, but we're getting there.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 12 years ago
32 changed file(s) with 544 addition(s) and 441 deletion(s). Raw diff Collapse all Expand all
216216 APFloat Val;
217217 ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
218218 protected:
219 ConstantFP(const Type *Ty, double V);
220219 ConstantFP(const Type *Ty, const APFloat& V);
221220 public:
222221 /// get() - Static factory methods - Return objects of the specified value
223 static ConstantFP *get(const Type *Ty, double V);
224222 static ConstantFP *get(const Type *Ty, const APFloat& V);
225223
226224 /// isValueValidForType - return true if Ty is big enough to represent V.
227225 static bool isValueValidForType(const Type *Ty, const APFloat& V);
228 static bool isValueValidForType(const Type *Ty, double V) {
229 if (Ty == Type::FloatTy)
230 return isValueValidForType(Ty, APFloat((float)V));
231 else
232 return isValueValidForType(Ty, APFloat(V));
233 }
234 inline double getValue() const {
235 if (&Val.getSemantics() == &APFloat::IEEEdouble)
236 return Val.convertToDouble();
237 else if (&Val.getSemantics() == &APFloat::IEEEsingle)
238 return (double)Val.convertToFloat();
239 else
240 assert(0);
241 }
242226 inline const APFloat& getValueAPF() const { return Val; }
243227
244228 /// isNullValue - Return true if this is the value that would be returned by
249233 /// isExactlyValue - We don't rely on operator== working on double values, as
250234 /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
251235 /// As such, this method can be used to do an exact bit-for-bit comparison of
252 /// two floating point values.
236 /// two floating point values. The version with a double operand is retained
237 /// because it's so convenient to write isExactlyValue(2.0), but please use
238 /// it only for constants.
253239 bool isExactlyValue(const APFloat& V) const;
240
254241 bool isExactlyValue(double V) const {
255242 if (&Val.getSemantics() == &APFloat::IEEEdouble)
256243 return isExactlyValue(APFloat(V));
406406 const Type *Ty) {
407407 errno = 0;
408408 V = NativeFP(V);
409 if (errno == 0)
410 return ConstantFP::get(Ty, V);
409 if (errno == 0) {
410 if (Ty==Type::FloatTy)
411 return ConstantFP::get(Ty, APFloat((float)V));
412 else if (Ty==Type::DoubleTy)
413 return ConstantFP::get(Ty, APFloat(V));
414 else
415 assert(0);
416 }
411417 errno = 0;
412418 return 0;
413419 }
417423 const Type *Ty) {
418424 errno = 0;
419425 V = NativeFP(V, W);
420 if (errno == 0)
421 return ConstantFP::get(Ty, V);
426 if (errno == 0) {
427 if (Ty==Type::FloatTy)
428 return ConstantFP::get(Ty, APFloat((float)V));
429 else if (Ty==Type::DoubleTy)
430 return ConstantFP::get(Ty, APFloat(V));
431 else
432 assert(0);
433 }
422434 errno = 0;
423435 return 0;
424436 }
425437
426438 /// ConstantFoldCall - Attempt to constant fold a call to the specified function
427439 /// with the specified arguments, returning null if unsuccessful.
440
428441 Constant *
429442 llvm::ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands) {
430443 const ValueName *NameVal = F->getValueName();
435448 const Type *Ty = F->getReturnType();
436449 if (NumOperands == 1) {
437450 if (ConstantFP *Op = dyn_cast(Operands[0])) {
438 double V = Op->getValue();
451 if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy)
452 return 0;
453 /// Currently APFloat versions of these functions do not exist, so we use
454 /// the host native double versions. Float versions are not called
455 /// directly but for all these it is true (float)(f((double)arg)) ==
456 /// f(arg). Long double not supported yet.
457 double V = Ty==Type::FloatTy ? (double)Op->getValueAPF().convertToFloat():
458 Op->getValueAPF().convertToDouble();
439459 switch (Str[0]) {
440460 case 'a':
441461 if (Len == 4 && !strcmp(Str, "acos"))
459479 break;
460480 case 'f':
461481 if (Len == 4 && !strcmp(Str, "fabs"))
462 return ConstantFP::get(Ty, fabs(V));
482 return ConstantFoldFP(fabs, V, Ty);
463483 else if (Len == 5 && !strcmp(Str, "floor"))
464484 return ConstantFoldFP(floor, V, Ty);
465485 break;
471491 else if (!strcmp(Str, "llvm.sqrt.f32") ||
472492 !strcmp(Str, "llvm.sqrt.f64")) {
473493 if (V >= -0.0)
474 return ConstantFP::get(Ty, sqrt(V));
494 return ConstantFoldFP(sqrt, V, Ty);
475495 else // Undefined
476 return ConstantFP::get(Ty, 0.0);
496 return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat(0.0f) :
497 APFloat(0.0));
477498 }
478499 break;
479500 case 's':
511532 }
512533 } else if (NumOperands == 2) {
513534 if (ConstantFP *Op1 = dyn_cast(Operands[0])) {
514 double Op1V = Op1->getValue();
535 double Op1V = Ty==Type::FloatTy ?
536 (double)Op1->getValueAPF().convertToFloat():
537 Op1->getValueAPF().convertToDouble();
515538 if (ConstantFP *Op2 = dyn_cast(Operands[1])) {
516 double Op2V = Op2->getValue();
539 if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy)
540 return 0;
541 double Op2V = Ty==Type::FloatTy ?
542 (double)Op2->getValueAPF().convertToFloat():
543 Op2->getValueAPF().convertToDouble();
517544
518545 if (Len == 3 && !strcmp(Str, "pow")) {
519546 return ConstantFoldBinaryFP(pow, Op1V, Op2V, Ty);
524551 }
525552 } else if (ConstantInt *Op2C = dyn_cast(Operands[1])) {
526553 if (!strcmp(Str, "llvm.powi.f32")) {
527 return ConstantFP::get(Ty, std::pow((float)Op1V,
528 (int)Op2C->getZExtValue()));
554 return ConstantFP::get(Ty, APFloat((float)std::pow((float)Op1V,
555 (int)Op2C->getZExtValue())));
529556 } else if (!strcmp(Str, "llvm.powi.f64")) {
530 return ConstantFP::get(Ty, std::pow((double)Op1V,
531 (int)Op2C->getZExtValue()));
557 return ConstantFP::get(Ty, APFloat((double)std::pow((double)Op1V,
558 (int)Op2C->getZExtValue())));
532559 }
533560 }
534561 }
484484 if (Val == 0)
485485 C = Constant::getNullValue(Ty);
486486 else if (Ty->isFloatingPoint())
487 C = ConstantFP::get(Ty, Val);
487 C = ConstantFP::get(Ty, APFloat(Ty==Type::FloatTy ? APFloat::IEEEsingle :
488 APFloat::IEEEdouble, Val));
488489 else
489490 C = ConstantInt::get(Ty, Val);
490491 return SCEVUnknown::get(C);
21282128 case 145:
21292129 YY_RULE_SETUP
21302130 #line 440 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
2131 { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
2131 { llvmAsmlval.FPVal = new APFloat(atof(yytext)); return FPVAL; }
21322132 YY_BREAK
21332133 case 146:
21342134 YY_RULE_SETUP
21352135 #line 441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
2136 { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
2136 { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext));
2137 return FPVAL;
2138 }
21372139 YY_BREAK
21382140 case YY_STATE_EOF(INITIAL):
2139 #line 443 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
2141 #line 445 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
21402142 {
21412143 /* Make sure to free the internal buffers for flex when we are
21422144 * done reading our input!
21472149 YY_BREAK
21482150 case 147:
21492151 YY_RULE_SETUP
2150 #line 451 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
2152 #line 453 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
21512153 { /* Ignore whitespace */ }
21522154 YY_BREAK
21532155 case 148:
21542156 YY_RULE_SETUP
2155 #line 452 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
2157 #line 454 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
21562158 { return yytext[0]; }
21572159 YY_BREAK
21582160 case 149:
21592161 YY_RULE_SETUP
2160 #line 454 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
2162 #line 456 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
21612163 YY_FATAL_ERROR( "flex scanner jammed" );
21622164 YY_BREAK
2163 #line 2165 "Lexer.cpp"
2165 #line 2167 "Lexer.cpp"
21642166
21652167 case YY_END_OF_BUFFER:
21662168 {
30423044 return 0;
30433045 }
30443046 #endif
3045 #line 454 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
3046
3047 #line 456 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l"
3048
436436 return GLOBALVAL_ID;
437437 }
438438
439 {FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
440 {HexFPConstant} { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
439 {FPConstant} { llvmAsmlval.FPVal = new APFloat(atof(yytext)); return FPVAL; }
440 {HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext));
441 return FPVAL;
442 }
441443
442444 <> {
443445 /* Make sure to free the internal buffers for flex when we are
436436 return GLOBALVAL_ID;
437437 }
438438
439 {FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
440 {HexFPConstant} { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
439 {FPConstant} { llvmAsmlval.FPVal = new APFloat(atof(yytext)); return FPVAL; }
440 {HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext));
441 return FPVAL;
442 }
441443
442444 <> {
443445 /* Make sure to free the internal buffers for flex when we are
2121 #include "llvm/Instructions.h"
2222 #include "llvm/Assembly/Parser.h"
2323 #include "llvm/ADT/StringExtras.h"
24
24 #include "llvm/ADT/APFloat.h"
2525
2626 // Global variables exported from the lexer...
2727
9292 std::string *Name; // If it's a named reference. Memory must be deleted.
9393 int64_t ConstPool64; // Constant pool reference. This is the value
9494 uint64_t UConstPool64;// Unsigned constant pool reference.
95 double ConstPoolFP; // Floating point constant pool reference
95 APFloat *ConstPoolFP; // Floating point constant pool reference
9696 Constant *ConstantValue; // Fully resolved constant for ConstantVal case.
9797 InlineAsmDescriptor *IAD;
98 };
98 };
9999
100100 static ValID createLocalID(unsigned Num) {
101101 ValID D; D.Type = LocalID; D.Num = Num; return D;
118118 ValID D; D.Type = ConstUIntVal; D.UConstPool64 = Val; return D;
119119 }
120120
121 static ValID create(double Val) {
121 static ValID create(APFloat *Val) {
122122 ValID D; D.Type = ConstFPVal; D.ConstPoolFP = Val; return D;
123123 }
124124
167167 case GlobalID : return '@' + utostr(Num);
168168 case LocalName : return *Name;
169169 case GlobalName : return *Name;
170 case ConstFPVal : return ftostr(ConstPoolFP);
170 case ConstFPVal : return ftostr(*ConstPoolFP);
171171 case ConstNullVal : return "null";
172172 case ConstUndefVal : return "undef";
173173 case ConstZeroVal : return "zeroinitializer";
193193 case GlobalName: return *Name < *V.Name;
194194 case ConstSIntVal: return ConstPool64 < V.ConstPool64;
195195 case ConstUIntVal: return UConstPool64 < V.UConstPool64;
196 case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
196 case ConstFPVal: return ConstPoolFP->compare(*V.ConstPoolFP) ==
197 APFloat::cmpLessThan;
197198 case ConstNullVal: return false;
198199 case ConstUndefVal: return false;
199200 case ConstZeroVal: return false;
211212 case GlobalName: return *Name == *(V.Name);
212213 case ConstSIntVal: return ConstPool64 == V.ConstPool64;
213214 case ConstUIntVal: return UConstPool64 == V.UConstPool64;
214 case ConstFPVal: return ConstPoolFP == V.ConstPoolFP;
215 case ConstFPVal: return ConstPoolFP->compare(*V.ConstPoolFP) ==
216 APFloat::cmpEqual;
215217 case ConstantVal: return ConstantValue == V.ConstantValue;
216218 case ConstNullVal: return true;
217219 case ConstUndefVal: return true;
354354 uint64_t UInt64Val;
355355 int SIntVal;
356356 unsigned UIntVal;
357 double FPVal;
357 llvm::APFloat *FPVal;
358358 bool BoolVal;
359359
360360 std::string *StrVal; // This memory must be deleted
411411 }
412412
413413 case ValID::ConstFPVal: // Is it a floating point const pool reference?
414 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
414 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
415415 GenerateError("FP constant invalid for type");
416416 return 0;
417417 }
418 return ConstantFP::get(Ty, D.ConstPoolFP);
418 // Lexer has no type info, so builds all FP constants as double.
419 // Fix this here.
420 if (Ty==Type::FloatTy)
421 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
422 return ConstantFP::get(Ty, *D.ConstPoolFP);
419423
420424 case ValID::ConstNullVal: // Is it a null value?
421425 if (!isa(Ty)) {
991995 uint64_t UInt64Val;
992996 int SIntVal;
993997 unsigned UIntVal;
994 double FPVal;
998 llvm::APFloat *FPVal;
995999 bool BoolVal;
9961000
9971001 std::string *StrVal; // This memory must be deleted
18611865 CHECK_FOR_ERROR
18621866 }
18631867 | FPType FPVAL { // Float & Double constants
1864 if (!ConstantFP::isValueValidForType($1, $2))
1868 if (!ConstantFP::isValueValidForType($1, *$2))
18651869 GEN_ERROR("Floating point constant invalid for type");
1866 $$ = ConstantFP::get($1, $2);
1870 // Lexer has no type info, so builds all FP constants as double.
1871 // Fix this here.
1872 if ($1==Type::FloatTy)
1873 $2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
1874 $$ = ConstantFP::get($1, *$2);
18671875 CHECK_FOR_ERROR
18681876 };
18691877
411411 }
412412
413413 case ValID::ConstFPVal: // Is it a floating point const pool reference?
414 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
414 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
415415 GenerateError("FP constant invalid for type");
416416 return 0;
417417 }
418 return ConstantFP::get(Ty, D.ConstPoolFP);
418 // Lexer has no type info, so builds all FP constants as double.
419 // Fix this here.
420 if (Ty==Type::FloatTy)
421 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
422 return ConstantFP::get(Ty, *D.ConstPoolFP);
419423
420424 case ValID::ConstNullVal: // Is it a null value?
421425 if (!isa(Ty)) {
991995 uint64_t UInt64Val;
992996 int SIntVal;
993997 unsigned UIntVal;
994 double FPVal;
998 llvm::APFloat *FPVal;
995999 bool BoolVal;
9961000
9971001 std::string *StrVal; // This memory must be deleted
18611865 CHECK_FOR_ERROR
18621866 }
18631867 | FPType FPVAL { // Float & Double constants
1864 if (!ConstantFP::isValueValidForType($1, $2))
1868 if (!ConstantFP::isValueValidForType($1, *$2))
18651869 GEN_ERROR("Floating point constant invalid for type");
1866 $$ = ConstantFP::get($1, $2);
1870 // Lexer has no type info, so builds all FP constants as double.
1871 // Fix this here.
1872 if ($1==Type::FloatTy)
1873 $2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
1874 $$ = ConstantFP::get($1, *$2);
18671875 CHECK_FOR_ERROR
18681876 };
18691877
625625 if (Record.empty())
626626 return Error("Invalid FLOAT record");
627627 if (CurTy == Type::FloatTy)
628 V = ConstantFP::get(CurTy, BitsToFloat(Record[0]));
628 V = ConstantFP::get(CurTy, APFloat((float)BitsToDouble(Record[0])));
629629 else if (CurTy == Type::DoubleTy)
630 V = ConstantFP::get(CurTy, BitsToDouble(Record[0]));
631 // FIXME: Make long double constants work.
632 else if (CurTy == Type::X86_FP80Ty ||
633 CurTy == Type::FP128Ty || CurTy == Type::PPC_FP128Ty)
634 assert(0 && "Long double constants not handled yet.");
630 V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
631 // FIXME: Make long double constants work. BitsToDouble does not make it.
632 else if (CurTy == Type::X86_FP80Ty)
633 V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
634 else if (CurTy == Type::FP128Ty)
635 V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
636 else if (CurTy == Type::PPC_FP128Ty)
637 assert(0 && "PowerPC long double constants not handled yet.");
635638 else
636639 V = UndefValue::get(CurTy);
637640 break;
526526 Code = bitc::CST_CODE_FLOAT;
527527 const Type *Ty = CFP->getType();
528528 if (Ty == Type::FloatTy) {
529 Record.push_back(FloatToBits((float)CFP->getValue()));
529 Record.push_back(DoubleToBits((double)CFP->getValueAPF().
530 convertToFloat()));
530531 } else if (Ty == Type::DoubleTy) {
531 Record.push_back(DoubleToBits((double)CFP->getValue()));
532 Record.push_back(DoubleToBits(CFP->getValueAPF().convertToDouble()));
532533 // FIXME: make long double constants work.
533534 } else if (Ty == Type::X86_FP80Ty ||
534535 Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) {
828828 } else if (const ConstantFP *CFP = dyn_cast(CV)) {
829829 // FP Constants are printed as integer constants to avoid losing
830830 // precision...
831 double Val = CFP->getValue();
832831 if (CFP->getType() == Type::DoubleTy) {
832 double Val = CFP->getValueAPF().convertToDouble();
833833 if (TAI->getData64bitsDirective())
834834 O << TAI->getData64bitsDirective() << DoubleToBits(Val) << "\t"
835835 << TAI->getCommentString() << " double value: " << Val << "\n";
850850 }
851851 return;
852852 } else {
853 float Val = CFP->getValueAPF().convertToFloat();
853854 O << TAI->getData32bitsDirective() << FloatToBits(Val)
854855 << "\t" << TAI->getCommentString() << " float " << Val << "\n";
855856 return;
860860 break;
861861 }
862862 case Type::FloatTyID: {
863 uint64_t val = FloatToBits(cast(PC)->getValue());
863 uint64_t val = FloatToBits(cast(PC)->
864 getValueAPF().convertToFloat());
864865 if (TD->isBigEndian())
865866 val = ByteSwap_32(val);
866867 ptr[0] = val;
870871 break;
871872 }
872873 case Type::DoubleTyID: {
873 uint64_t val = DoubleToBits(cast(PC)->getValue());
874 uint64_t val = DoubleToBits(cast(PC)->
875 getValueAPF().convertToDouble());
874876 if (TD->isBigEndian())
875877 val = ByteSwap_64(val);
876878 ptr[0] = val;
839839 return N = DAG.getNode(ISD::BUILD_VECTOR, VT,
840840 &Ops[0], Ops.size());
841841 } else if (ConstantFP *CFP = dyn_cast(C)) {
842 return N = DAG.getConstantFP(CFP->getValue(), VT);
842 return N = DAG.getConstantFP(CFP->getValueAPF(), VT);
843843 } else if (const VectorType *PTy = dyn_cast(VTy)) {
844844 unsigned NumElements = PTy->getNumElements();
845845 MVT::ValueType PVT = TLI.getValueType(PTy->getElementType());
20022002 const Type *ElTy = DestTy->getElementType();
20032003 if (ElTy->isFloatingPoint()) {
20042004 unsigned VL = DestTy->getNumElements();
2005 std::vector NZ(VL, ConstantFP::get(ElTy, -0.0));
2005 std::vector NZ(VL, ConstantFP::get(ElTy,
2006 ElTy==Type::FloatTy ? APFloat(-0.0f) : APFloat(-0.0)));
20062007 Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size());
20072008 if (CV == CNZ) {
20082009 SDOperand Op2 = getValue(I.getOperand(1));
524524 GenericValue Result;
525525 switch (C->getType()->getTypeID()) {
526526 case Type::FloatTyID:
527 Result.FloatVal = (float)cast(C)->getValue();
527 Result.FloatVal = cast(C)->getValueAPF().convertToFloat();
528528 break;
529529 case Type::DoubleTyID:
530 Result.DoubleVal = (double)cast(C)->getValue();
530 Result.DoubleVal = cast(C)->getValueAPF().convertToDouble();
531531 break;
532532 case Type::IntegerTyID:
533533 Result.IntVal = cast(C)->getValue();
205205 switch (ArgTy->getTypeID()) {
206206 default: assert(0 && "Unknown argument type for function call!");
207207 case Type::IntegerTyID: C = ConstantInt::get(AV.IntVal); break;
208 case Type::FloatTyID: C = ConstantFP ::get(ArgTy, AV.FloatVal); break;
209 case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break;
208 case Type::FloatTyID: C = ConstantFP ::get(ArgTy, APFloat(AV.FloatVal));
209 break;
210 case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, APFloat(AV.DoubleVal));
211 break;
210212 case Type::PointerTyID:
211213 void *ArgPtr = GVTOP(AV);
212214 if (sizeof(void*) == 4) {
603603 // only deal in IEEE FP).
604604 //
605605 static bool isFPCSafeToPrint(const ConstantFP *CFP) {
606 APFloat APF = APFloat(CFP->getValueAPF()); // copy
607 if (CFP->getType()==Type::FloatTy)
608 APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven);
606609 #if HAVE_PRINTF_A && ENABLE_CBE_PRINTF_A
607610 char Buffer[100];
608 sprintf(Buffer, "%a", CFP->getValue());
609
611 sprintf(Buffer, "%a", APF.convertToDouble());
610612 if (!strncmp(Buffer, "0x", 2) ||
611613 !strncmp(Buffer, "-0x", 3) ||
612614 !strncmp(Buffer, "+0x", 3))
613 return atof(Buffer) == CFP->getValue();
615 return APF.bitwiseIsEqual(APFloat(atof(Buffer)));
614616 return false;
615617 #else
616 std::string StrVal = ftostr(CFP->getValue());
618 std::string StrVal = ftostr(APF);
617619
618620 while (StrVal[0] == ' ')
619621 StrVal.erase(StrVal.begin());
624626 ((StrVal[0] == '-' || StrVal[0] == '+') &&
625627 (StrVal[1] >= '0' && StrVal[1] <= '9')))
626628 // Reparse stringized version!
627 return atof(StrVal.c_str()) == CFP->getValue();
629 return APF.bitwiseIsEqual(APFloat(atof(StrVal.c_str())));
628630 return false;
629631 #endif
630632 }
881883 Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double")
882884 << "*)&FPConstant" << I->second << ')';
883885 } else {
884 if (IsNAN(FPC->getValue())) {
886 double V = FPC->getType() == Type::FloatTy ?
887 FPC->getValueAPF().convertToFloat() :
888 FPC->getValueAPF().convertToDouble();
889 if (IsNAN(V)) {
885890 // The value is NaN
886891
892 // FIXME the actual NaN bits should be emitted.
887893 // The prefix for a quiet NaN is 0x7FF8. For a signalling NaN,
888894 // it's 0x7ff4.
889895 const unsigned long QuietNaN = 0x7ff8UL;
892898 // We need to grab the first part of the FP #
893899 char Buffer[100];
894900
895 uint64_t ll = DoubleToBits(FPC->getValue());
901 uint64_t ll = DoubleToBits(V);
896902 sprintf(Buffer, "0x%llx", static_cast(ll));
897903
898904 std::string Num(&Buffer[0], &Buffer[6]);
904910 else
905911 Out << "LLVM_NAN" << (Val == QuietNaN ? "" : "S") << "(\""
906912 << Buffer << "\") /*nan*/ ";
907 } else if (IsInf(FPC->getValue())) {
913 } else if (IsInf(V)) {
908914 // The value is Inf
909 if (FPC->getValue() < 0) Out << '-';
915 if (V < 0) Out << '-';
910916 Out << "LLVM_INF" << (FPC->getType() == Type::FloatTy ? "F" : "")
911917 << " /*inf*/ ";
912918 } else {
914920 #if HAVE_PRINTF_A && ENABLE_CBE_PRINTF_A
915921 // Print out the constant as a floating point number.
916922 char Buffer[100];
917 sprintf(Buffer, "%a", FPC->getValue());
923 sprintf(Buffer, "%a", V);
918924 Num = Buffer;
919925 #else
920 Num = ftostr(FPC->getValue());
926 Num = ftostr(FPC->getValueAPF());
921927 #endif
922 Out << Num;
928 Out << Num;
923929 }
924930 }
925931 break;
17141720 if (const ConstantFP *FPC = dyn_cast(*I))
17151721 if (!isFPCSafeToPrint(FPC) && // Do not put in FPConstantMap if safe.
17161722 !FPConstantMap.count(FPC)) {
1717 double Val = FPC->getValue();
1718
17191723 FPConstantMap[FPC] = FPCounter; // Number the FP constants
17201724
17211725 if (FPC->getType() == Type::DoubleTy) {
1726 double Val = FPC->getValueAPF().convertToDouble();
17221727 Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
17231728 << " = 0x" << std::hex << DoubleToBits(Val) << std::dec
17241729 << "ULL; /* " << Val << " */\n";
17251730 } else if (FPC->getType() == Type::FloatTy) {
1731 float Val = FPC->getValueAPF().convertToFloat();
17261732 Out << "static const ConstantFloatTy FPConstant" << FPCounter++
17271733 << " = 0x" << std::hex << FloatToBits(Val) << std::dec
17281734 << "U; /* " << Val << " */\n";
427427 uint64_t X;
428428 unsigned Size;
429429 if (FP->getType()->getTypeID()==Type::FloatTyID) {
430 X = FloatToBits(FP->getValue());
430 X = FloatToBits(FP->getValueAPF().convertToFloat());
431431 Size = 4;
432432 } else {
433 X = DoubleToBits(FP->getValue());
433 X = DoubleToBits(FP->getValueAPF().convertToDouble());
434434 Size = 8;
435435 }
436436 Out << "\tldc.r" << Size << "\t( " << utohexstr(X) << ')';
14711471 TySize = TD->getTypeSize(Ty);
14721472 const ConstantFP* FP = cast(C);
14731473 if (Ty->getTypeID() == Type::FloatTyID)
1474 Out << "int32 (" << FloatToBits(FP->getValue()) << ')';
1474 Out << "int32 (" <<
1475 FloatToBits(FP->getValueAPF().convertToFloat()) << ')';
14751476 else
1476 Out << "int64 (" << DoubleToBits(FP->getValue()) << ')';
1477 Out << "int64 (" <<
1478 DoubleToBits(FP->getValueAPF().convertToDouble()) << ')';
14771479 break;
14781480 }
14791481 case Type::ArrayTyID:
34113411 const Type *OpNTy = MVT::getTypeForValueType(EltVT);
34123412 std::vector CV;
34133413 if (EltVT == MVT::f64) {
3414 Constant *C = ConstantFP::get(OpNTy, BitsToDouble(~(1ULL << 63)));
3414 Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToDouble(~(1ULL << 63))));
34153415 CV.push_back(C);
34163416 CV.push_back(C);
34173417 } else {
3418 Constant *C = ConstantFP::get(OpNTy, BitsToFloat(~(1U << 31)));
3418 Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToFloat(~(1U << 31))));
34193419 CV.push_back(C);
34203420 CV.push_back(C);
34213421 CV.push_back(C);
34393439 const Type *OpNTy = MVT::getTypeForValueType(EltVT);
34403440 std::vector CV;
34413441 if (EltVT == MVT::f64) {
3442 Constant *C = ConstantFP::get(OpNTy, BitsToDouble(1ULL << 63));
3442 Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToDouble(1ULL << 63)));
34433443 CV.push_back(C);
34443444 CV.push_back(C);
34453445 } else {
3446 Constant *C = ConstantFP::get(OpNTy, BitsToFloat(1U << 31));
3446 Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToFloat(1U << 31)));
34473447 CV.push_back(C);
34483448 CV.push_back(C);
34493449 CV.push_back(C);
34743474 if (MVT::getSizeInBits(SrcVT) < MVT::getSizeInBits(VT)) {
34753475 Op1 = DAG.getNode(ISD::FP_EXTEND, VT, Op1);
34763476 SrcVT = VT;
3477 SrcTy = MVT::getTypeForValueType(SrcVT);
34773478 }
34783479
34793480 // First get the sign bit of second operand.
34803481 std::vector CV;
34813482 if (SrcVT == MVT::f64) {
3482 CV.push_back(ConstantFP::get(SrcTy, BitsToDouble(1ULL << 63)));
3483 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3483 CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToDouble(1ULL << 63))));
3484 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0)));
34843485 } else {
3485 CV.push_back(ConstantFP::get(SrcTy, BitsToFloat(1U << 31)));
3486 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3487 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3488 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3486 CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToFloat(1U << 31))));
3487 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f)));
3488 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f)));
3489 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f)));
34893490 }
34903491 Constant *C = ConstantVector::get(CV);
34913492 SDOperand CPIdx = DAG.getConstantPool(C, getPointerTy(), 4);
35073508 // Clear first operand sign bit.
35083509 CV.clear();
35093510 if (VT == MVT::f64) {
3510 CV.push_back(ConstantFP::get(SrcTy, BitsToDouble(~(1ULL << 63))));
3511 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3511 CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToDouble(~(1ULL << 63)))));
3512 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0)));
35123513 } else {
3513 CV.push_back(ConstantFP::get(SrcTy, BitsToFloat(~(1U << 31))));
3514 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3515 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3516 CV.push_back(ConstantFP::get(SrcTy, 0.0));
3514 CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToFloat(~(1U << 31)))));
3515 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f)));
3516 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f)));
3517 CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f)));
35173518 }
35183519 C = ConstantVector::get(CV);
35193520 CPIdx = DAG.getConstantPool(C, getPointerTy(), 4);
11171117 Value* base = ci->getOperand(1);
11181118 Value* expn = ci->getOperand(2);
11191119 if (ConstantFP *Op1 = dyn_cast(base)) {
1120 double Op1V = Op1->getValue();
1121 if (Op1V == 1.0) // pow(1.0,x) -> 1.0
1122 return ReplaceCallWith(ci, ConstantFP::get(Ty, 1.0));
1120 if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy)
1121 return false; // FIXME long double not yet supported
1122 if (Op1->isExactlyValue(1.0)) // pow(1.0,x) -> 1.0
1123 return ReplaceCallWith(ci, ConstantFP::get(Ty,
1124 Ty==Type::FloatTy ? APFloat(1.0f) : APFloat(1.0)));
11231125 } else if (ConstantFP* Op2 = dyn_cast(expn)) {
1124 double Op2V = Op2->getValue();
1125 if (Op2V == 0.0) {
1126 if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy)
1127 return false; // FIXME long double not yet supported
1128 if (Op2->getValueAPF().isZero()) {
11261129 // pow(x,0.0) -> 1.0
1127 return ReplaceCallWith(ci, ConstantFP::get(Ty,1.0));
1128 } else if (Op2V == 0.5) {
1130 return ReplaceCallWith(ci, ConstantFP::get(Ty,
1131 Ty==Type::FloatTy ? APFloat(1.0f) : APFloat(1.0)));
1132 } else if (Op2->isExactlyValue(0.5)) {
11291133 // pow(x,0.5) -> sqrt(x)
11301134 CallInst* sqrt_inst = new CallInst(SLC.get_sqrt(), base,
11311135 ci->getName()+".pow",ci);
11321136 return ReplaceCallWith(ci, sqrt_inst);
1133 } else if (Op2V == 1.0) {
1137 } else if (Op2->isExactlyValue(1.0)) {
11341138 // pow(x,1.0) -> x
11351139 return ReplaceCallWith(ci, base);
1136 } else if (Op2V == -1.0) {
1140 } else if (Op2->isExactlyValue(-1.0)) {
11371141 // pow(x,-1.0) -> 1.0/x
11381142 Value *div_inst =
1139 BinaryOperator::createFDiv(ConstantFP::get(Ty, 1.0), base,
1140 ci->getName()+".pow", ci);
1143 BinaryOperator::createFDiv(ConstantFP::get(Ty,
1144 Ty==Type::FloatTy ? APFloat(1.0f) : APFloat(1.0)),
1145 base, ci->getName()+".pow", ci);
11411146 return ReplaceCallWith(ci, div_inst);
11421147 }
11431148 }
23472347
23482348 // "In IEEE floating point, x*1 is not equivalent to x for nans. However,
23492349 // ANSI says we can drop signals, so we can do this anyway." (from GCC)
2350 if (Op1F->getValue() == 1.0)
2350 if (Op1F->isExactlyValue(1.0))
23512351 return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0'
23522352 }
23532353
485485 // make sure that we only output it in exponential format if we can parse
486486 // the value back and get the same value.
487487 //
488 std::string StrVal = ftostr(CFP->getValue());
488 bool isDouble = &CFP->getValueAPF().getSemantics() == &APFloat::IEEEdouble;
489 double Val = (isDouble) ? CFP->getValueAPF().convertToDouble() :
490 CFP->getValueAPF().convertToFloat();
491 std::string StrVal = ftostr(CFP->getValueAPF());
489492
490493 // Check to make sure that the stringized number is not some string like
491494 // "Inf" or NaN, that atof will accept, but the lexer will not. Check that
495498 ((StrVal[0] == '-' || StrVal[0] == '+') &&
496499 (StrVal[1] >= '0' && StrVal[1] <= '9')))
497500 // Reparse stringized version!
498 if (atof(StrVal.c_str()) == CFP->getValue()) {
501 if (atof(StrVal.c_str()) == Val) {
499502 Out << StrVal;
500503 return;
501504 }
504507 // output the string in hexadecimal format!
505508 assert(sizeof(double) == sizeof(uint64_t) &&
506509 "assuming that double is 64 bits!");
507 Out << "0x" << utohexstr(DoubleToBits(CFP->getValue()));
510 Out << "0x" << utohexstr(DoubleToBits(Val));
508511
509512 } else if (isa(CV)) {
510513 Out << "zeroinitializer";
6767 for (unsigned i = 0; i != SrcNumElts; ++i) {
6868 ConstantInt *CI = cast(CV->getOperand(i));
6969 double V = CI->getValue().bitsToDouble();
70 Result.push_back(ConstantFP::get(Type::DoubleTy, V));
70 Result.push_back(ConstantFP::get(Type::DoubleTy, APFloat(V)));
7171 }
7272 return ConstantVector::get(Result);
7373 }
7575 for (unsigned i = 0; i != SrcNumElts; ++i) {
7676 ConstantInt *CI = cast(CV->getOperand(i));
7777 float V = CI->getValue().bitsToFloat();
78 Result.push_back(ConstantFP::get(Type::FloatTy, V));
78 Result.push_back(ConstantFP::get(Type::FloatTy, APFloat(V)));
7979 }
8080 return ConstantVector::get(Result);
8181 }
8686 if (SrcEltTy->getTypeID() == Type::DoubleTyID) {
8787 for (unsigned i = 0; i != SrcNumElts; ++i) {
8888 uint64_t V =
89 DoubleToBits(cast(CV->getOperand(i))->getValue());
89 DoubleToBits(cast(CV->getOperand(i))->
90 getValueAPF().convertToDouble());
9091 Constant *C = ConstantInt::get(Type::Int64Ty, V);
9192 Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
9293 }
9596
9697 assert(SrcEltTy->getTypeID() == Type::FloatTyID);
9798 for (unsigned i = 0; i != SrcNumElts; ++i) {
98 uint32_t V = FloatToBits(cast(CV->getOperand(i))->getValue());
99 uint32_t V = FloatToBits(cast(CV->getOperand(i))->
100 getValueAPF().convertToFloat());
99101 Constant *C = ConstantInt::get(Type::Int32Ty, V);
100102 Result.push_back(ConstantExpr::getBitCast(C, DstEltTy));
101103 }
174176 switch (opc) {
175177 case Instruction::FPTrunc:
176178 case Instruction::FPExt:
177 if (const ConstantFP *FPC = dyn_cast(V))
178 return ConstantFP::get(DestTy, FPC->getValue());
179 if (const ConstantFP *FPC = dyn_cast(V)) {
180 APFloat Val = FPC->getValueAPF();
181 Val.convert(DestTy==Type::FloatTy ? APFloat::IEEEsingle :
182 APFloat::IEEEdouble,
183 APFloat::rmNearestTiesToEven);
184 return ConstantFP::get(DestTy, Val);
185 }
179186 return 0; // Can't fold.
180187 case Instruction::FPToUI:
181188 if (const ConstantFP *FPC = dyn_cast(V)) {
189 APFloat V = FPC->getValueAPF();
190 bool isDouble = &V.getSemantics()==&APFloat::IEEEdouble;
182191 uint32_t DestBitWidth = cast(DestTy)->getBitWidth();
183 APInt Val(APIntOps::RoundDoubleToAPInt(FPC->getValue(), DestBitWidth));
192 APInt Val(APIntOps::RoundDoubleToAPInt(isDouble ? V.convertToDouble() :
193 (double)V.convertToFloat(), DestBitWidth));
184194 return ConstantInt::get(Val);
185195 }
186196 return 0; // Can't fold.
187197 case Instruction::FPToSI:
188198 if (const ConstantFP *FPC = dyn_cast(V)) {
199 APFloat V = FPC->getValueAPF();
200 bool isDouble = &V.getSemantics()==&APFloat::IEEEdouble;
189201 uint32_t DestBitWidth = cast(DestTy)->getBitWidth();
190 APInt Val(APIntOps::RoundDoubleToAPInt(FPC->getValue(), DestBitWidth));
202 APInt Val(APIntOps::RoundDoubleToAPInt(isDouble ? V.convertToDouble() :
203 (double)V.convertToFloat(), DestBitWidth));
191204 return ConstantInt::get(Val);
192205 }
193206 return 0; // Can't fold.
200213 return ConstantInt::get(DestTy, 0);
201214 return 0; // Other pointer types cannot be casted
202215 case Instruction::UIToFP:
203 if (const ConstantInt *CI = dyn_cast(V))
204 return ConstantFP::get(DestTy, CI->getValue().roundToDouble());
216 if (const ConstantInt *CI = dyn_cast(V)) {
217 if (DestTy==Type::FloatTy)
218 return ConstantFP::get(DestTy,
219 APFloat((float)CI->getValue().roundToDouble()));
220 else
221 return ConstantFP::get(DestTy, APFloat(CI->getValue().roundToDouble()));
222 }
205223 return 0;
206224 case Instruction::SIToFP:
207 if (const ConstantInt *CI = dyn_cast(V))
208 return ConstantFP::get(DestTy, CI->getValue().signedRoundToDouble());
225 if (const ConstantInt *CI = dyn_cast(V)) {
226 double d = CI->getValue().signedRoundToDouble();
227 if (DestTy==Type::FloatTy)
228 return ConstantFP::get(DestTy, APFloat((float)d));
229 else
230 return ConstantFP::get(DestTy, APFloat(d));
231 }
209232 return 0;
210233 case Instruction::ZExt:
211234 if (const ConstantInt *CI = dyn_cast(V)) {
308331
309332 if (DestTy->isFloatingPoint()) {
310333 if (DestTy == Type::FloatTy)
311 return ConstantFP::get(DestTy, CI->getValue().bitsToFloat());
334 return ConstantFP::get(DestTy, APFloat(CI->getValue().bitsToFloat()));
312335 assert(DestTy == Type::DoubleTy && "Unknown FP type!");
313 return ConstantFP::get(DestTy, CI->getValue().bitsToDouble());
336 return ConstantFP::get(DestTy, APFloat(CI->getValue().bitsToDouble()));
314337 }
315338 // Otherwise, can't fold this (vector?)
316339 return 0;
321344 // FP -> Integral.
322345 if (DestTy == Type::Int32Ty) {
323346 APInt Val(32, 0);
324 return ConstantInt::get(Val.floatToBits(FP->getValue()));
347 return ConstantInt::get(Val.floatToBits(FP->
348 getValueAPF().convertToFloat()));
325349 } else {
326350 assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!");
327351 APInt Val(64, 0);
328 return ConstantInt::get(Val.doubleToBits(FP->getValue()));
352 return ConstantInt::get(Val.doubleToBits(FP->
353 getValueAPF().convertToDouble()));
329354 }
330355 }
331356 return 0;
659684 }
660685 } else if (const ConstantFP *CFP1 = dyn_cast(C1)) {
661686 if (const ConstantFP *CFP2 = dyn_cast(C2)) {
662 double C1Val = CFP1->getValue();
663 double C2Val = CFP2->getValue();
687 APFloat C1V = CFP1->getValueAPF();
688 APFloat C2V = CFP2->getValueAPF();
689 APFloat C3V = C1V; // copy for modification
690 bool isDouble = CFP1->getType()==Type::DoubleTy;
664691 switch (Opcode) {
665692 default:
666693 break;
667 case Instruction::Add:
668 return ConstantFP::get(CFP1->getType(), C1Val + C2Val);
694 case Instruction::Add:
695 (void)C3V.add(C2V, APFloat::rmNearestTiesToEven);
696 return ConstantFP::get(CFP1->getType(), C3V);
669697 case Instruction::Sub:
670 return ConstantFP::get(CFP1->getType(), C1Val - C2Val);
671 case Instruction::Mul:
672 return ConstantFP::get(CFP1->getType(), C1Val * C2Val);
698 (void)C3V.subtract(C2V, APFloat::rmNearestTiesToEven);
699 return ConstantFP::get(CFP1->getType(), C3V);
700 case Instruction::Mul:
701 (void)C3V.multiply(C2V, APFloat::rmNearestTiesToEven);
702 return ConstantFP::get(CFP1->getType(), C3V);
673703 case Instruction::FDiv:
674 if (CFP2->isExactlyValue(0.0) || CFP2->isExactlyValue(-0.0))
675 if (CFP1->isExactlyValue(0.0) || CFP1->isExactlyValue(-0.0))
704 // FIXME better to look at the return code
705 if (C2V.isZero())
706 if (C1V.isZero())
676707 // IEEE 754, Section 7.1, #4
677 return ConstantFP::get(CFP1->getType(),
678 std::numeric_limits::quiet_NaN());
679 else if (CFP2->isExactlyValue(-0.0) || C1Val < 0.0)
708 return ConstantFP::get(CFP1->getType(), isDouble ?
709 APFloat(std::numeric_limits::quiet_NaN()) :
710 APFloat(std::numeric_limits::quiet_NaN()));
711 else if (C2V.isNegZero() || C1V.isNegative())
680712 // IEEE 754, Section 7.2, negative infinity case
681 return ConstantFP::get(CFP1->getType(),
682 -std::numeric_limits::infinity());
713 return ConstantFP::get(CFP1->getType(), isDouble ?
714 APFloat(-std::numeric_limits::infinity()) :
715 APFloat(-std::numeric_limits::infinity()));
683716 else
684717 // IEEE 754, Section 7.2, positive infinity case
685 return ConstantFP::get(CFP1->getType(),
686 std::numeric_limits::infinity());
687 return ConstantFP::get(CFP1->getType(), C1Val / C2Val);
718 return ConstantFP::get(CFP1->getType(), isDouble ?
719 APFloat(std::numeric_limits::infinity()) :
720 APFloat(std::numeric_limits::infinity()));
721 (void)C3V.divide(C2V, APFloat::rmNearestTiesToEven);
722 return ConstantFP::get(CFP1->getType(), C3V);
688723 case Instruction::FRem:
689 if (CFP2->isExactlyValue(0.0) || CFP2->isExactlyValue(-0.0))
724 if (C2V.isZero())
690725 // IEEE 754, Section 7.1, #5
691 return ConstantFP::get(CFP1->getType(),
692 std::numeric_limits::quiet_NaN());
693 return ConstantFP::get(CFP1->getType(), std::fmod(C1Val, C2Val));
694
726 return ConstantFP::get(CFP1->getType(), isDouble ?
727 APFloat(std::numeric_limits::quiet_NaN()) :
728 APFloat(std::numeric_limits::quiet_NaN()));
729 (void)C3V.mod(C2V, APFloat::rmNearestTiesToEven);
730 return ConstantFP::get(CFP1->getType(), C3V);
695731 }
696732 }
697733 } else if (const ConstantVector *CP1 = dyn_cast(C1)) {
11221158 case ICmpInst::ICMP_UGE:return ConstantInt::get(Type::Int1Ty, V1.uge(V2));
11231159 }
11241160 } else if (isa(C1) && isa(C2)) {
1125 double C1Val = cast(C1)->getValue();
1126 double C2Val = cast(C2)->getValue();
1161 APFloat C1V = cast(C1)->getValueAPF();
1162 APFloat C2V = cast(C2)->getValueAPF();
1163 APFloat::cmpResult R = C1V.compare(C2V);
11271164 switch (pred) {
11281165 default: assert(0 && "Invalid FCmp Predicate"); return 0;
11291166 case FCmpInst::FCMP_FALSE: return ConstantInt::getFalse();
11301167 case FCmpInst::FCMP_TRUE: return ConstantInt::getTrue();
11311168 case FCmpInst::FCMP_UNO:
1132 return ConstantInt::get(Type::Int1Ty, C1Val != C1Val || C2Val != C2Val);
1169 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpUnordered);
11331170 case FCmpInst::FCMP_ORD:
1134 return ConstantInt::get(Type::Int1Ty, C1Val == C1Val && C2Val == C2Val);
1171 return ConstantInt::get(Type::Int1Ty, R!=APFloat::cmpUnordered);
11351172 case FCmpInst::FCMP_UEQ:
1136 if (C1Val != C1Val || C2Val != C2Val)
1137 return ConstantInt::getTrue();
1138 /* FALL THROUGH */
1173 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpUnordered ||
1174 R==APFloat::cmpEqual);
11391175 case FCmpInst::FCMP_OEQ:
1140 return ConstantInt::get(Type::Int1Ty, C1Val == C2Val);
1176 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpEqual);
11411177 case FCmpInst::FCMP_UNE:
1142 if (C1Val != C1Val || C2Val != C2Val)
1143 return ConstantInt::getTrue();
1144 /* FALL THROUGH */
1178 return ConstantInt::get(Type::Int1Ty, R!=APFloat::cmpEqual);
11451179 case FCmpInst::FCMP_ONE:
1146 return ConstantInt::get(Type::Int1Ty, C1Val != C2Val);
1180 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpLessThan ||
1181 R==APFloat::cmpGreaterThan);
11471182 case FCmpInst::FCMP_ULT:
1148 if (C1Val != C1Val || C2Val != C2Val)
1149 return ConstantInt::getTrue();
1150 /* FALL THROUGH */
1183 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpUnordered ||
1184 R==APFloat::cmpLessThan);
11511185 case FCmpInst::FCMP_OLT:
1152 return ConstantInt::get(Type::Int1Ty, C1Val < C2Val);
1186 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpLessThan);
11531187 case FCmpInst::FCMP_UGT:
1154 if (C1Val != C1Val || C2Val != C2Val)
1155 return ConstantInt::getTrue();
1156 /* FALL THROUGH */
1188 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpUnordered ||
1189 R==APFloat::cmpGreaterThan);
11571190 case FCmpInst::FCMP_OGT:
1158 return ConstantInt::get(Type::Int1Ty, C1Val > C2Val);
1191 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpGreaterThan);
11591192 case FCmpInst::FCMP_ULE:
1160 if (C1Val != C1Val || C2Val != C2Val)
1161 return ConstantInt::getTrue();
1162 /* FALL THROUGH */
1193 return ConstantInt::get(Type::Int1Ty, R!=APFloat::cmpGreaterThan);
11631194 case FCmpInst::FCMP_OLE:
1164 return ConstantInt::get(Type::Int1Ty, C1Val <= C2Val);
1195 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpLessThan ||
1196 R==APFloat::cmpEqual);
11651197 case FCmpInst::FCMP_UGE:
1166 if (C1Val != C1Val || C2Val != C2Val)
1167 return ConstantInt::getTrue();
1168 /* FALL THROUGH */
1198 return ConstantInt::get(Type::Int1Ty, R!=APFloat::cmpLessThan);
11691199 case FCmpInst::FCMP_OGE:
1170 return ConstantInt::get(Type::Int1Ty, C1Val >= C2Val);
1200 return ConstantInt::get(Type::Int1Ty, R==APFloat::cmpGreaterThan ||
1201 R==APFloat::cmpEqual);
11711202 }
11721203 } else if (const ConstantVector *CP1 = dyn_cast(C1)) {
11731204 if (const ConstantVector *CP2 = dyn_cast(C2)) {
106106 case Type::IntegerTyID:
107107 return ConstantInt::get(Ty, 0);
108108 case Type::FloatTyID:
109 return ConstantFP::get(Ty, APFloat(0.0f));
109110 case Type::DoubleTyID:
111 return ConstantFP::get(Ty, APFloat(0.0));
110112 case Type::X86_FP80TyID:
111113 case Type::PPC_FP128TyID:
112114 case Type::FP128TyID:
113 return ConstantFP::get(Ty, 0.0);
115 return ConstantFP::get(Ty, APFloat(0.0)); //FIXME
114116 case Type::PointerTyID:
115117 return ConstantPointerNull::get(cast(Ty));
116118 case Type::StructTyID:
237239 // ConstantFP
238240 //===----------------------------------------------------------------------===//
239241
240
241 ConstantFP::ConstantFP(const Type *Ty, double V)
242 : Constant(Ty, ConstantFPVal, 0, 0),
243 Val(Ty==Type::FloatTy ? APFloat((float)V) : APFloat(V)) {
244 }
245242 ConstantFP::ConstantFP(const Type *Ty, const APFloat& V)
246243 : Constant(Ty, ConstantFPVal, 0, 0), Val(V) {
247244 // temporary
291288 DenseMapAPFloatKeyInfo> FPMapTy;
292289
293290 static ManagedStatic FPConstants;
294
295 ConstantFP *ConstantFP::get(const Type *Ty, double V) {
296 if (Ty == Type::FloatTy) {
297 DenseMapAPFloatKeyInfo::KeyTy Key(APFloat((float)V));
298 ConstantFP *&Slot = (*FPConstants)[Key];
299 if (Slot) return Slot;
300 return Slot = new ConstantFP(Ty, APFloat((float)V));
301 } else if (Ty == Type::DoubleTy) {
302 // Without the redundant cast, the following is taken to be
303 // a function declaration. What a language.
304 DenseMapAPFloatKeyInfo::KeyTy Key(APFloat((double)V));
305 ConstantFP *&Slot = (*FPConstants)[Key];
306 if (Slot) return Slot;
307 return Slot = new ConstantFP(Ty, APFloat(V));
308 } else if (Ty == Type::X86_FP80Ty ||
309 Ty == Type::PPC_FP128Ty || Ty == Type::FP128Ty) {
310 assert(0 && "Long double constants not handled yet.");
311 } else {
312 assert(0 && "Unknown FP Type!");
313 }
314 }
315291
316292 ConstantFP *ConstantFP::get(const Type *Ty, const APFloat& V) {
317293 // temporary
19331909 if (const VectorType *PTy = dyn_cast(Ty))
19341910 if (PTy->getElementType()->isFloatingPoint()) {
19351911 std::vector zeros(PTy->getNumElements(),
1936 ConstantFP::get(PTy->getElementType(),-0.0));
1912 ConstantFP::get(PTy->getElementType(),
1913 PTy->getElementType()==Type::FloatTy ?
1914 APFloat(-0.0f) : APFloat(0.0)));
19371915 return ConstantVector::get(PTy, zeros);
19381916 }
19391917
19401918 if (Ty->isFloatingPoint())
1941 return ConstantFP::get(Ty, -0.0);
1919 return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat(-0.0f) :
1920 APFloat(-0.0));
19421921
19431922 return Constant::getNullValue(Ty);
19441923 }
158158 char *Name; // If it's a named reference. Memory must be free'd.
159159 int64_t ConstPool64; // Constant pool reference. This is the value
160160 uint64_t UConstPool64;// Unsigned constant pool reference.
161 double ConstPoolFP; // Floating point constant pool reference
161 APFloat *ConstPoolFP; // Floating point constant pool reference
162162 Constant *ConstantValue; // Fully resolved constant for ConstantVal case.
163163 InlineAsmDescriptor *IAD;
164164 };
186186 return D;
187187 }
188188
189 static ValID create(double Val) {
189 static ValID create(APFloat* Val) {
190190 ValID D; D.Type = ConstFPVal; D.ConstPoolFP = Val;
191191 D.S.makeSignless();
192192 return D;
244244 switch (Type) {
245245 case NumberVal : return std::string("#") + itostr(Num);
246246 case NameVal : return Name;
247 case ConstFPVal : return ftostr(ConstPoolFP);
247 case ConstFPVal : return ftostr(*ConstPoolFP);
248248 case ConstNullVal : return "null";
249249 case ConstUndefVal : return "undef";
250250 case ConstZeroVal : return "zeroinitializer";
270270 case NameVal: return strcmp(Name, V.Name) < 0;
271271 case ConstSIntVal: return ConstPool64 < V.ConstPool64;
272272 case ConstUIntVal: return UConstPool64 < V.UConstPool64;
273 case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
273 case ConstFPVal: return ConstPoolFP->compare(*V.ConstPoolFP) ==
274 APFloat::cmpLessThan;
274275 case ConstNullVal: return false;
275276 case ConstUndefVal: return false;
276277 case ConstZeroVal: return false;
1616 #define yylineno Upgradelineno
1717
1818 #line 20 "UpgradeLexer.cpp"
19 /* A lexical scanner generated by flex*/
19 /* A lexical scanner generated by flex */
2020
2121 /* Scanner skeleton version:
22 * $Header$
22 * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $
2323 */
2424
2525 #define FLEX_SCANNER
2727 #define YY_FLEX_MINOR_VERSION 5
2828
2929 #include
30 #include
3130
3231
3332 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
4140 #ifdef __cplusplus
4241
4342 #include
43 #include
4444
4545 /* Use prototypes in function declarations. */
4646 #define YY_USE_PROTOS
151151 while ( 0 )
152152
153153 #define unput(c) yyunput( c, yytext_ptr )
154
155 /* Some routines like yy_flex_realloc() are emitted as static but are
156 not called by all lexers. This generates warnings in some compilers,
157 notably GCC. Arrange to suppress these. */
158 #ifdef __GNUC__
159 #define YY_MAY_BE_UNUSED __attribute__((unused))
160 #else
161 #define YY_MAY_BE_UNUSED
162 #endif
163154
164155 /* The following is because we cannot portably get our hands on size_t
165156 * (without autoconf's help, which isn't available because we want
267258 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
268259
269260 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
270 static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
261 static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
271262 static void yy_flex_free YY_PROTO(( void * ));
272263
273264 #define yy_new_buffer yy_create_buffer
933924 #define YY_MORE_ADJ 0
934925 #define YY_RESTORE_YY_MORE_OFFSET
935926 char *yytext;
936 #line 1 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
927 #line 1 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
937928 #define INITIAL 0
938929 /*===-- UpgradeLexer.l - Scanner for 1.9 assembly files --------*- C++ -*--===//
939930 //
948939 //
949940 //===----------------------------------------------------------------------===*/
950941 #define YY_NEVER_INTERACTIVE 1
951 #line 28 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
942 #line 28 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
952943 #include "UpgradeInternals.h"
953944 #include "llvm/Module.h"
954945 #include
10891080 /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
10901081 * it to deal with 64 bit numbers.
10911082 */
1092 #line 1094 "UpgradeLexer.cpp"
1083 #line 1085 "UpgradeLexer.cpp"
10931084
10941085 /* Macros after this point can all be overridden by user definitions in
10951086 * section 1.
12371228 YY_DECL
12381229 {
12391230 register yy_state_type yy_current_state;
1240 register char *yy_cp = NULL, *yy_bp = NULL;
1231 register char *yy_cp, *yy_bp;
12411232 register int yy_act;
12421233
1243 #line 194 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1244
1245
1246 #line 1248 "UpgradeLexer.cpp"
1234 #line 194 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
1235
1236
1237 #line 1239 "UpgradeLexer.cpp"
12471238
12481239 if ( yy_init )
12491240 {
13361327 { /* beginning of action switch */
13371328 case 1:
13381329 YY_RULE_SETUP
1339 #line 196 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1330 #line 196 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13401331 { /* Ignore comments for now */ }
13411332 YY_BREAK
13421333 case 2:
13431334 YY_RULE_SETUP
1344 #line 198 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1335 #line 198 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13451336 { return BEGINTOK; }
13461337 YY_BREAK
13471338 case 3:
13481339 YY_RULE_SETUP
1349 #line 199 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1340 #line 199 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13501341 { return ENDTOK; }
13511342 YY_BREAK
13521343 case 4:
13531344 YY_RULE_SETUP
1354 #line 200 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1345 #line 200 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13551346 { return TRUETOK; }
13561347 YY_BREAK
13571348 case 5:
13581349 YY_RULE_SETUP
1359 #line 201 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1350 #line 201 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13601351 { return FALSETOK; }
13611352 YY_BREAK
13621353 case 6:
13631354 YY_RULE_SETUP
1364 #line 202 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1355 #line 202 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13651356 { return DECLARE; }
13661357 YY_BREAK
13671358 case 7:
13681359 YY_RULE_SETUP
1369 #line 203 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1360 #line 203 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13701361 { return GLOBAL; }
13711362 YY_BREAK
13721363 case 8:
13731364 YY_RULE_SETUP
1374 #line 204 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1365 #line 204 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13751366 { return CONSTANT; }
13761367 YY_BREAK
13771368 case 9:
13781369 YY_RULE_SETUP
1379 #line 205 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1370 #line 205 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13801371 { return INTERNAL; }
13811372 YY_BREAK
13821373 case 10:
13831374 YY_RULE_SETUP
1384 #line 206 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1375 #line 206 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13851376 { return LINKONCE; }
13861377 YY_BREAK
13871378 case 11:
13881379 YY_RULE_SETUP
1389 #line 207 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1380 #line 207 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13901381 { return WEAK; }
13911382 YY_BREAK
13921383 case 12:
13931384 YY_RULE_SETUP
1394 #line 208 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1385 #line 208 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
13951386 { return APPENDING; }
13961387 YY_BREAK
13971388 case 13:
13981389 YY_RULE_SETUP
1399 #line 209 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1390 #line 209 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14001391 { return DLLIMPORT; }
14011392 YY_BREAK
14021393 case 14:
14031394 YY_RULE_SETUP
1404 #line 210 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1395 #line 210 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14051396 { return DLLEXPORT; }
14061397 YY_BREAK
14071398 case 15:
14081399 YY_RULE_SETUP
1409 #line 211 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1400 #line 211 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14101401 { return EXTERN_WEAK; }
14111402 YY_BREAK
14121403 case 16:
14131404 YY_RULE_SETUP
1414 #line 212 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1405 #line 212 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14151406 { return EXTERNAL; } /* Deprecated, turn into external */
14161407 YY_BREAK
14171408 case 17:
14181409 YY_RULE_SETUP
1419 #line 213 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1410 #line 213 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14201411 { return EXTERNAL; }
14211412 YY_BREAK
14221413 case 18:
14231414 YY_RULE_SETUP
1424 #line 214 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1415 #line 214 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14251416 { return IMPLEMENTATION; }
14261417 YY_BREAK
14271418 case 19:
14281419 YY_RULE_SETUP
1429 #line 215 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1420 #line 215 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14301421 { return ZEROINITIALIZER; }
14311422 YY_BREAK
14321423 case 20:
14331424 YY_RULE_SETUP
1434 #line 216 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1425 #line 216 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14351426 { return DOTDOTDOT; }
14361427 YY_BREAK
14371428 case 21:
14381429 YY_RULE_SETUP
1439 #line 217 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1430 #line 217 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14401431 { return UNDEF; }
14411432 YY_BREAK
14421433 case 22:
14431434 YY_RULE_SETUP
1444 #line 218 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1435 #line 218 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14451436 { return NULL_TOK; }
14461437 YY_BREAK
14471438 case 23:
14481439 YY_RULE_SETUP
1449 #line 219 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1440 #line 219 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14501441 { return TO; }
14511442 YY_BREAK
14521443 case 24:
14531444 YY_RULE_SETUP
1454 #line 220 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1445 #line 220 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14551446 { return EXCEPT; }
14561447 YY_BREAK
14571448 case 25:
14581449 YY_RULE_SETUP
1459 #line 221 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1450 #line 221 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14601451 { return NOT; } /* Deprecated, turned into XOR */
14611452 YY_BREAK
14621453 case 26:
14631454 YY_RULE_SETUP
1464 #line 222 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1455 #line 222 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14651456 { return TAIL; }
14661457 YY_BREAK
14671458 case 27:
14681459 YY_RULE_SETUP
1469 #line 223 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1460 #line 223 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14701461 { return TARGET; }
14711462 YY_BREAK
14721463 case 28:
14731464 YY_RULE_SETUP
1474 #line 224 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1465 #line 224 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14751466 { return TRIPLE; }
14761467 YY_BREAK
14771468 case 29:
14781469 YY_RULE_SETUP
1479 #line 225 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1470 #line 225 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14801471 { return DEPLIBS; }
14811472 YY_BREAK
14821473 case 30:
14831474 YY_RULE_SETUP
1484 #line 226 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1475 #line 226 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14851476 { return ENDIAN; }
14861477 YY_BREAK
14871478 case 31:
14881479 YY_RULE_SETUP
1489 #line 227 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1480 #line 227 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14901481 { return POINTERSIZE; }
14911482 YY_BREAK
14921483 case 32:
14931484 YY_RULE_SETUP
1494 #line 228 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1485 #line 228 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
14951486 { return DATALAYOUT; }
14961487 YY_BREAK
14971488 case 33:
14981489 YY_RULE_SETUP
1499 #line 229 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1490 #line 229 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15001491 { return LITTLE; }
15011492 YY_BREAK
15021493 case 34:
15031494 YY_RULE_SETUP
1504 #line 230 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1495 #line 230 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15051496 { return BIG; }
15061497 YY_BREAK
15071498 case 35:
15081499 YY_RULE_SETUP
1509 #line 231 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1500 #line 231 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15101501 { return VOLATILE; }
15111502 YY_BREAK
15121503 case 36:
15131504 YY_RULE_SETUP
1514 #line 232 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1505 #line 232 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15151506 { return ALIGN; }
15161507 YY_BREAK
15171508 case 37:
15181509 YY_RULE_SETUP
1519 #line 233 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1510 #line 233 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15201511 { return SECTION; }
15211512 YY_BREAK
15221513 case 38:
15231514 YY_RULE_SETUP
1524 #line 234 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1515 #line 234 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15251516 { return MODULE; }
15261517 YY_BREAK
15271518 case 39:
15281519 YY_RULE_SETUP
1529 #line 235 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1520 #line 235 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15301521 { return ASM_TOK; }
15311522 YY_BREAK
15321523 case 40:
15331524 YY_RULE_SETUP
1534 #line 236 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1525 #line 236 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15351526 { return SIDEEFFECT; }
15361527 YY_BREAK
15371528 case 41:
15381529 YY_RULE_SETUP
1539 #line 238 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1530 #line 238 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15401531 { return CC_TOK; }
15411532 YY_BREAK
15421533 case 42:
15431534 YY_RULE_SETUP
1544 #line 239 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1535 #line 239 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15451536 { return CCC_TOK; }
15461537 YY_BREAK
15471538 case 43:
15481539 YY_RULE_SETUP
1549 #line 240 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1540 #line 240 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15501541 { return CSRETCC_TOK; }
15511542 YY_BREAK
15521543 case 44:
15531544 YY_RULE_SETUP
1554 #line 241 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1545 #line 241 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15551546 { return FASTCC_TOK; }
15561547 YY_BREAK
15571548 case 45:
15581549 YY_RULE_SETUP
1559 #line 242 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1550 #line 242 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15601551 { return COLDCC_TOK; }
15611552 YY_BREAK
15621553 case 46:
15631554 YY_RULE_SETUP
1564 #line 243 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1555 #line 243 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15651556 { return X86_STDCALLCC_TOK; }
15661557 YY_BREAK
15671558 case 47:
15681559 YY_RULE_SETUP
1569 #line 244 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1560 #line 244 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15701561 { return X86_FASTCALLCC_TOK; }
15711562 YY_BREAK
15721563 case 48:
15731564 YY_RULE_SETUP
1574 #line 246 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1565 #line 246 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15751566 { RET_TY(SBYTE, Type::Int8Ty, 2); }
15761567 YY_BREAK
15771568 case 49:
15781569 YY_RULE_SETUP
1579 #line 247 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1570 #line 247 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15801571 { RET_TY(UBYTE, Type::Int8Ty, 1); }
15811572 YY_BREAK
15821573 case 50:
15831574 YY_RULE_SETUP
1584 #line 248 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1575 #line 248 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15851576 { RET_TY(UBYTE, Type::Int8Ty, 1); }
15861577 YY_BREAK
15871578 case 51:
15881579 YY_RULE_SETUP
1589 #line 249 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1580 #line 249 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15901581 { RET_TY(SHORT, Type::Int16Ty, 2); }
15911582 YY_BREAK
15921583 case 52:
15931584 YY_RULE_SETUP
1594 #line 250 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1585 #line 250 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
15951586 { RET_TY(USHORT, Type::Int16Ty, 1); }
15961587 YY_BREAK
15971588 case 53:
15981589 YY_RULE_SETUP
1599 #line 251 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1590 #line 251 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16001591 { RET_TY(USHORT, Type::Int16Ty, 1); }
16011592 YY_BREAK
16021593 case 54:
16031594 YY_RULE_SETUP
1604 #line 252 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1595 #line 252 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16051596 { RET_TY(INT, Type::Int32Ty, 2); }
16061597 YY_BREAK
16071598 case 55:
16081599 YY_RULE_SETUP
1609 #line 253 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1600 #line 253 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16101601 { RET_TY(UINT, Type::Int32Ty, 1); }
16111602 YY_BREAK
16121603 case 56:
16131604 YY_RULE_SETUP
1614 #line 254 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1605 #line 254 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16151606 { RET_TY(UINT, Type::Int32Ty, 1); }
16161607 YY_BREAK
16171608 case 57:
16181609 YY_RULE_SETUP
1619 #line 255 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1610 #line 255 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16201611 { RET_TY(LONG, Type::Int64Ty, 2); }
16211612 YY_BREAK
16221613 case 58:
16231614 YY_RULE_SETUP
1624 #line 256 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1615 #line 256 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16251616 { RET_TY(ULONG, Type::Int64Ty, 1); }
16261617 YY_BREAK
16271618 case 59:
16281619 YY_RULE_SETUP
1629 #line 257 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1620 #line 257 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16301621 { RET_TY(ULONG, Type::Int64Ty, 1); }
16311622 YY_BREAK
16321623 case 60:
16331624 YY_RULE_SETUP
1634 #line 258 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1625 #line 258 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16351626 { RET_TY(VOID, Type::VoidTy, 0); }
16361627 YY_BREAK
16371628 case 61:
16381629 YY_RULE_SETUP
1639 #line 259 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1630 #line 259 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16401631 { RET_TY(BOOL, Type::Int1Ty, 1); }
16411632 YY_BREAK
16421633 case 62:
16431634 YY_RULE_SETUP
1644 #line 260 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1635 #line 260 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16451636 { RET_TY(BOOL, Type::Int1Ty, 1); }
16461637 YY_BREAK
16471638 case 63:
16481639 YY_RULE_SETUP
1649 #line 261 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1640 #line 261 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16501641 { RET_TY(FLOAT, Type::FloatTy, 0); }
16511642 YY_BREAK
16521643 case 64:
16531644 YY_RULE_SETUP
1654 #line 262 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1645 #line 262 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16551646 { RET_TY(DOUBLE, Type::DoubleTy,0); }
16561647 YY_BREAK
16571648 case 65:
16581649 YY_RULE_SETUP
1659 #line 263 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1650 #line 263 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16601651 { RET_TY(LABEL, Type::LabelTy, 0); }
16611652 YY_BREAK
16621653 case 66:
16631654 YY_RULE_SETUP
1664 #line 264 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1655 #line 264 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16651656 { return TYPE; }
16661657 YY_BREAK
16671658 case 67:
16681659 YY_RULE_SETUP
1669 #line 265 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1660 #line 265 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16701661 { return OPAQUE; }
16711662 YY_BREAK
16721663 case 68:
16731664 YY_RULE_SETUP
1674 #line 267 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1665 #line 267 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16751666 { RET_TOK(BinaryOpVal, AddOp, ADD); }
16761667 YY_BREAK
16771668 case 69:
16781669 YY_RULE_SETUP
1679 #line 268 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1670 #line 268 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16801671 { RET_TOK(BinaryOpVal, SubOp, SUB); }
16811672 YY_BREAK
16821673 case 70:
16831674 YY_RULE_SETUP
1684 #line 269 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1675 #line 269 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16851676 { RET_TOK(BinaryOpVal, MulOp, MUL); }
16861677 YY_BREAK
16871678 case 71:
16881679 YY_RULE_SETUP
1689 #line 270 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1680 #line 270 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16901681 { RET_TOK(BinaryOpVal, DivOp, DIV); }
16911682 YY_BREAK
16921683 case 72:
16931684 YY_RULE_SETUP
1694 #line 271 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1685 #line 271 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
16951686 { RET_TOK(BinaryOpVal, UDivOp, UDIV); }
16961687 YY_BREAK
16971688 case 73:
16981689 YY_RULE_SETUP
1699 #line 272 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1690 #line 272 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17001691 { RET_TOK(BinaryOpVal, SDivOp, SDIV); }
17011692 YY_BREAK
17021693 case 74:
17031694 YY_RULE_SETUP
1704 #line 273 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1695 #line 273 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17051696 { RET_TOK(BinaryOpVal, FDivOp, FDIV); }
17061697 YY_BREAK
17071698 case 75:
17081699 YY_RULE_SETUP
1709 #line 274 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1700 #line 274 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17101701 { RET_TOK(BinaryOpVal, RemOp, REM); }
17111702 YY_BREAK
17121703 case 76:
17131704 YY_RULE_SETUP
1714 #line 275 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1705 #line 275 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17151706 { RET_TOK(BinaryOpVal, URemOp, UREM); }
17161707 YY_BREAK
17171708 case 77:
17181709 YY_RULE_SETUP
1719 #line 276 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1710 #line 276 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17201711 { RET_TOK(BinaryOpVal, SRemOp, SREM); }
17211712 YY_BREAK
17221713 case 78:
17231714 YY_RULE_SETUP
1724 #line 277 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1715 #line 277 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17251716 { RET_TOK(BinaryOpVal, FRemOp, FREM); }
17261717 YY_BREAK
17271718 case 79:
17281719 YY_RULE_SETUP
1729 #line 278 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1720 #line 278 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17301721 { RET_TOK(BinaryOpVal, AndOp, AND); }
17311722 YY_BREAK
17321723 case 80:
17331724 YY_RULE_SETUP
1734 #line 279 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1725 #line 279 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17351726 { RET_TOK(BinaryOpVal, OrOp , OR ); }
17361727 YY_BREAK
17371728 case 81:
17381729 YY_RULE_SETUP
1739 #line 280 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1730 #line 280 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17401731 { RET_TOK(BinaryOpVal, XorOp, XOR); }
17411732 YY_BREAK
17421733 case 82:
17431734 YY_RULE_SETUP
1744 #line 281 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1735 #line 281 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17451736 { RET_TOK(BinaryOpVal, SetNE, SETNE); }
17461737 YY_BREAK
17471738 case 83:
17481739 YY_RULE_SETUP
1749 #line 282 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1740 #line 282 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17501741 { RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
17511742 YY_BREAK
17521743 case 84:
17531744 YY_RULE_SETUP
1754 #line 283 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1745 #line 283 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17551746 { RET_TOK(BinaryOpVal, SetLT, SETLT); }
17561747 YY_BREAK
17571748 case 85:
17581749 YY_RULE_SETUP
1759 #line 284 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1750 #line 284 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17601751 { RET_TOK(BinaryOpVal, SetGT, SETGT); }
17611752 YY_BREAK
17621753 case 86:
17631754 YY_RULE_SETUP
1764 #line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1755 #line 285 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17651756 { RET_TOK(BinaryOpVal, SetLE, SETLE); }
17661757 YY_BREAK
17671758 case 87:
17681759 YY_RULE_SETUP
1769 #line 286 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1760 #line 286 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17701761 { RET_TOK(BinaryOpVal, SetGE, SETGE); }
17711762 YY_BREAK
17721763 case 88:
17731764 YY_RULE_SETUP
1774 #line 287 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1765 #line 287 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17751766 { RET_TOK(BinaryOpVal, ShlOp, SHL); }
17761767 YY_BREAK
17771768 case 89:
17781769 YY_RULE_SETUP
1779 #line 288 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1770 #line 288 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17801771 { RET_TOK(BinaryOpVal, ShrOp, SHR); }
17811772 YY_BREAK
17821773 case 90:
17831774 YY_RULE_SETUP
1784 #line 289 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1775 #line 289 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17851776 { RET_TOK(BinaryOpVal, LShrOp, LSHR); }
17861777 YY_BREAK
17871778 case 91:
17881779 YY_RULE_SETUP
1789 #line 290 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1780 #line 290 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17901781 { RET_TOK(BinaryOpVal, AShrOp, ASHR); }
17911782 YY_BREAK
17921783 case 92:
17931784 YY_RULE_SETUP
1794 #line 292 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1785 #line 292 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
17951786 { RET_TOK(OtherOpVal, ICmpOp, ICMP); }
17961787 YY_BREAK
17971788 case 93:
17981789 YY_RULE_SETUP
1799 #line 293 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1790 #line 293 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18001791 { RET_TOK(OtherOpVal, FCmpOp, FCMP); }
18011792 YY_BREAK
18021793 case 94:
18031794 YY_RULE_SETUP
1804 #line 295 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1795 #line 295 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18051796 { return EQ; }
18061797 YY_BREAK
18071798 case 95:
18081799 YY_RULE_SETUP
1809 #line 296 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1800 #line 296 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18101801 { return NE; }
18111802 YY_BREAK
18121803 case 96:
18131804 YY_RULE_SETUP
1814 #line 297 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1805 #line 297 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18151806 { return SLT; }
18161807 YY_BREAK
18171808 case 97:
18181809 YY_RULE_SETUP
1819 #line 298 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1810 #line 298 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18201811 { return SGT; }
18211812 YY_BREAK
18221813 case 98:
18231814 YY_RULE_SETUP
1824 #line 299 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1815 #line 299 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18251816 { return SLE; }
18261817 YY_BREAK
18271818 case 99:
18281819 YY_RULE_SETUP
1829 #line 300 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1820 #line 300 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18301821 { return SGE; }
18311822 YY_BREAK
18321823 case 100:
18331824 YY_RULE_SETUP
1834 #line 301 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1825 #line 301 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18351826 { return ULT; }
18361827 YY_BREAK
18371828 case 101:
18381829 YY_RULE_SETUP
1839 #line 302 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1830 #line 302 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18401831 { return UGT; }
18411832 YY_BREAK
18421833 case 102:
18431834 YY_RULE_SETUP
1844 #line 303 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1835 #line 303 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18451836 { return ULE; }
18461837 YY_BREAK
18471838 case 103:
18481839 YY_RULE_SETUP
1849 #line 304 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1840 #line 304 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18501841 { return UGE; }
18511842 YY_BREAK
18521843 case 104:
18531844 YY_RULE_SETUP
1854 #line 305 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1845 #line 305 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18551846 { return OEQ; }
18561847 YY_BREAK
18571848 case 105:
18581849 YY_RULE_SETUP
1859 #line 306 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1850 #line 306 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18601851 { return ONE; }
18611852 YY_BREAK
18621853 case 106:
18631854 YY_RULE_SETUP
1864 #line 307 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1855 #line 307 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18651856 { return OLT; }
18661857 YY_BREAK
18671858 case 107:
18681859 YY_RULE_SETUP
1869 #line 308 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1860 #line 308 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18701861 { return OGT; }
18711862 YY_BREAK
18721863 case 108:
18731864 YY_RULE_SETUP
1874 #line 309 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1865 #line 309 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18751866 { return OLE; }
18761867 YY_BREAK
18771868 case 109:
18781869 YY_RULE_SETUP
1879 #line 310 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1870 #line 310 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18801871 { return OGE; }
18811872 YY_BREAK
18821873 case 110:
18831874 YY_RULE_SETUP
1884 #line 311 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1875 #line 311 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18851876 { return ORD; }
18861877 YY_BREAK
18871878 case 111:
18881879 YY_RULE_SETUP
1889 #line 312 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1880 #line 312 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18901881 { return UNO; }
18911882 YY_BREAK
18921883 case 112:
18931884 YY_RULE_SETUP
1894 #line 313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1885 #line 313 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
18951886 { return UEQ; }
18961887 YY_BREAK
18971888 case 113:
18981889 YY_RULE_SETUP
1899 #line 314 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1890 #line 314 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19001891 { return UNE; }
19011892 YY_BREAK
19021893 case 114:
19031894 YY_RULE_SETUP
1904 #line 316 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1895 #line 316 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19051896 { RET_TOK(OtherOpVal, PHIOp, PHI_TOK); }
19061897 YY_BREAK
19071898 case 115:
19081899 YY_RULE_SETUP
1909 #line 317 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1900 #line 317 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19101901 { RET_TOK(OtherOpVal, CallOp, CALL); }
19111902 YY_BREAK
19121903 case 116:
19131904 YY_RULE_SETUP
1914 #line 318 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1905 #line 318 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19151906 { RET_TOK(CastOpVal, CastOp, CAST); }
19161907 YY_BREAK
19171908 case 117:
19181909 YY_RULE_SETUP
1919 #line 319 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1910 #line 319 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19201911 { RET_TOK(CastOpVal, TruncOp, TRUNC); }
19211912 YY_BREAK
19221913 case 118:
19231914 YY_RULE_SETUP
1924 #line 320 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1915 #line 320 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19251916 { RET_TOK(CastOpVal, ZExtOp , ZEXT); }
19261917 YY_BREAK
19271918 case 119:
19281919 YY_RULE_SETUP
1929 #line 321 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1920 #line 321 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19301921 { RET_TOK(CastOpVal, SExtOp, SEXT); }
19311922 YY_BREAK
19321923 case 120:
19331924 YY_RULE_SETUP
1934 #line 322 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1925 #line 322 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19351926 { RET_TOK(CastOpVal, FPTruncOp, FPTRUNC); }
19361927 YY_BREAK
19371928 case 121:
19381929 YY_RULE_SETUP
1939 #line 323 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1930 #line 323 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19401931 { RET_TOK(CastOpVal, FPExtOp, FPEXT); }
19411932 YY_BREAK
19421933 case 122:
19431934 YY_RULE_SETUP
1944 #line 324 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1935 #line 324 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19451936 { RET_TOK(CastOpVal, FPToUIOp, FPTOUI); }
19461937 YY_BREAK
19471938 case 123:
19481939 YY_RULE_SETUP
1949 #line 325 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1940 #line 325 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19501941 { RET_TOK(CastOpVal, FPToSIOp, FPTOSI); }
19511942 YY_BREAK
19521943 case 124:
19531944 YY_RULE_SETUP
1954 #line 326 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1945 #line 326 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19551946 { RET_TOK(CastOpVal, UIToFPOp, UITOFP); }
19561947 YY_BREAK
19571948 case 125:
19581949 YY_RULE_SETUP
1959 #line 327 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1950 #line 327 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19601951 { RET_TOK(CastOpVal, SIToFPOp, SITOFP); }
19611952 YY_BREAK
19621953 case 126:
19631954 YY_RULE_SETUP
1964 #line 328 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1955 #line 328 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19651956 { RET_TOK(CastOpVal, PtrToIntOp, PTRTOINT); }
19661957 YY_BREAK
19671958 case 127:
19681959 YY_RULE_SETUP
1969 #line 329 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1960 #line 329 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19701961 { RET_TOK(CastOpVal, IntToPtrOp, INTTOPTR); }
19711962 YY_BREAK
19721963 case 128:
19731964 YY_RULE_SETUP
1974 #line 330 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1965 #line 330 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19751966 { RET_TOK(CastOpVal, BitCastOp, BITCAST); }
19761967 YY_BREAK
19771968 case 129:
19781969 YY_RULE_SETUP
1979 #line 331 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1970 #line 331 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19801971 { RET_TOK(OtherOpVal, SelectOp, SELECT); }
19811972 YY_BREAK
19821973 case 130:
19831974 YY_RULE_SETUP
1984 #line 332 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1975 #line 332 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19851976 { return VANEXT_old; }
19861977 YY_BREAK
19871978 case 131:
19881979 YY_RULE_SETUP
1989 #line 333 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1980 #line 333 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19901981 { return VAARG_old; }
19911982 YY_BREAK
19921983 case 132:
19931984 YY_RULE_SETUP
1994 #line 334 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1985 #line 334 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
19951986 { RET_TOK(OtherOpVal, VAArg , VAARG); }
19961987 YY_BREAK
19971988 case 133:
19981989 YY_RULE_SETUP
1999 #line 335 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1990 #line 335 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20001991 { RET_TOK(TermOpVal, RetOp, RET); }
20011992 YY_BREAK
20021993 case 134:
20031994 YY_RULE_SETUP
2004 #line 336 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
1995 #line 336 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20051996 { RET_TOK(TermOpVal, BrOp, BR); }
20061997 YY_BREAK
20071998 case 135:
20081999 YY_RULE_SETUP
2009 #line 337 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2000 #line 337 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20102001 { RET_TOK(TermOpVal, SwitchOp, SWITCH); }
20112002 YY_BREAK
20122003 case 136:
20132004 YY_RULE_SETUP
2014 #line 338 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2005 #line 338 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20152006 { RET_TOK(TermOpVal, InvokeOp, INVOKE); }
20162007 YY_BREAK
20172008 case 137:
20182009 YY_RULE_SETUP
2019 #line 339 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2010 #line 339 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20202011 { return UNWIND; }
20212012 YY_BREAK
20222013 case 138:
20232014 YY_RULE_SETUP
2024 #line 340 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2015 #line 340 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20252016 { RET_TOK(TermOpVal, UnreachableOp, UNREACHABLE); }
20262017 YY_BREAK
20272018 case 139:
20282019 YY_RULE_SETUP
2029 #line 342 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2020 #line 342 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20302021 { RET_TOK(MemOpVal, MallocOp, MALLOC); }
20312022 YY_BREAK
20322023 case 140:
20332024 YY_RULE_SETUP
2034 #line 343 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2025 #line 343 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20352026 { RET_TOK(MemOpVal, AllocaOp, ALLOCA); }
20362027 YY_BREAK
20372028 case 141:
20382029 YY_RULE_SETUP
2039 #line 344 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2030 #line 344 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20402031 { RET_TOK(MemOpVal, FreeOp, FREE); }
20412032 YY_BREAK
20422033 case 142:
20432034 YY_RULE_SETUP
2044 #line 345 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2035 #line 345 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20452036 { RET_TOK(MemOpVal, LoadOp, LOAD); }
20462037 YY_BREAK
20472038 case 143:
20482039 YY_RULE_SETUP
2049 #line 346 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2040 #line 346 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20502041 { RET_TOK(MemOpVal, StoreOp, STORE); }
20512042 YY_BREAK
20522043 case 144:
20532044 YY_RULE_SETUP
2054 #line 347 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2045 #line 347 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20552046 { RET_TOK(MemOpVal, GetElementPtrOp, GETELEMENTPTR); }
20562047 YY_BREAK
20572048 case 145:
20582049 YY_RULE_SETUP
2059 #line 349 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2050 #line 349 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20602051 { RET_TOK(OtherOpVal, ExtractElementOp, EXTRACTELEMENT); }
20612052 YY_BREAK
20622053 case 146:
20632054 YY_RULE_SETUP
2064 #line 350 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2055 #line 350 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20652056 { RET_TOK(OtherOpVal, InsertElementOp, INSERTELEMENT); }
20662057 YY_BREAK
20672058 case 147:
20682059 YY_RULE_SETUP
2069 #line 351 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2060 #line 351 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20702061 { RET_TOK(OtherOpVal, ShuffleVectorOp, SHUFFLEVECTOR); }
20712062 YY_BREAK
20722063 case 148:
20732064 YY_RULE_SETUP
2074 #line 354 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2065 #line 354 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20752066 {
20762067 UnEscapeLexed(yytext+1);
20772068 Upgradelval.StrVal = strdup(yytext+1); // Skip %
20802071 YY_BREAK
20812072 case 149:
20822073 YY_RULE_SETUP
2083 #line 359 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2074 #line 359 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20842075 {
20852076 yytext[strlen(yytext)-1] = 0; // nuke colon
20862077 UnEscapeLexed(yytext);
20902081 YY_BREAK
20912082 case 150:
20922083 YY_RULE_SETUP
2093 #line 365 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2084 #line 365 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
20942085 {
20952086 yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
20962087 UnEscapeLexed(yytext+1);
21002091 YY_BREAK
21012092 case 151:
21022093 YY_RULE_SETUP
2103 #line 372 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2094 #line 372 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21042095 { // Note that we cannot unescape a string constant here! The
21052096 // string constant might contain a \00 which would not be
21062097 // understood by the string stuff. It is valid to make a
21132104 YY_BREAK
21142105 case 152:
21152106 YY_RULE_SETUP
2116 #line 383 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2107 #line 383 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21172108 { Upgradelval.UInt64Val = atoull(yytext); return EUINT64VAL; }
21182109 YY_BREAK
21192110 case 153:
21202111 YY_RULE_SETUP
2121 #line 384 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2112 #line 384 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21222113 {
21232114 uint64_t Val = atoull(yytext+1);
21242115 // +1: we have bigger negative range
21302121 YY_BREAK
21312122 case 154:
21322123 YY_RULE_SETUP
2133 #line 392 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2124 #line 392 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21342125 {
21352126 Upgradelval.UInt64Val = HexIntToVal(yytext+3);
21362127 return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
21382129 YY_BREAK
21392130 case 155:
21402131 YY_RULE_SETUP
2141 #line 397 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2132 #line 397 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21422133 {
21432134 uint64_t Val = atoull(yytext+1);
21442135 if ((unsigned)Val != Val)
21492140 YY_BREAK
21502141 case 156:
21512142 YY_RULE_SETUP
2152 #line 404 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2143 #line 404 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21532144 {
21542145 uint64_t Val = atoull(yytext+2);
21552146 // +1: we have bigger negative range
21612152 YY_BREAK
21622153 case 157:
21632154 YY_RULE_SETUP
2164 #line 413 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2165 { Upgradelval.FPVal = atof(yytext); return FPVAL; }
2155 #line 413 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
2156 { Upgradelval.FPVal = new APFloat(atof(yytext)); return FPVAL; }
21662157 YY_BREAK
21672158 case 158:
21682159 YY_RULE_SETUP
2169 #line 414 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2170 { Upgradelval.FPVal = HexToFP(yytext); return FPVAL; }
2160 #line 414 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
2161 { Upgradelval.FPVal = new APFloat(HexToFP(yytext));
2162 return FPVAL;
2163 }
21712164 YY_BREAK
21722165 case YY_STATE_EOF(INITIAL):
2173 #line 416 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2166 #line 418 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21742167 {
21752168 /* Make sure to free the internal buffers for flex when we are
21762169 * done reading our input!
21812174 YY_BREAK
21822175 case 159:
21832176 YY_RULE_SETUP
2184 #line 424 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2177 #line 426 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21852178 { /* Ignore whitespace */ }
21862179 YY_BREAK
21872180 case 160:
21882181 YY_RULE_SETUP
2189 #line 425 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2182 #line 427 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21902183 { return yytext[0]; }
21912184 YY_BREAK
21922185 case 161:
21932186 YY_RULE_SETUP
2194 #line 427 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
2187 #line 429 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
21952188 YY_FATAL_ERROR( "flex scanner jammed" );
21962189 YY_BREAK
2197 #line 2199 "UpgradeLexer.cpp"
2190 #line 2192 "UpgradeLexer.cpp"
21982191
21992192 case YY_END_OF_BUFFER:
22002193 {
25702563 #endif /* ifndef YY_NO_UNPUT */
25712564
25722565
2573 #ifndef YY_NO_INPUT
25742566 #ifdef __cplusplus
25752567 static int yyinput()
25762568 #else
26442636
26452637 return c;
26462638 }
2647 #endif /* YY_NO_INPUT */
2639
26482640
26492641 #ifdef YY_USE_PROTOS
26502642 void yyrestart( FILE *input_file )
27552747 }
27562748
27572749
2750 #ifndef YY_ALWAYS_INTERACTIVE
2751 #ifndef YY_NEVER_INTERACTIVE
2752 extern int isatty YY_PROTO(( int ));
2753 #endif
2754 #endif
27582755
27592756 #ifdef YY_USE_PROTOS
27602757 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
30723069 return 0;
30733070 }
30743071 #endif
3075 #line 427 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeLexer.l"
3076
3072 #line 429 "/Volumes/MacOS9/gcc/llvm/tools/llvm-upgrade/UpgradeLexer.l"
3073
409409 return SINTVAL;
410410 }
411411
412 {FPConstant} { Upgradelval.FPVal = atof(yytext); return FPVAL; }
413 {HexFPConstant} { Upgradelval.FPVal = HexToFP(yytext); return FPVAL; }
412 {FPConstant} { Upgradelval.FPVal = new APFloat(atof(yytext)); return FPVAL; }
413 {HexFPConstant} { Upgradelval.FPVal = new APFloat(HexToFP(yytext));
414 return FPVAL;
415 }
414416
415417 <> {
416418 /* Make sure to free the internal buffers for flex when we are
409409 return SINTVAL;
410410 }
411411
412 {FPConstant} { Upgradelval.FPVal = atof(yytext); return FPVAL; }
413 {HexFPConstant} { Upgradelval.FPVal = HexToFP(yytext); return FPVAL; }
412 {FPConstant} { Upgradelval.FPVal = new APFloat(atof(yytext)); return FPVAL; }
413 {HexFPConstant} { Upgradelval.FPVal = new APFloat(HexToFP(yytext));
414 return FPVAL;
415 }
414416
415417 <> {
416418 /* Make sure to free the internal buffers for flex when we are
532532 return ConstantInt::get(Ty, D.UConstPool64);
533533
534534 case ValID::ConstFPVal: // Is it a floating point const pool reference?
535 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
535 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP))
536536 error("FP constant invalid for type");
537 return ConstantFP::get(Ty, D.ConstPoolFP);
537 // Lexer has no type info, so builds all FP constants as double.
538 // Fix this here.
539 if (Ty==Type::FloatTy)
540 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
541 return ConstantFP::get(Ty, *D.ConstPoolFP);
538542
539543 case ValID::ConstNullVal: // Is it a null value?
540544 if (!isa(Ty))
17721776 uint64_t UInt64Val;
17731777 int SIntVal;
17741778 unsigned UIntVal;
1775 double FPVal;
1779 llvm::APFloat *FPVal;
17761780 bool BoolVal;
17771781
17781782 char *StrVal; // This memory is strdup'd!
25132517 $$.S.makeUnsigned();
25142518 }
25152519 | FPType FPVAL { // Float & Double constants
2516 if (!ConstantFP::isValueValidForType($1.T, $2))
2520 if (!ConstantFP::isValueValidForType($1.T, *$2))
25172521 error("Floating point constant invalid for type");
2518 $$.C = ConstantFP::get($1.T, $2);
2522 // Lexer has no type info, so builds all FP constants as double.
2523 // Fix this here.
2524 if ($1.T==Type::FloatTy)
2525 $2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
2526 $$.C = ConstantFP::get($1.T, *$2);
25192527 $$.S.makeSignless();
25202528 }
25212529 ;
532532 return ConstantInt::get(Ty, D.UConstPool64);
533533
534534 case ValID::ConstFPVal: // Is it a floating point const pool reference?
535 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
535 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP))
536536 error("FP constant invalid for type");
537 return ConstantFP::get(Ty, D.ConstPoolFP);
537 // Lexer has no type info, so builds all FP constants as double.
538 // Fix this here.
539 if (Ty==Type::FloatTy)
540 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
541 return ConstantFP::get(Ty, *D.ConstPoolFP);
538542
539543 case ValID::ConstNullVal: // Is it a null value?
540544 if (!isa(Ty))
17721776 uint64_t UInt64Val;
17731777 int SIntVal;
17741778 unsigned UIntVal;
1775 double FPVal;
1779 llvm::APFloat *FPVal;
17761780 bool BoolVal;
17771781
17781782 char *StrVal; // This memory is strdup'd!
25132517 $$.S.makeUnsigned();
25142518 }
25152519 | FPType FPVAL { // Float & Double constants
2516 if (!ConstantFP::isValueValidForType($1.T, $2))
2520 if (!ConstantFP::isValueValidForType($1.T, *$2))
25172521 error("Floating point constant invalid for type");
2518 $$.C = ConstantFP::get($1.T, $2);
2522 // Lexer has no type info, so builds all FP constants as double.
2523 // Fix this here.
2524 if ($1.T==Type::FloatTy)
2525 $2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
2526 $$.C = ConstantFP::get($1.T, *$2);
25192527 $$.S.makeSignless();
25202528 }
25212529 ;
208208 // result so that we don't lose precision.
209209 void
210210 CppWriter::printCFP(const ConstantFP *CFP) {
211 APFloat APF = APFloat(CFP->getValueAPF()); // copy
212 if (CFP->getType() == Type::FloatTy)
213 APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven);
211214 Out << "ConstantFP::get(";
212215 if (CFP->getType() == Type::DoubleTy)
213216 Out << "Type::DoubleTy, ";
214217 else
215218 Out << "Type::FloatTy, ";
219 Out << "APFloat(";
216220 #if HAVE_PRINTF_A
217221 char Buffer[100];
218 sprintf(Buffer, "%A", CFP->getValue());
222 sprintf(Buffer, "%A", APF.convertToDouble());
219223 if ((!strncmp(Buffer, "0x", 2) ||
220224 !strncmp(Buffer, "-0x", 3) ||
221225 !strncmp(Buffer, "+0x", 3)) &&
222 (atof(Buffer) == CFP->getValue()))
226 APF.bitwiseIsEqual(APFloat(atof(Buffer)))) {
223227 if (CFP->getType() == Type::DoubleTy)
224228 Out << "BitsToDouble(" << Buffer << ")";
225229 else
226 Out << "BitsToFloat(" << Buffer << ")";
227 else {
230 Out << "BitsToFloat((float)" << Buffer << ")";
231 Out << ")";
232 } else {
228233 #endif
229 std::string StrVal = ftostr(CFP->getValue());
234 std::string StrVal = ftostr(CFP->getValueAPF());
230235
231236 while (StrVal[0] == ' ')
232237 StrVal.erase(StrVal.begin());
236241 if (((StrVal[0] >= '0' && StrVal[0] <= '9') ||
237242 ((StrVal[0] == '-' || StrVal[0] == '+') &&
238243 (StrVal[1] >= '0' && StrVal[1] <= '9'))) &&
239 (atof(StrVal.c_str()) == CFP->getValue()))
244 (CFP->isExactlyValue(atof(StrVal.c_str())))) {
240245 if (CFP->getType() == Type::DoubleTy)
241246 Out << StrVal;
242247 else
243 Out << StrVal;
248 Out << StrVal << "f";
249 }
244250 else if (CFP->getType() == Type::DoubleTy)
245 Out << "BitsToDouble(0x" << std::hex << DoubleToBits(CFP->getValue())
251 Out << "BitsToDouble(0x" << std::hex
252 << DoubleToBits(CFP->getValueAPF().convertToDouble())
246253 << std::dec << "ULL) /* " << StrVal << " */";
247254 else
248 Out << "BitsToFloat(0x" << std::hex << FloatToBits(CFP->getValue())
255 Out << "BitsToFloat(0x" << std::hex
256 << FloatToBits(CFP->getValueAPF().convertToFloat())
249257 << std::dec << "U) /* " << StrVal << " */";
258 Out << ")";
250259 #if HAVE_PRINTF_A
251260 }
252261 #endif