diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-15 00:26:18 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-15 00:26:18 +0000 |
commit | 30d0c58fc9ca78d33af185821a218cf732755ed3 (patch) | |
tree | bab1f83ef197eb52a781f9bbe246d7c90e72905f /tools/llvm-upgrade/UpgradeParser.cpp.cvs | |
parent | e0a15bbc022686d56429e89923e16a8e8676e372 (diff) |
Regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-upgrade/UpgradeParser.cpp.cvs')
-rw-r--r-- | tools/llvm-upgrade/UpgradeParser.cpp.cvs | 1282 |
1 files changed, 753 insertions, 529 deletions
diff --git a/tools/llvm-upgrade/UpgradeParser.cpp.cvs b/tools/llvm-upgrade/UpgradeParser.cpp.cvs index ea951a1762..5ae0db7529 100644 --- a/tools/llvm-upgrade/UpgradeParser.cpp.cvs +++ b/tools/llvm-upgrade/UpgradeParser.cpp.cvs @@ -366,7 +366,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 14 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" #include "UpgradeInternals.h" #include <algorithm> @@ -386,44 +386,14 @@ static std::string CurFilename; static std::ostream *O = 0; std::istream* LexInput = 0; unsigned SizeOfPointer = 32; -static uint64_t unique = 1; + // This bool controls whether attributes are ever added to function declarations // definitions and calls. static bool AddAttributes = false; -// This is set when a DECLARE keyword is recognized so that subsequent parsing -// of a function prototype can know if its a declaration or definition. -static bool isDeclare = false; - -// This bool is used to communicate between the InstVal and Inst rules about -// whether or not a cast should be deleted. When the flag is set, InstVal has -// determined that the cast is a candidate. However, it can only be deleted if -// the value being casted is the same value name as the instruction. The Inst -// rule makes that comparison if the flag is set and comments out the -// instruction if they match. -static bool deleteUselessCastFlag = false; -static std::string* deleteUselessCastName = 0; - -typedef std::vector<const TypeInfo*> TypeVector; -static TypeVector EnumeratedTypes; -typedef std::map<std::string,const TypeInfo*> TypeMap; -static TypeMap NamedTypes; -typedef std::map<const TypeInfo*,std::string> TypePlaneMap; -typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap; -static GlobalsTypeMap Globals; - static void warning(const std::string& msg); -void destroy(ValueList* VL) { - while (!VL->empty()) { - ValueInfo& VI = VL->back(); - VI.destroy(); - VL->pop_back(); - } - delete VL; -} - void UpgradeAssembly(const std::string &infile, std::istream& in, std::ostream &out, bool debug, bool addAttrs) { @@ -435,13 +405,176 @@ void UpgradeAssembly(const std::string &infile, std::istream& in, O = &out; if (yyparse()) { - std::cerr << "Parse failed.\n"; - out << "llvm-upgrade parse failed.\n"; + std::cerr << "llvm-upgrade: parse failed.\n"; + out << "llvm-upgrade: parse failed.\n"; exit(1); } } -TypeInfo::TypeRegMap TypeInfo::registry; +namespace { // Anonymous namespace to keep our implementation local + + +/// This type is used to keep track of the signedness of values. Instead +/// of creating llvm::Value directly, the parser will create ValueInfo which +/// associates a Value* with a Signedness indication. +struct ValueInfo { + std::string* val; + const TypeInfo* type; + bool constant; + bool isConstant() const { return constant; } + ~ValueInfo() { delete val; } +}; + + +/// This type is used to keep track of the signedness of the obsolete +/// integer types. Instead of creating an llvm::Type directly, the Lexer will +/// create instances of TypeInfo which retains the signedness indication so +/// it can be used by the parser for upgrade decisions. +/// For example if "uint" is encountered then the "first" field will be set +/// to "int32" and the "second" field will be set to "isUnsigned". If the +/// type is not obsolete then "second" will be set to "isSignless". +class TypeInfo { +public: + static const TypeInfo* get(const std::string &newType, Types oldType); + static const TypeInfo* get(const std::string& newType, Types oldType, + const TypeInfo* eTy, const TypeInfo* rTy); + + static const TypeInfo* get(const std::string& newType, Types oldType, + const TypeInfo *eTy, uint64_t elems); + + static const TypeInfo* get(const std::string& newType, Types oldType, + TypeList* TL); + + static const TypeInfo* get(const std::string& newType, const TypeInfo* resTy, + TypeList* TL); + + const TypeInfo* resolve() const; + bool operator<(const TypeInfo& that) const; + + bool sameNewTyAs(const TypeInfo* that) const { + return this->newTy == that->newTy; + } + + bool sameOldTyAs(const TypeInfo* that) const; + + Types getElementTy() const { + if (elemTy) { + return elemTy->oldTy; + } + return UnresolvedTy; + } + + unsigned getUpRefNum() const { + assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference"); + return atoi(&((getNewTy().c_str())[1])); // skip the slash + } + + typedef std::vector<const TypeInfo*> UpRefStack; + void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const; + std::string makeUniqueName(const std::string& BaseName) const; + + const std::string& getNewTy() const { return newTy; } + const TypeInfo* getResultType() const { return resultTy; } + const TypeInfo* getElementType() const { return elemTy; } + + const TypeInfo* getPointerType() const { + return get(newTy + "*", PointerTy, this, (TypeInfo*)0); + } + + bool isUnresolved() const { return oldTy == UnresolvedTy; } + bool isUpReference() const { return oldTy == UpRefTy; } + bool isVoid() const { return oldTy == VoidTy; } + bool isBool() const { return oldTy == BoolTy; } + bool isSigned() const { + return oldTy == SByteTy || oldTy == ShortTy || + oldTy == IntTy || oldTy == LongTy; + } + + bool isUnsigned() const { + return oldTy == UByteTy || oldTy == UShortTy || + oldTy == UIntTy || oldTy == ULongTy; + } + bool isSignless() const { return !isSigned() && !isUnsigned(); } + bool isInteger() const { return isSigned() || isUnsigned(); } + bool isIntegral() const { return oldTy == BoolTy || isInteger(); } + bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; } + bool isPacked() const { return oldTy == PackedTy; } + bool isPointer() const { return oldTy == PointerTy; } + bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; } + bool isArray() const { return oldTy == ArrayTy; } + bool isOther() const { + return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); } + bool isFunction() const { return oldTy == FunctionTy; } + bool isComposite() const { + return isStruct() || isPointer() || isArray() || isPacked(); + } + + bool isAttributeCandidate() const { + return isIntegral() && getBitWidth() < 32; + } + + bool isUnresolvedDeep() const; + + unsigned getBitWidth() const; + + const TypeInfo* getIndexedType(const ValueInfo* VI) const; + + unsigned getNumStructElements() const { + return (elements ? elements->size() : 0); + } + + const TypeInfo* getElement(unsigned idx) const { + if (elements) + if (idx < elements->size()) + return (*elements)[idx]; + return 0; + } + +private: + TypeInfo() + : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0), + nelems(0) { + } + + TypeInfo(const TypeInfo& that); // do not implement + TypeInfo& operator=(const TypeInfo& that); // do not implement + + ~TypeInfo() { delete elements; } + + struct ltfunctor + { + bool operator()(const TypeInfo* X, const TypeInfo* Y) const { + assert(X && "Can't compare null pointer"); + assert(Y && "Can't compare null pointer"); + return *X < *Y; + } + }; + + typedef std::set<const TypeInfo*, ltfunctor> TypeRegMap; + + static const TypeInfo* add_new_type(TypeInfo* existing); + + std::string newTy; + Types oldTy; + TypeInfo *elemTy; + TypeInfo *resultTy; + TypeList *elements; + uint64_t nelems; + static TypeRegMap registry; +public: + typedef std::vector<const TypeInfo*> TypeVector; + typedef std::map<std::string,const TypeInfo*> TypeMap; + typedef std::map<const TypeInfo*,std::string> TypePlaneMap; + typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap; + static TypeVector EnumeratedTypes; + static TypeMap NamedTypes; + static GlobalsTypeMap Globals; +}; + +TypeInfo::TypeRegMap TypeInfo::registry; +TypeInfo::TypeVector TypeInfo::EnumeratedTypes; +TypeInfo::TypeMap TypeInfo::NamedTypes; +TypeInfo::GlobalsTypeMap TypeInfo::Globals; const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) { TypeInfo* Ty = new TypeInfo(); @@ -501,7 +634,7 @@ const TypeInfo* TypeInfo::resolve() const { yyerror(msg.c_str()); } } else { - TypeMap::iterator I = NamedTypes.find(newTy); + TypeInfo::TypeMap::iterator I = NamedTypes.find(newTy); if (I != NamedTypes.end()) { return I->second; } else { @@ -651,12 +784,12 @@ unsigned TypeInfo::getBitWidth() const { } } -const TypeInfo* TypeInfo::getIndexedType(const ValueInfo& VI) const { +const TypeInfo* TypeInfo::getIndexedType(const ValueInfo* VI) const { if (isStruct()) { - if (VI.isConstant() && VI.type->isInteger()) { - size_t pos = VI.val->find(' ') + 1; - if (pos < VI.val->size()) { - uint64_t idx = atoi(VI.val->substr(pos).c_str()); + if (VI->isConstant() && VI->type->isInteger()) { + size_t pos = VI->val->find(' ') + 1; + if (pos < VI->val->size()) { + uint64_t idx = atoi(VI->val->substr(pos).c_str()); return (*elements)[idx]; } else { yyerror("Invalid value for constant integer"); @@ -802,9 +935,34 @@ const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) { return newTy; } -static const char* getCastOpcode( - std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy) -{ +/// This type is used to keep track of the signedness of constants. +struct ConstInfo { + std::string *cnst; + const TypeInfo *type; + ~ConstInfo() { delete cnst; } +}; + +/// This variable provides a counter for unique names. It is used in various +/// productions to ensure a unique name is generated. +static uint64_t UniqueNameCounter = 1; + +// This is set when a DECLARE keyword is recognized so that subsequent parsing +// of a function prototype can know if its a declaration or definition. +static bool isDeclare = false; + +// This bool is used to communicate between the InstVal and Inst rules about +// whether or not a cast should be deleted. When the flag is set, InstVal has +// determined that the cast is a candidate. However, it can only be deleted if +// the value being casted is the same value name as the instruction. The Inst +// rule makes that comparison if the flag is set and comments out the +// instruction if they match. +static bool deleteUselessCastFlag = false; +static std::string* deleteUselessCastName = 0; + + + +const char* getCastOpcode(std::string& Source, const TypeInfo* SrcTy, + const TypeInfo* DstTy) { unsigned SrcBits = SrcTy->getBitWidth(); unsigned DstBits = DstTy->getBitWidth(); const char* opcode = "bitcast"; @@ -880,9 +1038,8 @@ static const char* getCastOpcode( return opcode; } -static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy, - const TypeInfo* DstTy, bool isConst) -{ +std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy, + const TypeInfo* DstTy, bool isConst) { std::string Result; std::string Source = Src; if (SrcTy->isFloatingPoint() && DstTy->isPointer()) { @@ -891,9 +1048,9 @@ static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy, if (isConst) Source = "i64 fptoui(" + Source + " to i64)"; else { - *O << " %cast_upgrade" << unique << " = fptoui " << Source - << " to i64\n"; - Source = "i64 %cast_upgrade" + llvm::utostr(unique); + *O << " %cast_upgrade" << UniqueNameCounter++ << " = fptoui " + << Source << " to i64\n"; + Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter); } // Update the SrcTy for the getCastOpcode call below SrcTy = TypeInfo::get("i64", ULongTy); @@ -948,8 +1105,7 @@ const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) { return op; } -std::string -getCompareOp(const std::string& setcc, const TypeInfo* TI) { +std::string getCompareOp(const std::string& setcc, const TypeInfo* TI) { assert(setcc.length() == 5); char cc1 = setcc[3]; char cc2 = setcc[4]; @@ -979,7 +1135,7 @@ getCompareOp(const std::string& setcc, const TypeInfo* TI) { return result; } -static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) { +const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) { PFTy = PFTy->resolve(); if (PFTy->isPointer()) { const TypeInfo* ElemTy = PFTy->getElementType(); @@ -992,15 +1148,15 @@ static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) { return PFTy; } -static const TypeInfo* ResolveUpReference(const TypeInfo* Ty, - TypeInfo::UpRefStack* stack) { +const TypeInfo* ResolveUpReference(const TypeInfo* Ty, + TypeInfo::UpRefStack* stack) { assert(Ty->isUpReference() && "Can't resolve a non-upreference"); unsigned upref = Ty->getUpRefNum(); assert(upref < stack->size() && "Invalid up reference"); return (*stack)[upref - stack->size() - 1]; } -static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) { +const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) { const TypeInfo* Result = PTy = PTy->resolve(); assert(PTy->isPointer() && "GEP Operand is not a pointer?"); TypeInfo::UpRefStack stack; @@ -1024,13 +1180,12 @@ static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) { return Result->getPointerType(); } - // This function handles appending .u or .s to integer value names that // were previously unsigned or signed, respectively. This avoids name // collisions since the unsigned and signed type planes have collapsed // into a single signless type plane. -static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty, - bool isGlobal = false, bool isDef = false) { +std::string getUniqueName(const std::string *Name, const TypeInfo* Ty, + bool isGlobal = false, bool isDef = false) { // If its not a symbolic name, don't modify it, probably a constant val. if ((*Name)[0] != '%' && (*Name)[0] != '"') @@ -1044,10 +1199,10 @@ static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty, Ty = Ty->resolve(); // If its a global name, get its uniquified name, if any - GlobalsTypeMap::iterator GI = Globals.find(*Name); - if (GI != Globals.end()) { - TypePlaneMap::iterator TPI = GI->second.begin(); - TypePlaneMap::iterator TPE = GI->second.end(); + TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name); + if (GI != TypeInfo::Globals.end()) { + TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin(); + TypeInfo::TypePlaneMap::iterator TPE = GI->second.end(); for ( ; TPI != TPE ; ++TPI) { if (TPI->first->sameNewTyAs(Ty)) return TPI->second; @@ -1069,16 +1224,14 @@ static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty, return Result; } -static unsigned UniqueNameCounter = 0; - std::string getGlobalName(const std::string* Name, const std::string Linkage, const TypeInfo* Ty, bool isConstant) { // Default to given name std::string Result = *Name; // Look up the name in the Globals Map - GlobalsTypeMap::iterator GI = Globals.find(*Name); + TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name); // Did we see this global name before? - if (GI != Globals.end()) { + if (GI != TypeInfo::Globals.end()) { if (Ty->isUnresolvedDeep()) { // The Gval's type is unresolved. Consequently, we can't disambiguate it // by type. We'll just change its name and emit a warning. @@ -1089,7 +1242,7 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage, Result += llvm::utostr(UniqueNameCounter); return Result; } else { - TypePlaneMap::iterator TPI = GI->second.find(Ty); + TypeInfo::TypePlaneMap::iterator TPI = GI->second.find(Ty); if (TPI != GI->second.end()) { // We found an existing name of the same old type. This isn't allowed // in LLVM 2.0. Consequently, we must alter the name of the global so it @@ -1104,8 +1257,8 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage, // There isn't an existing definition for this name according to the // old types. Now search the TypePlanMap for types with the same new // name. - TypePlaneMap::iterator TPI = GI->second.begin(); - TypePlaneMap::iterator TPE = GI->second.end(); + TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin(); + TypeInfo::TypePlaneMap::iterator TPE = GI->second.end(); for ( ; TPI != TPE; ++TPI) { if (TPI->first->sameNewTyAs(Ty)) { // The new types are the same but the old types are different so @@ -1145,17 +1298,26 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage, // Its a new global name, if it is external we can't change it if (isConstant || Linkage == "external" || Linkage == "dllimport" || Linkage == "extern_weak" || Linkage == "") { - Globals[Result][Ty] = Result; + TypeInfo::Globals[Result][Ty] = Result; return Result; } // Its a new global name, and it is internal, change the name to make it // unique for its type. // Result = getUniqueName(Name, Ty); - Globals[*Name][Ty] = Result; + TypeInfo::Globals[*Name][Ty] = Result; return Result; } +} // End anonymous namespace + +// This function is used by the Lexer to create a TypeInfo. It can't be +// in the anonymous namespace. +const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy) { + return TypeInfo::get(newTy, oldTy); +} + + /* Enabling traces. */ #ifndef YYDEBUG @@ -1176,17 +1338,17 @@ std::string getGlobalName(const std::string* Name, const std::string Linkage, #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 806 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 968 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" typedef union YYSTYPE { std::string* String; const TypeInfo* Type; - ValueInfo Value; - ConstInfo Const; + ValueInfo* Value; + ConstInfo* Const; ValueList* ValList; TypeList* TypeVec; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1190 "UpgradeParser.tab.c" +#line 1352 "UpgradeParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1198,7 +1360,7 @@ typedef union YYSTYPE { /* Line 219 of yacc.c. */ -#line 1202 "UpgradeParser.tab.c" +#line 1364 "UpgradeParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1553,37 +1715,37 @@ static const short int yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 871, 871, 871, 872, 872, 876, 876, 876, 876, - 876, 876, 876, 877, 877, 877, 877, 878, 878, 878, - 879, 879, 879, 879, 879, 879, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 882, 882, 882, 882, - 882, 882, 883, 883, 883, 883, 884, 884, 884, 884, - 884, 884, 884, 885, 885, 885, 885, 885, 885, 890, - 890, 890, 890, 891, 891, 891, 891, 892, 892, 893, - 893, 896, 899, 904, 904, 904, 904, 904, 904, 905, - 906, 909, 909, 909, 909, 909, 910, 911, 916, 921, - 922, 925, 926, 934, 940, 941, 944, 945, 954, 955, - 968, 968, 969, 969, 970, 974, 974, 974, 974, 974, - 974, 974, 975, 975, 975, 975, 975, 977, 980, 983, - 986, 990, 1003, 1009, 1015, 1025, 1028, 1038, 1041, 1049, - 1053, 1060, 1061, 1066, 1071, 1081, 1087, 1092, 1098, 1104, - 1110, 1115, 1121, 1127, 1134, 1140, 1146, 1152, 1158, 1164, - 1170, 1178, 1192, 1204, 1209, 1215, 1220, 1226, 1231, 1236, - 1244, 1249, 1254, 1264, 1269, 1274, 1274, 1284, 1289, 1292, - 1297, 1301, 1305, 1307, 1307, 1310, 1320, 1325, 1330, 1340, - 1350, 1360, 1370, 1375, 1380, 1385, 1387, 1387, 1390, 1395, - 1402, 1407, 1414, 1421, 1426, 1427, 1435, 1435, 1436, 1436, - 1438, 1447, 1451, 1455, 1458, 1463, 1466, 1469, 1492, 1493, - 1496, 1507, 1508, 1510, 1519, 1520, 1521, 1525, 1525, 1539, - 1540, 1543, 1543, 1543, 1543, 1543, 1543, 1543, 1544, 1545, - 1550, 1551, 1560, 1560, 1564, 1569, 1579, 1588, 1591, 1599, - 1603, 1608, 1611, 1617, 1617, 1619, 1624, 1629, 1634, 1642, - 1650, 1657, 1679, 1684, 1690, 1696, 1704, 1722, 1730, 1739, - 1743, 1750, 1751, 1755, 1760, 1763, 1772, 1780, 1789, 1797, - 1805, 1814, 1842, 1848, 1854, 1861, 1867, 1873, 1879, 1928, - 1933, 1934, 1938, 1939, 1942, 1950, 1959, 1967, 1976, 1982, - 1991, 2000 + 0, 1033, 1033, 1033, 1034, 1034, 1038, 1038, 1038, 1038, + 1038, 1038, 1038, 1039, 1039, 1039, 1039, 1040, 1040, 1040, + 1041, 1041, 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042, + 1042, 1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044, + 1044, 1044, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046, + 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1052, + 1052, 1052, 1052, 1053, 1053, 1053, 1053, 1054, 1054, 1055, + 1055, 1058, 1061, 1066, 1066, 1066, 1066, 1066, 1066, 1067, + 1068, 1071, 1071, 1071, 1071, 1071, 1072, 1073, 1078, 1083, + 1084, 1087, 1088, 1096, 1102, 1103, 1106, 1107, 1116, 1117, + 1130, 1130, 1131, 1131, 1132, 1136, 1136, 1136, 1136, 1136, + 1136, 1136, 1137, 1137, 1137, 1137, 1137, 1139, 1142, 1145, + 1148, 1152, 1165, 1171, 1177, 1187, 1190, 1200, 1203, 1211, + 1215, 1222, 1223, 1228, 1233, 1243, 1250, 1256, 1263, 1270, + 1277, 1283, 1290, 1297, 1305, 1312, 1319, 1326, 1333, 1340, + 1347, 1355, 1369, 1381, 1386, 1392, 1397, 1403, 1408, 1413, + 1421, 1426, 1431, 1441, 1446, 1451, 1451, 1461, 1466, 1469, + 1474, 1478, 1482, 1484, 1484, 1487, 1497, 1502, 1507, 1517, + 1527, 1537, 1547, 1552, 1557, 1562, 1564, 1564, 1567, 1572, + 1579, 1584, 1591, 1598, 1603, 1604, 1612, 1612, 1613, 1613, + 1615, 1624, 1628, 1632, 1635, 1640, 1643, 1646, 1669, 1670, + 1673, 1684, 1685, 1687, 1696, 1697, 1698, 1702, 1702, 1716, + 1717, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1721, 1722, + 1727, 1728, 1737, 1737, 1741, 1747, 1758, 1767, 1770, 1778, + 1782, 1787, 1790, 1796, 1796, 1798, 1803, 1808, 1813, 1821, + 1831, 1840, 1862, 1867, 1873, 1879, 1887, 1905, 1914, 1924, + 1928, 1935, 1936, 1940, 1945, 1948, 1959, 1969, 1980, 1990, + 2000, 2011, 2041, 2050, 2057, 2066, 2073, 2080, 2086, 2137, + 2142, 2143, 2147, 2148, 2151, 2160, 2170, 2179, 2190, 2197, + 2208, 2219 }; #endif @@ -2930,26 +3092,26 @@ yyreduce: switch (yyn) { case 81: -#line 896 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1058 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = (yyvsp[-1].String); ;} break; case 82: -#line 899 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 90: -#line 906 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1068 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 97: -#line 911 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1073 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2958,27 +3120,27 @@ yyreduce: break; case 98: -#line 916 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1078 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(""); ;} break; case 99: -#line 921 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1083 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 100: -#line 922 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1084 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;} break; case 101: -#line 925 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 102: -#line 926 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1088 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, ", "); *(yyvsp[-1].String) += " " + *(yyvsp[0].String); @@ -2988,7 +3150,7 @@ yyreduce: break; case 103: -#line 934 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1096 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -2997,17 +3159,17 @@ yyreduce: break; case 104: -#line 940 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1102 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 106: -#line 944 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1106 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.String) = new std::string(); ;} break; case 107: -#line 945 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1107 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyvsp[-1].String)->insert(0, ", "); if (!(yyvsp[0].String)->empty()) @@ -3018,7 +3180,7 @@ yyreduce: break; case 109: -#line 955 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1117 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); @@ -3027,28 +3189,28 @@ yyreduce: break; case 127: -#line 977 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1139 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy); ;} break; case 128: -#line 980 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy); ;} break; case 129: -#line 983 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.Type) = (yyvsp[0].Type); ;} break; case 130: -#line 986 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Type UpReference (yyvsp[0].String)->insert(0, "\\"); (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy); @@ -3056,7 +3218,7 @@ yyreduce: break; case 131: -#line 990 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1152 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Function derived type? std::string newTy( (yyvsp[-3].Type)->getNewTy() + "("); for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) { @@ -3073,7 +3235,7 @@ yyreduce: break; case 132: -#line 1003 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1165 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Sized array type? uint64_t elems = atoi((yyvsp[-3].String)->c_str()); (yyvsp[-3].String)->insert(0,"[ "); @@ -3083,7 +3245,7 @@ yyreduce: break; case 133: -#line 1009 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1171 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Packed array type? uint64_t elems = atoi((yyvsp[-3].String)->c_str()); (yyvsp[-3].String)->insert(0,"< "); @@ -3093,7 +3255,7 @@ yyreduce: break; case 134: -#line 1015 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1177 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Structure type? std::string newTy("{"); for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) { @@ -3107,14 +3269,14 @@ yyreduce: break; case 135: -#line 1025 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1187 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Empty structure type? (yyval.Type) = TypeInfo::get("{}", StructTy, new TypeList()); ;} break; case 136: -#line 1028 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Packed Structure type? std::string newTy("<{"); for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) { @@ -3128,21 +3290,21 @@ yyreduce: break; case 137: -#line 1038 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1200 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Empty packed structure type? (yyval.Type) = TypeInfo::get("<{}>", PackedStructTy, new TypeList()); ;} break; case 138: -#line 1041 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Pointer type? (yyval.Type) = (yyvsp[-1].Type)->getPointerType(); ;} break; case 139: -#line 1049 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVec) = new TypeList(); (yyval.TypeVec)->push_back((yyvsp[0].Type)); @@ -3150,7 +3312,7 @@ yyreduce: break; case 140: -#line 1053 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1215 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVec) = (yyvsp[-2].TypeVec); (yyval.TypeVec)->push_back((yyvsp[0].Type)); @@ -3158,7 +3320,7 @@ yyreduce: break; case 142: -#line 1061 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1223 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVec) = (yyvsp[-2].TypeVec); (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy)); @@ -3167,7 +3329,7 @@ yyreduce: break; case 143: -#line 1066 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1228 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVec) = new TypeList(); (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy)); @@ -3176,176 +3338,192 @@ yyreduce: break; case 144: -#line 1071 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1233 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { (yyval.TypeVec) = new TypeList(); ;} break; case 145: -#line 1081 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1243 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr - (yyval.Const).type = (yyvsp[-3].Type); - (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy()); - *(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]"; + (yyval.Const) = new ConstInfo; + (yyval.Const)->type = (yyvsp[-3].Type); + (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy()); + *(yyval.Const)->cnst += " [ " + *(yyvsp[-1].String) + " ]"; delete (yyvsp[-1].String); ;} break; case 146: -#line 1087 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1250 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { - (yyval.Const).type = (yyvsp[-2].Type); - (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy()); - *(yyval.Const).cnst += "[ ]"; + (yyval.Const) = new ConstInfo; + (yyval.Const)->type = (yyvsp[-2].Type); + (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy()); + *(yyval.Const)->cnst += "[ ]"; ;} break; case 147: -#line 1092 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1256 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { - (yyval.Const).type = (yyvsp[-2].Type); - (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy()); - *(yyval.Const).cnst += " c" + *(yyvsp[0].String); + (yyval.Const) = new ConstInfo; + (yyval.Const)->type = (yyvsp[-2].Type); + (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy()); + *(yyval.Const)->cnst += " c" + *(yyvsp[0].String); delete (yyvsp[0].String); ;} break; case 148: -#line 1098 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1263 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { // Nonempty unsized arr - (yyval.Const).type = (yyvsp[-3].Type); - (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy()); - *(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >"; + (yyval.Const) = new ConstInfo; + (yyval.Const)->type = (yyvsp[-3].Type); + (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy()); + *(yyval.Const)->cnst += " < " + *(yyvsp[-1].String) + " >"; delete (yyvsp[-1].String); ;} break; case 149: -#line 1104 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1270 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { - (yyval.Const).type = (yyvsp[-3].Type); - (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy()); - *(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }"; + (yyval.Const) = new ConstInfo; + (yyval.Const)->type = (yyvsp[-3].Type); + (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy()); + *(yyval.Const)->cnst += " { " + *(yyvsp[-1].String) + " }"; delete (yyvsp[-1].String); ;} break; case 150: -#line 1110 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1277 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" { - (yyval.Const).type = (yyvsp[-2].Type); - (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy()); - *(yyval.Const).cnst += " {}"; + (yyval.Const) = new ConstInfo; + (yyval.Const)->type = (yyvsp[-2].Type); + (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy()); + *(yyval.Const)->cnst += " {}"; ;} break; case 151: -#line 1115 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y" +#line 1283 "/proj/llvm/llvm-2/tools/llvm-upgrade/Upgr |