diff options
Diffstat (limited to 'lib')
33 files changed, 1368 insertions, 1341 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 2291852..82dee54 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -268,7 +268,7 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) { static bool isNoAliasArgument(const Argument *Arg) { const Function *Func = Arg->getParent(); - const ParamAttrsList *Attr = Func->getFunctionType()->getParamAttrs(); + const ParamAttrsList *Attr = Func->getParamAttrs(); if (Attr) { unsigned Idx = 1; for (Function::const_arg_iterator I = Func->arg_begin(), @@ -839,7 +839,7 @@ BasicAliasAnalysis::getModRefBehavior(Function *F, CallSite CS, return UnknownModRefBehavior; } - const ParamAttrsList *Attrs = F->getFunctionType()->getParamAttrs(); + const ParamAttrsList *Attrs = F->getParamAttrs(); if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ReadNone)) return DoesNotAccessMemory; if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ReadOnly)) diff --git a/lib/AsmParser/llvmAsmParser.cpp.cvs b/lib/AsmParser/llvmAsmParser.cpp.cvs index 4a15348..5907eec 100644 --- a/lib/AsmParser/llvmAsmParser.cpp.cvs +++ b/lib/AsmParser/llvmAsmParser.cpp.cvs @@ -214,8 +214,8 @@ NOALIAS = 395, BYVAL = 396, NEST = 397, - CONST = 398, - PURE = 399, + READNONE = 398, + READONLY = 399, DEFAULT = 400, HIDDEN = 401, PROTECTED = 402 @@ -362,8 +362,8 @@ #define NOALIAS 395 #define BYVAL 396 #define NEST 397 -#define CONST 398 -#define PURE 399 +#define READNONE 398 +#define READONLY 399 #define DEFAULT 400 #define HIDDEN 401 #define PROTECTED 402 @@ -372,7 +372,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -391,9 +391,6 @@ #include <list> #include <map> #include <utility> -#ifndef NDEBUG -#define YYDEBUG 1 -#endif // The following is a gross hack. In order to rid the libAsmParser library of // exceptions, we have to have a way of getting the yyparse function to go into @@ -413,15 +410,6 @@ static bool TriggerError = false; int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit int yylex(); // declaration" of xxx warnings. int yyparse(); - -namespace llvm { - std::string CurFilename; -#if YYDEBUG -static cl::opt<bool> -Debug("debug-yacc", cl::desc("Print yacc debug state changes"), - cl::Hidden, cl::init(false)); -#endif -} using namespace llvm; static Module *ParserResult; @@ -875,7 +863,7 @@ static Value *getVal(const Type *Ty, const ValID &ID) { // Remember where this forward reference came from. FIXME, shouldn't we try // to recycle these things?? CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, - llvmAsmlineno))); + LLLgetLineNo()))); if (inFunctionScope()) InsertValue(V, CurFun.LateResolveValues); @@ -1307,22 +1295,11 @@ static PATypeHolder HandleUpRefs(const Type *ty) { // static Module* RunParser(Module * M); -Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { - set_scan_file(F); - - CurFilename = Filename; - return RunParser(new Module(CurFilename)); -} - -Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { - set_scan_string(AsmString); - - CurFilename = "from_memory"; - if (M == NULL) { - return RunParser(new Module (CurFilename)); - } else { - return RunParser(M); - } +Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { + InitLLLexer(MB); + Module *M = RunParser(new Module(LLLgetFilename())); + FreeLexer(); + return M; } @@ -1347,7 +1324,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 968 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 945 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1394,8 +1371,8 @@ typedef union YYSTYPE llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } -/* Line 193 of yacc.c. */ -#line 1399 "llvmAsmParser.tab.c" +/* Line 187 of yacc.c. */ +#line 1376 "llvmAsmParser.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -1408,7 +1385,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 1412 "llvmAsmParser.tab.c" +#line 1389 "llvmAsmParser.tab.c" #ifdef short # undef short @@ -1458,7 +1435,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -1623,7 +1600,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 43 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1754 +#define YYLAST 1816 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 162 @@ -1632,7 +1609,7 @@ union yyalloc /* YYNRULES -- Number of rules. */ #define YYNRULES 314 /* YYNRULES -- Number of states. */ -#define YYNSTATES 602 +#define YYNSTATES 608 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -1720,10 +1697,10 @@ static const yytype_uint16 yyprhs[] = 690, 692, 694, 696, 700, 702, 708, 710, 712, 714, 716, 718, 720, 723, 726, 729, 733, 736, 737, 739, 742, 745, 749, 759, 769, 778, 793, 795, 797, 804, - 810, 813, 820, 828, 832, 836, 842, 848, 849, 850, - 854, 857, 859, 865, 871, 878, 885, 890, 897, 902, - 907, 914, 921, 924, 933, 935, 937, 938, 942, 949, - 953, 960, 963, 969, 977 + 810, 813, 820, 828, 833, 838, 845, 852, 853, 854, + 858, 861, 863, 869, 875, 882, 889, 894, 901, 906, + 911, 918, 925, 928, 937, 939, 941, 942, 946, 953, + 957, 964, 967, 973, 981 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -1752,7 +1729,7 @@ static const yytype_int16 yyrhs[] = 135, -1, 117, -1, 134, -1, 118, -1, 137, -1, 138, -1, 140, -1, 141, -1, 142, -1, -1, 184, 183, -1, 136, -1, 139, -1, 135, -1, 134, -1, - 144, -1, 143, -1, -1, 186, 185, -1, -1, 53, + 143, -1, 144, -1, -1, 186, 185, -1, -1, 53, 4, -1, -1, 149, 53, 4, -1, 34, 22, -1, -1, 189, -1, -1, 149, 192, 191, -1, 189, -1, 53, 4, -1, 11, -1, 12, -1, 13, -1, 16, @@ -1811,60 +1788,60 @@ static const yytype_int16 yyrhs[] = 17, 229, -1, 71, -1, 72, -1, 235, 168, 227, 149, 17, 229, -1, 168, 227, 149, 17, 229, -1, 172, 241, -1, 194, 154, 229, 149, 229, 156, -1, - 237, 149, 154, 229, 149, 229, 156, -1, 194, 229, - 184, -1, 17, 229, 184, -1, 238, 149, 194, 229, - 184, -1, 238, 149, 17, 229, 184, -1, -1, -1, - 239, 149, 230, -1, 56, 55, -1, 55, -1, 163, - 194, 229, 149, 229, -1, 164, 194, 229, 149, 229, - -1, 88, 166, 194, 229, 149, 229, -1, 89, 167, - 194, 229, 149, 229, -1, 165, 230, 38, 194, -1, - 129, 230, 149, 230, 149, 230, -1, 130, 230, 149, - 194, -1, 131, 230, 149, 230, -1, 132, 230, 149, - 230, 149, 230, -1, 133, 230, 149, 230, 149, 230, - -1, 128, 237, -1, 240, 182, 196, 229, 152, 238, - 153, 186, -1, 243, -1, 36, -1, -1, 110, 194, - 188, -1, 110, 194, 149, 11, 229, 188, -1, 111, - 194, 188, -1, 111, 194, 149, 11, 229, 188, -1, - 112, 230, -1, 242, 113, 194, 229, 188, -1, 242, - 114, 230, 149, 194, 229, 188, -1, 115, 194, 229, - 239, -1 + 237, 149, 154, 229, 149, 229, 156, -1, 194, 184, + 229, 184, -1, 17, 184, 229, 184, -1, 238, 149, + 194, 184, 229, 184, -1, 238, 149, 17, 184, 229, + 184, -1, -1, -1, 239, 149, 230, -1, 56, 55, + -1, 55, -1, 163, 194, 229, 149, 229, -1, 164, + 194, 229, 149, 229, -1, 88, 166, 194, 229, 149, + 229, -1, 89, 167, 194, 229, 149, 229, -1, 165, + 230, 38, 194, -1, 129, 230, 149, 230, 149, 230, + -1, 130, 230, 149, 194, -1, 131, 230, 149, 230, + -1, 132, 230, 149, 230, 149, 230, -1, 133, 230, + 149, 230, 149, 230, -1, 128, 237, -1, 240, 182, + 196, 229, 152, 238, 153, 186, -1, 243, -1, 36, + -1, -1, 110, 194, 188, -1, 110, 194, 149, 11, + 229, 188, -1, 111, 194, 188, -1, 111, 194, 149, + 11, 229, 188, -1, 112, 230, -1, 242, 113, 194, + 229, 188, -1, 242, 114, 230, 149, 194, 229, 188, + -1, 115, 194, 229, 239, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, - 1128, 1129, 1129, 1129, 1129, 1129, 1129, 1130, 1130, 1130, - 1130, 1130, 1130, 1131, 1131, 1131, 1131, 1131, 1131, 1134, - 1134, 1135, 1135, 1136, 1136, 1137, 1137, 1138, 1138, 1142, - 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1147, - 1147, 1148, 1148, 1149, 1150, 1155, 1156, 1156, 1156, 1156, - 1156, 1158, 1158, 1158, 1159, 1159, 1163, 1167, 1172, 1172, - 1174, 1175, 1180, 1186, 1187, 1188, 1189, 1190, 1194, 1195, - 1196, 1200, 1201, 1202, 1203, 1207, 1208, 1209, 1213, 1214, - 1215, 1216, 1217, 1221, 1222, 1223, 1226, 1227, 1228, 1229, - 1230, 1231, 1232, 1239, 1240, 1241, 1242, 1243, 1244, 1245, - 1246, 1247, 1250, 1251, 1256, 1257, 1258, 1259, 1260, 1261, - 1264, 1265, 1272, 1273, 1279, 1280, 1288, 1296, 1297, 1302, - 1303, 1304, 1309, 1322, 1322, 1322, 1322, 1322, 1322, 1322, - 1325, 1329, 1333, 1340, 1345, 1353, 1383, 1414, 1419, 1429, - 1439, 1443, 1453, 1460, 1467, 1474, 1479, 1484, 1491, 1492, - 1499, 1506, 1514, 1520, 1532, 1560, 1576, 1603, 1631, 1657, - 1677, 1703, 1723, 1735, 1742, 1808, 1818, 1828, 1834, 1844, - 1850, 1860, 1865, 1870, 1883, 1895, 1917, 1925, 1931, 1942, - 1947, 1952, 1958, 1964, 1973, 1977, 1985, 1985, 1988, 1988, - 1991, 2003, 2024, 2029, 2037, 2038, 2042, 2042, 2046, 2046, - 2049, 2052, 2076, 2087, 2087, 2098, 2097, 2107, 2106, 2117, - 2157, 2160, 2166, 2176, 2180, 2185, 2187, 2192, 2197, 2206, - 2216, 2227, 2231, 2240, 2249, 2254, 2375, 2375, 2377, 2386, - 2386, 2388, 2393, 2405, 2409, 2414, 2418, 2422, 2426, 2430, - 2434, 2438, 2442, 2446, 2471, 2475, 2485, 2489, 2493, 2498, - 2505, 2505, 2511, 2520, 2524, 2533, 2542, 2551, 2555, 2562, - 2566, 2570, 2575, 2585, 2604, 2613, 2693, 2697, 2704, 2715, - 2728, 2738, 2749, 2759, 2768, 2774, 2783, 2789, 2792, 2793, - 2800, 2804, 2809, 2825, 2842, 2856, 2870, 2882, 2890, 2897, - 2903, 2909, 2915, 2930, 3015, 3020, 3024, 3031, 3038, 3046, - 3053, 3061, 3069, 3083, 3100 + 0, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, + 1105, 1106, 1106, 1106, 1106, 1106, 1106, 1107, 1107, 1107, + 1107, 1107, 1107, 1108, 1108, 1108, 1108, 1108, 1108, 1111, + 1111, 1112, 1112, 1113, 1113, 1114, 1114, 1115, 1115, 1119, + 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1124, + 1124, 1125, 1125, 1126, 1127, 1132, 1133, 1133, 1133, 1133, + 1133, 1135, 1135, 1135, 1136, 1136, 1140, 1144, 1149, 1149, + 1151, 1152, 1157, 1163, 1164, 1165, 1166, 1167, 1171, 1172, + 1173, 1177, 1178, 1179, 1180, 1184, 1185, 1186, 1190, 1191, + 1192, 1193, 1194, 1198, 1199, 1200, 1203, 1204, 1205, 1206, + 1207, 1208, 1209, 1216, 1217, 1218, 1219, 1220, 1221, 1222, + 1223, 1224, 1227, 1228, 1233, 1234, 1235, 1236, 1237, 1238, + 1241, 1242, 1249, 1250, 1256, 1257, 1265, 1273, 1274, 1279, + 1280, 1281, 1286, 1299, 1299, 1299, 1299, 1299, 1299, 1299, + 1302, 1306, 1310, 1317, 1322, 1330, 1348, 1366, 1371, 1381, + 1391, 1395, 1405, 1412, 1421, 1428, 1433, 1438, 1445, 1446, + 1453, 1460, 1468, 1474, 1486, 1514, 1530, 1557, 1585, 1611, + 1631, 1657, 1677, 1689, 1696, 1762, 1772, 1782, 1788, 1798, + 1804, 1814, 1819, 1824, 1837, 1849, 1871, 1879, 1885, 1896, + 1901, 1906, 1912, 1918, 1927, 1931, 1939, 1939, 1942, 1942, + 1945, 1957, 1978, 1983, 1991, 1992, 1996, 1996, 2000, 2000, + 2003, 2006, 2030, 2041, 2041, 2052, 2051, 2061, 2060, 2071, + 2111, 2114, 2120, 2130, 2134, 2139, 2141, 2146, 2151, 2160, + 2170, 2181, 2185, 2194, 2203, 2208, 2338, 2338, 2340, 2349, + 2349, 2351, 2356, 2368, 2372, 2377, 2381, 2385, 2389, 2393, + 2397, 2401, 2405, 2409, 2434, 2438, 2448, 2452, 2456, 2461, + 2468, 2468, 2474, 2483, 2487, 2496, 2505, 2514, 2518, 2525, + 2529, 2533, 2538, 2548, 2567, 2576, 2660, 2664, 2671, 2682, + 2695, 2705, 2716, 2726, 2737, 2745, 2755, 2762, 2765, 2766, + 2773, 2777, 2782, 2798, 2815, 2829, 2843, 2855, 2863, 2870, + 2876, 2882, 2888, 2903, 2994, 2999, 3003, 3010, 3017, 3025, + 3032, 3040, 3048, 3062, 3079 }; #endif @@ -1894,27 +1871,28 @@ static const char *const yytname[] = "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN", - "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "CONST", "PURE", - "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'", "'\\\\'", "'('", - "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", - "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", "FPredicates", - "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign", - "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", - "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", - "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", - "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", - "SectionString", "OptSection", "GlobalVarAttributes", - "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", - "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", - "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", - "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", - "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", - "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", - "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", - "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", - "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", - "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal", - "OptVolatile", "MemoryInst", 0 + "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", + "READONLY", "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'", + "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", + "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps", + "IPredicates", "FPredicates", "IntType", "FPType", "LocalName", + "OptLocalName", "OptLocalAssign", "GlobalName", "OptGlobalAssign", + "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage", + "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", + "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs", + "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", + "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", + "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", + "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", + "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition", + "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition", + "LibrariesDefinition", "LibList", "ArgListH", "ArgList", + "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function", + "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", + "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock", + "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", + "ParamList", "IndexList", "OptTailCall", "InstVal", "OptVolatile", + "MemoryInst", 0 }; #endif @@ -2011,7 +1989,7 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, 6, 5, - 2, 6, 7, 3, 3, 5, 5, 0, 0, 3, + 2, 6, 7, 4, 4, 6, 6, 0, 0, 3, 2, 1, 5, 5, 6, 6, 4, 6, 4, 4, 6, 6, 2, 8, 1, 1, 0, 3, 6, 3, 6, 2, 5, 7, 4 @@ -2062,7 +2040,7 @@ static const yytype_uint16 yydefact[] = 254, 261, 260, 262, 0, 271, 0, 0, 0, 0, 0, 307, 0, 309, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 116, - 114, 115, 119, 118, 121, 216, 218, 0, 0, 0, + 114, 115, 118, 119, 121, 216, 218, 0, 0, 0, 288, 0, 0, 0, 0, 0, 164, 150, 162, 0, 167, 168, 0, 0, 0, 0, 0, 131, 129, 233, 112, 231, 0, 244, 0, 0, 0, 0, 0, 0, @@ -2074,15 +2052,15 @@ static const yytype_uint16 yydefact[] = 0, 0, 0, 0, 292, 293, 287, 0, 312, 0, 201, 0, 0, 185, 0, 0, 0, 0, 170, 0, 0, 0, 64, 230, 232, 112, 127, 0, 0, 0, - 139, 0, 0, 294, 295, 308, 310, 289, 0, 0, + 112, 112, 0, 294, 295, 308, 310, 289, 0, 0, 297, 300, 301, 0, 124, 0, 0, 0, 191, 0, 0, 187, 188, 184, 65, 128, 122, 255, 0, 0, - 112, 112, 0, 120, 281, 0, 120, 313, 189, 190, + 0, 0, 0, 120, 281, 0, 120, 313, 189, 190, 0, 0, 0, 229, 0, 235, 0, 274, 0, 0, - 284, 283, 139, 0, 0, 282, 303, 186, 192, 193, - 123, 272, 0, 273, 0, 112, 112, 0, 0, 0, - 286, 285, 0, 0, 0, 0, 279, 0, 0, 278, - 0, 275 + 104, 106, 112, 112, 112, 112, 0, 282, 303, 186, + 192, 193, 123, 272, 0, 273, 0, 284, 283, 0, + 0, 0, 0, 0, 112, 112, 0, 0, 0, 286, + 285, 0, 279, 0, 0, 278, 0, 275 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -2101,84 +2079,84 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -549 +#define YYPACT_NINF -546 static const yytype_int16 yypact[] = { - 322, -549, -549, -549, -549, -549, -549, -549, -18, -120, - 6, -117, 62, -60, 224, -549, 111, 464, -549, 103, - 184, -12, -7, -549, 21, 133, -549, 1309, -549, -549, - -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, - 140, 140, 211, -549, -549, -549, -549, 140, -549, -549, - -549, -549, -549, 140, 139, -549, -14, 157, 174, 182, - -549, -549, -549, -549, -549, 60, -549, -549, -549, -549, - -549, -549, -549, -549, 215, 233, 2, 526, -549, -549, - -549, 150, -549, 178, 178, 269, -549, 14, 274, 274, - -549, -549, 134, -549, -549, -549, -549, -549, -549, -549, - -23, 54, -549, 97, 105, 993, 60, -549, 150, -125, - -549, 54, 14, 14, -549, -549, 1093, -549, -549, 1340, - 260, -549, -549, -549, -549, -549, 1358, -549, -17, 1584, - -549, 251, -549, -549, 150, -549, 128, 146, 1380, 1380, - 145, -106, 1380, -549, 151, 1340, 1380, 60, 155, 150, - 231, -549, 101, 303, 305, 308, 312, 315, 229, 320, - 808, -549, -549, 187, -549, -549, -549, -549, -549, 275, - 1423, 85, 321, 274, -549, -549, -549, -549, -549, -549, - -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, - -549, 461, 481, 1380, 1380, 1380, 1380, -549, -549, -549, - -549, -549, -549, -549, -549, -549, -549, -549, -549, 1380, - 1380, 1380, 1380, 1380, 1380, 1380, 1380, 1380, -549, 274, - -549, 110, -549, -549, -85, 1116, -549, -2, -33, -549, - 173, 150, -549, -549, 150, 1093, -549, -549, -549, -549, - -549, -549, -549, -549, -549, -549, -549, 461, 481, 191, - 198, 199, 203, 204, 1156, 1534, 1033, 335, 206, 207, - 208, -549, -549, 217, 223, -549, 60, 649, -549, 785, - 785, -549, 785, 1358, -549, -549, -549, -549, -549, -549, - -549, -549, -549, -549, 1380, -549, -549, -549, -549, -549, - -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, - -549, 1380, 107, 113, -549, 649, 26, 218, 236, 237, - 238, 239, 240, 649, 649, 340, 1358, 1380, 1380, -549, - -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, - -549, 162, -549, -549, -549, 162, 217, 217, 344, 242, - 243, 1340, 1340, 1340, 1340, 1340, -549, -549, -9, 1073, - -50, -549, -63, -549, 1340, 1340, 1340, -11, -549, 1187, - -549, -549, -549, -549, -549, -549, -549, -549, 333, 1340, - -549, -549, -549, -549, 247, -549, 248, 785, 649, 649, - 7, -549, 34, -549, -549, 785, 244, 1380, 1380, 1380, - 1380, 1380, 256, 257, 1380, 785, 649, 258, -549, -549, - -549, -549, -549, -549, -549, -549, -549, 1380, 1340, 1340, - -549, 261, 264, 267, 268, 1340, -549, 263, 808, -51, - -549, -549, 270, 273, 362, 396, 419, -549, 217, -549, - 150, 276, 271, -549, 405, -48, 411, 412, 280, 284, - 287, 785, 433, 785, 289, 290, 785, 293, 150, -549, - 294, 295, 785, 785, 150, 296, 297, 1380, 90, 298, - 300, 13, 1340, 1340, 1340, 1340, -549, -549, 299, 1340, - 1340, 1380, -549, -549, -549, -3, 1269, -549, 304, -549, - 785, 785, 1577, 785, 785, 297, -549, 297, 1380, 785, - 306, 1380, 1380, 1380, -549, -549, 1577, 401, -549, 649, - -549, 1340, 1340, -549, 309, 310, 319, 323, -549, 316, - 318, 126, -549, -549, -549, 150, 38, 437, 324, 307, - 785, 649, 44, -549, -549, -549, -549, -549, 325, 785, - -549, -549, -549, 53, 297, 327, 332, 1340, -549, 1340, - 1340, -549, -549, -549, -3, -549, 421, -549, 460, 1, - -549, -549, 1595, -549, -549, 334, -549, -549, -549, -549, - 336, 338, 339, -549, 489, -549, 785, -549, 945, 3, - -85, -85, 785, 649, 86, -549, 162, -549, -549, -549, - -549, -549, 347, -549, 945, -549, -549, 484, 485, 356, - -85, -85, 785, 785, 492, 439, -549, 785, 494, -549, - 785, -549 + 47, -546, -546, -546, -546, -546, -546, -546, -17, -95, + 52, -90, 86, 14, 183, -546, 135, 1758, -546, -10, + 64, 18, 33, -546, 5, 180, -546, 1341, -546, -546, + -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, + 76, 76, 59, -546, -546, -546, -546, 76, -546, -546, + -546, -546, -546, 76, 193, -546, 13, 202, 224, 233, + -546, -546, -546, -546, -546, 111, -546, -546, -546, -546, + -546, -546, -546, -546, 260, 261, 1, 378, -546, -546, + -546, -7, -546, 231, 231, 150, -546, 55, 309, 309, + -546, -546, 100, -546, -546, -546, -546, -546, -546, -546, + -99, 1088, -546, 116, 122, 988, 111, -546, -7, -106, + -546, 1088, 55, 55, -546, -546, 1142, -546, -546, 1359, + 274, -546, -546, -546, -546, -546, 1414, -546, -18, 1624, + -546, 257, -546, -546, -7, -546, 131, 128, 1454, 1454, + 129, -105, 1454, -546, 136, 1359, 1454, 111, 141, -7, + 237, -546, 214, 279, 285, 289, 291, 294, 145, 299, + 803, -546, -546, 103, -546, -546, -546, -546, -546, 254, + 1512, 57, 301, 309, -546, -546, -546, -546, -546, -546, + -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, + -546, 596, 646, 1454, 1454, 1454, 1454, -546, -546, -546, + -546, -546, -546, -546, -546, -546, -546, -546, -546, 1454, + 1454, 1454, 1454, 1454, 1454, 1454, 1454, 1454, -546, 309, + -546, 61, -546, -546, 132, 1182, -546, -57, -69, -546, + 155, -7, -546, -546, -7, 1142, -546, -546, -546, -546, + -546, -546, -546, -546, -546, -546, -546, 596, 646, 162, + 163, 164, 166, 167, 1242, 1530, 1028, 303, 169, 174, + 179, -546, -546, 185, 191, -546, 111, 644, -546, 780, + 780, -546, 780, 1414, -546, -546, -546, -546, -546, -546, + -546, -546, -546, -546, 1454, -546, -546, -546, -546, -546, + -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, + -546, 1454, 30, 48, -546, 644, -21, 197, 199, 203, + 204, 205, 206, 644, 644, 313, 1414, 1454, 1454, -546, + -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, + -546, 201, -546, -546, -546, 201, 185, 185, 320, 207, + 208, 1359, 1359, 1359, 1359, 1359, -546, -546, -65, 1068, + -86, -546, -104, -546, 1359, 1359, 1359, -20, -546, 1261, + -546, -546, -546, -546, -546, -546, -546, -546, 273, 1359, + -546, -546, -546, -546, 217, -546, 218, 780, 644, 644, + 8, -546, 11, -546, -546, 780, 221, 1454, 1454, 1454, + 1454, 1454, 227, 234, 1454, 780, 644, 235, -546, -546, + -546, -546, -546, -546, -546, -546, -546, 1454, 1359, 1359, + -546, 247, 258, 263, 265, 1359, -546, 259, 803, -101, + -546, -546, 269, 270, 344, 398, 419, -546, 185, -546, + -7, 276, 275, -546, 404, -76, 412, 413, 282, 288, + 292, 780, 440, 780, 297, 300, 780, 302, -7, -546, + 304, 308, 780, 780, -7, 306, 310, 1454, -35, 311, + 314, -73, 1359, 1359, 1359, 1359, -546, -546, 315, 1359, + 1359, 1454, -546, -546, -546, 298, 1301, -546, 319, -546, + 780, 780, 1570, 780, 780, 310, -546, 310, 1454, 780, + 322, 1454, 1454, 1454, -546, -546, 1570, 399, -546, 644, + -546, 1359, 1359, -546, 323, 316, 325, 327, -546, 324, + 326, 60, -546, -546, -546, -7, 3, 460, 334, 330, + 82, -7, -13, -546, -546, -546, -546, -546, 332, 780, + -546, -546, -546, 12, 310, 336, 337, 1359, -546, 1359, + 1359, -546, -546, -546, 298, -546, 438, -546, 475, -4, + 493, 493, 1610, -546, -546, 338, -546, -546, -546, -546, + 342, 345, 346, -546, 501, -546, 780, -546, 940, 2, + 354, 355, -546, -546, 82, -7, 72, -546, 201, -546, + -546, -546, -546, -546, 359, -546, 940, 132, 132, 493, + 493, 492, 494, 361, -546, -546, 780, 780, 497, 132, + 132, 450, -546, 780, 505, -546, 780, -546 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -549, 383, 384, 385, 272, 277, -170, -549, 0, -24, - 429, 8, -549, -549, -549, -549, 42, -549, -549, -549, - -160, -549, -421, -549, -228, -549, -293, 11, -549, -310, - -549, -549, -26, 341, -121, -549, 418, 425, -61, -157, - -226, 9, 205, 326, -549, -549, 515, -549, -549, -549, - -549, -549, -549, -549, -549, -549, -549, -549, 446, -549, - -549, -549, -549, -549, -549, -548, -69, 121, -173, -549, - 491, -549, -549, -549, -549, -549, 67, 158, -549, -549, - -549, -549 + -546, 394, 395, 396, 280, 283, -170, -546, 0, -16, + 444, 15, -546, -546, -546, -546, -1, -546, -546, -546, + -157, -546, -418, -546, -229, -546, -292, 23, -546, -307, + -546, -546, -26, 305, -120, -546, 429, 436, -59, -156, + -235, 126, 168, 307, -546, -546, 526, -546, -546, -546, + -546, -546, -546, -546, -546, -546, -546, -546, 456, -546, + -546, -546, -546, -546, -546, -545, -142, 108, -186, -546, + 490, -546, -546, -546, -546, -546, 51, 138, -546, -546, + -546, -546 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -2188,362 +2166,374 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -204 static const yytype_int16 yytable[] = { - 11, 81, 272, 261, 335, 163, 104, 90, 13, 475, - 383, 164, 271, 273, 271, 93, 1, 11, 441, 3, - 582, 5, 304, 425, 142, 13, 405, 406, 24, 350, - 352, 26, 319, 320, 21, 143, 589, 308, 309, 310, - 311, 312, 426, 142, 315, 443, 117, 118, 22, 321, - 322, 108, 323, 324, 230, 325, 326, 327, 161, 316, - 442, 63, 64, 25, 106, 66, 67, 68, 69, 70, - 71, 72, 425, 1, 2, 134, 3, 4, 5, 108, - 27, 236, 83, 84, 233, 134, 415, 442, 28, 88, - 149, 262, 11, 133, 544, 89, 269, 421, 415, 415, - 149, 415, 270, 73, -55, -55, -55, -55, 420, 468, - 479, 43, 227, 228, 319, 320, 231, 110, 474, 111, - 234, 145, 146, 419, 587, 333, 131, 237, 238, 570, - 571, 321, 322, 132, 323, 324, 57, 325, 326, 327, - 415, 58, 165, 435, 267, 397, 94, 416, 110, 45, - 111, 46, 377, 1, 332, 61, 3, 567, 5, 583, - 90, 105, 488, 498, 590, 591, 503, 302, 303, 267, - 305, 264, 398, 399, 400, 59, 110, 401, 111, 97, - 385, 402, 403, 306, 267, 267, 267, 267, 267, 313, - 314, 267, 525, 552, 526, 395, 98, 553, 372, 134, - 372, 372, 552, 372, 99, 74, 556, 2, 75, 149, - 4, 76, 101, 77, 447, 86, 449, 450, 451, 102, - 398, 399, 400, 317, 318, 401, 49, 50, 51, 402, - 403, 52, 239, 240, 241, 242, 372, 103, 63, 64, - 110, 557, 111, 500, 372, 372, 85, 149, 86, 516, - 1, 2, 138, 3, 4, 5, 380, 110, 378, 111, - 139, 261, 382, 110, 162, 111, 29, 30, 31, 32, - 33, 34, 35, 223, 36, 379, 110, 225, 111, 543, - 410, 411, 412, 413, 414, 37, 38, 39, 112, 113, - 149, 396, 267, 422, 423, 424, 398, 399, 400, 226, - 110, 401, 111, 229, 232, 402, 403, 235, 372, 372, - 372, 114, -56, 115, -57, 527, 372, -60, 530, 531, - 532, -59, -203, 418, -58, 574, 372, 372, 576, 243, - 265, 334, 271, 430, 120, 121, 122, 123, 124, 125, - -67, 1, 2, 341, 3, 4, 5, 459, 460, 262, - 342, 343, 6, 7, 466, 344, 345, 353, 354, 355, - 356, 267, 448, 267, 267, 267, 357, 386, 454, 37, - 38, 39, 372, 8, 372, 359, 9, 372, 394, 568, - 10, 458, 407, 372, 372, 387, 388, 389, 390, 391, - 374, 375, 433, 376, 408, 409, 436, 437, 446, 584, - 471, 504, 505, 506, 507, 452, 453, 457, 509, 510, - 462, 372, 372, 463, 372, 372, 464, 465, 472, 469, - 372, 467, 470, 473, 477, 476, 384, 478, 480, 481, - 372, 499, 482, 483, 392, 393, 484, 486, 488, 489, - 535, 536, 491, 492, 493, 511, 497, 501, 496, 502, - 515, 372, 372, 517, 442, 529, 521, 508, 537, 547, - 372, 549, 267, 538, -202, 267, 267, 267, 539, 541, - 521, 542, 540, 548, 564, 512, 560, 566, 561, 562, - 558, 554, -67, 1, 2, 559, 3, 4, 5, 577, - 575, 578, 579, 580, 6, 7, 588, 372, 438, 439, - 440, 592, 593, 372, 372, 594, 445, 285, 286, 597, - 598, 600, 215, 216, 217, 8, 455, 456, 9, 339, - 563, 129, 10, 372, 372, 340, 573, 545, 372, 144, - 141, 372, 44, 63, 64, 128, 106, 66, 67, 68, - 69, 70, 71, 72, 512, 1, 2, 96, 3, 4, - 5, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 338, 485, 533, 487, 0, 330, 490, 461, 0, - 0, 0, 0, 494, 495, 73, 0, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 518, 519, 0, 523, 524, 0, 0, 0, 0, - 528, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 534, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 550, 551, 0, 0, 0, 0, 0, 0, 0, - 555, 0, 360, 361, 0, 0, 63, 64, 362, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, - 0, 3, 4, 5, 363, 364, 365, 74, 0, 0, - 75, 0, 0, 76, 0, 77, 107, 581, 0, 366, - 367, 0, 0, 585, 586, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 368, 0, 0, 0, - 0, 0, 0, 595, 596, 0, 0, 0, 599, 0, - 0, 601, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 247, 248, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 249, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 0, 250, 0, - 251, 252, 253, 0, 0, 0, 0, 0, 360, 361, - 0, 0, 63, 64, 362, 0, 0, 0, 0, 110, - 0, 111, 0, 0, 1, 2, 369, 3, 4, 5, - 363, 364, 365, 0, 0, 63, 64, 0, 0, 0, - 0, 0, 0, 0, 0, 366, 367, 1, 2, 0, - 3, 4, 5, 244, 0, 0, 0, 0, 0, 0, - 0, 0, 368, 0, 0, 0, 0, 0, 245, 246, - 0, 0, 0, 0, 0, 0, 0, 0, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 247, 248, 0, 0, 0, 0, 0, - 0, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 247, 248, 0, 0, - 249, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 0, 250, 0, 251, 252, 253, 0, - 0, 0, 0, 249, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 0, 250, 0, 251, - 252, 253, 369, 0, 0, 0, 0, 0, 360, 361, - 0, 0, 0, 0, 362, 0, 0, 0, 110, 0, - 111, 0, 254, 0, 0, 255, 0, 256, 0, 257, - 363, 364, 365, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 366, 367, 0, 0, 0, + 11, 81, 272, 335, 261, 104, 163, 271, 236, 304, + 164, 383, 475, 271, 425, 13, 273, 11, 262, 441, + 350, 352, 443, 584, 308, 309, 310, 311, 312, 405, + 406, 315, 13, 426, 90, 21, 45, 425, 46, 83, + 84, 593, 93, 142, 142, 415, 88, -203, 415, 22, + 131, 108, 89, 24, 143, 230, 421, 132, 26, 468, + 161, 442, 316, 415, 442, -67, 1, 2, 269, 3, + 4, 5, 420, 415, 270, 134, 488, 6, 7, 108, + 503, 110, 479, 111, 415, 134, 233, 117, 118, 333, + 149, 416, 11, 110, 85, 111, 86, 544, 8, 332, + 149, 9, 550, 551, 27, 10, 49, 50, 51, 25, + 591, 52, 227, 228, 419, 110, 231, 111, 500, 1, + 234, 474, 3, 2, 5, 372, 4, 372, 372, 110, + 372, 111, 397, 385, 435, 43, 552, 398, 399, 400, + 553, 165, 401, 110, 267, 111, 402, 403, 239, 240, + 241, 242, 567, 377, 587, 588, 589, 590, 585, 59, + 105, 552, 28, 372, 498, 556, 57, 302, 303, 267, + 305, 372, 372, 94, 317, 318, 599, 600, 264, 380, + 110, 58, 111, 306, 267, 267, 267, 267, 267, 313, + 314, 267, 114, 525, 115, 526, 395, 382, 110, 134, + 111, 447, 61, 449, 450, 451, 398, 399, 400, 149, + 110, 401, 111, 543, 90, 402, 403, -55, -55, -55, + -55, 37, 38, 39, 97, 29, 30, 31, 32, 33, + 34, 35, -139, 36, -139, 372, 372, 372, 145, 146, + 237, 238, 557, 372, 63, 64, 98, 149, 516, 319, + 320, 112, 113, 372, 372, 99, 1, 2, 378, 3, + 4, 5, 261, 101, 102, 103, 321, 322, 86, 323, + 324, 138, 325, 326, 327, 379, 262, 139, 162, 223, + 225, 226, 410, 411, 412, 413, 414, 229, -56, 232, + 149, 396, 267, 235, -57, 422, 423, 424, -60, 372, + -59, 372, 527, -58, 372, 530, 531, 532, 243, 265, + 372, 372, 271, 334, 341, 342, 343, 1, 344, 345, + 3, 354, 5, 418, 576, 353, 355, 578, 37, 38, + 39, 356, 433, 430, 357, 398, 399, 400, 372, 372, + 401, 372, 372, 359, 402, 403, 386, 372, 387, 459, + 460, 394, 388, 389, 390, 391, 466, 372, 407, 408, + 409, 267, 448, 267, 267, 267, 436, 437, 454, 120, + 121, 122, 123, 124, 125, 446, 452, 374, 375, 568, + 376, 458, 471, 453, 457, 63, 64, 372, 106, 66, + 67, 68, 69, 70, 71, 72, 462, 1, 2, 586, + 3, 4, 5, 504, 505, 506, 507, 463, 372, 372, + 509, 510, 464, 384, 465, 319, 320, 467, 469, 470, + 472, 392, 393, 473, 372, 476, 478, 73, 477, 480, + 481, 499, 321, 322, 482, 323, 324, 483, 325, 326, + 327, 484, 535, 536, 486, 511, 488, 372, 372, 489, + 515, 491, 442, 492, 372, 372, 521, 493, 496, 497, + 501, 372, 267, 502, 372, 267, 267, 267, 517, 538, + 521, 529, 537, 508, 539, 512, 540, 541, 560, 542, + 561, 562, 547, 548, 549, 438, 439, 440, 554, 558, + 559, 564, 566, 445, 577, 579, 360, 361, 580, 581, + 63, 64, 362, 455, 456, 582, -18, -19, 592, 596, + 598, 597, 1, 2, 603, 3, 4, 5, 363, 364, + 365, 604, 606, 215, 216, 217, 575, 339, 563, 74, + 330, 340, 75, 366, 367, 76, 129, 77, 107, 545, + 144, 141, 338, 44, 512, 128, 96, 533, 461, 485, + 368, 487, 0, 0, 490, 0, 0, 0, 0, 0, + 494, 495, 0, 0, 0, 0, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 247, 248, 0, 0, 0, 0, 0, 518, 519, + 0, 523, 524, 0, 0, 0, 0, 528, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 534, 249, 197, + 570, 571, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 0, 250, 0, 251, 252, 253, 321, 322, 0, + 323, 324, 0, 325, 326, 327, 0, 555, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 360, 361, 0, + 369, 63, 64, 362, 0, 0, 0, 0, 572, 573, + 0, 0, 0, 1, 2, 0, 3, 4, 5, 363, + 364, 365, 285, 286, 583, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 366, 367, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 0, 594, 595, 0, + 0, 368, 0, 0, 601, 602, 0, 0, 0, 0, + 0, 605, 0, 0, 607, 0, 0, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 247, 248, 0, 0, 0, 0, 0, 0, + 0, 0, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 0, 0, 0, 249, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 0, 250, 0, 251, 252, 253, 0, 0, + 0, 0, 0, 360, 361, 0, 0, 63, 64, 362, + 0, 0, 0, 0, 110, 0, 111, 0, 0, 1, + 2, 369, 3, 4, 5, 363, 364, 365, 0, 0, + 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, + 366, 367, 1, 2, 0, 3, 4, 5, 244, 0, + 0, 0, 0, 0, 0, 0, 0, 368, 0, 0, + 0, 0, 0, 245, 246, 0, 0, 0, 0, 0, + 0, 0, 0, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 247, 248, + 0, 0, 0, 0, 0, 0, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 247, 248, 0, 0, 249, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 0, 250, + 0, 251, 252, 253, 0, 0, 0, 0, 249, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 0, 250, 0, 251, 252, 253, 369, 0, 0, + 0, 0, 0, 360, 361, 0, 0, 0, 0, 362, + 0, 0, 0, 110, 0, 111, 0, 254, 0, 0, + 255, 0, 256, 0, 257, 363, 364, 365, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 63, 64, 368, 106, 66, 67, 68, 69, 70, 71, - 72, 0, 1, 2, 0, 3, 4, 5, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 247, 248, 0, 0, 0, 0, 0, - 63, 64, 73, 106, 152, 153, 154, 155, 156, 157, - 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, - 249, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 0, 250, 0, 251, 252, 253, 0, - 63, 64, 73, 106, 152, 153, 154, 155, 156, 157, - 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, - 63, 64, 369, 147, 66, 67, 68, 69, 70, 71, - 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, - 0, 0, 73, 63, 64, 0, 106, 66, 67, 68, - 69, 70, 71, 72, 0, 1, 2, 0, 3, 4, - 5, 0, 73, 0, 74, 0, 0, 75, 0, 0, - 76, 0, 77, 140, 0, 329, 0, 0, 0, 0, - 0, 0, 0, 63, 64, 73, 106, 152, 153, 154, - 155, 156, 157, 72, 0, 1, 2, 0, 3, 4, - 5, 0, 0, 0, 74, 0, 0, 75, 0, 0, - 76, 0, 77, 351, 63, 64, 0, 106, 66, 67, - 68, 69, 70, 71, 72, 73, 1, 2, 0, 3, - 4, 5, 0, 0, 148, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 0, 429, 75, 0, 0, - 76, 0, 77, 417, 0, 0, 73, 0, 0, 0, - 0, 0, 0, 0, 74, 0, 0, 75, 0, 0, - 76, 0, 77, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, - 75, 0, 0, 76, 0, 77, 63, 64, 0, 106, - 66, 67, 68, 69, 70, 71, 72, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 74, 514, 0, - 75, 0, 346, 76, 0, 77, 63, 64, 73, 65, - 66, 67, 68, 69, 70, 71, 72, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 74, 0, - 0, 75, 0, 0, 76, 0, 77, 63, 64, 0, - 106, 152, 153, 154, 155, 156, 157, 72, 73, 1, - 2, 0, 3, 4, 5, 63, 64, 0, 147, 66, + 366, 367, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 63, 64, 368, 106, 66, 67, 68, 69, 70, 71, 72, 0, 1, 2, 0, - 3, 4, 5, 0, 0, 0, 0, 63, 64, 73, - 106, 66, 67, 68, 69, 70, 71, 72, 0, 1, - 2, 0, 3, 4, 5, 0, 0, 73, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 0, 0, 75, 0, 0, 76, 0, 77, 73, - 63, 64, 0, 266, 66, 67, 68, 69, 70, 71, - 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 0, 0, 75, 0, 0, 76, 0, 77, 0, - 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 0, 0, 75, 0, 0, 76, 0, 77, + 3, 4, 5, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 247, 248, + 0, 0, 0, 0, 0, 63, 64, 73, 106, 152, + 153, 154, 155, 156, 157, 72, 0, 1, 2, 0, + 3, 4, 5, 0, 0, 249, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 0, 250, + 0, 251, 252, 253, 0, 63, 64, 73, 106, 152, + 153, 154, 155, 156, 157, 72, 0, 1, 2, 0, + 3, 4, 5, 0, 0, 63, 64, 369, 106, 66, + 67, 68, 69, 70, 71, 72, 0, 1, 2, 0, + 3, 4, 5, 0, 0, 0, 0, 73, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 73, 0, 74, + 0, 0, 75, 0, 0, 76, 0, 77, 140, 63, + 64, 0, 147, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, - 0, 0, 75, 0, 0, 76, 0, 77, 0, 0, + 0, 0, 75, 0, 0, 76, 0, 77, 351, 63, + 64, 73, 106, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 0, 329, 75, 0, 0, 76, 0, 77, 417, 0, + 0, 73, 0, 0, 0, 0, 0, 0, 0, 74, + 0, 0, 75, 0, 0, 76, 0, 77, 0, 63, + 64, 0, 106, 152, 153, 154, 155, 156, 157, 72, + 0, 1, 2, 148, 3, 4, 5, 0, 63, 64, + 0, 106, 66, 67, 68, 69, 70, 71, 72, 0, + 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, + 0, 73, 0, 74, 0, 0, 75, 0, 0, 76, + 429, 77, 0, 0, 0, 0, 0, 0, 63, 64, + 73, 106, 66, 67, 68, 69, 70, 71, 72, 0, + 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, + 0, 0, 0, 74, 0, 0, 75, 0, 0, 76, + 514, 77, 0, 0, 0, 0, 0, 0, 63, 64, + 73, 65, 66, 67, 68, 69, 70, 71, 72, 0, + 1, 2, 0, 3, 4, 5, 63, 64, 0, 106, + 152, 153, 154, 155, 156, 157, 72, 0, 1, 2, + 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, + 73, 0, 0, 74, 0, 0, 75, 0, 346, 76, + 0, 77, 0, 0, 0, 0, 0, 0, 73, 0, + 0, 0, 74, 0, 0, 75, 0, 0, 76, 0, + 77, 63, 64, 0, 147, 66, 67, 68, 69, 70, + 71, 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 0, 0, 75, 0, 0, 76, 0, 77, - 0, 63, 64, 0, 106, 152, 153, 154, 155, 156, - 157, 72, 0, 1, 2, 0, 3, 4, 5, 0, + 0, 0, 74, 0, 0, 75, 0, 0, 76, 0, + 77, 63, 64, 73, 106, 66, 67, 68, 69, 70, + 71, 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 0, 0, 75, 0, 0, - 76, 0, 77, 73, 63, 64, 0, 106, 66, 67, - 68, 69, 70, 71, 520, 0, 1, 2, 0, 3, - 4, 5, 63, 64, 0, 106, 66, 67, 68, 69, - 70, 71, 572, 0, 1, 2, 0, 3, 4, 5, - 167, 0, 0, 0, 0, 0, 73, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, - 169, 0, 0, 0, 73, 0, 0, 0, 0, 0, + 0, 0, 74, 0, 0, 75, 0, 0, 76, 0, + 77, 0, 0, 73, 0, 0, 0, 0, 0, 0, + 74, 0, 0, 75, 0, 0, 76, 0, 77, 63, + 64, 0, 266, 66, 67, 68, 69, 70, 71, 72, + 0, 1, 2, 0, 3, 4, 5, 63, 64, 0, + 106, 152, 153, 154, 155, 156, 157, 72, 0, 1, + 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, + 0, 73, 0, 0, 0, 74, 0, 0, 75, 0, + 0, 76, 0, 77, 0, 0, 0, 63, 64, 73, + 106, 66, 67, 68, 69, 70, 71, 520, 0, 1, + 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 74, 0, 0, 75, 0, + 0, 76, 0, 77, 0, 0, 0, 63, 64, 73, + 106, 66, 67, 68, 69, 70, 71, 574, 0, 1, + 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, + 167, 0, 0, 74, 0, 0, 75, 0, 0, 76, + 0, 77, 0, 0, 0, 0, 0, 0, 0, 168, + 169, 74, 0, 0, 75, 0, 0, 76, 0, 349, 0, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 74, 0, 0, 75, 0, - 0, 76, 0, 349, 193, 194, 195, 0, 0, 196, + 0, 74, 0, 0, 75, 0, 0, 76, 0, 77, + 0, 0, 0, 0, 193, 194, 195, 0, 0, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, - 0, 75, 0, 0, 76, 0, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 74, 0, 0, 75, - 0, 0, 76, 0, 77 + 207, 208, 209, 210, 211, 212, 213, 214, -202, 0, + 0, 74, 0, 0, 75, 0, 0, 76, 0, 77, + 0, 0, 0, 0, 0, 0, -67, 1, 2, 0, + 3, 4, 5, 0, 0, 0, 0, 0, 6, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 0, 0, 9, 0, 0, 0, 10 }; static const yytype_int16 yycheck[] = { - 0, 27, 172, 160, 232, 126, 4, 21, 0, 430, - 303, 28, 11, 173, 11, 29, 19, 17, 11, 22, - 568, 24, 195, 34, 149, 17, 336, 337, 148, 255, - 256, 148, 117, 118, 52, 160, 584, 210, 211, 212, - 213, 214, 53, 149, 217, 11, 32, 33, 66, 134, - 135, 77, 137, 138, 160, 140, 141, 142, 119, 219, - 53, 7, 8, 57, 10, 11, 12, 13, 14, 15, - 16, 17, 34, 19, 20, 101, 22, 23, 24, 105, - 18, 150, 40, 41, 145, 111, 149, 53, 148, 47, - 116, 160, 92, 39, 515, 53, 11, 160, 149, 149, - 126, 149, 17, 49, 3, 4, 5, 6, 158, 160, - 158, 0, 138, 139, 117, 118, 142, 150, 428, 152, - 146, 112, 113, 349, 38, 158, 149, 26, 27, 550, - 551, 134, 135, 156, 137, 138, 148, 140, 141, 142, - 149, 148, 159, 369, 170, 318, 160, 156, 150, 46, - 152, 48, 273, 19, 156, 22, 22, 156, 24, 156, - 21, 159, 149, 456, 585, 586, 153, 193, 194, 195, - 196, 163, 134, 135, 136, 154, 150, 139, 152, 22, - 154, 143, 144, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 485, 149, 487, 316, 22, 153, 267, 225, - 269, 270, 149, 272, 22, 151, 153, 20, 154, 235, - 23, 157, 152, 159, 387, 37, 389, 390, 391, 4, - 134, 135, 136, 113, 114, 139, 42, 43, 44, 143, - 144, 47, 3, 4, 5, 6, 305, 4, 7, 8, - 150, 534, 152, 153, 313, 314, 35, 273, 37, 477, - 19, 20, 155, 22, 23, 24, 149, 150, 284, 152, - 155, 418, 149, 150, 4, 152, 42, 43, 44, 45, - 46, 47, 48, 22, 50, 301, 150, 149, 152, 153, - 341, 342, 343, 344, 345, 145, 146, 147, 83, 84, - 316, 317, 318, 354, 355, 356, 134, 135, 136, 153, - 150, 139, 152, 158, 153, 143, 144, 152, 377, 378, - 379, 42, 9, 44, 9, 488, 385, 9, 491, 492, - 493, 9, 0, 349, 9, 553, 395, 396, 556, 9, - 55, 158, 11, 359, 60, 61, 62, 63, 64, 65, - 18, 19, 20, 152, 22, 23, 24, 408, 409, 418, - 152, 152, 30, 31, 415, 152, 152, 22, 152, 152, - 152, 387, 388, 389, 390, 391, 149, 149, 394, 145, - 146, 147, 441, 51, 443, 152, 54, 446, 38, 549, - 58, 407, 38, 452, 453, 149, 149, 149, 149, 149, - 269, 270, 59, 272, 152, 152, 149, 149, 154, 569, - 38, 462, 463, 464, 465, 149, 149, 149, 469, 470, - 149, 480, 481, 149, 483, 484, 149, 149, 22, 149, - 489, 158, 149, 4, 153, 149, 305, 22, 17, 17, - 499, 457, 152, 149, 313, 314, 149, 4, 149, 149, - 501, 502, 149, 149, 149, 471, 149, 149, 152, 149, - 476, 520, 521, 149, 53, 149, 482, 158, 149, 22, - 529, 154, 488, 153, 0, 491, 492, 493, 149, 153, - 496, 153, 149, 149, 53, 475, 537, 17, 539, 540, - 153, 156, 18, 19, 20, 153, 22, 23, 24, 153, - 156, 153, 153, 4, 30, 31, 149, 566, 377, 378, - 379, 17, 17, 572, 573, 149, 385, 26, 27, 17, - 71, 17, 129, 129, 129, 51, 395, 396, 54, 247, - 544, 92, 58, 592, 593, 248, 552, 516, 597, 111, - 105, 600, 17, 7, 8, 89, 10, 11, 12, 13, - 14, 15, 16, 17, 544, 19, 20, 56, 22, 23, - 24, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 235, 441, 496, 443, -1, 225, 446, 410, -1, - -1, -1, -1, 452, 453, 49, -1, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 480, 481, -1, 483, 484, -1, -1, -1, -1, - 489, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 499, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 520, 521, -1, -1, -1, -1, -1, -1, -1, - 529, -1, 3, 4, -1, -1, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, - -1, 22, 23, 24, 25, 26, 27, 151, -1, -1, - 154, -1, -1, 157, -1, 159, 160, 566, -1, 40, - 41, -1, -1, 572, 573, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, - -1, -1, -1, 592, 593, -1, -1, -1, 597, -1, - -1, 600, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, -1, 129, -1, - 131, 132, 133, -1, -1, -1, -1, -1, 3, 4, - -1, -1, 7, 8, 9, -1, -1, -1, -1, 150, - -1, 152, -1, -1, 19, 20, 157, 22, 23, 24, - 25, 26, 27, -1, -1, 7, 8, -1, -1, -1, - -1, -1, -1, -1, -1, 40, 41, 19, 20, -1, - 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, - -1, -1, 57, -1, -1, -1, -1, -1, 40, 41, - -1, -1, -1, -1, -1, -1, -1, -1, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, - -1, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, -1, 129, -1, 131, 132, 133, -1, - -1, -1, -1, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, -1, 129, -1, 131, - 132, 133, 157, -1, -1, -1, -1, -1, 3, 4, - -1, -1, -1, -1, 9, -1, -1, -1, 150, -1, - 152, -1, 154, -1, -1, 157, -1, 159, -1, 161, - 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, + 0, 27, 172, 232, 160, 4, 126, 11, 150, 195, + 28, 303, 430, 11, 34, 0, 173, 17, 160, 11, + 255, 256, 11, 568, 210, 211, 212, 213, 214, 336, + 337, 217, 17, 53, 21, 52, 46, 34, 48, 40, + 41, 586, 29, 149, 149, 149, 47, 0, 149, 66, + 149, 77, 53, 148, 160, 160, 160, 156, 148, 160, + 119, 53, 219, 149, 53, 18, 19, 20, 11, 22, + 23, 24, 158, 149, 17, 101, 149, 30, 31, 105, + 153, 150, 158, 152, 149, 111, 145, 32, 33, 158, + 116, 156, 92, 150, 35, 152, 37, 515, 51, 156, + 126, 54, 520, 521, 18, 58, 42, 43, 44, 57, + 38, 47, 138, 139, 349, 150, 142, 152, 153, 19, + 146, 428, 22, 20, 24, 267, 23, 269, 270, 150, + 272, 152, 318, 154, 369, 0, 149, 134, 135, 136, + 153, 159, 139, 150, 170, 152, 143, 144, 3, 4, + 5, 6, 156, 273, 572, 573, 574, 575, 156, 154, + 159, 149, 148, 305, 456, 153, 148, 193, 194, 195, + 196, 313, 314, 160, 113, 114, 594, 595, 163, 149, + 150, 148, 152, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 42, 485, 44, 487, 316, 149, 150, 225, + 152, 387, 22, 389, 390, 391, 134, 135, 136, 235, + 150, 139, 152, 153, 21, 143, 144, 3, 4, 5, + 6, 145, 146, 147, 22, 42, 43, 44, 45, 46, + 47, 48, 150, 50, 152, 377, 378, 379, 112, 113, + 26, 27, 534, 385, 7, 8, 22, 273, 477, 117, + 118, 83, 84, 395, 396, 22, 19, 20, 284, 22, + 23, 24, 418, 152, 4, 4, 134, 135, 37, 137, + 138, 155, 140, 141, 142, 301, 418, 155, 4, 22, + 149, 153, 341, 342, 343, 344, 345, 158, 9, 153, + 316, 317, 318, 152, 9, 354, 355, 356, 9, 441, + 9, 443, 488, 9, 446, 491, 492, 493, 9, 55, + 452, 453, 11, 158, 152, 152, 152, 19, 152, 152, + 22, 152, 24, 349, 553, 22, 152, 556, 145, 146, + 147, 152, 59, 359, 149, 134, 135, 136, 480, 481, + 139, 483, 484, 152, 143, 144, 149, 489, 149, 408, + 409, 38, 149, 149, 149, 149, 415, 499, 38, 152, + 152, 387, 388, 389, 390, 391, 149, 149, 394, 60, + 61, 62, 63, 64, 65, 154, 149, 269, 270, 549, + 272, 407, 38, 149, 149, 7, 8, 529, 10, 11, + 12, 13, 14, 15, 16, 17, 149, 19, 20, 569, + 22, 23, 24, 462, 463, 464, 465, 149, 550, 551, + 469, 470, 149, 305, 149, 117, 118, 158, 149, 149, + 22, 313, 314, 4, 566, 149, 22, 49, 153, 17, + 17, 457, 134, 135, 152, 137, 138, 149, 140, 141, + 142, 149, 501, 502, 4, 471, 149, 589, 590, 149, + 476, 149, 53, 149, 596, 597, 482, 149, 152, 149, + 149, 603, 488, 149, 606, 491, 492, 493, 149, 153, + 496, 149, 149, 158, 149, 475, 149, 153, 537, 153, + 539, 540, 22, 149, 154, 377, 378, 379, 156, 153, + 153, 53, 17, 385, 156, 153, 3, 4, 153, 153, + 7, 8, 9, 395, 396, 4, 152, 152, 149, 17, + 149, 17, 19, 20, 17, 22, 23, 24, 25, 26, + 27, 71, 17, 129, 129, 129, 552, 247, 544, 151, + 225, 248, 154, 40, 41, 157, 92, 159, 160, 516, + 111, 105, 235, 17, 544, 89, 56, 496, 410, 441, + 57, 443, -1, -1, 446, -1, -1, -1, -1, -1, + 452, 453, -1, -1, -1, -1, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, -1, -1, -1, -1, -1, 480, 481, + -1, 483, 484, -1, -1, -1, -1, 489, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 499, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, -1, 129, -1, 131, 132, 133, 134, 135, -1, + 137, 138, -1, 140, 141, 142, -1, 529, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 3, 4, -1, + 157, 7, 8, 9, -1, -1, -1, -1, 550, 551, + -1, -1, -1, 19, 20, -1, 22, 23, 24, 25, + 26, 27, 26, 27, 566, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 40, 41, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, -1, 589, 590, -1, + -1, 57, -1, -1, 596, 597, -1, -1, -1, -1, + -1, 603, -1, -1, 606, -1, -1, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, + -1, -1, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, -1, -1, -1, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, -1, 129, -1, 131, 132, 133, -1, -1, + -1, -1, -1, 3, 4, -1, -1, 7, 8, 9, + -1, -1, -1, -1, 150, -1, 152, -1, -1, 19, + 20, 157, 22, 23, 24, 25, 26, 27, -1, -1, + 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, + 40, 41, 19, 20, -1, 22, 23, 24, 25, -1, + -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, + -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, + -1, -1, -1, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + -1, -1, -1, -1, -1, -1, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, -1, -1, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, -1, 129, + -1, 131, 132, 133, -1, -1, -1, -1, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, -1, 129, -1, 131, 132, 133, 157, -1, -1, + -1, -1, -1, 3, 4, -1, -1, -1, -1, 9, + -1, -1, -1, 150, -1, 152, -1, 154, -1, -1, + 157, -1, 159, -1, 161, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 7, 8, 57, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, - 7, 8, 49, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, -1, 129, -1, 131, 132, 133, -1, - 7, 8, 49, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, - 7, 8, 157, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, - -1, -1, 49, 7, 8, -1, 10, 11, 12, 13, - 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, - 24, -1, 49, -1, 151, -1, -1, 154, -1, -1, - 157, -1, 159, 160, -1, 39, -1, -1, -1, -1, - -1, -1, -1, 7, 8, 49, 10, 11, 12, 13, - 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, - 24, -1, -1, -1, 151, -1, -1, 154, -1, -1, - 157, -1, 159, 160, 7, 8, -1, 10, 11, 12, - 13, 14, 15, 16, 17, 49, 19, 20, -1, 22, - 23, 24, -1, -1, 121, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 151, -1, 39, 154, -1, -1, - 157, -1, 159, 160, -1, -1, 49, -1, -1, -1, - -1, -1, -1, -1, 151, -1, -1, 154, -1, -1, - 157, -1, 159, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 151, -1, -1, - 154, -1, -1, 157, -1, 159, 7, 8, -1, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 151, 39, -1, - 154, -1, 156, 157, -1, 159, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, 151, -1, - -1, 154, -1, -1, 157, -1, 159, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, 49, 19, - 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, + 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 7, 8, 57, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, - 22, 23, 24, -1, -1, -1, -1, 7, 8, 49, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, -1, -1, 49, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 151, -1, -1, 154, -1, -1, 157, -1, 159, 49, - 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, - 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 151, -1, -1, 154, -1, -1, 157, -1, 159, -1, - -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 151, -1, -1, 154, -1, -1, 157, -1, 159, + 22, 23, 24, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + -1, -1, -1, -1, -1, 7, 8, 49, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, + 22, 23, 24, -1, -1, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, -1, 129, + -1, 131, 132, 133, -1, 7, 8, 49, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, + 22, 23, 24, -1, -1, 7, 8, 157, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, + 22, 23, 24, -1, -1, -1, -1, 49, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 49, -1, 151, + -1, -1, 154, -1, -1, 157, -1, 159, 160, 7, + 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, - -1, -1, 154, -1, -1, 157, -1, 159, -1, -1, + -1, -1, 154, -1, -1, 157, -1, 159, 160, 7, + 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, + -1, 39, 154, -1, -1, 157, -1, 159, 160, -1, + -1, 49, -1, -1, -1, -1, -1, -1, -1, 151, + -1, -1, 154, -1, -1, 157, -1, 159, -1, 7, + 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, 121, 22, 23, 24, -1, 7, 8, + -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, + -1, 49, -1, 151, -1, -1, 154, -1, -1, 157, + 39, 159, -1, -1, -1, -1, -1, -1, 7, 8, + 49, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, + -1, -1, -1, 151, -1, -1, 154, -1, -1, 157, + 39, 159, -1, -1, -1, -1, -1, -1, 7, 8, + 49, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, -1, 22, 23, 24, 7, 8, -1, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, + 49, -1, -1, 151, -1, -1, 154, -1, 156, 157, + -1, 159, -1, -1, -1, -1, -1, -1, 49, -1, + -1, -1, 151, -1, -1, 154, -1, -1, 157, -1, + 159, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 151, -1, -1, 154, -1, -1, 157, -1, 159, - -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, + -1, -1, 151, -1, -1, 154, -1, -1, 157, -1, + 159, 7, 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 151, -1, -1, 154, -1, -1, - 157, -1, 159, 49, 7, 8, -1, 10, 11, 12, - 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, - 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, - 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, - 36, -1, -1, -1, -1, -1, 49, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, - 56, -1, -1, -1, 49, -1, -1, -1, -1, -1, + -1, -1, 151, -1, -1, 154, -1, -1, 157, -1, + 159, -1, -1, 49, -1, -1, -1, -1, -1, -1, + 151, -1, -1, 154, -1, -1, 157, -1, 159, 7, + 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, + -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, + 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, + 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, + -1, 49, -1, -1, -1, 151, -1, -1, 154, -1, + -1, 157, -1, 159, -1, -1, -1, 7, 8, 49, + 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, + 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 151, -1, -1, 154, -1, + -1, 157, -1, 159, -1, -1, -1, 7, 8, 49, + 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, + 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, + 36, -1, -1, 151, -1, -1, 154, -1, -1, 157, + -1, 159, -1, -1, -1, -1, -1, -1, -1, 55, + 56, 151, -1, -1, 154, -1, -1, 157, -1, 159, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 151, -1, -1, 154, -1, - -1, 157, -1, 159, 110, 111, 112, -1, -1, 115, + -1, 151, -1, -1, 154, -1, -1, 157, -1, 159, + -1, -1, -1, -1, 110, 111, 112, -1, -1, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, - -1, 154, -1, -1, 157, -1, 159, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 151, -1, -1, 154, - -1, -1, 157, -1, 159 + 126, 127, 128, 129, 130, 131, 132, 133, 0, -1, + -1, 151, -1, -1, 154, -1, -1, 157, -1, 159, + -1, -1, -1, -1, -1, -1, 18, 19, 20, -1, + 22, 23, 24, -1, -1, -1, -1, -1, 30, 31, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, + -1, -1, 54, -1, -1, -1, 58 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -2605,12 +2595,12 @@ static const yytype_uint8 yystos[] = 17, 194, 238, 229, 229, 188, 188, 230, 229, 149, 230, 230, 230, 238, 229, 200, 200, 149, 153, 149, 149, 153, 153, 153, 184, 189, 190, 22, 149, 154, - 229, 229, 149, 153, 156, 229, 153, 188, 153, 153, + 184, 184, 149, 153, 156, 229, 153, 188, 153, 153, 200, 200, 200, 171, 53, 187, 17, 156, 168, 235, - 184, 184, 17, 194, 186, 156, 186, 153, 153, 153, - 4, 229, 227, 156, 168, 229, 229, 38, 149, 227, - 184, 184, 17, 17, 149, 229, 229, 17, 71, 229, - 17, 229 + 117, 118, 229, 229, 17, 194, 186, 156, 186, 153, + 153, 153, 4, 229, 227, 156, 168, 184, 184, 184, + 184, 38, 149, 227, 229, 229, 17, 17, 149, 184, + 184, 229, 229, 17, 71, 229, 17, 229 }; #define yyerrok (yyerrstatus = 0) @@ -2684,7 +2674,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -3425,142 +3415,142 @@ yyreduce: switch (yyn) { case 29: -#line 1134 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1111 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 30: -#line 1134 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1111 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 31: -#line 1135 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1112 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 32: -#line 1135 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1112 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 33: -#line 1136 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1113 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 34: -#line 1136 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1113 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 35: -#line 1137 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1114 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 36: -#line 1137 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1114 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 37: -#line 1138 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1115 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 38: -#line 1138 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1115 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 39: -#line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1119 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 40: -#line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1119 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 41: -#line 1143 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1120 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 42: -#line 1143 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1120 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 43: -#line 1144 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1121 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 44: -#line 1144 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1121 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 45: -#line 1145 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1122 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 46: -#line 1145 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1122 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 47: -#line 1146 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1123 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 48: -#line 1146 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1123 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 49: -#line 1147 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1124 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 50: -#line 1147 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1124 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 51: -#line 1148 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1125 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 52: -#line 1148 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1125 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 53: -#line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1126 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 54: -#line 1150 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1127 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 65: -#line 1159 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 66: -#line 1163 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3568,7 +3558,7 @@ yyreduce: break; case 67: -#line 1167 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3576,7 +3566,7 @@ yyreduce: break; case 71: -#line 1175 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3584,7 +3574,7 @@ yyreduce: break; case 72: -#line 1180 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR @@ -3592,152 +3582,152 @@ yyreduce: break; case 73: -#line 1186 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1163 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 74: -#line 1187 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1164 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 75: -#line 1188 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1165 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 76: -#line 1189 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1166 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 77: -#line 1190 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1167 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 78: -#line 1194 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1171 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 79: -#line 1195 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1172 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 80: -#line 1196 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 81: -#line 1200 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1177 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 82: -#line 1201 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1178 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} break; case 83: -#line 1202 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1179 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} break; case 84: -#line 1203 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1180 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} break; case 85: -#line 1207 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1184 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 86: -#line 1208 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1185 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 87: -#line 1209 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 88: -#line 1213 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1190 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 89: -#line 1214 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1191 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 90: -#line 1215 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1192 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 91: -#line 1216 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1193 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 92: -#line 1217 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 93: -#line 1221 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1198 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 94: -#line 1222 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1199 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 95: -#line 1223 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1200 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 96: -#line 1226 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 97: -#line 1227 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 98: -#line 1228 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1205 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 99: -#line 1229 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1206 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 100: -#line 1230 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 101: -#line 1231 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 102: -#line 1232 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1209 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large"); @@ -3747,111 +3737,111 @@ yyreduce: break; case 103: -#line 1239 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1216 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 104: -#line 1240 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1217 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 105: -#line 1241 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1218 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 106: -#line 1242 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1219 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 107: -#line 1243 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::InReg; ;} break; case 108: -#line 1244 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} break; case 109: -#line 1245 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} break; case 110: -#line 1246 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1223 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} break; case 111: -#line 1247 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1224 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::Nest; ;} break; case 112: -#line 1250 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; case 113: -#line 1251 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1228 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; case 114: -#line 1256 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} break; case 115: -#line 1257 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1234 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} break; case 116: -#line 1258 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} break; case 117: -#line 1259 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1236 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::SExt; ;} break; case 118: -#line 1260 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::Pure; ;} +#line 1237 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} break; case 119: -#line 1261 "/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ParamAttrs) = ParamAttr::Const; ;} +#line 1238 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} break; case 120: -#line 1264 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = ParamAttr::None; ;} break; case 121: -#line 1265 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1242 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); ;} break; case 122: -#line 1272 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 123: -#line 1273 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3861,12 +3851,12 @@ yyreduce: break; case 124: -#line 1279 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1256 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 125: -#line 1280 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3876,7 +3866,7 @@ yyreduce: break; case 126: -#line 1288 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1265 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') @@ -3887,27 +3877,27 @@ yyreduce: break; case 127: -#line 1296 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1273 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 128: -#line 1297 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1274 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; case 129: -#line 1302 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1279 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 130: -#line 1303 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1280 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 131: -#line 1304 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1281 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -3916,7 +3906,7 @@ yyreduce: break; case 132: -#line 1309 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1286 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two"); @@ -3926,7 +3916,7 @@ yyreduce: break; case 140: -#line 1325 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1302 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -3934,7 +3924,7 @@ yyreduce: break; case 141: -#line 1329 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1306 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR @@ -3942,7 +3932,7 @@ yyreduce: break; case 142: -#line 1333 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1310 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -3953,7 +3943,7 @@ yyreduce: break; case 143: -#line 1340 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1317 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR @@ -3962,7 +3952,7 @@ yyreduce: break; case 144: -#line 1345 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1322 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3974,32 +3964,20 @@ yyreduce: break; case 145: -#line 1353 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1330 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. std::vector<const Type*> Params; - ParamAttrsVector Attrs; - if ((yyvsp[(5) - (5)].ParamAttrs) != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[(5) - (5)].ParamAttrs); - Attrs.push_back(X); - } - unsigned index = 1; TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); - for (; I != E; ++I, ++index) { + for (; I != E; ++I ) { const Type *Ty = I->Ty->get(); Params.push_back(Ty); - if (Ty != Type::VoidTy) - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; - Attrs.push_back(X); - } } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - ParamAttrsList *ActualAttrs = 0; - if (!Attrs.empty()) - ActualAttrs = ParamAttrsList::get(Attrs); - FunctionType *FT = FunctionType::get(*(yyvsp[(1) - (5)].TypeVal), Params, isVarArg, ActualAttrs); + FunctionType *FT = FunctionType::get(*(yyvsp[(1) - (5)].TypeVal), Params, isVarArg); delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); @@ -4008,33 +3986,20 @@ yyreduce: break; case 146: -#line 1383 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1348 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. std::vector<const Type*> Params; - ParamAttrsVector Attrs; - if ((yyvsp[(5) - (5)].ParamAttrs) != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = 0; X.attrs = (yyvsp[(5) - (5)].ParamAttrs); - Attrs.push_back(X); - } TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); - unsigned index = 1; - for ( ; I != E; ++I, ++index) { + for ( ; I != E; ++I ) { const Type* Ty = I->Ty->get(); Params.push_back(Ty); - if (Ty != Type::VoidTy) - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; - Attrs.push_back(X); - } } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - ParamAttrsList *ActualAttrs = 0; - if (!Attrs.empty()) - ActualAttrs = ParamAttrsList::get(Attrs); - - FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg, ActualAttrs); + FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); CHECK_FOR_ERROR @@ -4042,7 +4007,7 @@ yyreduce: break; case 147: -#line 1414 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1366 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); delete (yyvsp[(4) - (5)].TypeVal); @@ -4051,7 +4016,7 @@ yyreduce: break; case 148: -#line 1419 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1371 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) @@ -4065,7 +4030,7 @@ yyreduce: break; case 149: -#line 1429 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1381 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector<const Type*> Elements; for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), @@ -4079,7 +4044,7 @@ yyreduce: break; case 150: -#line 1439 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1391 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); CHECK_FOR_ERROR @@ -4087,7 +4052,7 @@ yyreduce: break; case 151: -#line 1443 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1395 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector<const Type*> Elements; for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), @@ -4101,7 +4066,7 @@ yyreduce: break; case 152: -#line 1453 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1405 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); CHECK_FOR_ERROR @@ -4109,15 +4074,17 @@ yyreduce: break; case 153: -#line 1460 "/llvm/lib/AsmParser/llvmAsmParser.y" - { +#line 1412 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" + { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); - (yyval.TypeWithAttrs).Attrs = (yyvsp[(2) - (2)].ParamAttrs); + (yyval.TypeWithAttrs).Attrs = ParamAttr::None; ;} break; case 154: -#line 1467 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1421 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); @@ -4128,14 +4095,14 @@ yyreduce: break; case 155: -#line 1474 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1428 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); ;} break; case 156: -#line 1479 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1433 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); @@ -4144,7 +4111,7 @@ yyreduce: break; case 157: -#line 1484 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1438 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); CHECK_FOR_ERROR @@ -4152,7 +4119,7 @@ yyreduce: break; case 159: -#line 1492 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1446 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4163,7 +4130,7 @@ yyreduce: break; case 160: -#line 1499 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1453 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -4174,7 +4141,7 @@ yyreduce: break; case 161: -#line 1506 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1460 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); CHECK_FOR_ERROR @@ -4182,7 +4149,7 @@ yyreduce: break; case 162: -#line 1514 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1468 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list<PATypeHolder>(); (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); @@ -4192,7 +4159,7 @@ yyreduce: break; case 163: -#line 1520 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1474 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); @@ -4201,7 +4168,7 @@ yyreduce: break; case 164: -#line 1532 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1486 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4233,7 +4200,7 @@ yyreduce: break; case 165: -#line 1560 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1514 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4253,7 +4220,7 @@ yyreduce: break; case 166: -#line 1576 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1530 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4284,7 +4251,7 @@ yyreduce: break; case 167: -#line 1603 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1557 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); @@ -4316,7 +4283,7 @@ yyreduce: break; case 168: -#line 1631 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1585 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) @@ -4346,7 +4313,7 @@ yyreduce: break; case 169: -#line 1657 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1611 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -4370,7 +4337,7 @@ yyreduce: break; case 170: -#line 1677 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1631 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); if (STy == 0) @@ -4400,7 +4367,7 @@ yyreduce: break; case 171: -#line 1703 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1657 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); @@ -4424,7 +4391,7 @@ yyreduce: break; case 172: -#line 1723 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1677 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4440,7 +4407,7 @@ yyreduce: break; case 173: -#line 1735 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1689 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4451,7 +4418,7 @@ yyreduce: break; case 174: -#line 1742 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1696 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4521,7 +4488,7 @@ yyreduce: break; case 175: -#line 1808 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1762 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4535,7 +4502,7 @@ yyreduce: break; case 176: -#line 1818 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1772 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -4549,7 +4516,7 @@ yyreduce: break; case 177: -#line 1828 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1782 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4559,7 +4526,7 @@ yyreduce: break; case 178: -#line 1834 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1788 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4573,7 +4540,7 @@ yyreduce: break; case 179: -#line 1844 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1798 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type"); @@ -4583,7 +4550,7 @@ yyreduce: break; case 180: -#line 1850 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1804 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { @@ -4597,7 +4564,7 @@ yyreduce: break; case 181: -#line 1860 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1814 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getTrue(); @@ -4606,7 +4573,7 @@ yyreduce: break; case 182: -#line 1865 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1819 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); (yyval.ConstVal) = ConstantInt::getFalse(); @@ -4615,7 +4582,7 @@ yyreduce: break; case 183: -#line 1870 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1824 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type"); @@ -4630,7 +4597,7 @@ yyreduce: break; case 184: -#line 1883 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1837 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); @@ -4646,7 +4613,7 @@ yyreduce: break; case 185: -#line 1895 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1849 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -4672,7 +4639,7 @@ yyreduce: break; case 186: -#line 1917 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1871 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -4684,7 +4651,7 @@ yyreduce: break; case 187: -#line 1925 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1879 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match"); @@ -4694,7 +4661,7 @@ yyreduce: break; case 188: -#line 1931 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1885 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match"); @@ -4709,7 +4676,7 @@ yyreduce: break; case 189: -#line 1942 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1896 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match"); @@ -4718,7 +4685,7 @@ yyreduce: break; case 190: -#line 1947 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1901 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match"); @@ -4727,7 +4694,7 @@ yyreduce: break; case 191: -#line 1952 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1906 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands"); @@ -4737,7 +4704,7 @@ yyreduce: break; case 192: -#line 1958 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1912 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands"); @@ -4747,7 +4714,7 @@ yyreduce: break; case 193: -#line 1964 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1918 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -4757,7 +4724,7 @@ yyreduce: break; case 194: -#line 1973 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1927 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR @@ -4765,7 +4732,7 @@ yyreduce: break; case 195: -#line 1977 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1931 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector<Constant*>(); (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); @@ -4774,27 +4741,27 @@ yyreduce: break; case 196: -#line 1985 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1939 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 197: -#line 1985 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1939 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 198: -#line 1988 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1942 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 199: -#line 1988 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1942 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 200: -#line 1991 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1945 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); @@ -4810,7 +4777,7 @@ yyreduce: break; case 201: -#line 2003 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1957 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = (yyvsp[(3) - (6)].ConstVal); const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); @@ -4826,7 +4793,7 @@ yyreduce: break; case 202: -#line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1978 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4835,7 +4802,7 @@ yyreduce: break; case 203: -#line 2029 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1983 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -4844,12 +4811,12 @@ yyreduce: break; case 206: -#line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1996 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ;} break; case 207: -#line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1996 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR @@ -4857,26 +4824,26 @@ yyreduce: break; case 208: -#line 2046 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2000 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 209: -#line 2046 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2000 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 210: -#line 2049 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2003 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 211: -#line 2052 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2006 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); @@ -4904,7 +4871,7 @@ yyreduce: break; case 212: -#line 2076 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2030 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); @@ -4919,7 +4886,7 @@ yyreduce: break; case 213: -#line 2087 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2041 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if ((yyvsp[(5) - (5)].ConstVal) == 0) @@ -4931,14 +4898,14 @@ yyreduce: break; case 214: -#line 2094 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2048 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 215: -#line 2098 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2052 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(6) - (6)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -4948,14 +4915,14 @@ yyreduce: break; case 216: -#line 2103 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2057 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 217: -#line 2107 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2061 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription()); @@ -4966,7 +4933,7 @@ yyreduce: break; case 218: -#line 2113 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2067 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4974,7 +4941,7 @@ yyreduce: break; case 219: -#line 2117 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2071 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if ((yyvsp[(1) - (5)].StrVal)) { @@ -5018,21 +4985,21 @@ yyreduce: break; case 220: -#line 2157 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2111 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 221: -#line 2160 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2114 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 222: -#line 2166 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2120 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -5045,7 +5012,7 @@ yyreduce: break; case 223: -#line 2176 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2130 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5053,7 +5020,7 @@ yyreduce: break; case 224: -#line 2180 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2134 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5061,7 +5028,7 @@ yyreduce: break; case 226: -#line 2187 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2141 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); delete (yyvsp[(3) - (3)].StrVal); @@ -5070,7 +5037,7 @@ yyreduce: break; case 227: -#line 2192 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2146 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5079,14 +5046,14 @@ yyreduce: break; case 228: -#line 2197 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2151 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 229: -#line 2206 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2160 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -5100,7 +5067,7 @@ yyreduce: break; case 230: -#line 2216 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2170 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); @@ -5114,7 +5081,7 @@ yyreduce: break; case 231: -#line 2227 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2181 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR @@ -5122,7 +5089,7 @@ yyreduce: break; case 232: -#line 2231 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2185 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); struct ArgListEntry E; @@ -5135,7 +5102,7 @@ yyreduce: break; case 233: -#line 2240 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2194 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new ArgListType; struct ArgListEntry E; @@ -5148,7 +5115,7 @@ yyreduce: break; case 234: -#line 2249 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2203 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -5156,7 +5123,7 @@ yyreduce: break; case 235: -#line 2255 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2209 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*(yyvsp[(3) - (9)].StrVal)); delete (yyvsp[(3) - (9)].StrVal); // Free strdup'd memory! @@ -5169,7 +5136,9 @@ yyreduce: std::vector<const Type*> ParamTypeList; ParamAttrsVector Attrs; if ((yyvsp[(7) - (9)].ParamAttrs) != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(7) - (9)].ParamAttrs); + ParamAttrsWithIndex PAWI; + PAWI.index = 0; + PAWI.attrs = (yyvsp[(7) - (9)].ParamAttrs); Attrs.push_back(PAWI); } if ((yyvsp[(5) - (9)].ArgList)) { // If there are arguments... @@ -5181,7 +5150,9 @@ yyreduce: ParamTypeList.push_back(Ty); if (Ty != Type::VoidTy) if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = I->Attrs; Attrs.push_back(PAWI); } } @@ -5194,7 +5165,7 @@ yyreduce: if (!Attrs.empty()) PAL = ParamAttrsList::get(Attrs); - FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (9)].TypeVal), ParamTypeList, isVarArg, PAL); + FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (9)].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); delete (yyvsp[(2) - (9)].TypeVal); @@ -5211,19 +5182,24 @@ yyreduce: // Move the function to the end of the list, from whereever it was // previously inserted. Fn = cast<Function>(FWRef); + assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!"); CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { - if (Fn->getFunctionType() != FT) { + if (Fn->getFunctionType() != FT ) { // The existing function doesn't have the same type. This is an overload // error. GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); + } else if (Fn->getParamAttrs() != PAL) { + // The existing function doesn't have the same parameter attributes. + // This is an overload error. + GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { // Neither the existing or the current function is a declaration and they // have the same name and same type. Clearly this is a redefinition. GEN_ERROR("Redefinition of function '" + FunctionName + "'"); - } if (Fn->isDeclaration()) { + } else if (Fn->isDeclaration()) { // Make sure to strip off any argument names so we can't get conflicts. for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) @@ -5232,7 +5208,6 @@ yyreduce: } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName, CurModule.CurrentModule); - InsertValue(Fn, CurModule.Values); } @@ -5246,6 +5221,7 @@ yyreduce: Fn->setVisibility(CurFun.Visibility); } Fn->setCallingConv((yyvsp[(1) - (9)].UIntVal)); + Fn->setParamAttrs(PAL); Fn->setAlignment((yyvsp[(9) - (9)].UIntVal)); if ((yyvsp[(8) - (9)].StrVal)) { Fn->setSection(*(yyvsp[(8) - (9)].StrVal)); @@ -5279,7 +5255,7 @@ yyreduce: break; case 238: -#line 2377 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2340 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -5291,7 +5267,7 @@ yyreduce: break; case 241: -#line 2388 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2351 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5299,7 +5275,7 @@ yyreduce: break; case 242: -#line 2393 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2356 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); @@ -5310,7 +5286,7 @@ yyreduce: break; case 243: -#line 2405 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2368 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5318,7 +5294,7 @@ yyreduce: break; case 244: -#line 2409 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2372 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5326,7 +5302,7 @@ yyreduce: break; case 245: -#line 2414 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2377 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR @@ -5334,7 +5310,7 @@ yyreduce: break; case 246: -#line 2418 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2381 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR @@ -5342,7 +5318,7 @@ yyreduce: break; case 247: -#line 2422 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2385 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR @@ -5350,7 +5326,7 @@ yyreduce: break; case 248: -#line 2426 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2389 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR @@ -5358,7 +5334,7 @@ yyreduce: break; case 249: -#line 2430 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2393 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR @@ -5366,7 +5342,7 @@ yyreduce: break; case 250: -#line 2434 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2397 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -5374,7 +5350,7 @@ yyreduce: break; case 251: -#line 2438 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2401 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -5382,7 +5358,7 @@ yyreduce: break; case 252: -#line 2442 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2405 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -5390,7 +5366,7 @@ yyreduce: break; case 253: -#line 2446 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2409 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); @@ -5419,7 +5395,7 @@ yyreduce: break; case 254: -#line 2471 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2434 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR @@ -5427,7 +5403,7 @@ yyreduce: break; case 255: -#line 2475 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2438 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); delete (yyvsp[(3) - (5)].StrVal); @@ -5437,7 +5413,7 @@ yyreduce: break; case 256: -#line 2485 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2448 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5445,7 +5421,7 @@ yyreduce: break; case 257: -#line 2489 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2452 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); CHECK_FOR_ERROR @@ -5453,7 +5429,7 @@ yyreduce: break; case 258: -#line 2493 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2456 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5462,7 +5438,7 @@ yyreduce: break; case 259: -#line 2498 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2461 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); delete (yyvsp[(1) - (1)].StrVal); @@ -5471,7 +5447,7 @@ yyreduce: break; case 262: -#line 2511 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2474 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); @@ -5482,7 +5458,7 @@ yyreduce: break; case 263: -#line 2520 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2483 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5490,7 +5466,7 @@ yyreduce: break; case 264: -#line 2524 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2487 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR @@ -5498,7 +5474,7 @@ yyreduce: break; case 265: -#line 2533 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2496 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR @@ -5510,7 +5486,7 @@ yyreduce: break; case 266: -#line 2542 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2505 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) @@ -5523,7 +5499,7 @@ yyreduce: break; case 267: -#line 2551 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2514 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR @@ -5531,7 +5507,7 @@ yyreduce: break; case 268: -#line 2555 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2518 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); delete (yyvsp[(1) - (1)].StrVal); @@ -5541,7 +5517,7 @@ yyreduce: break; case 269: -#line 2562 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2525 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal)); CHECK_FOR_ERROR @@ -5549,7 +5525,7 @@ yyreduce: break; case 270: -#line 2566 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2529 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR @@ -5557,7 +5533,7 @@ yyreduce: break; case 271: -#line 2570 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2533 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR @@ -5566,7 +5542,7 @@ yyreduce: break; case 272: -#line 2575 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2538 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); @@ -5580,7 +5556,7 @@ yyreduce: break; case 273: -#line 2585 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2548 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR @@ -5603,7 +5579,7 @@ yyreduce: break; case 274: -#line 2604 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2567 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR @@ -5616,7 +5592,7 @@ yyreduce: break; case 275: -#line 2614 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2577 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -5626,28 +5602,14 @@ yyreduce: !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector<const Type*> ParamTypes; - ParamAttrsVector Attrs; - if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs); - Attrs.push_back(PAWI); - } ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end(); - unsigned index = 1; - for (; I != E; ++I, ++index) { + for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; - Attrs.push_back(PAWI); - } } - - ParamAttrsList *PAL = 0; - if (!Attrs.empty()) - PAL = ParamAttrsList::get(Attrs); - Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false, PAL); + Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::get(Ty); } @@ -5660,6 +5622,12 @@ yyreduce: BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); CHECK_FOR_ERROR + ParamAttrsVector Attrs; + if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) { + ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs); + Attrs.push_back(PAWI); + } + // Check the arguments ValueList Args; if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? @@ -5673,12 +5641,19 @@ yyreduce: FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end(); + unsigned index = 1; - for (; ArgI != ArgE && I != E; ++ArgI, ++I) { + for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { if (ArgI->Val->getType() != *I) GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + (*I)->getDescription() + "'"); Args.push_back(ArgI->Val); + if (ArgI->Attrs != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = ArgI->Attrs; + Attrs.push_back(PAWI); + } } if (Ty->isVarArg()) { @@ -5689,9 +5664,14 @@ yyreduce: GEN_ERROR("Invalid number of parameters detected"); } + ParamAttrsList *PAL = 0; + if (!Attrs.empty()) + PAL = ParamAttrsList::get(Attrs); + // Create the InvokeInst InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); + II->setParamAttrs(PAL); (yyval.TermInstVal) = II; delete (yyvsp[(6) - (14)].ParamList); CHECK_FOR_ERROR @@ -5699,7 +5679,7 @@ yyreduce: break; case 276: -#line 2693 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2660 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -5707,7 +5687,7 @@ yyreduce: break; case 277: -#line 2697 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2664 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -5715,7 +5695,7 @@ yyreduce: break; case 278: -#line 2704 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2671 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); @@ -5730,7 +5710,7 @@ yyreduce: break; case 279: -#line 2715 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2682 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); @@ -5746,7 +5726,7 @@ yyreduce: break; case 280: -#line 2728 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2695 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); @@ -5758,7 +5738,7 @@ yyreduce: break; case 281: -#line 2738 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2705 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); @@ -5773,7 +5753,7 @@ yyreduce: break; case 282: -#line 2749 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2716 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); @@ -5785,63 +5765,69 @@ yyreduce: break; case 283: -#line 2759 "/llvm/lib/AsmParser/llvmAsmParser.y" - { +#line 2726 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" + { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); // Used for call and invoke instructions (yyval.ParamList) = new ParamList(); - ParamListEntry E; E.Attrs = (yyvsp[(3) - (3)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (3)].TypeVal)->get(), (yyvsp[(2) - (3)].ValIDVal)); + ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); (yyval.ParamList)->push_back(E); - delete (yyvsp[(1) - (3)].TypeVal); + delete (yyvsp[(1) - (4)].TypeVal); + CHECK_FOR_ERROR ;} break; case 284: -#line 2768 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2737 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs (yyval.ParamList) = new ParamList(); - ParamListEntry E; E.Attrs = (yyvsp[(3) - (3)].ParamAttrs); E.Val = getBBVal((yyvsp[(2) - (3)].ValIDVal)); + ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); (yyval.ParamList)->push_back(E); + CHECK_FOR_ERROR ;} break; case 285: -#line 2774 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2745 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); - (yyval.ParamList) = (yyvsp[(1) - (5)].ParamList); - ParamListEntry E; E.Attrs = (yyvsp[(5) - (5)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (5)].TypeVal)->get(), (yyvsp[(4) - (5)].ValIDVal)); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); + (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); + ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); (yyval.ParamList)->push_back(E); - delete (yyvsp[(3) - (5)].TypeVal); + delete (yyvsp[(3) - (6)].TypeVal); CHECK_FOR_ERROR ;} break; case 286: -#line 2783 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2755 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ParamList) = (yyvsp[(1) - (5)].ParamList); - ParamListEntry E; E.Attrs = (yyvsp[(5) - (5)].ParamAttrs); E.Val = getBBVal((yyvsp[(4) - (5)].ValIDVal)); + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 + (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); + ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); (yyval.ParamList)->push_back(E); CHECK_FOR_ERROR ;} break; case 287: -#line 2789 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2762 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ParamList) = new ParamList(); ;} break; case 288: -#line 2792 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2765 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector<Value*>(); ;} break; case 289: -#line 2793 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2766 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); @@ -5850,7 +5836,7 @@ yyreduce: break; case 290: -#line 2800 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2773 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5858,7 +5844,7 @@ yyreduce: break; case 291: -#line 2804 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2777 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5866,7 +5852,7 @@ yyreduce: break; case 292: -#line 2809 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2782 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -5886,7 +5872,7 @@ yyreduce: break; case 293: -#line 2825 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2798 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); @@ -5907,7 +5893,7 @@ yyreduce: break; case 294: -#line 2842 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2815 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -5925,7 +5911,7 @@ yyreduce: break; case 295: -#line 2856 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2829 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); @@ -5943,7 +5929,7 @@ yyreduce: break; case 296: -#line 2870 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2843 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -5959,7 +5945,7 @@ yyreduce: break; case 297: -#line 2882 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2855 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -5971,7 +5957,7 @@ yyreduce: break; case 298: -#line 2890 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2863 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); @@ -5982,7 +5968,7 @@ yyreduce: break; case 299: -#line 2897 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2870 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands"); @@ -5992,7 +5978,7 @@ yyreduce: break; case 300: -#line 2903 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2876 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands"); @@ -6002,7 +5988,7 @@ yyreduce: break; case 301: -#line 2909 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2882 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands"); @@ -6012,7 +5998,7 @@ yyreduce: break; case 302: -#line 2915 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2888 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -6031,7 +6017,7 @@ yyreduce: break; case 303: -#line 2931 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2904 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -6041,29 +6027,14 @@ yyreduce: !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector<const Type*> ParamTypes; - ParamAttrsVector Attrs; - if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs); - Attrs.push_back(PAWI); - } - unsigned index = 1; ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end(); - for (; I != E; ++I, ++index) { + for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; - Attrs.push_back(PAWI); - } } - - ParamAttrsList *PAL = 0; - if (!Attrs.empty()) - PAL = ParamAttrsList::get(Attrs); - - Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false, PAL); + Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); PFTy = PointerType::get(Ty); } @@ -6079,6 +6050,14 @@ yyreduce: theF->getName() + "'"); } + // Set up the ParamAttrs for the function + ParamAttrsVector Attrs; + if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = 0; + PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs); + Attrs.push_back(PAWI); + } // Check the arguments ValueList Args; if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? @@ -6088,17 +6067,23 @@ yyreduce: "expects arguments"); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified - // correctly! - // + // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end(); + unsigned index = 1; - for (; ArgI != ArgE && I != E; ++ArgI, ++I) { + for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { if (ArgI->Val->getType() != *I) GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + (*I)->getDescription() + "'"); Args.push_back(ArgI->Val); + if (ArgI->Attrs != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = ArgI->Attrs; + Attrs.push_back(PAWI); + } } if (Ty->isVarArg()) { if (I == E) @@ -6107,10 +6092,17 @@ yyreduce: } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } + + // Finish off the ParamAttrs and check them + ParamAttrsList *PAL = 0; + if (!Attrs.empty()) + PAL = ParamAttrsList::get(Attrs); + // Create the call node CallInst *CI = new CallInst(V, Args.begin(), Args.end()); CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); + CI->setParamAttrs(PAL); (yyval.InstVal) = CI; delete (yyvsp[(6) - (8)].ParamList); delete (yyvsp[(3) - (8)].TypeVal); @@ -6119,7 +6111,7 @@ yyreduce: break; case 304: -#line 3015 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2994 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR @@ -6127,7 +6119,7 @@ yyreduce: break; case 305: -#line 3020 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2999 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -6135,7 +6127,7 @@ yyreduce: break; case 306: -#line 3024 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3003 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -6143,7 +6135,7 @@ yyreduce: break; case 307: -#line 3031 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3010 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6154,7 +6146,7 @@ yyreduce: break; case 308: -#line 3038 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3017 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6166,7 +6158,7 @@ yyreduce: break; case 309: -#line 3046 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3025 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); @@ -6177,7 +6169,7 @@ yyreduce: break; case 310: -#line 3053 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3032 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); @@ -6189,7 +6181,7 @@ yyreduce: break; case 311: -#line 3061 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3040 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -6200,7 +6192,7 @@ yyreduce: break; case 312: -#line 3069 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3048 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); @@ -6218,7 +6210,7 @@ yyreduce: break; case 313: -#line 3083 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3062 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); @@ -6239,7 +6231,7 @@ yyreduce: break; case 314: -#line 3100 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3079 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); @@ -6259,7 +6251,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 6263 "llvmAsmParser.tab.c" +#line 6255 "llvmAsmParser.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -6473,18 +6465,12 @@ yyreturn: } -#line 3117 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3096 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { - - llvmAsmlineno = 1; // Reset the current line number... CurModule.CurrentModule = M; -#if YYDEBUG - yydebug = Debug; -#endif - // Check to make sure the parser succeeded if (yyparse()) { if (ParserResult) @@ -6536,21 +6522,21 @@ static Module* RunParser(Module * M) { } void llvm::GenerateError(const std::string &message, int LineNo) { - if (LineNo == -1) LineNo = llvmAsmlineno; + if (LineNo == -1) LineNo = LLLgetLineNo(); // TODO: column number in exception if (TheParseError) - TheParseError->setError(CurFilename, message, LineNo); + TheParseError->setError(LLLgetFilename(), message, LineNo); TriggerError = 1; } int yyerror(const char *ErrorMsg) { - std::string where - = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) - + ":" + utostr((unsigned) llvmAsmlineno) + ": "; + std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; std::string errMsg = where + "error: " + std::string(ErrorMsg); - if (yychar != YYEMPTY && yychar != 0) - errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ - "'"; + if (yychar != YYEMPTY && yychar != 0) { + errMsg += " while reading token: '"; + errMsg += std::string(LLLgetTokenStart(), + LLLgetTokenStart()+LLLgetTokenLength()) + "'"; + } GenerateError(errMsg); return 0; } diff --git a/lib/AsmParser/llvmAsmParser.h.cvs b/lib/AsmParser/llvmAsmParser.h.cvs index 601fc40..88b51c3 100644 --- a/lib/AsmParser/llvmAsmParser.h.cvs +++ b/lib/AsmParser/llvmAsmParser.h.cvs @@ -179,8 +179,8 @@ NOALIAS = 395, BYVAL = 396, NEST = 397, - CONST = 398, - PURE = 399, + READNONE = 398, + READONLY = 399, DEFAULT = 400, HIDDEN = 401, PROTECTED = 402 @@ -327,8 +327,8 @@ #define NOALIAS 395 #define BYVAL 396 #define NEST 397 -#define CONST 398 -#define PURE 399 +#define READNONE 398 +#define READONLY 399 #define DEFAULT 400 #define HIDDEN 401 #define PROTECTED 402 @@ -338,7 +338,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 968 "/llvm/lib/AsmParser/llvmAsmParser.y" +#line 945 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y" { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -385,7 +385,7 @@ typedef union YYSTYPE llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; } -/* Line 1529 of yacc.c. */ +/* Line 1489 of yacc.c. */ #line 390 "llvmAsmParser.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index a1373ce..683b95b 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1328,61 +1328,36 @@ Types CHECK_FOR_ERROR } | Types '(' ArgTypeListI ')' OptFuncAttrs { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. std::vector<const Type*> Params; - ParamAttrsVector Attrs; - if ($5 != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = 0; X.attrs = $5; - Attrs.push_back(X); - } - unsigned index = 1; TypeWithAttrsList::iterator I = $3->begin(), E = $3->end(); - for (; I != E; ++I, ++index) { + for (; I != E; ++I ) { const Type *Ty = I->Ty->get(); Params.push_back(Ty); - if (Ty != Type::VoidTy) - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; - Attrs.push_back(X); - } } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - ParamAttrsList *ActualAttrs = 0; - if (!Attrs.empty()) - ActualAttrs = ParamAttrsList::get(Attrs); - FunctionType *FT = FunctionType::get(*$1, Params, isVarArg, ActualAttrs); + FunctionType *FT = FunctionType::get(*$1, Params, isVarArg); delete $3; // Delete the argument list delete $1; // Delete the return type handle $$ = new PATypeHolder(HandleUpRefs(FT)); CHECK_FOR_ERROR } | VOID '(' ArgTypeListI ')' OptFuncAttrs { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. std::vector<const Type*> Params; - ParamAttrsVector Attrs; - if ($5 != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = 0; X.attrs = $5; - Attrs.push_back(X); - } TypeWithAttrsList::iterator I = $3->begin(), E = $3->end(); - unsigned index = 1; - for ( ; I != E; ++I, ++index) { + for ( ; I != E; ++I ) { const Type* Ty = I->Ty->get(); Params.push_back(Ty); - if (Ty != Type::VoidTy) - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; - Attrs.push_back(X); - } } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - ParamAttrsList *ActualAttrs = 0; - if (!Attrs.empty()) - ActualAttrs = ParamAttrsList::get(Attrs); - - FunctionType *FT = FunctionType::get($1, Params, isVarArg, ActualAttrs); + FunctionType *FT = FunctionType::get($1, Params, isVarArg); delete $3; // Delete the argument list $$ = new PATypeHolder(HandleUpRefs(FT)); CHECK_FOR_ERROR @@ -1434,9 +1409,11 @@ Types ; ArgType - : Types OptParamAttrs { + : Types OptParamAttrs { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. $$.Ty = $1; - $$.Attrs = $2; + $$.Attrs = ParamAttr::None; } ; @@ -2241,7 +2218,9 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' std::vector<const Type*> ParamTypeList; ParamAttrsVector Attrs; if ($7 != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $7; + ParamAttrsWithIndex PAWI; + PAWI.index = 0; + PAWI.attrs = $7; Attrs.push_back(PAWI); } if ($5) { // If there are arguments... @@ -2253,7 +2232,9 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' ParamTypeList.push_back(Ty); if (Ty != Type::VoidTy) if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = I->Attrs; Attrs.push_back(PAWI); } } @@ -2266,7 +2247,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' if (!Attrs.empty()) PAL = ParamAttrsList::get(Attrs); - FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg, PAL); + FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); delete $2; @@ -2283,19 +2264,24 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' // Move the function to the end of the list, from whereever it was // previously inserted. Fn = cast<Function>(FWRef); + assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!"); CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { - if (Fn->getFunctionType() != FT) { + if (Fn->getFunctionType() != FT ) { // The existing function doesn't have the same type. This is an overload // error. GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); + } else if (Fn->getParamAttrs() != PAL) { + // The existing function doesn't have the same parameter attributes. + // This is an overload error. + GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { // Neither the existing or the current function is a declaration and they // have the same name and same type. Clearly this is a redefinition. GEN_ERROR("Redefinition of function '" + FunctionName + "'"); - } if (Fn->isDeclaration()) { + } else if (Fn->isDeclaration()) { // Make sure to strip off any argument names so we can't get conflicts. for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) @@ -2304,7 +2290,6 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName, CurModule.CurrentModule); - InsertValue(Fn, CurModule.Values); } @@ -2318,6 +2303,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' Fn->setVisibility(CurFun.Visibility); } Fn->setCallingConv($1); + Fn->setParamAttrs(PAL); Fn->setAlignment($9); if ($8) { Fn->setSection(*$8); @@ -2597,28 +2583,14 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector<const Type*> ParamTypes; - ParamAttrsVector Attrs; - if ($8 != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $8; - Attrs.push_back(PAWI); - } ParamList::iterator I = $6->begin(), E = $6->end(); - unsigned index = 1; - for (; I != E; ++I, ++index) { + for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; - Attrs.push_back(PAWI); - } } - - ParamAttrsList *PAL = 0; - if (!Attrs.empty()) - PAL = ParamAttrsList::get(Attrs); - Ty = FunctionType::get($3->get(), ParamTypes, false, PAL); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::get(Ty); } @@ -2631,6 +2603,12 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... BasicBlock *Except = getBBVal($14); CHECK_FOR_ERROR + ParamAttrsVector Attrs; + if ($8 != ParamAttr::None) { + ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $8; + Attrs.push_back(PAWI); + } + // Check the arguments ValueList Args; if ($6->empty()) { // Has no arguments? @@ -2644,12 +2622,19 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + unsigned index = 1; - for (; ArgI != ArgE && I != E; ++ArgI, ++I) { + for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { if (ArgI->Val->getType() != *I) GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + (*I)->getDescription() + "'"); Args.push_back(ArgI->Val); + if (ArgI->Attrs != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = ArgI->Attrs; + Attrs.push_back(PAWI); + } } if (Ty->isVarArg()) { @@ -2660,9 +2645,14 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... GEN_ERROR("Invalid number of parameters detected"); } + ParamAttrsList *PAL = 0; + if (!Attrs.empty()) + PAL = ParamAttrsList::get(Attrs); + // Create the InvokeInst InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); II->setCallingConv($2); + II->setParamAttrs(PAL); $$ = II; delete $6; CHECK_FOR_ERROR @@ -2733,33 +2723,39 @@ PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes }; -ParamList : Types ValueRef OptParamAttrs { +ParamList : Types OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); // Used for call and invoke instructions $$ = new ParamList(); - ParamListEntry E; E.Attrs = $3; E.Val = getVal($1->get(), $2); + ParamListEntry E; E.Attrs = $2 | $4; E.Val = getVal($1->get(), $3); $$->push_back(E); delete $1; + CHECK_FOR_ERROR } - | LABEL ValueRef OptParamAttrs { + | LABEL OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs $$ = new ParamList(); - ParamListEntry E; E.Attrs = $3; E.Val = getBBVal($2); + ParamListEntry E; E.Attrs = $2 | $4; E.Val = getBBVal($3); $$->push_back(E); + CHECK_FOR_ERROR } - | ParamList ',' Types ValueRef OptParamAttrs { + | ParamList ',' Types OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); $$ = $1; - ParamListEntry E; E.Attrs = $5; E.Val = getVal($3->get(), $4); + ParamListEntry E; E.Attrs = $4 | $6; E.Val = getVal($3->get(), $5); $$->push_back(E); delete $3; CHECK_FOR_ERROR } - | ParamList ',' LABEL ValueRef OptParamAttrs { + | ParamList ',' LABEL OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 $$ = $1; - ParamListEntry E; E.Attrs = $5; E.Val = getBBVal($4); + ParamListEntry E; E.Attrs = $4 | $6; E.Val = getBBVal($5); $$->push_back(E); CHECK_FOR_ERROR } @@ -2914,29 +2910,14 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector<const Type*> ParamTypes; - ParamAttrsVector Attrs; - if ($8 != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $8; - Attrs.push_back(PAWI); - } - unsigned index = 1; ParamList::iterator I = $6->begin(), E = $6->end(); - for (; I != E; ++I, ++index) { + for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; - Attrs.push_back(PAWI); - } } - - ParamAttrsList *PAL = 0; - if (!Attrs.empty()) - PAL = ParamAttrsList::get(Attrs); - - Ty = FunctionType::get($3->get(), ParamTypes, false, PAL); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::get(Ty); } @@ -2952,6 +2933,14 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { theF->getName() + "'"); } + // Set up the ParamAttrs for the function + ParamAttrsVector Attrs; + if ($8 != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = 0; + PAWI.attrs = $8; + Attrs.push_back(PAWI); + } // Check the arguments ValueList Args; if ($6->empty()) { // Has no arguments? @@ -2961,17 +2950,23 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { "expects arguments"); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified - // correctly! - // + // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + unsigned index = 1; - for (; ArgI != ArgE && I != E; ++ArgI, ++I) { + for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { if (ArgI->Val->getType() != *I) GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + (*I)->getDescription() + "'"); Args.push_back(ArgI->Val); + if (ArgI->Attrs != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = ArgI->Attrs; + Attrs.push_back(PAWI); + } } if (Ty->isVarArg()) { if (I == E) @@ -2980,10 +2975,17 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } + + // Finish off the ParamAttrs and check them + ParamAttrsList *PAL = 0; + if (!Attrs.empty()) + PAL = ParamAttrsList::get(Attrs); + // Create the call node CallInst *CI = new CallInst(V, Args.begin(), Args.end()); CI->setTailCall($1); CI->setCallingConv($2); + CI->setParamAttrs(PAL); $$ = CI; delete $6; delete $3; diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs index 3525567..683b95b 100644 --- a/lib/AsmParser/llvmAsmParser.y.cvs +++ b/lib/AsmParser/llvmAsmParser.y.cvs @@ -29,9 +29,6 @@ #include <list> #include <map> #include <utility> -#ifndef NDEBUG -#define YYDEBUG 1 -#endif // The following is a gross hack. In order to rid the libAsmParser library of // exceptions, we have to have a way of getting the yyparse function to go into @@ -51,15 +48,6 @@ static bool TriggerError = false; int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit int yylex(); // declaration" of xxx warnings. int yyparse(); - -namespace llvm { - std::string CurFilename; -#if YYDEBUG -static cl::opt<bool> -Debug("debug-yacc", cl::desc("Print yacc debug state changes"), - cl::Hidden, cl::init(false)); -#endif -} using namespace llvm; static Module *ParserResult; @@ -513,7 +501,7 @@ static Value *getVal(const Type *Ty, const ValID &ID) { // Remember where this forward reference came from. FIXME, shouldn't we try // to recycle these things?? CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, - llvmAsmlineno))); + LLLgetLineNo()))); if (inFunctionScope()) InsertValue(V, CurFun.LateResolveValues); @@ -945,22 +933,11 @@ static PATypeHolder HandleUpRefs(const Type *ty) { // static Module* RunParser(Module * M); -Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { - set_scan_file(F); - - CurFilename = Filename; - return RunParser(new Module(CurFilename)); -} - -Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { - set_scan_string(AsmString); - - CurFilename = "from_memory"; - if (M == NULL) { - return RunParser(new Module (CurFilename)); - } else { - return RunParser(M); - } +Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { + InitLLLexer(MB); + Module *M = RunParser(new Module(LLLgetFilename())); + FreeLexer(); + return M; } %} @@ -1113,7 +1090,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { // Function Attributes %token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST -%token CONST PURE +%token READNONE READONLY // Visibility Styles %token DEFAULT HIDDEN PROTECTED @@ -1257,8 +1234,8 @@ FuncAttr : NORETURN { $$ = ParamAttr::NoReturn; } | NOUNWIND { $$ = ParamAttr::NoUnwind; } | ZEROEXT { $$ = ParamAttr::ZExt; } | SIGNEXT { $$ = ParamAttr::SExt; } - | PURE { $$ = ParamAttr::Pure; } - | CONST { $$ = ParamAttr::Const; } + | READNONE { $$ = ParamAttr::ReadNone; } + | READONLY { $$ = ParamAttr::ReadOnly; } ; OptFuncAttrs : /* empty */ { $$ = ParamAttr::None; } @@ -1351,61 +1328,36 @@ Types CHECK_FOR_ERROR } | Types '(' ArgTypeListI ')' OptFuncAttrs { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. std::vector<const Type*> Params; - ParamAttrsVector Attrs; - if ($5 != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = 0; X.attrs = $5; - Attrs.push_back(X); - } - unsigned index = 1; TypeWithAttrsList::iterator I = $3->begin(), E = $3->end(); - for (; I != E; ++I, ++index) { + for (; I != E; ++I ) { const Type *Ty = I->Ty->get(); Params.push_back(Ty); - if (Ty != Type::VoidTy) - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; - Attrs.push_back(X); - } } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - ParamAttrsList *ActualAttrs = 0; - if (!Attrs.empty()) - ActualAttrs = ParamAttrsList::get(Attrs); - FunctionType *FT = FunctionType::get(*$1, Params, isVarArg, ActualAttrs); + FunctionType *FT = FunctionType::get(*$1, Params, isVarArg); delete $3; // Delete the argument list delete $1; // Delete the return type handle $$ = new PATypeHolder(HandleUpRefs(FT)); CHECK_FOR_ERROR } | VOID '(' ArgTypeListI ')' OptFuncAttrs { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. std::vector<const Type*> Params; - ParamAttrsVector Attrs; - if ($5 != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = 0; X.attrs = $5; - Attrs.push_back(X); - } TypeWithAttrsList::iterator I = $3->begin(), E = $3->end(); - unsigned index = 1; - for ( ; I != E; ++I, ++index) { + for ( ; I != E; ++I ) { const Type* Ty = I->Ty->get(); Params.push_back(Ty); - if (Ty != Type::VoidTy) - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs; - Attrs.push_back(X); - } } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - ParamAttrsList *ActualAttrs = 0; - if (!Attrs.empty()) - ActualAttrs = ParamAttrsList::get(Attrs); - - FunctionType *FT = FunctionType::get($1, Params, isVarArg, ActualAttrs); + FunctionType *FT = FunctionType::get($1, Params, isVarArg); delete $3; // Delete the argument list $$ = new PATypeHolder(HandleUpRefs(FT)); CHECK_FOR_ERROR @@ -1457,9 +1409,11 @@ Types ; ArgType - : Types OptParamAttrs { + : Types OptParamAttrs { + // Allow but ignore attributes on function types; this permits auto-upgrade. + // FIXME: remove in LLVM 3.0. $$.Ty = $1; - $$.Attrs = $2; + $$.Attrs = ParamAttr::None; } ; @@ -2264,7 +2218,9 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' std::vector<const Type*> ParamTypeList; ParamAttrsVector Attrs; if ($7 != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $7; + ParamAttrsWithIndex PAWI; + PAWI.index = 0; + PAWI.attrs = $7; Attrs.push_back(PAWI); } if ($5) { // If there are arguments... @@ -2276,7 +2232,9 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' ParamTypeList.push_back(Ty); if (Ty != Type::VoidTy) if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = I->Attrs; Attrs.push_back(PAWI); } } @@ -2289,7 +2247,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' if (!Attrs.empty()) PAL = ParamAttrsList::get(Attrs); - FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg, PAL); + FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); delete $2; @@ -2306,19 +2264,24 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' // Move the function to the end of the list, from whereever it was // previously inserted. Fn = cast<Function>(FWRef); + assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!"); CurModule.CurrentModule->getFunctionList().remove(Fn); CurModule.CurrentModule->getFunctionList().push_back(Fn); } else if (!FunctionName.empty() && // Merge with an earlier prototype? (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { - if (Fn->getFunctionType() != FT) { + if (Fn->getFunctionType() != FT ) { // The existing function doesn't have the same type. This is an overload // error. GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); + } else if (Fn->getParamAttrs() != PAL) { + // The existing function doesn't have the same parameter attributes. + // This is an overload error. + GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { // Neither the existing or the current function is a declaration and they // have the same name and same type. Clearly this is a redefinition. GEN_ERROR("Redefinition of function '" + FunctionName + "'"); - } if (Fn->isDeclaration()) { + } else if (Fn->isDeclaration()) { // Make sure to strip off any argument names so we can't get conflicts. for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) @@ -2327,7 +2290,6 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' } else { // Not already defined? Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName, CurModule.CurrentModule); - InsertValue(Fn, CurModule.Values); } @@ -2341,6 +2303,7 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')' Fn->setVisibility(CurFun.Visibility); } Fn->setCallingConv($1); + Fn->setParamAttrs(PAL); Fn->setAlignment($9); if ($8) { Fn->setSection(*$8); @@ -2620,28 +2583,14 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector<const Type*> ParamTypes; - ParamAttrsVector Attrs; - if ($8 != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $8; - Attrs.push_back(PAWI); - } ParamList::iterator I = $6->begin(), E = $6->end(); - unsigned index = 1; - for (; I != E; ++I, ++index) { + for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; - Attrs.push_back(PAWI); - } } - - ParamAttrsList *PAL = 0; - if (!Attrs.empty()) - PAL = ParamAttrsList::get(Attrs); - Ty = FunctionType::get($3->get(), ParamTypes, false, PAL); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::get(Ty); } @@ -2654,6 +2603,12 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... BasicBlock *Except = getBBVal($14); CHECK_FOR_ERROR + ParamAttrsVector Attrs; + if ($8 != ParamAttr::None) { + ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $8; + Attrs.push_back(PAWI); + } + // Check the arguments ValueList Args; if ($6->empty()) { // Has no arguments? @@ -2667,12 +2622,19 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + unsigned index = 1; - for (; ArgI != ArgE && I != E; ++ArgI, ++I) { + for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { if (ArgI->Val->getType() != *I) GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + (*I)->getDescription() + "'"); Args.push_back(ArgI->Val); + if (ArgI->Attrs != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = ArgI->Attrs; + Attrs.push_back(PAWI); + } } if (Ty->isVarArg()) { @@ -2683,9 +2645,14 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result... GEN_ERROR("Invalid number of parameters detected"); } + ParamAttrsList *PAL = 0; + if (!Attrs.empty()) + PAL = ParamAttrsList::get(Attrs); + // Create the InvokeInst InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); II->setCallingConv($2); + II->setParamAttrs(PAL); $$ = II; delete $6; CHECK_FOR_ERROR @@ -2756,33 +2723,39 @@ PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes }; -ParamList : Types ValueRef OptParamAttrs { +ParamList : Types OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); // Used for call and invoke instructions $$ = new ParamList(); - ParamListEntry E; E.Attrs = $3; E.Val = getVal($1->get(), $2); + ParamListEntry E; E.Attrs = $2 | $4; E.Val = getVal($1->get(), $3); $$->push_back(E); delete $1; + CHECK_FOR_ERROR } - | LABEL ValueRef OptParamAttrs { + | LABEL OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs $$ = new ParamList(); - ParamListEntry E; E.Attrs = $3; E.Val = getBBVal($2); + ParamListEntry E; E.Attrs = $2 | $4; E.Val = getBBVal($3); $$->push_back(E); + CHECK_FOR_ERROR } - | ParamList ',' Types ValueRef OptParamAttrs { + | ParamList ',' Types OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); $$ = $1; - ParamListEntry E; E.Attrs = $5; E.Val = getVal($3->get(), $4); + ParamListEntry E; E.Attrs = $4 | $6; E.Val = getVal($3->get(), $5); $$->push_back(E); delete $3; CHECK_FOR_ERROR } - | ParamList ',' LABEL ValueRef OptParamAttrs { + | ParamList ',' LABEL OptParamAttrs ValueRef OptParamAttrs { + // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 $$ = $1; - ParamListEntry E; E.Attrs = $5; E.Val = getBBVal($4); + ParamListEntry E; E.Attrs = $4 | $6; E.Val = getBBVal($5); $$->push_back(E); CHECK_FOR_ERROR } @@ -2937,29 +2910,14 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector<const Type*> ParamTypes; - ParamAttrsVector Attrs; - if ($8 != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = $8; - Attrs.push_back(PAWI); - } - unsigned index = 1; ParamList::iterator I = $6->begin(), E = $6->end(); - for (; I != E; ++I, ++index) { + for (; I != E; ++I) { const Type *Ty = I->Val->getType(); if (Ty == Type::VoidTy) GEN_ERROR("Short call syntax cannot be used with varargs"); ParamTypes.push_back(Ty); - if (I->Attrs != ParamAttr::None) { - ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs; - Attrs.push_back(PAWI); - } } - - ParamAttrsList *PAL = 0; - if (!Attrs.empty()) - PAL = ParamAttrsList::get(Attrs); - - Ty = FunctionType::get($3->get(), ParamTypes, false, PAL); + Ty = FunctionType::get($3->get(), ParamTypes, false); PFTy = PointerType::get(Ty); } @@ -2975,6 +2933,14 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { theF->getName() + "'"); } + // Set up the ParamAttrs for the function + ParamAttrsVector Attrs; + if ($8 != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = 0; + PAWI.attrs = $8; + Attrs.push_back(PAWI); + } // Check the arguments ValueList Args; if ($6->empty()) { // Has no arguments? @@ -2984,17 +2950,23 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { "expects arguments"); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified - // correctly! - // + // correctly. Also, gather any parameter attributes. FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); ParamList::iterator ArgI = $6->begin(), ArgE = $6->end(); + unsigned index = 1; - for (; ArgI != ArgE && I != E; ++ArgI, ++I) { + for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { if (ArgI->Val->getType() != *I) GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + (*I)->getDescription() + "'"); Args.push_back(ArgI->Val); + if (ArgI->Attrs != ParamAttr::None) { + ParamAttrsWithIndex PAWI; + PAWI.index = index; + PAWI.attrs = ArgI->Attrs; + Attrs.push_back(PAWI); + } } if (Ty->isVarArg()) { if (I == E) @@ -3003,10 +2975,17 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { } else if (I != E || ArgI != ArgE) GEN_ERROR("Invalid number of parameters detected"); } + + // Finish off the ParamAttrs and check them + ParamAttrsList *PAL = 0; + if (!Attrs.empty()) + PAL = ParamAttrsList::get(Attrs); + // Create the call node CallInst *CI = new CallInst(V, Args.begin(), Args.end()); CI->setTailCall($1); CI->setCallingConv($2); + CI->setParamAttrs(PAL); $$ = CI; delete $6; delete $3; @@ -3118,13 +3097,7 @@ MemoryInst : MALLOC Types OptCAlign { // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { - - llvmAsmlineno = 1; // Reset the current line number... CurModule.CurrentModule = M; -#if YYDEBUG - yydebug = Debug; -#endif - // Check to make sure the parser succeeded if (yyparse()) { if (ParserResult) @@ -3176,21 +3149,21 @@ static Module* RunParser(Module * M) { } void llvm::GenerateError(const std::string &message, int LineNo) { - if (LineNo == -1) LineNo = llvmAsmlineno; + if (LineNo == -1) LineNo = LLLgetLineNo(); // TODO: column number in exception if (TheParseError) - TheParseError->setError(CurFilename, message, LineNo); + TheParseError->setError(LLLgetFilename(), message, LineNo); TriggerError = 1; } int yyerror(const char *ErrorMsg) { - std::string where - = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) - + ":" + utostr((unsigned) llvmAsmlineno) + ": "; + std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; std::string errMsg = where + "error: " + std::string(ErrorMsg); - if (yychar != YYEMPTY && yychar != 0) - errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+ - "'"; + if (yychar != YYEMPTY && yychar != 0) { + errMsg += " while reading token: '"; + errMsg += std::string(LLLgetTokenStart(), + LLLgetTokenStart()+LLLgetTokenLength()) + "'"; + } GenerateError(errMsg); return 0; } diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 119a583..93542f3 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -329,15 +329,15 @@ bool BitcodeReader::ParseTypeTable() { ResultTy = PointerType::get(getTypeByID(Record[0], true)); break; case bitc::TYPE_CODE_FUNCTION: { - // FUNCTION: [vararg, attrid, retty, paramty x N] - if (Record.size() < 3) + // FUNCTION: [vararg, retty, paramty x N] + if (Record.size() < 2) return Error("Invalid FUNCTION type record"); std::vector<const Type*> ArgTys; - for (unsigned i = 3, e = Record.size(); i != e; ++i) + for (unsigned i = 2, e = Record.size(); i != e; ++i) ArgTys.push_back(getTypeByID(Record[i], true)); - ResultTy = FunctionType::get(getTypeByID(Record[2], true), ArgTys, - Record[0], getParamAttrs(Record[1])); + ResultTy = FunctionType::get(getTypeByID(Record[1], true), ArgTys, + Record[0]); break; } case bitc::TYPE_CODE_STRUCT: { // STRUCT: [ispacked, eltty x N] @@ -1033,9 +1033,8 @@ bool BitcodeReader::ParseModule(const std::string &ModuleID) { Func->setCallingConv(Record[1]); bool isProto = Record[2]; Func->setLinkage(GetDecodedLinkage(Record[3])); - - assert(Func->getFunctionType()->getParamAttrs() == - getParamAttrs(Record[4])); + const ParamAttrsList *PAL = getParamAttrs(Record[4]); + Func->setParamAttrs(PAL); Func->setAlignment((1 << Record[5]) >> 1); if (Record[6]) { @@ -1360,8 +1359,10 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { break; } - case bitc::FUNC_CODE_INST_INVOKE: { // INVOKE: [cc,fnty, op0,op1,op2, ...] + case bitc::FUNC_CODE_INST_INVOKE: { + // INVOKE: [attrs, cc, normBB, unwindBB, fnty, op0,op1,op2, ...] if (Record.size() < 4) return Error("Invalid INVOKE record"); + const ParamAttrsList *PAL = getParamAttrs(Record[0]); unsigned CCInfo = Record[1]; BasicBlock *NormalBB = getBasicBlock(Record[2]); BasicBlock *UnwindBB = getBasicBlock(Record[3]); @@ -1380,8 +1381,6 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { Record.size() < OpNum+FTy->getNumParams()) return Error("Invalid INVOKE record"); - assert(FTy->getParamAttrs() == getParamAttrs(Record[0])); - SmallVector<Value*, 16> Ops; for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i, ++OpNum) { Ops.push_back(getFnValueByID(Record[OpNum], FTy->getParamType(i))); @@ -1403,6 +1402,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { I = new InvokeInst(Callee, NormalBB, UnwindBB, Ops.begin(), Ops.end()); cast<InvokeInst>(I)->setCallingConv(CCInfo); + cast<InvokeInst>(I)->setParamAttrs(PAL); break; } case bitc::FUNC_CODE_INST_UNWIND: // UNWIND @@ -1482,10 +1482,12 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { I = new StoreInst(Val, Ptr, Record[OpNum+1], (1 << Record[OpNum]) >> 1); break; } - case bitc::FUNC_CODE_INST_CALL: { // CALL: [cc, fnty, fnid, arg0, arg1...] - if (Record.size() < 2) + case bitc::FUNC_CODE_INST_CALL: { + // CALL: [paramattrs, cc, fnty, fnid, arg0, arg1...] + if (Record.size() < 3) return Error("Invalid CALL record"); + const ParamAttrsList *PAL = getParamAttrs(Record[0]); unsigned CCInfo = Record[1]; unsigned OpNum = 2; @@ -1499,8 +1501,6 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { if (!FTy || Record.size() < FTy->getNumParams()+OpNum) return Error("Invalid CALL record"); - assert(FTy->getParamAttrs() == getParamAttrs(Record[0])); - SmallVector<Value*, 16> Args; // Read the fixed params. for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i, ++OpNum) { @@ -1527,6 +1527,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { I = new CallInst(Callee, Args.begin(), Args.end()); cast<CallInst>(I)->setCallingConv(CCInfo>>1); cast<CallInst>(I)->setTailCall(CCInfo & 1); + cast<CallInst>(I)->setParamAttrs(PAL); break; } case bitc::FUNC_CODE_INST_VAARG: { // VAARG: [valistty, valist, instty] diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 6bf2712..9249c70 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -147,8 +147,6 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) { Abbv = new BitCodeAbbrev(); Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_FUNCTION)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isvararg - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, - Log2_32_Ceil(VE.getParamAttrs().size()+1))); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(VE.getTypes().size()+1))); @@ -206,10 +204,9 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) { case Type::FunctionTyID: { const FunctionType *FT = cast<FunctionType>(T); - // FUNCTION: [isvararg, attrid, retty, paramty x N] + // FUNCTION: [isvararg, retty, paramty x N] Code = bitc::TYPE_CODE_FUNCTION; TypeVals.push_back(FT->isVarArg()); - TypeVals.push_back(VE.getParamAttrID(FT->getParamAttrs())); TypeVals.push_back(VE.getTypeID(FT->getReturnType())); for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) TypeVals.push_back(VE.getTypeID(FT->getParamType(i))); @@ -383,18 +380,13 @@ static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE, // Emit the function proto information. for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) { - // FUNCTION: [type, callingconv, isproto, linkage, alignment, section, - // visibility] + // FUNCTION: [type, callingconv, isproto, paramattr, + // linkage, alignment, section, visibility] Vals.push_back(VE.getTypeID(F->getType())); Vals.push_back(F->getCallingConv()); Vals.push_back(F->isDeclaration()); Vals.push_back(getEncodedLinkage(F)); - - // Note: we emit the param attr ID number for the function type of this - // function. In the future, we intend for attrs to be properties of - // functions, instead of on the type. This is to support this future work. - Vals.push_back(VE.getParamAttrID(F->getFunctionType()->getParamAttrs())); - + Vals.push_back(VE.getParamAttrID(F->getParamAttrs())); Vals.push_back(Log2_32(F->getAlignment())+1); Vals.push_back(F->hasSection() ? SectionMap[F->getSection()] : 0); Vals.push_back(getEncodedVisibility(F)); @@ -760,12 +752,9 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, const FunctionType *FTy = cast<FunctionType>(PTy->getElementType()); Code = bitc::FUNC_CODE_INST_INVOKE; - // Note: we emit the param attr ID number for the function type of this - // function. In the future, we intend for attrs to be properties of - // functions, instead of on the type. This is to support this future work. - Vals.push_back(VE.getParamAttrID(FTy->getParamAttrs())); - - Vals.push_back(cast<InvokeInst>(I).getCallingConv()); + const InvokeInst *II = cast<InvokeInst>(&I); + Vals.push_back(VE.getParamAttrID(II->getParamAttrs())); + Vals.push_back(II->getCallingConv()); Vals.push_back(VE.getValueID(I.getOperand(1))); // normal dest Vals.push_back(VE.getValueID(I.getOperand(2))); // unwind dest PushValueAndType(I.getOperand(0), InstID, Vals, VE); // callee @@ -837,14 +826,10 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, Code = bitc::FUNC_CODE_INST_CALL; - // Note: we emit the param attr ID number for the function type of this - // function. In the future, we intend for attrs to be properties of - // functions, instead of on the type. This is to support this future work. - Vals.push_back(VE.getParamAttrID(FTy->getParamAttrs())); - - Vals.push_back((cast<CallInst>(I).getCallingConv() << 1) | - unsigned(cast<CallInst>(I).isTailCall())); - PushValueAndType(I.getOperand(0), InstID, Vals, VE); // Callee + const CallInst *CI = cast<CallInst>(&I); + Vals.push_back(VE.getParamAttrID(CI->getParamAttrs())); + Vals.push_back((CI->getCallingConv() << 1) | unsigned(CI->isTailCall())); + PushValueAndType(CI->getOperand(0), InstID, Vals, VE); // Callee // Emit value #'s for the fixed parameters. for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 6b3885e..21b0372 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -17,6 +17,7 @@ #include "llvm/Module.h" #include "llvm/TypeSymbolTable.h" #include "llvm/ValueSymbolTable.h" +#include "llvm/Instructions.h" #include <algorithm> using namespace llvm; @@ -44,8 +45,10 @@ ValueEnumerator::ValueEnumerator(const Module *M) { EnumerateValue(I); // Enumerate the functions. - for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) + for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) { EnumerateValue(I); + EnumerateParamAttrs(cast<Function>(I)->getParamAttrs()); + } // Enumerate the aliases. for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end(); @@ -86,6 +89,10 @@ ValueEnumerator::ValueEnumerator(const Module *M) { OI != E; ++OI) EnumerateOperandType(*OI); EnumerateType(I->getType()); + if (const CallInst *CI = dyn_cast<CallInst>(I)) + EnumerateParamAttrs(CI->getParamAttrs()); + else if (const InvokeInst *II = dyn_cast<InvokeInst>(I)) + EnumerateParamAttrs(II->getParamAttrs()); } } @@ -220,10 +227,6 @@ void ValueEnumerator::EnumerateType(const Type *Ty) { for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); I != E; ++I) EnumerateType(*I); - - // If this is a function type, enumerate the param attrs. - if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) - EnumerateParamAttrs(FTy->getParamAttrs()); } // Enumerate the types for the specified value. If the value is a constant, @@ -296,6 +299,10 @@ void ValueEnumerator::incorporateFunction(const Function &F) { // Optimize the constant layout. OptimizeConstants(FirstFuncConstantID, Values.size()); + // Add the function's parameter attributes so they are available for use in + // the function's instruction. + EnumerateParamAttrs(F.getParamAttrs()); + FirstInstID = Values.size(); // Add all of the instructions. diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 270c9a9..3ba886f 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -499,11 +499,11 @@ public: unsigned Opc); bool isExportableFromCurrentBlock(Value *V, const BasicBlock *FromBB); void ExportFromCurrentBlock(Value *V); - void LowerCallTo(Instruction &I, - const Type *CalledValueTy, unsigned CallingConv, + void LowerCallTo(Instruction &I, const Type *CalledValueTy, + const ParamAttrsList *PAL, unsigned CallingConv, bool IsTailCall, SDOperand Callee, unsigned OpIdx, MachineBasicBlock *LandingPad = NULL); - + // Terminator instructions. void visitRet(ReturnInst &I); void visitBr(BranchInst &I); @@ -934,12 +934,11 @@ void SelectionDAGLowering::visitRet(ReturnInst &I) { TmpVT = TLI.getTypeToTransformTo(MVT::i32); else TmpVT = MVT::i32; - const FunctionType *FTy = I.getParent()->getParent()->getFunctionType(); - const ParamAttrsList *Attrs = FTy->getParamAttrs(); + const ParamAttrsList *PAL = I.getParent()->getParent()->getParamAttrs(); ISD::NodeType ExtendKind = ISD::ANY_EXTEND; - if (Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt)) + if (PAL && PAL->paramHasAttr(0, ParamAttr::SExt)) ExtendKind = ISD::SIGN_EXTEND; - if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ZExt)) + if (PAL && PAL->paramHasAttr(0, ParamAttr::ZExt)) ExtendKind = ISD::ZERO_EXTEND; RetOp = DAG.getNode(ExtendKind, TmpVT, RetOp); NewValues.push_back(RetOp); @@ -1450,7 +1449,7 @@ void SelectionDAGLowering::visitInvoke(InvokeInst &I) { MachineBasicBlock *Return = FuncInfo.MBBMap[I.getSuccessor(0)]; MachineBasicBlock *LandingPad = FuncInfo.MBBMap[I.getSuccessor(1)]; - LowerCallTo(I, I.getCalledValue()->getType(), + LowerCallTo(I, I.getCalledValue()->getType(), I.getParamAttrs(), I.getCallingConv(), false, getValue(I.getOperand(0)), @@ -2940,13 +2939,13 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { void SelectionDAGLowering::LowerCallTo(Instruction &I, const Type *CalledValueTy, + const ParamAttrsList *Attrs, unsigned CallingConv, bool IsTailCall, SDOperand Callee, unsigned OpIdx, MachineBasicBlock *LandingPad) { const PointerType *PT = cast<PointerType>(CalledValueTy); const FunctionType *FTy = cast<FunctionType>(PT->getElementType()); - const ParamAttrsList *Attrs = FTy->getParamAttrs(); MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); unsigned BeginLabel = 0, EndLabel = 0; @@ -3073,7 +3072,7 @@ void SelectionDAGLowering::visitCall(CallInst &I) { else Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy()); - LowerCallTo(I, I.getCalledValue()->getType(), + LowerCallTo(I, I.getCalledValue()->getType(), I.getParamAttrs(), I.getCallingConv(), I.isTailCall(), Callee, @@ -3893,8 +3892,7 @@ void SelectionDAGLowering::visitVACopy(CallInst &I) { /// integrated into SDISel. std::vector<SDOperand> TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { - const FunctionType *FTy = F.getFunctionType(); - const ParamAttrsList *Attrs = FTy->getParamAttrs(); + const ParamAttrsList *Attrs = F.getParamAttrs(); // Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node. std::vector<SDOperand> Ops; Ops.push_back(DAG.getRoot()); diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 0504580..0f2afe5 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -358,6 +358,7 @@ static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) { if (const Function *SrcF = dyn_cast<Function>(SrcGV)) { Function *DestF = cast<Function>(DestGV); DestF->setCallingConv(SrcF->getCallingConv()); + DestF->setParamAttrs(SrcF->getParamAttrs()); } } diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index f874a18..852e28d 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -126,12 +126,14 @@ namespace { std::ostream &printType(std::ostream &Out, const Type *Ty, bool isSigned = false, const std::string &VariableName = "", - bool IgnoreName = false); + bool IgnoreName = false, + const ParamAttrsList *PAL = 0); std::ostream &printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, const std::string &NameSoFar = ""); void printStructReturnPointerFunctionType(std::ostream &Out, + const ParamAttrsList *PAL, const PointerType *Ty); void writeOperand(Value *Operand); @@ -353,6 +355,7 @@ bool CBackendNameAllUsedStructsAndMergeFunctions::runOnModule(Module &M) { /// return type, except, instead of printing the type as void (*)(Struct*, ...) /// print it as "Struct (*)(...)", for struct return functions. void CWriter::printStructReturnPointerFunctionType(std::ostream &Out, + const ParamAttrsList *PAL, const PointerType *TheTy) { const FunctionType *FTy = cast<FunctionType>(TheTy->getElementType()); std::stringstream FunctionInnards; @@ -362,12 +365,11 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out, FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end(); const Type *RetTy = cast<PointerType>(I->get())->getElementType(); unsigned Idx = 1; - const ParamAttrsList *Attrs = FTy->getParamAttrs(); for (++I; I != E; ++I) { if (PrintedType) FunctionInnards << ", "; printType(FunctionInnards, *I, - /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), ""); + /*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt), ""); PrintedType = true; } if (FTy->isVarArg()) { @@ -379,7 +381,7 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out, FunctionInnards << ')'; std::string tstr = FunctionInnards.str(); printType(Out, RetTy, - /*isSigned=*/Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), tstr); + /*isSigned=*/PAL && PAL->paramHasAttr(0, ParamAttr::SExt), tstr); } std::ostream & @@ -422,7 +424,7 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, // std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, bool isSigned, const std::string &NameSoFar, - bool IgnoreName) { + bool IgnoreName, const ParamAttrsList* PAL) { if (Ty->isPrimitiveType() || Ty->isInteger()) { printSimpleType(Out, Ty, isSigned, NameSoFar); return Out; @@ -439,14 +441,13 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, const FunctionType *FTy = cast<FunctionType>(Ty); std::stringstream FunctionInnards; FunctionInnards << " (" << NameSoFar << ") ("; - const ParamAttrsList *Attrs = FTy->getParamAttrs(); unsigned Idx = 1; for (FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) FunctionInnards << ", "; - printType(FunctionInnards, *I, - /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), ""); + printType(FunctionInnards, *I, + /*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt), ""); ++Idx; } if (FTy->isVarArg()) { @@ -458,7 +459,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, FunctionInnards << ')'; std::string tstr = FunctionInnards.str(); printType(Out, FTy->getReturnType(), - /*isSigned=*/Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), tstr); + /*isSigned=*/PAL && PAL->paramHasAttr(0, ParamAttr::SExt), tstr); return Out; } case Type::StructTyID: { @@ -1836,7 +1837,7 @@ void CWriter::printContainedStructs(const Type *Ty, void CWriter::printFunctionSignature(const Function *F, bool Prototype) { /// isStructReturn - Should this function actually return a struct by-value? - bool isStructReturn = F->getFunctionType()->isStructReturn(); + bool isStructReturn = F->isStructReturn(); if (F->hasInternalLinkage()) Out << "static "; if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) "; @@ -1852,7 +1853,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) { // Loop over the arguments, printing them... const FunctionType *FT = cast<FunctionType>(F->getFunctionType()); - const ParamAttrsList *Attrs = FT->getParamAttrs(); + const ParamAttrsList *PAL = F->getParamAttrs(); std::stringstream FunctionInnards; @@ -1880,7 +1881,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) { else ArgName = ""; printType(FunctionInnards, I->getType(), - /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt), + /*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt), ArgName); PrintedArg = true; ++Idx; @@ -1901,7 +1902,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) { for (; I != E; ++I) { if (PrintedArg) FunctionInnards << ", "; printType(FunctionInnards, *I, - /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt)); + /*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt)); PrintedArg = true; ++Idx; } @@ -1929,7 +1930,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) { // Print out the return type and the signature built above. printType(Out, RetTy, - /*isSigned=*/ Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt), + /*isSigned=*/ PAL && PAL->paramHasAttr(0, ParamAttr::SExt), FunctionInnards.str()); } @@ -1944,7 +1945,7 @@ static inline bool isFPIntBitCast(const Instruction &I) { void CWriter::printFunction(Function &F) { /// isStructReturn - Should this function actually return a struct by-value? - bool isStructReturn = F.getFunctionType()->isStructReturn(); + bool isStructReturn = F.isStructReturn(); printFunctionSignature(&F, false); Out << " {\n"; @@ -2068,8 +2069,7 @@ void CWriter::printBasicBlock(BasicBlock *BB) { // void CWriter::visitReturnInst(ReturnInst &I) { // If this is a struct return function, return the temporary struct. - bool isStructReturn = I.getParent()->getParent()-> - getFunctionType()->isStructReturn(); + bool isStructReturn = I.getParent()->getParent()->isStructReturn(); if (isStructReturn) { Out << " return StructReturn;\n"; @@ -2594,7 +2594,8 @@ void CWriter::visitCallInst(CallInst &I) { // If this is a call to a struct-return function, assign to the first // parameter instead of passing it to the call. - bool isStructRet = FTy->isStructReturn(); + const ParamAttrsList *PAL = I.getParamAttrs(); + bool isStructRet = I.isStructReturn(); if (isStructRet) { Out << "*("; writeOperand(I.getOperand(1)); @@ -2633,7 +2634,7 @@ void CWriter::visitCallInst(CallInst &I) { if (!isStructRet) printType(Out, I.getCalledValue()->getType()); else - printStructReturnPointerFunctionType(Out, + printStructReturnPointerFunctionType(Out, PAL, cast<PointerType>(I.getCalledValue()->getType())); Out << ")(void*)"; } @@ -2652,7 +2653,6 @@ void CWriter::visitCallInst(CallInst &I) { ++ArgNo; } - const ParamAttrsList *Attrs = FTy->getParamAttrs(); bool PrintedArg = false; unsigned Idx = 1; for (; AI != AE; ++AI, ++ArgNo, ++Idx) { @@ -2661,7 +2661,7 @@ void CWriter::visitCallInst(CallInst &I) { (*AI)->getType() != FTy->getParamType(ArgNo)) { Out << '('; printType(Out, FTy->getParamType(ArgNo), - /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, ParamAttr::SExt)); + /*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt)); Out << ')'; } writeOperand(*AI); diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index b316588..2fe4f3b 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -1387,8 +1387,7 @@ void MSILWriter::printStaticInitializerList() { void MSILWriter::printFunction(const Function& F) { - const FunctionType* FTy = F.getFunctionType(); - const ParamAttrsList *Attrs = FTy->getParamAttrs(); + const ParamAttrsList *Attrs = F.getParamAttrs(); bool isSigned = Attrs && Attrs->paramHasAttr(0, ParamAttr::SExt); Out << "\n.method static "; Out << (F.hasInternalLinkage() ? "private " : "public "); diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 31e5010..1625e4c 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -93,13 +93,13 @@ void X86SharedAsmPrinter::decorateName(std::string &Name, case StdCall: // "Pure" variadic functions do not receive @0 suffix. if (!FT->isVarArg() || (FT->getNumParams() == 0) || - (FT->getNumParams() == 1 && FT->isStructReturn())) + (FT->getNumParams() == 1 && F->isStructReturn())) Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); break; case FastCall: // "Pure" variadic functions do not receive @0 suffix. if (!FT->isVarArg() || (FT->getNumParams() == 0) || - (FT->getNumParams() == 1 && FT->isStructReturn())) + (FT->getNumParams() == 1 && F->isStructReturn())) Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); if (Name[0] == '_') { diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 3fcae95..505c302 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -4927,7 +4927,7 @@ SDOperand X86TargetLowering::LowerTRAMPOLINE(SDOperand Op, // Check that ECX wasn't needed by an 'inreg' parameter. const FunctionType *FTy = Func->getFunctionType(); - const ParamAttrsList *Attrs = FTy->getParamAttrs(); + const ParamAttrsList *Attrs = Func->getParamAttrs(); if (Attrs && !Func->isVarArg()) { unsigned InRegCount = 0; diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 7479c8e..26d8853 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -35,6 +35,7 @@ #include "llvm/Module.h" #include "llvm/CallGraphSCCPass.h" #include "llvm/Instructions.h" +#include "llvm/ParameterAttributes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/Target/TargetData.h" @@ -139,10 +140,10 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) { // No promotable pointer arguments. if (PointerArgs.empty()) return false; - // Okay, promote all of the arguments are rewrite the callees! + // Okay, promote all of the arguments and rewrite the callees! Function *NewF = DoPromotion(F, PointerArgs); - // Update the call graph to know that the old function is gone. + // Update the call graph to know that the function has been transformed. getAnalysis<CallGraph>().changeFunction(F, NewF); return true; } @@ -349,9 +350,23 @@ Function *ArgPromotion::DoPromotion(Function *F, // what the new GEP/Load instructions we are inserting look like. std::map<std::vector<Value*>, LoadInst*> OriginalLoads; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) + // ParamAttrs - Keep track of the parameter attributes for the arguments + // that we are *not* promoting. For the ones that we do promote, the parameter + // attributes are lost + ParamAttrsVector ParamAttrsVec; + const ParamAttrsList *PAL = F->getParamAttrs(); + + unsigned index = 1; + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; + ++I, ++index) if (!ArgsToPromote.count(I)) { Params.push_back(I->getType()); + if (PAL) { + unsigned attrs = PAL->getParamAttrs(index); + if (attrs) + ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), + attrs)); + } } else if (I->use_empty()) { ++NumArgumentsDead; } else { @@ -387,6 +402,13 @@ Function *ArgPromotion::DoPromotion(Function *F, const Type *RetTy = FTy->getReturnType(); + // Recompute the parameter attributes list based on the new arguments for + // the function. + if (ParamAttrsVec.empty()) + PAL = 0; + else + PAL = ParamAttrsList::get(ParamAttrsVec); + // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which // have zero fixed arguments. bool ExtraArgHack = false; @@ -394,11 +416,14 @@ Function *ArgPromotion::DoPromotion(Function *F, ExtraArgHack = true; Params.push_back(Type::Int32Ty); } + + // Construct the new function type using the new arguments. FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); - // Create the new function body and insert it into the module... + // Create the new function body and insert it into the module... Function *NF = new Function(NFTy, F->getLinkage(), F->getName()); NF->setCallingConv(F->getCallingConv()); + NF->setParamAttrs(PAL); F->getParent()->getFunctionList().insert(F, NF); // Get the alias analysis information that we need to update to reflect our @@ -449,9 +474,11 @@ Function *ArgPromotion::DoPromotion(Function *F, New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(), Args.begin(), Args.end(), "", Call); cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv()); + cast<InvokeInst>(New)->setParamAttrs(PAL); } else { New = new CallInst(NF, Args.begin(), Args.end(), "", Call); cast<CallInst>(New)->setCallingConv(CS.getCallingConv()); + cast<CallInst>(New)->setParamAttrs(PAL); if (cast<CallInst>(Call)->isTailCall()) cast<CallInst>(New)->setTailCall(); } diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 3d345ee..a76a43a 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -26,6 +26,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Module.h" #include "llvm/Pass.h" +#include "llvm/ParameterAttributes.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" @@ -157,6 +158,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { // Create the new function body and insert it into the module... Function *NF = new Function(NFTy, Fn.getLinkage()); NF->setCallingConv(Fn.getCallingConv()); + NF->setParamAttrs(Fn.getParamAttrs()); Fn.getParent()->getFunctionList().insert(&Fn, NF); NF->takeName(&Fn); @@ -176,9 +178,11 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(), Args.begin(), Args.end(), "", Call); cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv()); + cast<InvokeInst>(New)->setParamAttrs(NF->getParamAttrs()); } else { New = new CallInst(NF, Args.begin(), Args.end(), "", Call); cast<CallInst>(New)->setCallingConv(CS.getCallingConv()); + cast<CallInst>(New)->setParamAttrs(NF->getParamAttrs()); if (cast<CallInst>(Call)->isTailCall()) cast<CallInst>(New)->setTailCall(); } @@ -233,10 +237,10 @@ static inline bool CallPassesValueThoughVararg(Instruction *Call, // (used in a computation), MaybeLive (only passed as an argument to a call), or // Dead (not used). DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { - const FunctionType *FTy = A.getParent()->getFunctionType(); + const Function *F = A.getParent(); // If this is the return value of a struct function, it's not really dead. - if (FTy->isStructReturn() && &*A.getParent()->arg_begin() == &A) + if (F->isStructReturn() && &*(F->arg_begin()) == &A) return Live; if (A.use_empty()) // First check, directly dead? @@ -488,10 +492,32 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { const FunctionType *FTy = F->getFunctionType(); std::vector<const Type*> Params; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) - if (!DeadArguments.count(I)) + // Set up to build a new list of parameter attributes + ParamAttrsVector ParamAttrsVec; + const ParamAttrsList *PAL = F->getParamAttrs(); + + // Construct the new parameter list from non-dead arguments. Also construct + // a new set of parameter attributes to correspond. + unsigned index = 1; + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; + ++I, ++index) + if (!DeadArguments.count(I)) { Params.push_back(I->getType()); + if (PAL) { + uint16_t Attrs = PAL->getParamAttrs(index); + if (Attrs != ParamAttr::None) + ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), + Attrs)); + } + } + + // Reconstruct the ParamAttrsList based on the vector we constructed. + if (ParamAttrsVec.empty()) + PAL = 0; + else + PAL = ParamAttrsList::get(ParamAttrsVec); + // Make the function return void if the return value is dead. const Type *RetTy = FTy->getReturnType(); if (DeadRetVal.count(F)) { RetTy = Type::VoidTy; @@ -507,11 +533,13 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { Params.push_back(Type::Int32Ty); } + // Create the new function type based on the recomputed parameters. FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); // Create the new function body and insert it into the module... Function *NF = new Function(NFTy, F->getLinkage()); NF->setCallingConv(F->getCallingConv()); + NF->setParamAttrs(PAL); F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); @@ -542,9 +570,11 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(), Args.begin(), Args.end(), "", Call); cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv()); + cast<InvokeInst>(New)->setParamAttrs(PAL); } else { New = new CallInst(NF, Args.begin(), Args.end(), "", Call); cast<CallInst>(New)->setCallingConv(CS.getCallingConv()); + cast<CallInst>(New)->setParamAttrs(PAL); if (cast<CallInst>(Call)->isTailCall()) cast<CallInst>(New)->setTailCall(); } diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp index ed22465..e5b2d41 100644 --- a/lib/Transforms/IPO/ExtractFunction.cpp +++ b/lib/Transforms/IPO/ExtractFunction.cpp @@ -95,6 +95,7 @@ namespace { Function *New = new Function(I->getFunctionType(), GlobalValue::ExternalLinkage); New->setCallingConv(I->getCallingConv()); + New->setParamAttrs(I->getParamAttrs()); // If it's not the named function, delete the body of the function I->dropAllReferences(); diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index dbc3199..90ece17 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -476,6 +476,8 @@ void LowerSetJmp::visitCallInst(CallInst& CI) InvokeInst* II = new InvokeInst(CI.getCalledValue(), NewBB, PrelimBBMap[Func], Params.begin(), Params.end(), CI.getName(), Term); + II->setCallingConv(CI.getCallingConv()); + II->setParamAttrs(CI.getParamAttrs()); // Replace the old call inst with the invoke inst and remove the call. CI.replaceAllUsesWith(II); diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index 52f8d5e..631b5f7 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -156,6 +156,7 @@ bool PruneEH::SimplifyFunction(Function *F) { Args.begin(), Args.end(), "", II); Call->takeName(II); Call->setCallingConv(II->getCallingConv()); + Call->setParamAttrs(II->getParamAttrs()); // Anything that used the value produced by the invoke instruction // now uses the value produced by the call instruction. diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index e90d190..52c66a5 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7994,13 +7994,15 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { const FunctionType *FT = Callee->getFunctionType(); const Type *OldRetTy = Caller->getType(); - const FunctionType *ActualFT = - cast<FunctionType>(cast<PointerType>(CE->getType())->getElementType()); - + const ParamAttrsList* CallerPAL = 0; + if (CallInst *CallerCI = dyn_cast<CallInst>(Caller)) + CallerPAL = CallerCI->getParamAttrs(); + else if (InvokeInst *CallerII = dyn_cast<InvokeInst>(Caller)) + CallerPAL = CallerII->getParamAttrs(); + // If the parameter attributes are not compatible, don't do the xform. We // don't want to lose an sret attribute or something. - if (!ParamAttrsList::areCompatible(FT->getParamAttrs(), - ActualFT->getParamAttrs())) + if (!ParamAttrsList::areCompatible(CallerPAL, Callee->getParamAttrs())) return false; // Check to see if we are changing the return type... @@ -8135,12 +8137,15 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { NC = new InvokeInst(Callee, II->getNormalDest(), II->getUnwindDest(), Args.begin(), Args.end(), Caller->getName(), Caller); cast<InvokeInst>(NC)->setCallingConv(II->getCallingConv()); + cast<InvokeInst>(NC)->setParamAttrs(CallerPAL); } else { NC = new CallInst(Callee, Args.begin(), Args.end(), Caller->getName(), Caller); - if (cast<CallInst>(Caller)->isTailCall()) + CallInst *CI = cast<CallInst>(Caller); + if (CI->isTailCall()) cast<CallInst>(NC)->setTailCall(); - cast<CallInst>(NC)->setCallingConv(cast<CallInst>(Caller)->getCallingConv()); + cast<CallInst>(NC)->setCallingConv(CI->getCallingConv()); + cast<CallInst>(NC)->setParamAttrs(CallerPAL); } // Insert a cast of the return type as necessary. @@ -8191,7 +8196,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { const PointerType *NestFPTy = cast<PointerType>(NestF->getType()); const FunctionType *NestFTy = cast<FunctionType>(NestFPTy->getElementType()); - if (const ParamAttrsList *NestAttrs = NestFTy->getParamAttrs()) { + if (const ParamAttrsList *NestAttrs = NestF->getParamAttrs()) { unsigned NestIdx = 1; const Type *NestTy = 0; uint16_t NestAttr = 0; @@ -8239,7 +8244,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { // Handle this by synthesizing a new function type, equal to FTy // with the chain parameter inserted. Likewise for attributes. - const ParamAttrsList *Attrs = FTy->getParamAttrs(); + const ParamAttrsList *Attrs = CS.getParamAttrs(); std::vector<const Type*> NewTypes; ParamAttrsVector NewAttrs; NewTypes.reserve(FTy->getNumParams()+1); @@ -8280,10 +8285,10 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { // Replace the trampoline call with a direct call. Let the generic // code sort out any function type mismatches. FunctionType *NewFTy = - FunctionType::get(FTy->getReturnType(), NewTypes, FTy->isVarArg(), - ParamAttrsList::get(NewAttrs)); + FunctionType::get(FTy->getReturnType(), NewTypes, FTy->isVarArg()); Constant *NewCallee = NestF->getType() == PointerType::get(NewFTy) ? NestF : ConstantExpr::getBitCast(NestF, PointerType::get(NewFTy)); + const ParamAttrsList *NewPAL = ParamAttrsList::get(NewAttrs); Instruction *NewCaller; if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) { @@ -8292,6 +8297,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { NewArgs.begin(), NewArgs.end(), Caller->getName(), Caller); cast<InvokeInst>(NewCaller)->setCallingConv(II->getCallingConv()); + cast<InvokeInst>(NewCaller)->setParamAttrs(NewPAL); } else { NewCaller = new CallInst(NewCallee, NewArgs.begin(), NewArgs.end(), Caller->getName(), Caller); @@ -8299,6 +8305,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { cast<CallInst>(NewCaller)->setTailCall(); cast<CallInst>(NewCaller)-> setCallingConv(cast<CallInst>(Caller)->getCallingConv()); + cast<CallInst>(NewCaller)->setParamAttrs(NewPAL); } if (Caller->getType() != Type::VoidTy && !Caller->use_empty()) Caller->replaceAllUsesWith(NewCaller); diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp index bac7ac7..aff3f2c 100644 --- a/lib/Transforms/Scalar/LowerGC.cpp +++ b/lib/Transforms/Scalar/LowerGC.cpp @@ -339,6 +339,8 @@ bool LowerGC::runOnFunction(Function &F) { Value *II = new InvokeInst(CI->getCalledValue(), NewBB, Cleanup, Args.begin(), Args.end(), CI->getName(), CBB); + cast<InvokeInst>(II)->setCallingConv(CI->getCallingConv()); + cast<InvokeInst>(II)->setParamAttrs(CI->getParamAttrs()); CI->replaceAllUsesWith(II); delete CI; } diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 3717a16..22d81c8 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -96,16 +96,11 @@ static bool IsNoReturn(const CallInst *CI) { if (Attrs->paramHasAttr(0, ParamAttr::NoReturn)) return true; - if (const Function *Callee = CI->getCalledFunction()) { + if (const Function *Callee = CI->getCalledFunction()) if (const ParamAttrsList *Attrs = Callee->getParamAttrs()) if (Attrs->paramHasAttr(0, ParamAttr::NoReturn)) return true; - - const FunctionType *FT = Callee->getFunctionType(); - if (const ParamAttrsList *Attrs = FT->getParamAttrs()) - if (Attrs->paramHasAttr(0, ParamAttr::NoReturn)) - return true; - } + return false; } @@ -115,16 +110,11 @@ static bool IsNoUnwind(const InvokeInst *II) { if (Attrs->paramHasAttr(0, ParamAttr::NoUnwind)) return true; - if (const Function *Callee = II->getCalledFunction()) { + if (const Function *Callee = II->getCalledFunction()) if (const ParamAttrsList *Attrs = Callee->getParamAttrs()) if (Attrs->paramHasAttr(0, ParamAttr::NoUnwind)) return true; - - const FunctionType *FT = Callee->getFunctionType(); - if (const ParamAttrsList *Attrs = FT->getParamAttrs()) - if (Attrs->paramHasAttr(0, ParamAttr::NoUnwind)) - return true; - } + return false; } diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index d1faf01..f05085f 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -79,6 +79,9 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, assert(ValueMap.count(I) && "No mapping from source argument specified!"); #endif + // Clone the parameter attributes + NewFunc->setParamAttrs(OldFunc->getParamAttrs()); + // Loop over all of the basic blocks in the function, cloning them as // appropriate. Note that we save BE this way in order to handle cloning of // recursive functions into themselves. @@ -304,7 +307,7 @@ ConstantFoldMappedInstruction(const Instruction *I) { /// effect of this is to copy significantly less code in cases where (for /// example) a function call with constant arguments is inlined, and those /// constant arguments cause a significant amount of code in the callee to be -/// dead. Since this doesn't produce an exactly copy of the input, it can't be +/// dead. Since this doesn't produce an exact copy of the input, it can't be /// used for things like CloneFunction or CloneModule. void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, DenseMap<const Value*, Value*> &ValueMap, diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index cd9f4b6..201da5b 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -66,6 +66,7 @@ Module *llvm::CloneModule(const Module *M, new Function(cast<FunctionType>(I->getType()->getElementType()), GlobalValue::ExternalLinkage, I->getName(), New); NF->setCallingConv(I->getCallingConv()); + NF->setParamAttrs(I->getParamAttrs()); ValueMap[I]= NF; } @@ -120,5 +121,3 @@ Module *llvm::CloneModule(const Module *M, return New; } - -// vim: sw=2 diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 96ad420..2a6d9ae 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -88,6 +88,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock, InvokeArgs.begin(), InvokeArgs.end(), CI->getName(), BB->getTerminator()); II->setCallingConv(CI->getCallingConv()); + II->setParamAttrs(CI->getParamAttrs()); // Make sure that anything using the call now uses the invoke! CI->replaceAllUsesWith(II); diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index acb2b52..24b167a 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -212,9 +212,10 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) { std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end()); // Insert a normal call instruction... CallInst *NewCall = new CallInst(II->getCalledValue(), - CallArgs.begin(), CallArgs.end(), "", II); + CallArgs.begin(), CallArgs.end(), "",II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); + NewCall->setParamAttrs(II->getParamAttrs()); II->replaceAllUsesWith(NewCall); // Insert an unconditional branch to the normal destination. @@ -273,6 +274,7 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo, II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); + NewCall->setParamAttrs(II->getParamAttrs()); II->replaceAllUsesWith(NewCall); // Replace the invoke with an uncond branch. diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 470daf3..1305fd9 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1376,6 +1376,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { CallInst *CI = new CallInst(II->getCalledValue(), Args.begin(), Args.end(), II->getName(), BI); CI->setCallingConv(II->getCallingConv()); + CI->setParamAttrs(II->getParamAttrs()); // If the invoke produced a value, the Call now does instead II->replaceAllUsesWith(CI); delete II; @@ -1751,6 +1752,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { Args.begin(), Args.end(), II->getName(), BI); CI->setCallingConv(II->getCallingConv()); + CI->setParamAttrs(II->getParamAttrs()); // If the invoke produced a value, the Call does now instead. II->replaceAllUsesWith(CI); delete II; diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 859807b..ef8161b 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -305,28 +305,17 @@ static void calcTypeName(const Type *Ty, const FunctionType *FTy = cast<FunctionType>(Ty); calcTypeName(FTy->getReturnType(), TypeStack, TypeNames, Result); Result += " ("; - unsigned Idx = 1; - const ParamAttrsList *Attrs = FTy->getParamAttrs(); for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { + E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) Result += ", "; calcTypeName(*I, TypeStack, TypeNames, Result); - if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) { - Result += + " "; - Result += Attrs->getParamAttrsTextByIndex(Idx); - } - Idx++; } if (FTy->isVarArg()) { if (FTy->getNumParams()) Result += ", "; Result += "..."; } Result += ")"; - if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) { - Result += " "; - Result += Attrs->getParamAttrsTextByIndex(0); - } break; } case Type::StructTyID: { @@ -749,6 +738,7 @@ public: inline void write(const Type *Ty) { printType(Ty); } void writeOperand(const Value *Op, bool PrintType); + void writeParamOperand(const Value *Operand, uint16_t Attrs); const Module* getModule() { return TheModule; } @@ -789,25 +779,17 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { else if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) { printType(FTy->getReturnType()); Out << " ("; - unsigned Idx = 1; - const ParamAttrsList *Attrs = FTy->getParamAttrs(); for (FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) Out << ", "; printType(*I); - if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) { - Out << " " << Attrs->getParamAttrsTextByIndex(Idx); - } - Idx++; } if (FTy->isVarArg()) { if (FTy->getNumParams()) Out << ", "; Out << "..."; } Out << ')'; - if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) - Out << ' ' << Attrs->getParamAttrsTextByIndex(0); } else if (const StructType *STy = dyn_cast<StructType>(Ty)) { if (STy->isPacked()) Out << '<'; @@ -850,6 +832,20 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType) { } } +void AssemblyWriter::writeParamOperand(const Value *Operand, uint16_t Attrs) { + if (Operand == 0) { + Out << "<null operand!>"; + } else { + Out << ' '; + // Print the type + printType(Operand->getType()); + // Print parameter attributes list + if (Attrs != ParamAttr::None) + Out << ' ' << ParamAttrsList::getParamAttrsText(Attrs); + // Print the operand + WriteAsOperandInternal(Out, Operand, TypeNames, &Machine); + } +} void AssemblyWriter::printModule(const Module *M) { if (!M->getModuleIdentifier().empty() && @@ -1066,7 +1062,7 @@ void AssemblyWriter::printFunction(const Function *F) { } const FunctionType *FT = F->getFunctionType(); - const ParamAttrsList *Attrs = FT->getParamAttrs(); + const ParamAttrsList *Attrs = F->getParamAttrs(); printType(F->getReturnType()) << ' '; if (!F->getName().empty()) Out << getLLVMName(F->getName(), GlobalPrefix); @@ -1139,6 +1135,7 @@ void AssemblyWriter::printArgument(const Argument *Arg, uint16_t Attrs) { // Output type... printType(Arg->getType()); + // Output parameter attributes list if (Attrs != ParamAttr::None) Out << ' ' << ParamAttrsList::getParamAttrsText(Attrs); @@ -1295,7 +1292,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { const PointerType *PTy = cast<PointerType>(Operand->getType()); const FunctionType *FTy = cast<FunctionType>(PTy->getElementType()); const Type *RetTy = FTy->getReturnType(); - const ParamAttrsList *PAL = FTy->getParamAttrs(); + const ParamAttrsList *PAL = CI->getParamAttrs(); // If possible, print out the short form of the call instruction. We can // only do this if the first argument is a pointer to a nonvararg function, @@ -1313,9 +1310,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { for (unsigned op = 1, Eop = I.getNumOperands(); op < Eop; ++op) { if (op > 1) Out << ','; - writeOperand(I.getOperand(op), true); - if (PAL && PAL->getParamAttrs(op) != ParamAttr::None) - Out << " " << PAL->getParamAttrsTextByIndex(op); + writeParamOperand(I.getOperand(op), PAL ? PAL->getParamAttrs(op) : 0); } Out << " )"; if (PAL && PAL->getParamAttrs(0) != ParamAttr::None) @@ -1324,7 +1319,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { const PointerType *PTy = cast<PointerType>(Operand->getType()); const FunctionType *FTy = cast<FunctionType>(PTy->getElementType()); const Type *RetTy = FTy->getReturnType(); - const ParamAttrsList *PAL = FTy->getParamAttrs(); + const ParamAttrsList *PAL = II->getParamAttrs(); // Print the calling convention being used. switch (II->getCallingConv()) { @@ -1353,9 +1348,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { for (unsigned op = 3, Eop = I.getNumOperands(); op < Eop; ++op) { if (op > 3) Out << ','; - writeOperand(I.getOperand(op), true); - if (PAL && PAL->getParamAttrs(op-2) != ParamAttr::None) - Out << " " << PAL->getParamAttrsTextByIndex(op-2); + writeParamOperand(I.getOperand(op), PAL ? PAL->getParamAttrs(op-2) : 0); } Out << " )"; diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index b56fe70..40c431c 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -127,9 +127,6 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { Function *F = CI->getCalledFunction(); assert(F && "CallInst has no function associated with it."); - - const FunctionType *FTy = F->getFunctionType(); - const FunctionType *NewFnTy = NewFn->getFunctionType(); switch(NewFn->getIntrinsicID()) { default: assert(0 && "Unknown function for CallInst upgrade."); @@ -149,10 +146,10 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { // Handle any uses of the old CallInst. if (!CI->use_empty()) { // Check for sign extend parameter attributes on the return values. - bool SrcSExt = NewFnTy->getParamAttrs() && - NewFnTy->getParamAttrs()->paramHasAttr(0,ParamAttr::SExt); - bool DestSExt = FTy->getParamAttrs() && - FTy->getParamAttrs()->paramHasAttr(0,ParamAttr::SExt); + bool SrcSExt = NewFn->getParamAttrs() && + NewFn->getParamAttrs()->paramHasAttr(0,ParamAttr::SExt); + bool DestSExt = F->getParamAttrs() && + F->getParamAttrs()->paramHasAttr(0,ParamAttr::SExt); // Construct an appropriate cast from the new return type to the old. CastInst *RetCast = CastInst::create( diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 2b83e6b..023cb55 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -161,7 +161,7 @@ ParamAttrsList::areCompatible(const ParamAttrsList *A, const ParamAttrsList *B){ void ParamAttrsList::Profile(FoldingSetNodeID &ID) const { for (unsigned i = 0; i < attrs.size(); ++i) { - unsigned val = attrs[i].attrs << 16 | attrs[i].index; + uint32_t val = uint32_t(attrs[i].attrs) << 16 | attrs[i].index; ID.AddInteger(val); } } @@ -170,7 +170,10 @@ static ManagedStatic<FoldingSet<ParamAttrsList> > ParamAttrsLists; ParamAttrsList * ParamAttrsList::get(const ParamAttrsVector &attrVec) { - assert(!attrVec.empty() && "Illegal to create empty ParamAttrsList"); + // If there are no attributes then return a null ParamAttrsList pointer. + if (attrVec.empty()) + return 0; + #ifndef NDEBUG for (unsigned i = 0, e = attrVec.size(); i < e; ++i) { assert(attrVec[i].attrs != ParamAttr::None @@ -179,15 +182,22 @@ ParamAttrsList::get(const ParamAttrsVector &attrVec) { && "Misordered ParamAttrsList!"); } #endif + + // Otherwise, build a key to look up the existing attributes. ParamAttrsList key(attrVec); FoldingSetNodeID ID; key.Profile(ID); void *InsertPos; ParamAttrsList* PAL = ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos); + + // If we didn't find any existing attributes of the same shape then + // create a new one and insert it. if (!PAL) { PAL = new ParamAttrsList(attrVec); ParamAttrsLists->InsertNode(PAL, InsertPos); } + + // Return the ParamAttrsList that we found or created. return PAL; } @@ -201,8 +211,8 @@ ParamAttrsList::~ParamAttrsList() { Function::Function(const FunctionType *Ty, LinkageTypes Linkage, const std::string &name, Module *ParentModule) - : GlobalValue(PointerType::get(Ty), Value::FunctionVal, 0, 0, Linkage, name) { - ParamAttrs = 0; + : GlobalValue(PointerType::get(Ty), Value::FunctionVal, 0, 0, Linkage, name), + ParamAttrs(0) { SymTab = new ValueSymbolTable(); assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy) @@ -259,16 +269,30 @@ void Function::setParent(Module *parent) { LeakDetector::removeGarbageObject(this); } -void Function::setParamAttrs(ParamAttrsList *attrs) { +void Function::setParamAttrs(const ParamAttrsList *attrs) { + // Avoid deleting the ParamAttrsList if they are setting the + // attributes to the same list. + if (ParamAttrs == attrs) + return; + + // Drop reference on the old ParamAttrsList if (ParamAttrs) ParamAttrs->dropRef(); + // Add reference to the new ParamAttrsList if (attrs) attrs->addRef(); + // Set the new ParamAttrsList. ParamAttrs = attrs; } +bool Function::isStructReturn() const { + if (ParamAttrs) + return ParamAttrs->paramHasAttr(1, ParamAttr::StructRet); + return false; +} + const FunctionType *Function::getFunctionType() const { return cast<FunctionType>(getType()->getElementType()); } diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 6bee186..7226f66 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -35,6 +35,18 @@ void CallSite::setCallingConv(unsigned CC) { else cast<InvokeInst>(I)->setCallingConv(CC); } +const ParamAttrsList* CallSite::getParamAttrs() const { + if (CallInst *CI = dyn_cast<CallInst>(I)) + return CI->getParamAttrs(); + else + return cast<InvokeInst>(I)->getParamAttrs(); +} +void CallSite::setParamAttrs(const ParamAttrsList *PAL) { + if (CallInst *CI = dyn_cast<CallInst>(I)) + CI->setParamAttrs(PAL); + else + cast<InvokeInst>(I)->setParamAttrs(PAL); +} @@ -341,8 +353,9 @@ CallInst::CallInst(Value *Func, const std::string &Name, CallInst::CallInst(const CallInst &CI) : Instruction(CI.getType(), Instruction::Call, new Use[CI.getNumOperands()], - CI.getNumOperands()) { - ParamAttrs = 0; + CI.getNumOperands()), + ParamAttrs(0) { + setParamAttrs(CI.getParamAttrs()); SubclassData = CI.SubclassData; Use *OL = OperandList; Use *InOL = CI.OperandList; @@ -350,7 +363,10 @@ CallInst::CallInst(const CallInst &CI) OL[i].init(InOL[i], this); } -void CallInst::setParamAttrs(ParamAttrsList *newAttrs) { +void CallInst::setParamAttrs(const ParamAttrsList *newAttrs) { + if (ParamAttrs == newAttrs) + return; + if (ParamAttrs) ParamAttrs->dropRef(); @@ -360,6 +376,12 @@ void CallInst::setParamAttrs(ParamAttrsList *newAttrs) { ParamAttrs = newAttrs; } +bool CallInst::isStructReturn() const { + if (ParamAttrs) + return ParamAttrs->paramHasAttr(1, ParamAttr::StructRet); + return false; +} + //===----------------------------------------------------------------------===// // InvokeInst Implementation //===----------------------------------------------------------------------===// @@ -397,8 +419,9 @@ void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException, InvokeInst::InvokeInst(const InvokeInst &II) : TerminatorInst(II.getType(), Instruction::Invoke, - new Use[II.getNumOperands()], II.getNumOperands()) { - ParamAttrs = 0; + new Use[II.getNumOperands()], II.getNumOperands()), + ParamAttrs(0) { + setParamAttrs(II.getParamAttrs()); SubclassData = II.SubclassData; Use *OL = OperandList, *InOL = II.OperandList; for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i) @@ -415,7 +438,10 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) { return setSuccessor(idx, B); } -void InvokeInst::setParamAttrs(ParamAttrsList *newAttrs) { +void InvokeInst::setParamAttrs(const ParamAttrsList *newAttrs) { + if (ParamAttrs == newAttrs) + return; + if (ParamAttrs) ParamAttrs->dropRef(); @@ -425,6 +451,12 @@ void InvokeInst::setParamAttrs(ParamAttrsList *newAttrs) { ParamAttrs = newAttrs; } +bool InvokeInst::isStructReturn() const { + if (ParamAttrs) + return ParamAttrs->paramHasAttr(1, ParamAttr::StructRet); + return false; +} + //===----------------------------------------------------------------------===// // ReturnInst Implementation //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index b8ce47b..1e58477 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/DerivedTypes.h" -#include "llvm/ParameterAttributes.h" #include "llvm/Constants.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/StringExtras.h" @@ -307,15 +306,10 @@ static std::string getTypeDescription(const Type *Ty, if (!Result.empty()) Result += " "; Result += getTypeDescription(FTy->getReturnType(), TypeStack) + " ("; - unsigned Idx = 1; - const ParamAttrsList *Attrs = FTy->getParamAttrs(); for (FunctionType::param_iterator I = FTy->param_begin(), - E = FTy->param_end(); I != E; ++I) { + E = FTy->param_end(); I != E; ++I) { if (I != FTy->param_begin()) Result += ", "; - if (Attrs && Attrs->getParamAttrs(Idx) != ParamAttr::None) - Result += Attrs->getParamAttrsTextByIndex(Idx); - Idx++; Result += getTypeDescription(*I, TypeStack); } if (FTy->isVarArg()) { @@ -323,9 +317,6 @@ static std::string getTypeDescription(const Type *Ty, Result += "..."; } Result += ")"; - if (Attrs && Attrs->getParamAttrs(0) != ParamAttr::None) { - Result += " " + Attrs->getParamAttrsTextByIndex(0); - } break; } case Type::StructTyID: { @@ -444,8 +435,8 @@ const IntegerType *Type::Int64Ty = new BuiltinIntegerType(64); FunctionType::FunctionType(const Type *Result, const std::vector<const Type*> &Params, - bool IsVarArgs, const ParamAttrsList *Attrs) - : DerivedType(FunctionTyID), isVarArgs(IsVarArgs), ParamAttrs(Attrs) { + bool IsVarArgs) + : DerivedType(FunctionTyID), isVarArgs(IsVarArgs) { ContainedTys = reinterpret_cast<PATypeHandle*>(this+1); NumContainedTys = Params.size() + 1; // + 1 for result type assert((Result->isFirstClassType() || Result == Type::VoidTy || @@ -667,16 +658,7 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2, FTy->getNumParams() != FTy2->getNumParams() || !TypesEqual(FTy->getReturnType(), FTy2->getReturnType(), EqTypes)) return false; - const ParamAttrsList *Attrs1 = FTy->getParamAttrs(); - const ParamAttrsList *Attrs2 = FTy2->getParamAttrs(); - if ((!Attrs1 && Attrs2) || (!Attrs2 && Attrs1) || - (Attrs1 && Attrs2 && (Attrs1->size() != Attrs2->size() || - (Attrs1->getParamAttrs(0) != Attrs2->getParamAttrs(0))))) - return false; - for (unsigned i = 0, e = FTy2->getNumParams(); i != e; ++i) { - if (Attrs1 && Attrs1->getParamAttrs(i+1) != Attrs2->getParamAttrs(i+1)) - return false; if (!TypesEqual(FTy->getParamType(i), FTy2->getParamType(i), EqTypes)) return false; } @@ -1055,12 +1037,10 @@ namespace llvm { class FunctionValType { const Type *RetTy; std::vector<const Type*> ArgTypes; - const ParamAttrsList *ParamAttrs; bool isVarArg; public: FunctionValType(const Type *ret, const std::vector<const Type*> &args, - bool IVA, const ParamAttrsList *attrs) - : RetTy(ret), ParamAttrs(attrs), isVarArg(IVA) { + bool isVA) : RetTy(ret), isVarArg(isVA) { for (unsigned i = 0; i < args.size(); ++i) ArgTypes.push_back(args[i]); } @@ -1068,9 +1048,7 @@ public: static FunctionValType get(const FunctionType *FT); static unsigned hashTypeStructure(const FunctionType *FT) { - unsigned Result = FT->getNumParams()*64 + FT->isVarArg(); - if (FT->getParamAttrs()) - Result += FT->getParamAttrs()->size()*2; + unsigned Result = FT->getNumParams()*2 + FT->isVarArg(); return Result; } @@ -1081,13 +1059,6 @@ public: if (isVarArg > MTV.isVarArg) return false; if (ArgTypes < MTV.ArgTypes) return true; if (ArgTypes > MTV.ArgTypes) return false; - if (ParamAttrs) - if (MTV.ParamAttrs) - return *ParamAttrs < *MTV.ParamAttrs; - else - return false; - else if (MTV.ParamAttrs) - return true; return false; } }; @@ -1102,18 +1073,15 @@ FunctionValType FunctionValType::get(const FunctionType *FT) { ParamTypes.reserve(FT->getNumParams()); for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) ParamTypes.push_back(FT->getParamType(i)); - return FunctionValType(FT->getReturnType(), ParamTypes, FT->isVarArg(), - FT->getParamAttrs()); + return FunctionValType(FT->getReturnType(), ParamTypes, FT->isVarArg()); } // FunctionType::get - The factory function for the FunctionType class... FunctionType *FunctionType::get(const Type *ReturnType, const std::vector<const Type*> &Params, - bool isVarArg, - const ParamAttrsList *Attrs) { - - FunctionValType VT(ReturnType, Params, isVarArg, Attrs); + bool isVarArg) { + FunctionValType VT(ReturnType, Params, isVarArg); FunctionType *FT = FunctionTypes->get(VT); if (FT) { return FT; @@ -1121,7 +1089,7 @@ FunctionType *FunctionType::get(const Type *ReturnType, FT = (FunctionType*) new char[sizeof(FunctionType) + sizeof(PATypeHandle)*(Params.size()+1)]; - new (FT) FunctionType(ReturnType, Params, isVarArg, Attrs); + new (FT) FunctionType(ReturnType, Params, isVarArg); FunctionTypes->add(VT, FT); #ifdef DEBUG_MERGE_TYPES @@ -1130,12 +1098,6 @@ FunctionType *FunctionType::get(const Type *ReturnType, return FT; } -bool FunctionType::isStructReturn() const { - if (ParamAttrs) - return ParamAttrs->paramHasAttr(1, ParamAttr::StructRet); - return false; -} - //===----------------------------------------------------------------------===// // Array Type Factory... // diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index a547721..eb7c90f 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -390,12 +390,12 @@ void Verifier::visitFunction(Function &F) { F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); - Assert1(!FT->isStructReturn() || FT->getReturnType() == Type::VoidTy, + Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy, "Invalid struct-return function!", &F); bool SawSRet = false; - if (const ParamAttrsList *Attrs = FT->getParamAttrs()) { + if (const ParamAttrsList *Attrs = F.getParamAttrs()) { bool SawNest = false; for (unsigned Idx = 0; Idx <= FT->getNumParams(); ++Idx) { @@ -448,7 +448,7 @@ void Verifier::visitFunction(Function &F) { } } - Assert1(SawSRet == FT->isStructReturn(), + Assert1(SawSRet == F.isStructReturn(), "StructReturn function with no sret attribute!", &F); // Check that this function meets the restrictions on this calling convention. |