From evan.cheng at apple.com Mon Oct 23 00:11:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Oct 2006 00:11:31 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll Message-ID: <200610230511.k9N5BVxv014150@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: store_op_load_fold2.ll updated: 1.4 -> 1.5 --- Log message: Fix test case. --- Diffs of the changes: (+3 -6) store_op_load_fold2.ll | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) Index: llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll diff -u llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.4 llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.5 --- llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll:1.4 Tue Aug 29 16:49:58 2006 +++ llvm/test/Regression/CodeGen/X86/store_op_load_fold2.ll Mon Oct 23 00:11:09 2006 @@ -9,21 +9,18 @@ internal fastcc int %dct_chroma(int %uv, int %cr_cbp) { entry: - br bool false, label %bb2611, label %cond_true129 + br bool true, label %cond_true2732.preheader, label %cond_true129 cond_true129: ; preds = %entry ret int 0 -bb2611: ; preds = %entry - br bool false, label %cond_true2732.preheader, label %cond_next2752 - cond_true2732.preheader: ; preds = %bb2611 %tmp2666 = getelementptr %struct.Macroblock* null, int 0, uint 13 ; [#uses=2] %tmp2674 = cast int 0 to ubyte ; [#uses=1] - br bool false, label %cond_true2732.preheader.split.us, label %cond_true2732.preheader.split + br bool true, label %cond_true2732.preheader.split.us, label %cond_true2732.preheader.split cond_true2732.preheader.split.us: ; preds = %cond_true2732.preheader - br bool false, label %cond_true2732.outer.us.us, label %cond_true2732.outer.us + br bool true, label %cond_true2732.outer.us.us, label %cond_true2732.outer.us cond_true2732.outer.us.us: ; preds = %cond_true2732.preheader.split.us %tmp2667.us.us = load long* %tmp2666 ; [#uses=1] From reid at x10sys.com Mon Oct 23 01:25:42 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Oct 2006 01:25:42 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Message-ID: <200610230625.k9N6PgnT015423@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.cpp.cvs updated: 1.18.2.6 -> 1.18.2.7 llvmAsmParser.h.cvs updated: 1.13.2.6 -> 1.13.2.7 llvmAsmParser.y.cvs updated: 1.18.2.6 -> 1.18.2.7 --- Log message: Regenerate. --- Diffs of the changes: (+239 -227) llvmAsmParser.cpp.cvs | 456 +++++++++++++++++++++++++------------------------- llvmAsmParser.h.cvs | 2 llvmAsmParser.y.cvs | 8 3 files changed, 239 insertions(+), 227 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.6 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.7 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.6 Sun Oct 22 03:59:00 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Mon Oct 23 01:25:18 2006 @@ -1091,7 +1091,13 @@ return Ty; } -// This function is +// This template function is used to obtain the correct opcode for an +// instruction when an obsolete opcode is encountered. The OpcodeInfo template +// keeps track of the opcode and the "obsolete" flag. These are generated by +// the lexer and obsolete will be true when the lexer encounters the token for +// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +// to maintain backwards compatibility for asm files that still have the "div" +// instruction. This function handles converting div -> [usf]div appropriately. template static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { if (OI.obsolete) { @@ -1293,7 +1299,7 @@ #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 999 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1005 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1334,7 +1340,7 @@ llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1338 "llvmAsmParser.tab.c" +#line 1344 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1346,7 +1352,7 @@ /* Line 219 of yacc.c. */ -#line 1350 "llvmAsmParser.tab.c" +#line 1356 "llvmAsmParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1681,32 +1687,32 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1122, 1122, 1123, 1131, 1132, 1142, 1142, 1142, 1142, - 1142, 1142, 1142, 1143, 1143, 1143, 1144, 1144, 1144, 1144, - 1144, 1144, 1146, 1146, 1150, 1150, 1150, 1150, 1151, 1151, - 1151, 1151, 1152, 1152, 1153, 1153, 1156, 1160, 1165, 1166, - 1167, 1168, 1169, 1170, 1171, 1172, 1174, 1175, 1176, 1177, - 1178, 1179, 1180, 1181, 1190, 1191, 1197, 1198, 1206, 1214, - 1215, 1220, 1221, 1222, 1227, 1241, 1241, 1242, 1242, 1244, - 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1255, 1255, 1255, - 1255, 1255, 1255, 1256, 1260, 1264, 1272, 1280, 1293, 1298, - 1310, 1320, 1324, 1335, 1340, 1346, 1347, 1351, 1355, 1366, - 1392, 1406, 1436, 1462, 1483, 1496, 1506, 1511, 1572, 1579, - 1588, 1594, 1600, 1604, 1608, 1616, 1627, 1659, 1667, 1691, - 1702, 1708, 1716, 1722, 1728, 1737, 1741, 1749, 1749, 1759, - 1767, 1772, 1776, 1780, 1784, 1799, 1821, 1824, 1827, 1827, - 1835, 1835, 1843, 1843, 1851, 1851, 1860, 1863, 1866, 1870, - 1883, 1884, 1886, 1890, 1899, 1904, 1910, 1912, 1917, 1922, - 1931, 1931, 1932, 1932, 1934, 1941, 1947, 1954, 1958, 1964, - 1969, 1974, 2069, 2069, 2071, 2079, 2079, 2081, 2086, 2087, - 2088, 2090, 2090, 2100, 2104, 2109, 2113, 2117, 2121, 2125, - 2129, 2133, 2137, 2141, 2166, 2170, 2184, 2188, 2194, 2194, - 2200, 2205, 2209, 2218, 2229, 2234, 2246, 2259, 2263, 2267, - 2272, 2281, 2300, 2309, 2365, 2369, 2376, 2387, 2400, 2409, - 2418, 2428, 2432, 2439, 2439, 2441, 2445, 2450, 2468, 2483, - 2497, 2510, 2518, 2526, 2534, 2540, 2560, 2583, 2589, 2595, - 2601, 2616, 2675, 2682, 2685, 2690, 2694, 2701, 2706, 2712, - 2717, 2723, 2731, 2743, 2758 + 0, 1128, 1128, 1129, 1137, 1138, 1148, 1148, 1148, 1148, + 1148, 1148, 1148, 1149, 1149, 1149, 1150, 1150, 1150, 1150, + 1150, 1150, 1152, 1152, 1156, 1156, 1156, 1156, 1157, 1157, + 1157, 1157, 1158, 1158, 1159, 1159, 1162, 1166, 1171, 1172, + 1173, 1174, 1175, 1176, 1177, 1178, 1180, 1181, 1182, 1183, + 1184, 1185, 1186, 1187, 1196, 1197, 1203, 1204, 1212, 1220, + 1221, 1226, 1227, 1228, 1233, 1247, 1247, 1248, 1248, 1250, + 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1261, 1261, 1261, + 1261, 1261, 1261, 1262, 1266, 1270, 1278, 1286, 1299, 1304, + 1316, 1326, 1330, 1341, 1346, 1352, 1353, 1357, 1361, 1372, + 1398, 1412, 1442, 1468, 1489, 1502, 1512, 1517, 1578, 1585, + 1594, 1600, 1606, 1610, 1614, 1622, 1633, 1665, 1673, 1697, + 1708, 1714, 1722, 1728, 1734, 1743, 1747, 1755, 1755, 1765, + 1773, 1778, 1782, 1786, 1790, 1805, 1827, 1830, 1833, 1833, + 1841, 1841, 1849, 1849, 1857, 1857, 1866, 1869, 1872, 1876, + 1889, 1890, 1892, 1896, 1905, 1910, 1916, 1918, 1923, 1928, + 1937, 1937, 1938, 1938, 1940, 1947, 1953, 1960, 1964, 1970, + 1975, 1980, 2075, 2075, 2077, 2085, 2085, 2087, 2092, 2093, + 2094, 2096, 2096, 2106, 2110, 2115, 2119, 2123, 2127, 2131, + 2135, 2139, 2143, 2147, 2172, 2176, 2190, 2194, 2200, 2200, + 2206, 2211, 2215, 2224, 2235, 2240, 2252, 2265, 2269, 2273, + 2278, 2287, 2306, 2315, 2371, 2375, 2382, 2393, 2406, 2415, + 2424, 2434, 2438, 2445, 2445, 2447, 2451, 2456, 2474, 2489, + 2503, 2516, 2524, 2532, 2540, 2546, 2566, 2589, 2595, 2601, + 2607, 2622, 2681, 2688, 2691, 2696, 2700, 2707, 2712, 2718, + 2723, 2729, 2737, 2749, 2764 }; #endif @@ -2975,7 +2981,7 @@ switch (yyn) { case 3: -#line 1123 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1129 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -2985,7 +2991,7 @@ break; case 5: -#line 1132 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1138 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -2995,7 +3001,7 @@ break; case 36: -#line 1156 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1162 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -3003,7 +3009,7 @@ break; case 37: -#line 1160 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3011,82 +3017,82 @@ break; case 38: -#line 1165 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1171 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 39: -#line 1166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 40: -#line 1167 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 41: -#line 1168 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1174 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 42: -#line 1169 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1175 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 43: -#line 1170 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1176 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 44: -#line 1171 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1177 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 45: -#line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1178 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 46: -#line 1174 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 47: -#line 1175 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 48: -#line 1176 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1182 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::CSRet; ;} break; case 49: -#line 1177 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 50: -#line 1178 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1184 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 51: -#line 1179 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1185 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 52: -#line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 53: -#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large!"); @@ -3096,12 +3102,12 @@ break; case 54: -#line 1190 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 55: -#line 1191 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3111,12 +3117,12 @@ break; case 56: -#line 1197 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1203 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 57: -#line 1198 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1204 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3126,7 +3132,7 @@ break; case 58: -#line 1206 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') @@ -3137,27 +3143,27 @@ break; case 59: -#line 1214 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 60: -#line 1215 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; case 61: -#line 1220 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 62: -#line 1221 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 63: -#line 1222 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1228 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -3166,7 +3172,7 @@ break; case 64: -#line 1227 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1233 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); @@ -3176,17 +3182,17 @@ break; case 66: -#line 1241 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1247 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; case 68: -#line 1242 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1248 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; case 69: -#line 1244 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -3196,7 +3202,7 @@ break; case 83: -#line 1256 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1262 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -3204,7 +3210,7 @@ break; case 84: -#line 1260 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1266 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR @@ -3212,7 +3218,7 @@ break; case 85: -#line 1264 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1270 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -3221,7 +3227,7 @@ break; case 86: -#line 1272 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1278 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3233,7 +3239,7 @@ break; case 87: -#line 1280 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1286 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3250,7 +3256,7 @@ break; case 88: -#line 1293 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); delete (yyvsp[-1].TypeVal); @@ -3259,7 +3265,7 @@ break; case 89: -#line 1298 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1304 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Packed array type? const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) @@ -3275,7 +3281,7 @@ break; case 90: -#line 1310 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1316 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3289,7 +3295,7 @@ break; case 91: -#line 1320 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1326 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -3297,7 +3303,7 @@ break; case 92: -#line 1324 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1330 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -3308,7 +3314,7 @@ break; case 93: -#line 1335 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1341 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); @@ -3317,7 +3323,7 @@ break; case 94: -#line 1340 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1346 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR @@ -3325,7 +3331,7 @@ break; case 96: -#line 1347 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1353 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR @@ -3333,7 +3339,7 @@ break; case 97: -#line 1351 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1357 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR @@ -3341,7 +3347,7 @@ break; case 98: -#line 1355 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1361 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR @@ -3349,7 +3355,7 @@ break; case 99: -#line 1366 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1372 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) @@ -3379,7 +3385,7 @@ break; case 100: -#line 1392 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1398 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3397,7 +3403,7 @@ break; case 101: -#line 1406 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1412 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3431,7 +3437,7 @@ break; case 102: -#line 1436 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1442 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) @@ -3461,7 +3467,7 @@ break; case 103: -#line 1462 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1468 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) @@ -3486,7 +3492,7 @@ break; case 104: -#line 1483 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) @@ -3503,7 +3509,7 @@ break; case 105: -#line 1496 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1502 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) @@ -3517,7 +3523,7 @@ break; case 106: -#line 1506 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1512 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); delete (yyvsp[-1].TypeVal); @@ -3526,7 +3532,7 @@ break; case 107: -#line 1511 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1517 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) @@ -3591,7 +3597,7 @@ break; case 108: -#line 1572 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1578 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); @@ -3602,7 +3608,7 @@ break; case 109: -#line 1579 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1585 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) @@ -3614,7 +3620,7 @@ break; case 110: -#line 1588 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1594 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3624,7 +3630,7 @@ break; case 111: -#line 1594 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1600 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3634,7 +3640,7 @@ break; case 112: -#line 1600 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1606 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getTrue(); CHECK_FOR_ERROR @@ -3642,7 +3648,7 @@ break; case 113: -#line 1604 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1610 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getFalse(); CHECK_FOR_ERROR @@ -3650,7 +3656,7 @@ break; case 114: -#line 1608 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1614 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); @@ -3660,7 +3666,7 @@ break; case 115: -#line 1616 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1622 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + @@ -3675,7 +3681,7 @@ break; case 116: -#line 1627 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1633 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); @@ -3711,7 +3717,7 @@ break; case 117: -#line 1659 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1665 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); @@ -3723,7 +3729,7 @@ break; case 118: -#line 1667 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1673 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); @@ -3751,7 +3757,7 @@ break; case 119: -#line 1691 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1697 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); @@ -3766,7 +3772,7 @@ break; case 120: -#line 1702 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1708 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); @@ -3776,7 +3782,7 @@ break; case 121: -#line 1708 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1714 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); @@ -3788,7 +3794,7 @@ break; case 122: -#line 1716 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1722 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -3798,7 +3804,7 @@ break; case 123: -#line 1722 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1728 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -3808,7 +3814,7 @@ break; case 124: -#line 1728 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1734 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -3818,7 +3824,7 @@ break; case 125: -#line 1737 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1743 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR @@ -3826,7 +3832,7 @@ break; case 126: -#line 1741 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1747 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); @@ -3835,17 +3841,17 @@ break; case 127: -#line 1749 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1755 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 128: -#line 1749 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1755 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 129: -#line 1759 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1765 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); @@ -3854,7 +3860,7 @@ break; case 130: -#line 1767 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1773 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); @@ -3863,7 +3869,7 @@ break; case 131: -#line 1772 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1778 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR @@ -3871,7 +3877,7 @@ break; case 132: -#line 1776 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1782 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR @@ -3879,7 +3885,7 @@ break; case 133: -#line 1780 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1786 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR @@ -3887,7 +3893,7 @@ break; case 134: -#line 1784 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1790 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -3904,7 +3910,7 @@ break; case 135: -#line 1799 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1805 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -3930,21 +3936,21 @@ break; case 136: -#line 1821 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1827 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; case 137: -#line 1824 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1830 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; case 138: -#line 1827 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1833 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); @@ -3954,14 +3960,14 @@ break; case 139: -#line 1832 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1838 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 140: -#line 1835 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1841 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -3970,7 +3976,7 @@ break; case 141: -#line 1839 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1845 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -3978,7 +3984,7 @@ break; case 142: -#line 1843 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1849 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -3987,7 +3993,7 @@ break; case 143: -#line 1847 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1853 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -3995,7 +4001,7 @@ break; case 144: -#line 1851 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1857 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); @@ -4005,7 +4011,7 @@ break; case 145: -#line 1856 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1862 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4013,27 +4019,27 @@ break; case 146: -#line 1860 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1866 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 147: -#line 1863 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1869 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 148: -#line 1866 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1872 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ;} break; case 149: -#line 1870 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1876 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); @@ -4049,17 +4055,17 @@ break; case 150: -#line 1883 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1889 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; case 151: -#line 1884 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1890 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; case 152: -#line 1886 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1892 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR @@ -4067,7 +4073,7 @@ break; case 153: -#line 1890 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1896 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); @@ -4080,7 +4086,7 @@ break; case 154: -#line 1899 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1905 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4089,7 +4095,7 @@ break; case 155: -#line 1904 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1910 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4098,7 +4104,7 @@ break; case 157: -#line 1912 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1918 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4107,7 +4113,7 @@ break; case 158: -#line 1917 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1923 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4116,19 +4122,19 @@ break; case 159: -#line 1922 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1928 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 163: -#line 1932 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1938 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 164: -#line 1934 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1940 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); @@ -4138,7 +4144,7 @@ break; case 165: -#line 1941 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1947 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4148,7 +4154,7 @@ break; case 166: -#line 1947 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1953 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4158,7 +4164,7 @@ break; case 167: -#line 1954 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1960 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR @@ -4166,7 +4172,7 @@ break; case 168: -#line 1958 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1964 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyval.ArgList)->push_back(std::pair >(); (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); @@ -4185,7 +4191,7 @@ break; case 170: -#line 1969 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1975 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -4193,7 +4199,7 @@ break; case 171: -#line 1975 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1981 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { UnEscapeLexed((yyvsp[-5].StrVal)); std::string FunctionName((yyvsp[-5].StrVal)); @@ -4290,7 +4296,7 @@ break; case 174: -#line 2071 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2077 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -4301,7 +4307,7 @@ break; case 177: -#line 2081 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2087 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4309,22 +4315,22 @@ break; case 179: -#line 2087 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2093 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; case 180: -#line 2088 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; case 181: -#line 2090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2096 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 182: -#line 2090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2096 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -4333,7 +4339,7 @@ break; case 183: -#line 2100 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2106 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4341,7 +4347,7 @@ break; case 184: -#line 2104 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2110 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4349,7 +4355,7 @@ break; case 185: -#line 2109 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2115 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR @@ -4357,7 +4363,7 @@ break; case 186: -#line 2113 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2119 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR @@ -4365,7 +4371,7 @@ break; case 187: -#line 2117 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2123 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR @@ -4373,7 +4379,7 @@ break; case 188: -#line 2121 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2127 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR @@ -4381,7 +4387,7 @@ break; case 189: -#line 2125 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2131 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR @@ -4389,7 +4395,7 @@ break; case 190: -#line 2129 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -4397,7 +4403,7 @@ break; case 191: -#line 2133 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2139 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -4405,7 +4411,7 @@ break; case 192: -#line 2137 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -4413,7 +4419,7 @@ break; case 193: -#line 2141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2147 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); int NumElements = (yyvsp[-1].ConstVector)->size(); @@ -4442,7 +4448,7 @@ break; case 194: -#line 2166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR @@ -4450,7 +4456,7 @@ break; case 195: -#line 2170 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2176 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); std::string AsmStr = std::string((yyvsp[-2].StrVal), End); @@ -4464,7 +4470,7 @@ break; case 196: -#line 2184 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2190 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR @@ -4472,7 +4478,7 @@ break; case 197: -#line 2188 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2194 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR @@ -4480,7 +4486,7 @@ break; case 200: -#line 2200 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2206 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR @@ -4488,7 +4494,7 @@ break; case 201: -#line 2205 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2211 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4496,7 +4502,7 @@ break; case 202: -#line 2209 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2215 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4504,7 +4510,7 @@ break; case 203: -#line 2218 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2224 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR @@ -4518,7 +4524,7 @@ break; case 204: -#line 2229 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2235 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); @@ -4527,7 +4533,7 @@ break; case 205: -#line 2234 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2240 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR @@ -4543,7 +4549,7 @@ break; case 206: -#line 2246 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2252 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); CHECK_FOR_ERROR @@ -4559,7 +4565,7 @@ break; case 207: -#line 2259 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2265 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR @@ -4567,7 +4573,7 @@ break; case 208: -#line 2263 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2269 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR @@ -4575,7 +4581,7 @@ break; case 209: -#line 2267 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2273 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -4584,7 +4590,7 @@ break; case 210: -#line 2272 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2278 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR @@ -4597,7 +4603,7 @@ break; case 211: -#line 2281 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2287 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR @@ -4620,7 +4626,7 @@ break; case 212: -#line 2300 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2306 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR @@ -4633,7 +4639,7 @@ break; case 213: -#line 2310 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2316 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -4692,7 +4698,7 @@ break; case 214: -#line 2365 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2371 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -4700,7 +4706,7 @@ break; case 215: -#line 2369 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2375 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -4708,7 +4714,7 @@ break; case 216: -#line 2376 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2382 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[-5].JumpTable); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4723,7 +4729,7 @@ break; case 217: -#line 2387 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2393 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4739,7 +4745,7 @@ break; case 218: -#line 2400 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2406 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); @@ -4751,7 +4757,7 @@ break; case 219: -#line 2409 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2415 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes (yyval.PHIList) = new std::list >(); Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); @@ -4764,7 +4770,7 @@ break; case 220: -#line 2418 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2424 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[-6].PHIList); Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); @@ -4776,7 +4782,7 @@ break; case 221: -#line 2428 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2434 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); @@ -4784,7 +4790,7 @@ break; case 222: -#line 2432 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2438 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[-2].ValueList); (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); @@ -4793,12 +4799,12 @@ break; case 224: -#line 2439 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2445 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = 0; ;} break; case 225: -#line 2441 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2447 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4806,7 +4812,7 @@ break; case 226: -#line 2445 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2451 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4814,7 +4820,7 @@ break; case 227: -#line 2450 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2456 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && !isa((*(yyvsp[-3].TypeVal)).get())) @@ -4836,7 +4842,7 @@ break; case 228: -#line 2468 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2474 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { if (!isa((yyvsp[-3].TypeVal)->get()) || @@ -4855,7 +4861,7 @@ break; case 229: -#line 2483 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if(isa((*(yyvsp[-3].TypeVal)).get())) { GEN_ERROR( @@ -4873,7 +4879,7 @@ break; case 230: -#line 2497 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2503 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; @@ -4890,7 +4896,7 @@ break; case 231: -#line 2510 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2516 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); @@ -4902,7 +4908,7 @@ break; case 232: -#line 2518 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2524 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast instruction to a non-primitive type: '" + @@ -4914,7 +4920,7 @@ break; case 233: -#line 2526 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2532 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); @@ -4926,7 +4932,7 @@ break; case 234: -#line 2534 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2540 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { NewVarArgs = true; (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); @@ -4936,7 +4942,7 @@ break; case 235: -#line 2540 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2546 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -4960,7 +4966,7 @@ break; case 236: -#line 2560 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2566 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -4987,7 +4993,7 @@ break; case 237: -#line 2583 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2589 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -4997,7 +5003,7 @@ break; case 238: -#line 2589 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2595 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -5007,7 +5013,7 @@ break; case 239: -#line 2595 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2601 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -5017,7 +5023,7 @@ break; case 240: -#line 2601 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2607 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -5036,7 +5042,7 @@ break; case 241: -#line 2616 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2622 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -5099,7 +5105,7 @@ break; case 242: -#line 2675 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2681 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR @@ -5107,7 +5113,7 @@ break; case 243: -#line 2682 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2688 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR @@ -5115,7 +5121,7 @@ break; case 244: -#line 2685 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2691 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR @@ -5123,7 +5129,7 @@ break; case 245: -#line 2690 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2696 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5131,7 +5137,7 @@ break; case 246: -#line 2694 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2700 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5139,7 +5145,7 @@ break; case 247: -#line 2701 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2707 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5148,7 +5154,7 @@ break; case 248: -#line 2706 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2712 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5158,7 +5164,7 @@ break; case 249: -#line 2712 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2718 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5167,7 +5173,7 @@ break; case 250: -#line 2717 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2723 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5177,7 +5183,7 @@ break; case 251: -#line 2723 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2729 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5188,7 +5194,7 @@ break; case 252: -#line 2731 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2737 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + @@ -5204,7 +5210,7 @@ break; case 253: -#line 2743 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2749 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) @@ -5223,7 +5229,7 @@ break; case 254: -#line 2758 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2764 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); @@ -5255,7 +5261,7 @@ } /* Line 1126 of yacc.c. */ -#line 5259 "llvmAsmParser.tab.c" +#line 5265 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -5523,7 +5529,7 @@ } -#line 2784 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2790 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.6 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.7 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.6 Sun Oct 22 03:59:00 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Mon Oct 23 01:25:19 2006 @@ -253,7 +253,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 999 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1005 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.6 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.7 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.6 Sun Oct 22 03:59:00 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Mon Oct 23 01:25:19 2006 @@ -813,7 +813,13 @@ return Ty; } -// This function is +// This template function is used to obtain the correct opcode for an +// instruction when an obsolete opcode is encountered. The OpcodeInfo template +// keeps track of the opcode and the "obsolete" flag. These are generated by +// the lexer and obsolete will be true when the lexer encounters the token for +// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +// to maintain backwards compatibility for asm files that still have the "div" +// instruction. This function handles converting div -> [usf]div appropriately. template static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { if (OI.obsolete) { From reid at x10sys.com Mon Oct 23 01:58:50 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 23 Oct 2006 01:58:50 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/docs/LangRef.html Message-ID: <200610230658.k9N6woab015982@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.158 -> 1.158.2.1 --- Log message: Document the udiv, sdiv and fdiv replacements for the div instruction. --- Diffs of the changes: (+56 -12) LangRef.html | 68 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 56 insertions(+), 12 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.158 llvm/docs/LangRef.html:1.158.2.1 --- llvm/docs/LangRef.html:1.158 Sun Oct 15 15:05:59 2006 +++ llvm/docs/LangRef.html Mon Oct 23 01:58:29 2006 @@ -77,7 +77,9 @@
  • 'add' Instruction
  • 'sub' Instruction
  • 'mul' Instruction
  • -
  • 'div' Instruction
  • +
  • 'udiv' Instruction
  • +
  • 'sdiv' Instruction
  • +
  • 'fdiv' Instruction
  • 'rem' Instruction
  • 'setcc' Instructions
  • @@ -1630,26 +1632,68 @@ -
    'div' + +
    +
    Syntax:
    +
      <result> = udiv <ty> <var1>, <var2>   ; yields {ty}:result
    +
    +
    Overview:
    +

    The 'udiv' instruction returns the quotient of its two +operands.

    +
    Arguments:
    +

    The two arguments to the 'div' instruction must be +integer values. The arguments are considered to be +unsigned integer quantities. This instruction can also take +packed versions of the values. Both arguments must +have identical types.

    +
    Semantics:
    +

    The value produced is the unsigned integer quotient of the two operands.

    +
    Example:
    +
      <result> = udiv uint 4, %var          ; yields {uint}:result = 4 / %var
    +
    +
    + + +
    +
    Syntax:
    +
      <result> = sdiv <ty> <var1>, <var2>   ; yields {ty}:result
    +
    +
    Overview:
    +

    The 'sdiv' instruction returns the quotient of its two +operands.

    +
    Arguments:
    +

    The two arguments to the 'sdiv' instruction must be +integer values. The arguments are considered to be +signed integer quantities. This instruction can also take +packed versions of the values. Both arguments must +have identical types.

    +
    Semantics:
    +

    The value produced is the signed integer quotient of the two operands.

    +
    Example:
    +
      <result> = sdiv int 4, %var          ; yields {int}:result = 4 / %var
    +
    +
    + +
    Syntax:
    -
      <result> = div <ty> <var1>, <var2>   ; yields {ty}:result
    +
      <result> = fdiv <ty> <var1>, <var2>   ; yields {ty}:result
     
    Overview:
    -

    The 'div' instruction returns the quotient of its two +

    The 'fdiv' instruction returns the quotient of its two operands.

    Arguments:
    -

    The two arguments to the 'div' instruction must be either integer or floating point -values. -This instruction can also take packed versions of the values. +

    The two arguments to the 'div' instruction must be +floating point values. This instruction can also +take packed versions of the values. Both arguments must have identical types.

    Semantics:
    -

    The value produced is the integer or floating point quotient of the -two operands.

    +

    The value produced is the floating point quotient of the two operands.

    Example:
    -
      <result> = div int 4, %var          ; yields {int}:result = 4 / %var
    +
      <result> = fdiv float 4.0, %var          ; yields {float}:result = 4.0 / %var
     
    @@ -3910,7 +3954,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/15 20:05:59 $ + Last modified: $Date: 2006/10/23 06:58:29 $ From jlaskey at apple.com Mon Oct 23 09:39:39 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 23 Oct 2006 09:39:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200610231439.k9NEddZn032559@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.155 -> 1.156 --- Log message: [SU]int update - inactive code may get activated someday --- Diffs of the changes: (+1 -1) Local.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.155 llvm/lib/Analysis/DataStructure/Local.cpp:1.156 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.155 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Analysis/DataStructure/Local.cpp Mon Oct 23 09:39:22 2006 @@ -419,7 +419,7 @@ #if 0 if (const SequentialType *STy = cast(*I)) { CurTy = STy->getElementType(); - if (ConstantSInt *CS = dyn_cast(GEP.getOperand(i))) { + if (ConstantInt *CS = dyn_cast(GEP.getOperand(i))) { Offset += CS->getValue()*TD.getTypeSize(CurTy); } else { // Variable index into a node. We must merge all of the elements of the From jlaskey at apple.com Mon Oct 23 09:56:52 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 23 Oct 2006 09:56:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp DwarfWriter.cpp MachineDebugInfo.cpp Message-ID: <200610231456.k9NEuq8o000367@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.19 -> 1.20 DwarfWriter.cpp updated: 1.83 -> 1.84 MachineDebugInfo.cpp updated: 1.51 -> 1.52 --- Log message: More complete solution to deleting blocks and debug info. --- Diffs of the changes: (+28 -14) BranchFolding.cpp | 2 +- DwarfWriter.cpp | 21 ++++++++++++++++++--- MachineDebugInfo.cpp | 19 +++++++++---------- 3 files changed, 28 insertions(+), 14 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.19 llvm/lib/CodeGen/BranchFolding.cpp:1.20 --- llvm/lib/CodeGen/BranchFolding.cpp:1.19 Sat Oct 21 01:11:43 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Mon Oct 23 09:56:37 2006 @@ -75,7 +75,7 @@ I != E; ++I) { if ((unsigned)I->getOpcode() == DWARF_LABELOpc) { // The label ID # is always operand #0, an immediate. - MDI->RemoveLabelInfo(I->getOperand(0).getImm()); + MDI->InvalidateLabel(I->getOperand(0).getImm()); } } } Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.83 llvm/lib/CodeGen/DwarfWriter.cpp:1.84 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.83 Tue Oct 17 17:06:46 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Mon Oct 23 09:56:37 2006 @@ -1755,17 +1755,24 @@ // FIXME - Ignore inlined functions for the time being. if (!Scope->getParent()) continue; + unsigned StartID = Scope->getStartLabelID(); + unsigned EndID = Scope->getEndLabelID(); + + // Throw out scope if block is discarded. + if (StartID && !DebugInfo->isLabelValid(StartID)) continue; + if (EndID && !DebugInfo->isLabelValid(EndID)) continue; + DIE *ScopeDie = new DIE(DW_TAG_lexical_block); // Add the scope bounds. - if (unsigned StartID = Scope->getStartLabelID()) { + if (StartID) { ScopeDie->AddLabel(DW_AT_low_pc, DW_FORM_addr, DWLabel("loc", StartID)); } else { ScopeDie->AddLabel(DW_AT_low_pc, DW_FORM_addr, DWLabel("func_begin", SubprogramCount)); } - if (unsigned EndID = Scope->getEndLabelID()) { + if (EndID) { ScopeDie->AddLabel(DW_AT_high_pc, DW_FORM_addr, DWLabel("loc", EndID)); } else { @@ -1975,6 +1982,10 @@ for (unsigned i = 0, N = Moves.size(); i < N; ++i) { MachineMove *Move = Moves[i]; unsigned LabelID = Move->getLabelID(); + + // Throw out move if the label is invalid. + if (LabelID && !DebugInfo->isLabelValid(LabelID)) continue; + const MachineLocation &Dst = Move->getDestination(); const MachineLocation &Src = Move->getSource(); @@ -2194,6 +2205,10 @@ // Construct rows of the address, source, line, column matrix. for (unsigned i = 0, N = LineInfos.size(); i < N; ++i) { const SourceLineInfo &LineInfo = LineInfos[i]; + unsigned LabelID = LineInfo.getLabelID(); + + // Throw out line info if label is invalid. + if (!DebugInfo->isLabelValid(LabelID)) continue; if (DwarfVerbose) { unsigned SourceID = LineInfo.getSourceID(); @@ -2210,7 +2225,7 @@ EmitInt8(0); EOL("Extended Op"); EmitInt8(4 + 1); EOL("Op size"); EmitInt8(DW_LNE_set_address); EOL("DW_LNE_set_address"); - EmitReference("loc", LineInfo.getLabelID()); EOL("Location label"); + EmitReference("loc", LabelID); EOL("Location label"); // If change of source, then switch to the new source. if (Source != LineInfo.getSourceID()) { Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.51 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.52 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.51 Fri Oct 20 02:07:24 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Mon Oct 23 09:56:37 2006 @@ -1451,6 +1451,7 @@ , LabelID(0) , ScopeMap() , RootScope(NULL) +, DeletedLabelIDs() , FrameMoves() {} MachineDebugInfo::~MachineDebugInfo() { @@ -1543,20 +1544,18 @@ return ID; } -static bool LabelUIDComparison(const SourceLineInfo &LI, unsigned UID) { - return LI.getLabelID() < UID; +/// InvalidateLabel - Inhibit use of the specified label # from +/// MachineDebugInfo, for example because the code was deleted. +void MachineDebugInfo::InvalidateLabel(unsigned LabelID) { + DeletedLabelIDs.insert(LabelID); } -/// RemoveLabelInfo - Remove the specified label # from MachineDebugInfo, for -/// example because the code was deleted. -void MachineDebugInfo::RemoveLabelInfo(unsigned LabelUID) { - std::vector::iterator I = - std::lower_bound(Lines.begin(), Lines.end(), LabelUID, LabelUIDComparison); - assert(I != Lines.end() && "Didn't find label UID in MachineDebugInfo!"); - Lines.erase(I); +/// isLabelValid - Check to make sure the label is still valid before +/// attempting to use. +bool MachineDebugInfo::isLabelValid(unsigned LabelID) { + return DeletedLabelIDs.find(LabelID) == DeletedLabelIDs.end(); } - /// RecordSource - Register a source file with debug info. Returns an source /// ID. unsigned MachineDebugInfo::RecordSource(const std::string &Directory, From jlaskey at apple.com Mon Oct 23 09:56:53 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 23 Oct 2006 09:56:53 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Message-ID: <200610231456.k9NEurbb000373@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.42 -> 1.43 --- Log message: More complete solution to deleting blocks and debug info. --- Diffs of the changes: (+14 -5) MachineDebugInfo.h | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.42 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.43 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.42 Tue Oct 17 18:16:42 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Mon Oct 23 09:56:37 2006 @@ -30,6 +30,8 @@ #ifndef LLVM_CODEGEN_MACHINEDEBUGINFO_H #define LLVM_CODEGEN_MACHINEDEBUGINFO_H +#include + #include "llvm/Support/Dwarf.h" #include "llvm/Support/DataTypes.h" #include "llvm/ADT/UniqueVector.h" @@ -979,6 +981,10 @@ // DebugScope *RootScope; + // DeletedLabelIDs - List of label IDs that have been removed from the + // module. + std::set DeletedLabelIDs; + // FrameMoves - List of moves done by a function's prolog. Used to construct // frame maps by debug consumers. std::vector FrameMoves; @@ -1029,11 +1035,14 @@ /// provide correspondence to the source line list. unsigned RecordLabel(unsigned Line, unsigned Column, unsigned Source); - /// RemoveLabelInfo - Remove the specified label # from MachineDebugInfo, for - /// example because the code was deleted. - void RemoveLabelInfo(unsigned LabelUID); - - + /// InvalidateLabel - Inhibit use of the specified label # from + /// MachineDebugInfo, for example because the code was deleted. + void InvalidateLabel(unsigned LabelID); + + /// isLabelValid - Check to make sure the label is still valid before + /// attempting to use. + bool isLabelValid(unsigned LabelID); + /// RecordSource - Register a source file with debug info. Returns an source /// ID. unsigned RecordSource(const std::string &Directory, From zhousheng00 at gmail.com Mon Oct 23 13:01:25 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:01:25 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200610231801.k9NI1PN7003747@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.18.2.3 -> 1.18.2.4 --- Log message: --- Diffs of the changes: (+1 -1) StackerCompiler.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.3 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.4 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.18.2.3 Thu Oct 19 23:27:18 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Mon Oct 23 13:01:10 2006 @@ -1052,7 +1052,7 @@ LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); BinaryOperator* divop = - BinaryOperator::create( Instruction::Rem, op1, op2); + BinaryOperator::create( Instruction::SRem, op1, op2); bb->getInstList().push_back( divop ); push_value( bb, divop ); break; From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200610231813.k9NIDw8U004097@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.198.2.6 -> 1.198.2.7 --- Log message: --- Diffs of the changes: (+15 -6) Reader.cpp | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.6 llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.7 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.6 Sun Oct 22 18:28:40 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Oct 23 13:13:26 2006 @@ -643,7 +643,15 @@ break; case 11: // Rem - Opcode = Instruction::Rem; + // As with "Div", make the signed/unsigned or floating point + // Rem instruction choice based + // on the type of the operands. + if (iType == 10 || iType == 11) + Opcode = Instruction::FRem; + else if (iType >= 2 && iType <= 9 && iType % 2 != 0) + Opcode = Instruction::SRem; + else + Opcode = Instruction::URem; break; case 12: // And Opcode = Instruction::And; @@ -1653,14 +1661,15 @@ break; case 11: // Rem - // As with "Div", make the signed/unsigned Rem instruction choice based - // on the type of the instruction. + // As with "Div", make the signed/unsigned or floating point + // Rem instruction choice based + // on the type of the operands. if (ArgVec[0]->getType()->isFloatingPoint()) - Opcode = Instruction::Rem; + Opcode = Instruction::FRem; else if (ArgVec[0]->getType()->isSigned()) - Opcode = Instruction::Rem; + Opcode = Instruction::SRem; else - Opcode = Instruction::Rem; + Opcode = Instruction::URem; break; case 12: // And From zhousheng00 at gmail.com Mon Oct 23 13:13:55 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:55 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200610231813.k9NIDt6V004023@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.53.2.3 -> 1.53.2.4 --- Log message: --- Diffs of the changes: (+1 -1) ScalarEvolution.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.3 llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.4 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.3 Thu Oct 19 23:27:17 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Oct 23 13:13:26 2006 @@ -2148,7 +2148,7 @@ if (SCEVConstant *StartC = dyn_cast(Start)) { ConstantInt *StartCC = StartC->getValue(); Constant *StartNegC = ConstantExpr::getNeg(StartCC); - Constant *Rem = ConstantExpr::getRem(StartNegC, StepC->getValue()); + Constant *Rem = ConstantExpr::getSRem(StartNegC, StepC->getValue()); if (Rem->isNullValue()) { Constant *Result =ConstantExpr::getSDiv(StartNegC,StepC->getValue()); return SCEVUnknown::get(Result); From zhousheng00 at gmail.com Mon Oct 23 13:13:56 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:56 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Constants.h Instruction.def Message-ID: <200610231813.k9NIDu7i004030@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.88.2.7 -> 1.88.2.8 Instruction.def updated: 1.19.6.5 -> 1.19.6.6 --- Log message: --- Diffs of the changes: (+38 -34) Constants.h | 4 ++- Instruction.def | 68 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 38 insertions(+), 34 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.88.2.7 llvm/include/llvm/Constants.h:1.88.2.8 --- llvm/include/llvm/Constants.h:1.88.2.7 Sun Oct 22 03:58:59 2006 +++ llvm/include/llvm/Constants.h Mon Oct 23 13:13:26 2006 @@ -547,7 +547,7 @@ static Constant *getUDiv(Constant *C1, Constant *C2); static Constant *getSDiv(Constant *C1, Constant *C2); static Constant *getFDiv(Constant *C1, Constant *C2); - static Constant *getRem(Constant *C1, Constant *C2); + static Constant *getFRem(Constant *C1, Constant *C2); static Constant *getAnd(Constant *C1, Constant *C2); static Constant *getOr(Constant *C1, Constant *C2); static Constant *getXor(Constant *C1, Constant *C2); @@ -562,6 +562,8 @@ static Constant *getUShr(Constant *C1, Constant *C2); // unsigned shr static Constant *getSShr(Constant *C1, Constant *C2); // signed shr + static Constant *getURem(Constant *C1, Constant *C2); // unsgied rem + static Constant *getSRem(Constant *C1, Constant *C2); // signed rem /// Getelementptr form. std::vector is only accepted for convenience: /// all elements must be Constant's. Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.19.6.5 llvm/include/llvm/Instruction.def:1.19.6.6 --- llvm/include/llvm/Instruction.def:1.19.6.5 Sun Oct 22 03:59:00 2006 +++ llvm/include/llvm/Instruction.def Mon Oct 23 13:13:26 2006 @@ -96,47 +96,49 @@ HANDLE_BINARY_INST(10, UDiv , BinaryOperator) HANDLE_BINARY_INST(11, SDiv , BinaryOperator) HANDLE_BINARY_INST(12, FDiv , BinaryOperator) -HANDLE_BINARY_INST(13, Rem , BinaryOperator) +HANDLE_BINARY_INST(13, URem , BinaryOperator) +HANDLE_BINARY_INST(14, SRem , BinaryOperator) +HANDLE_BINARY_INST(15, FRem , BinaryOperator) // Logical operators... -HANDLE_BINARY_INST(14, And , BinaryOperator) -HANDLE_BINARY_INST(15, Or , BinaryOperator) -HANDLE_BINARY_INST(16, Xor , BinaryOperator) +HANDLE_BINARY_INST(16, And , BinaryOperator) +HANDLE_BINARY_INST(17, Or , BinaryOperator) +HANDLE_BINARY_INST(18, Xor , BinaryOperator) // Binary comparison operators... -HANDLE_BINARY_INST(17, SetEQ , SetCondInst) -HANDLE_BINARY_INST(18, SetNE , SetCondInst) -HANDLE_BINARY_INST(19, SetLE , SetCondInst) -HANDLE_BINARY_INST(20, SetGE , SetCondInst) -HANDLE_BINARY_INST(21, SetLT , SetCondInst) -HANDLE_BINARY_INST(22, SetGT , SetCondInst) - LAST_BINARY_INST(22) +HANDLE_BINARY_INST(19, SetEQ , SetCondInst) +HANDLE_BINARY_INST(20, SetNE , SetCondInst) +HANDLE_BINARY_INST(21, SetLE , SetCondInst) +HANDLE_BINARY_INST(22, SetGE , SetCondInst) +HANDLE_BINARY_INST(23, SetLT , SetCondInst) +HANDLE_BINARY_INST(24, SetGT , SetCondInst) + LAST_BINARY_INST(24) // Memory operators... - FIRST_MEMORY_INST(23) -HANDLE_MEMORY_INST(23, Malloc, MallocInst) // Heap management instructions -HANDLE_MEMORY_INST(24, Free , FreeInst ) -HANDLE_MEMORY_INST(25, Alloca, AllocaInst) // Stack management -HANDLE_MEMORY_INST(26, Load , LoadInst ) // Memory manipulation instrs -HANDLE_MEMORY_INST(27, Store , StoreInst ) -HANDLE_MEMORY_INST(28, GetElementPtr, GetElementPtrInst) - LAST_MEMORY_INST(28) + FIRST_MEMORY_INST(25) +HANDLE_MEMORY_INST(25, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(26, Free , FreeInst ) +HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(29, Store , StoreInst ) +HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(30) // Other operators... - FIRST_OTHER_INST(29) -HANDLE_OTHER_INST(29, PHI , PHINode ) // PHI node instruction -HANDLE_OTHER_INST(30, Cast , CastInst ) // Type cast -HANDLE_OTHER_INST(31, Call , CallInst ) // Call a function -HANDLE_OTHER_INST(32, Shl , ShiftInst ) // Shift operations -HANDLE_OTHER_INST(33, Shr , ShiftInst ) -HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction -HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass -HANDLE_OTHER_INST(36, UserOp2, Instruction) -HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction -HANDLE_OTHER_INST(38, ExtractElement, ExtractElementInst)// extract from vector. -HANDLE_OTHER_INST(39, InsertElement, InsertElementInst) // insert into vector -HANDLE_OTHER_INST(40, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. - LAST_OTHER_INST(40) + FIRST_OTHER_INST(31) +HANDLE_OTHER_INST(31, PHI , PHINode ) // PHI node instruction +HANDLE_OTHER_INST(32, Cast , CastInst ) // Type cast +HANDLE_OTHER_INST(33, Call , CallInst ) // Call a function +HANDLE_OTHER_INST(34, Shl , ShiftInst ) // Shift operations +HANDLE_OTHER_INST(35, Shr , ShiftInst ) +HANDLE_OTHER_INST(36, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(37, UserOp1, Instruction) // May be used internally in a pass +HANDLE_OTHER_INST(38, UserOp2, Instruction) +HANDLE_OTHER_INST(39, VAArg , VAArgInst ) // vaarg instruction +HANDLE_OTHER_INST(40, ExtractElement, ExtractElementInst)// extract from vector. +HANDLE_OTHER_INST(41, InsertElement, InsertElementInst) // insert into vector +HANDLE_OTHER_INST(42, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. + LAST_OTHER_INST(42) #undef FIRST_TERM_INST #undef HANDLE_TERM_INST From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200610231813.k9NIDwYC004062@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.9.2.2 -> 1.9.2.3 --- Log message: --- Diffs of the changes: (+15 -2) PatternMatch.h | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.9.2.2 llvm/include/llvm/Support/PatternMatch.h:1.9.2.3 --- llvm/include/llvm/Support/PatternMatch.h:1.9.2.2 Sun Oct 22 03:59:00 2006 +++ llvm/include/llvm/Support/PatternMatch.h Mon Oct 23 13:13:26 2006 @@ -123,6 +123,19 @@ return BinaryOp_match(L, R); } +// SignlessType Revision: here we replace m_Rem with m_URem and add m_SRem +// for SRem which is signed Rem. +template +inline BinaryOp_match m_URem(const LHS &L, + const RHS &R) { + return BinaryOp_match(L, R); +} + +template +inline BinaryOp_match m_SRem(const LHS &L, + const RHS &R) { + return BinaryOp_match(L, R); +} template inline BinaryOp_match m_FDiv(const LHS &L, const RHS &R) { @@ -130,9 +143,9 @@ } template -inline BinaryOp_match m_Rem(const LHS &L, +inline BinaryOp_match m_FRem(const LHS &L, const RHS &R) { - return BinaryOp_match(L, R); + return BinaryOp_match(L, R); } template From zhousheng00 at gmail.com Mon Oct 23 13:13:57 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:57 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610231813.k9NIDvdH004052@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.289.2.5 -> 1.289.2.6 --- Log message: --- Diffs of the changes: (+3 -7) SelectionDAGISel.cpp | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.5 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.6 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.5 Sun Oct 22 03:59:00 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct 23 13:13:26 2006 @@ -515,16 +515,12 @@ else visitIntBinary(I, ISD::MUL, ISD::VMUL); } + void visitURem(User &I) { visitIntBinary(I, ISD::UREM, 0); } + void visitSRem(User &I) { visitIntBinary(I, ISD::SREM, 0); } void visitUDiv(User &I) { visitIntBinary(I, ISD::UDIV, ISD::VUDIV); } void visitSDiv(User &I) { visitIntBinary(I, ISD::SDIV, ISD::VSDIV); } void visitFDiv(User &I) { visitFPBinary(I, ISD::FDIV, ISD::VSDIV); } - void visitRem(User &I) { - const Type *Ty = I.getType(); - if (Ty->isFloatingPoint()) - visitFPBinary(I, ISD::FREM, 0); - else - visitIntBinary(I, Ty->isSigned() ? ISD::SREM : ISD::UREM, 0); - } + void visitFRem(User &I) { visitFPBinary(I, ISD::FREM, 0); } void visitAnd(User &I) { visitIntBinary(I, ISD::AND, ISD::VAND); } void visitOr (User &I) { visitIntBinary(I, ISD::OR, ISD::VOR); } void visitXor(User &I) { visitIntBinary(I, ISD::XOR, ISD::VXOR); } From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200610231813.k9NIDwiL004055@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.272.2.5 -> 1.272.2.6 --- Log message: --- Diffs of the changes: (+11 -4) Writer.cpp | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.272.2.5 llvm/lib/Target/CBackend/Writer.cpp:1.272.2.6 --- llvm/lib/Target/CBackend/Writer.cpp:1.272.2.5 Sun Oct 22 04:55:50 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Oct 23 13:13:27 2006 @@ -586,10 +586,12 @@ case Instruction::Add: case Instruction::Sub: case Instruction::Mul: + case Instruction::URem: + case Instruction::SRem: case Instruction::SDiv: case Instruction::UDiv: case Instruction::FDiv: - case Instruction::Rem: + case Instruction::FRem: case Instruction::And: case Instruction::Or: case Instruction::Xor: @@ -607,10 +609,12 @@ case Instruction::Add: Out << " + "; break; case Instruction::Sub: Out << " - "; break; case Instruction::Mul: Out << " * "; break; + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: Out << " % "; break; case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: Out << " / "; break; - case Instruction::Rem: Out << " % "; break; case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; case Instruction::Xor: Out << " ^ "; break; @@ -1634,7 +1638,8 @@ Out << "-("; writeOperand(BinaryOperator::getNegArgument(cast(&I))); Out << ")"; - } else if (I.getOpcode() == Instruction::Rem && + } else if ((I.getOpcode() == Instruction::URem || + I.getOpcode() == Instruction::SRem) && I.getType()->isFloatingPoint()) { // Output a call to fmod/fmodf instead of emitting a%b if (I.getType() == Type::FloatTy) @@ -1652,10 +1657,12 @@ case Instruction::Add: Out << " + "; break; case Instruction::Sub: Out << " - "; break; case Instruction::Mul: Out << '*'; break; + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: Out << '%'; break; case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: Out << '/'; break; - case Instruction::Rem: Out << '%'; break; case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; case Instruction::Xor: Out << " ^ "; break; From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp Message-ID: <200610231813.k9NIDw40004081@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.93.2.7 -> 1.93.2.8 Constants.cpp updated: 1.163.2.8 -> 1.163.2.9 Instruction.cpp updated: 1.53.2.4 -> 1.53.2.5 Instructions.cpp updated: 1.42.2.5 -> 1.42.2.6 --- Log message: --- Diffs of the changes: (+75 -31) ConstantFolding.cpp | 78 +++++++++++++++++++++++++++++++++++++--------------- Constants.cpp | 18 ++++++++---- Instruction.cpp | 8 ++++- Instructions.cpp | 2 - 4 files changed, 75 insertions(+), 31 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.7 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.8 --- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.7 Sun Oct 22 18:27:21 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Oct 23 13:13:27 2006 @@ -40,10 +40,12 @@ virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0; virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *urem(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *srem(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *frem(const Constant *V1, const Constant *V2) const = 0; virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0; virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0; virtual Constant *fdiv(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *rem(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_xor(const Constant *V1, const Constant *V2) const = 0; @@ -114,11 +116,17 @@ virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); } + virtual Constant *urem(const Constant *V1, const Constant *V2) const { + return SubClassName::URem((const ArgType *)V1, (const ArgType *)V2); + } + virtual Constant *srem(const Constant *V1, const Constant *V2) const { + return SubClassName::SRem((const ArgType *)V1, (const ArgType *)V2); + } virtual Constant *fdiv(const Constant *V1, const Constant *V2) const { return SubClassName::FDiv((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *rem(const Constant *V1, const Constant *V2) const { - return SubClassName::Rem((const ArgType *)V1, (const ArgType *)V2); + virtual Constant *frem(const Constant *V1, const Constant *V2) const { + return SubClassName::FRem((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *op_and(const Constant *V1, const Constant *V2) const { return SubClassName::And((const ArgType *)V1, (const ArgType *)V2); @@ -186,18 +194,20 @@ // Default "noop" implementations //===--------------------------------------------------------------------===// - static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Add(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Sub(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *URem(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *SRem(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shl(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shr(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *FDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Rem (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *FRem(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -389,11 +399,17 @@ static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getSDiv); } + static Constant *URem(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getURem); + } + static Constant *SRem(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getSRem); + } static Constant *FDiv(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getFDiv); } - static Constant *Rem(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getRem); + static Constant *FRem(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getFRem); } static Constant *And(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getAnd); @@ -520,6 +536,17 @@ return ConstantInt::get(*Ty, R); } + static Constant *URem(const ConstantInt *V1, + const ConstantInt *V2) { + if (V2->isNullValue()) return 0; // X / 0 + if (V2->isAllOnesValue() && // MIN_INT / -1 + (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) + return 0; + BuiltinType R = + (BuiltinType)V1->getZExtValue() % (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); + } + static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) { if (V2->isNullValue()) return 0; @@ -531,14 +558,14 @@ return ConstantInt::get(*Ty, R); } - static Constant *Rem(const ConstantInt *V1, + static Constant *SRem(const ConstantInt *V1, const ConstantInt *V2) { if (V2->isNullValue()) return 0; // X / 0 if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) + (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) return 0; BuiltinType R = - (BuiltinType)V1->getZExtValue() % (BuiltinType)V2->getZExtValue(); + (BuiltinType)V1->getSExtValue() % (BuiltinType)V2->getSExtValue(); return ConstantInt::get(*Ty, R); } @@ -637,7 +664,7 @@ DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST - static Constant *Rem(const ConstantFP *V1, const ConstantFP *V2) { + static Constant *FRem(const ConstantFP *V1, const ConstantFP *V2) { if (V2->isNullValue()) return 0; BuiltinType Result = std::fmod((BuiltinType)V1->getValue(), (BuiltinType)V2->getValue()); @@ -1252,10 +1279,12 @@ case Instruction::Add: C = ConstRules::get(V1, V2).add(V1, V2); break; case Instruction::Sub: C = ConstRules::get(V1, V2).sub(V1, V2); break; case Instruction::Mul: C = ConstRules::get(V1, V2).mul(V1, V2); break; + case Instruction::URem: C = ConstRules::get(V1, V2).urem(V1, V2); break; + case Instruction::SRem: C = ConstRules::get(V1, V2).srem(V1, V2); break; case Instruction::UDiv: C = ConstRules::get(V1, V2).udiv(V1, V2); break; case Instruction::SDiv: C = ConstRules::get(V1, V2).sdiv(V1, V2); break; case Instruction::FDiv: C = ConstRules::get(V1, V2).fdiv(V1, V2); break; - case Instruction::Rem: C = ConstRules::get(V1, V2).rem(V1, V2); break; + case Instruction::FRem: C = ConstRules::get(V1, V2).frem(V1, V2); break; case Instruction::And: C = ConstRules::get(V1, V2).op_and(V1, V2); break; case Instruction::Or: C = ConstRules::get(V1, V2).op_or (V1, V2); break; case Instruction::Xor: C = ConstRules::get(V1, V2).op_xor(V1, V2); break; @@ -1337,10 +1366,12 @@ case Instruction::Mul: case Instruction::And: return Constant::getNullValue(V1->getType()); + case Instruction::URem: + case Instruction::SRem: case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: - case Instruction::Rem: + case Instruction::FRem: if (!isa(V2)) // undef/X -> 0 return Constant::getNullValue(V1->getType()); return const_cast(V2); // X/undef -> undef @@ -1396,7 +1427,8 @@ if (CI->getZExtValue() == 1) return const_cast(V1); // X / 1 == X break; - case Instruction::Rem: + case Instruction::URem: + case Instruction::SRem: if (const ConstantInt *CI = dyn_cast(V2)) if (CI->getZExtValue() == 1) return Constant::getNullValue(CI->getType()); // X % 1 == 0 @@ -1452,10 +1484,12 @@ case Instruction::Shl: case Instruction::Shr: case Instruction::Sub: + case Instruction::URem: + case Instruction::SRem: case Instruction::SDiv: case Instruction::UDiv: case Instruction::FDiv: - case Instruction::Rem: + case Instruction::FRem: default: // These instructions cannot be flopped around. break; } Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.163.2.8 llvm/lib/VMCore/Constants.cpp:1.163.2.9 --- llvm/lib/VMCore/Constants.cpp:1.163.2.8 Sun Oct 22 03:59:01 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Oct 23 13:13:27 2006 @@ -425,11 +425,17 @@ Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) { return get(Instruction::SDiv, C1, C2); } +Constant *ConstantExpr::getURem(Constant *C1, Constant *C2) { + return get(Instruction::URem, C1, C2); +} +Constant *ConstantExpr::getSRem(Constant *C1, Constant *C2) { + return get(Instruction::SRem, C1, C2); +} Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { return get(Instruction::FDiv, C1, C2); } -Constant *ConstantExpr::getRem(Constant *C1, Constant *C2) { - return get(Instruction::Rem, C1, C2); +Constant *ConstantExpr::getFRem(Constant *C1, Constant *C2) { + return get(Instruction::FRem, C1, C2); } Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) { return get(Instruction::And, C1, C2); @@ -1310,7 +1316,7 @@ break; default: assert(OldC->getOpcode() >= Instruction::BinaryOpsBegin && - OldC->getOpcode() < Instruction::BinaryOpsEnd); + OldC->getOpcode() < Instruction::BinaryOpsEnd); New = ConstantExpr::getTy(NewTy, OldC->getOpcode(), OldC->getOperand(0), OldC->getOperand(1)); break; @@ -1396,8 +1402,8 @@ if (Opcode == Instruction::Shl || Opcode == Instruction::Shr) return getShiftTy(ReqTy, Opcode, C1, C2); // Check the operands for consistency first - assert((Opcode >= Instruction::BinaryOpsBegin && - Opcode < Instruction::BinaryOpsEnd) && + assert(Opcode >= Instruction::BinaryOpsBegin && + Opcode < Instruction::BinaryOpsEnd && "Invalid opcode in binary constant expression"); assert(C1->getType() == C2->getType() && "Operand types in binary constant expression should match"); @@ -1416,9 +1422,9 @@ #ifndef NDEBUG switch (Opcode) { case Instruction::Add: case Instruction::Sub: + case Instruction::URem: case Instruction::SRem: case Instruction::FRem: case Instruction::Mul: case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: - case Instruction::Rem: assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() || isa(C1->getType())) && Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.53.2.4 llvm/lib/VMCore/Instruction.cpp:1.53.2.5 --- llvm/lib/VMCore/Instruction.cpp:1.53.2.4 Sun Oct 22 03:59:01 2006 +++ llvm/lib/VMCore/Instruction.cpp Mon Oct 23 13:13:27 2006 @@ -94,10 +94,12 @@ case Add: return "add"; case Sub: return "sub"; case Mul: return "mul"; + case URem: return "urem"; + case SRem: return "srem"; case UDiv: return "udiv"; case SDiv: return "sdiv"; case FDiv: return "fdiv"; - case Rem: return "rem"; + case FRem: return "frem"; // Logical operators... case And: return "and"; @@ -223,10 +225,12 @@ /// bool Instruction::isTrapping(unsigned op) { switch(op) { + case URem: + case SRem: case UDiv: case SDiv: case FDiv: - case Rem: + case FRem: case Load: case Store: case Call: Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.42.2.5 llvm/lib/VMCore/Instructions.cpp:1.42.2.6 --- llvm/lib/VMCore/Instructions.cpp:1.42.2.5 Sun Oct 22 03:59:01 2006 +++ llvm/lib/VMCore/Instructions.cpp Mon Oct 23 13:13:27 2006 @@ -1022,8 +1022,8 @@ #ifndef NDEBUG switch (iType) { case Add: case Sub: + case URem: case SRem: case FRem: case Mul: case UDiv: case SDiv: case FDiv: - case Rem: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); assert((getType()->isInteger() || getType()->isFloatingPoint() || From zhousheng00 at gmail.com Mon Oct 23 13:13:57 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:57 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs Lexer.l Lexer.l.cvs llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200610231813.k9NIDvw7004049@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs updated: 1.10.2.6 -> 1.10.2.7 Lexer.l updated: 1.78.2.5 -> 1.78.2.6 Lexer.l.cvs updated: 1.8.2.5 -> 1.8.2.6 llvmAsmParser.cpp.cvs updated: 1.18.2.7 -> 1.18.2.8 llvmAsmParser.h.cvs updated: 1.13.2.7 -> 1.13.2.8 llvmAsmParser.y updated: 1.266.2.7 -> 1.266.2.8 llvmAsmParser.y.cvs updated: 1.18.2.7 -> 1.18.2.8 --- Log message: --- Diffs of the changes: (+1796 -1704) Lexer.cpp.cvs | 1179 +++++++++++++-------------- Lexer.l | 5 Lexer.l.cvs | 5 llvmAsmParser.cpp.cvs | 2153 +++++++++++++++++++++++++------------------------- llvmAsmParser.h.cvs | 116 +- llvmAsmParser.y | 21 llvmAsmParser.y.cvs | 21 7 files changed, 1796 insertions(+), 1704 deletions(-) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.10.2.6 llvm/lib/AsmParser/Lexer.cpp.cvs:1.10.2.7 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.10.2.6 Sun Oct 22 03:59:00 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Mon Oct 23 13:13:26 2006 @@ -20,7 +20,7 @@ /* A lexical scanner generated by flex*/ /* Scanner skeleton version: - * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.10.2.6 2006/10/22 08:59:00 reid Exp $ + * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.10.2.7 2006/10/23 18:13:26 sheng Exp $ */ #define FLEX_SCANNER @@ -317,35 +317,35 @@ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 117 -#define YY_END_OF_BUFFER 118 -static yyconst short int yy_acclist[195] = +#define YY_NUM_RULES 120 +#define YY_END_OF_BUFFER 121 +static yyconst short int yy_acclist[198] = { 0, - 118, 116, 117, 115, 116, 117, 115, 117, 116, 117, - 116, 117, 116, 117, 116, 117, 116, 117, 116, 117, - 108, 116, 117, 108, 116, 117, 1, 116, 117, 116, - 117, 116, 117, 116, 117, 116, 117, 116, 117, 116, - 117, 116, 117, 116, 117, 116, 117, 116, 117, 116, - 117, 116, 117, 116, 117, 116, 117, 116, 117, 116, - 117, 116, 117, 116, 117, 116, 117, 116, 117, 116, - 117, 107, 105, 104, 104, 111, 109, 113, 108, 1, - 90, 41, 72, 23, 107, 104, 104, 112, 113, 20, - 113, 114, 63, 71, 39, 34, 42, 66, 3, 54, - - 65, 25, 80, 70, 89, 84, 85, 64, 73, 106, - 113, 113, 49, 81, 82, 32, 69, 97, 98, 56, - 22, 110, 68, 26, 4, 61, 67, 55, 48, 11, - 113, 36, 2, 5, 58, 60, 50, 75, 79, 77, - 78, 76, 74, 52, 99, 51, 57, 21, 87, 96, - 45, 59, 30, 24, 44, 7, 92, 33, 95, 38, - 62, 83, 91, 27, 28, 93, 53, 88, 86, 43, - 6, 29, 37, 8, 17, 9, 10, 35, 12, 14, - 13, 40, 15, 31, 94, 100, 102, 103, 16, 46, - 101, 18, 47, 19 + 121, 119, 120, 118, 119, 120, 118, 120, 119, 120, + 119, 120, 119, 120, 119, 120, 119, 120, 119, 120, + 111, 119, 120, 111, 119, 120, 1, 119, 120, 119, + 120, 119, 120, 119, 120, 119, 120, 119, 120, 119, + 120, 119, 120, 119, 120, 119, 120, 119, 120, 119, + 120, 119, 120, 119, 120, 119, 120, 119, 120, 119, + 120, 119, 120, 119, 120, 119, 120, 119, 120, 119, + 120, 110, 108, 107, 107, 114, 112, 116, 111, 1, + 93, 41, 75, 23, 110, 107, 107, 115, 116, 20, + 116, 117, 63, 74, 39, 34, 42, 66, 3, 54, + + 65, 25, 83, 70, 92, 87, 88, 64, 76, 109, + 116, 116, 49, 84, 85, 32, 69, 100, 73, 101, + 56, 22, 113, 68, 72, 26, 4, 61, 67, 55, + 71, 48, 11, 116, 36, 2, 5, 58, 60, 50, + 78, 82, 80, 81, 79, 77, 52, 102, 51, 57, + 21, 90, 99, 45, 59, 30, 24, 44, 7, 95, + 33, 98, 38, 62, 86, 94, 27, 28, 96, 53, + 91, 89, 43, 6, 29, 37, 8, 17, 9, 10, + 35, 12, 14, 13, 40, 15, 31, 97, 103, 105, + 106, 16, 46, 104, 18, 47, 19 } ; -static yyconst short int yy_accept[514] = +static yyconst short int yy_accept[521] = { 0, 1, 1, 1, 2, 4, 7, 9, 11, 13, 15, 17, 19, 21, 24, 27, 30, 32, 34, 36, 38, @@ -358,52 +358,52 @@ 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 86, 87, 89, - 90, 91, 92, 92, 93, 94, 94, 94, 95, 95, - 96, 96, 97, 97, 97, 97, 98, 98, 98, 98, - 98, 98, 98, 99, 99, 99, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 102, 103, 103, - 103, 104, 104, 105, 106, 106, 106, 106, 106, 106, - 106, 107, 107, 108, 108, 108, 108, 109, 109, 109, + 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, + 87, 89, 90, 91, 92, 92, 93, 94, 94, 94, + 95, 95, 96, 96, 97, 97, 97, 97, 98, 98, + 98, 98, 98, 98, 98, 99, 99, 99, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, + 103, 103, 103, 104, 104, 105, 106, 106, 106, 106, + 106, 106, 106, 107, 107, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, - 110, 110, 111, 112, 112, 112, 112, 113, 113, 113, - 113, 113, 114, 115, 116, 116, 116, 116, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 120, 121, 121, 121, 122, 122, 122, 123, - 123, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 125, 125, 125, 126, 127, 127, 128, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 130, 130, 131, 131, 131, 132, 133, 133, 133, 134, - - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 135, 135, 136, 136, 136, 136, 136, 136, - 136, 137, 137, 137, 137, 137, 137, 137, 138, 138, - 138, 139, 140, 141, 142, 143, 144, 145, 145, 145, - 146, 146, 146, 146, 147, 148, 149, 149, 149, 149, - 149, 149, 150, 150, 150, 150, 150, 150, 151, 151, - 152, 152, 152, 152, 152, 152, 152, 153, 154, 155, - 155, 155, 156, 156, 157, 157, 157, 157, 158, 158, - 159, 160, 161, 162, 162, 162, 163, 163, 163, 164, - 165, 166, 166, 166, 167, 168, 169, 170, 170, 170, - - 170, 170, 170, 170, 171, 172, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 175, 175, - 175, 175, 176, 176, 176, 176, 176, 177, 178, 178, - 178, 178, 178, 178, 179, 179, 179, 179, 180, 181, - 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, - 182, 183, 183, 183, 183, 183, 183, 184, 184, 184, - 184, 184, 185, 185, 185, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 187, + 109, 109, 109, 109, 110, 110, 111, 112, 112, 112, + 112, 113, 113, 113, 113, 113, 114, 115, 116, 116, + 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 118, 118, 119, 120, 120, 120, + 120, 120, 120, 120, 120, 120, 120, 121, 122, 122, + 122, 123, 123, 123, 124, 124, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 126, 126, 126, 127, + 127, 127, 128, 129, 129, 130, 131, 131, 131, 131, + 131, 131, 132, 132, 132, 132, 132, 133, 133, 134, + + 134, 134, 135, 136, 136, 136, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 138, + 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, + 140, 140, 140, 140, 140, 141, 141, 141, 142, 143, + 144, 145, 146, 147, 148, 148, 148, 149, 149, 149, + 149, 150, 151, 152, 152, 152, 152, 152, 152, 153, + 153, 153, 153, 153, 153, 154, 154, 155, 155, 155, + 155, 155, 155, 155, 156, 157, 158, 158, 158, 159, + 159, 160, 160, 160, 160, 161, 161, 162, 163, 164, + 165, 165, 165, 166, 166, 166, 167, 168, 169, 169, + + 169, 170, 171, 172, 173, 173, 173, 173, 173, 173, + 173, 174, 175, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 178, 178, 178, 178, 179, + 179, 179, 179, 179, 180, 181, 181, 181, 181, 181, + 181, 182, 182, 182, 182, 183, 184, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 186, 186, + 186, 186, 186, 186, 187, 187, 187, 187, 187, 188, + 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, - 187, 188, 189, 190, 190, 191, 191, 192, 193, 194, - 194, 195, 195 + 189, 189, 189, 189, 189, 189, 190, 190, 191, 192, + 193, 193, 194, 194, 195, 196, 197, 197, 198, 198 } ; static yyconst int yy_ec[256] = @@ -447,244 +447,246 @@ 3, 3, 3 } ; -static yyconst short int yy_base[518] = +static yyconst short int yy_base[525] = { 0, - 0, 0, 1114, 1115, 1115, 1115, 1109, 1098, 36, 40, + 0, 0, 1128, 1129, 1129, 1129, 1123, 1112, 36, 40, 44, 50, 56, 62, 0, 63, 66, 81, 89, 47, 100, 97, 76, 96, 111, 49, 113, 110, 68, 140, - 126, 171, 119, 118, 139, 133, 1107, 1115, 1096, 1115, - 0, 162, 176, 199, 204, 70, 209, 224, 229, 0, - 117, 130, 162, 72, 165, 169, 176, 123, 1095, 168, - 178, 31, 69, 191, 233, 95, 215, 189, 241, 243, - 242, 245, 192, 244, 246, 247, 248, 251, 150, 254, - 255, 263, 262, 268, 256, 275, 211, 1094, 280, 281, - 282, 155, 259, 284, 285, 286, 288, 291, 289, 299, - - 302, 1093, 303, 306, 311, 313, 314, 317, 320, 318, - 332, 329, 319, 340, 322, 334, 1092, 0, 354, 360, - 1091, 374, 391, 0, 1090, 354, 348, 1089, 367, 1088, - 347, 1087, 364, 378, 345, 1086, 386, 375, 392, 395, - 381, 398, 1085, 399, 403, 402, 405, 407, 382, 406, - 410, 417, 411, 418, 419, 421, 423, 424, 362, 430, - 426, 431, 434, 437, 438, 441, 1084, 1083, 443, 444, - 1082, 445, 1081, 1080, 470, 447, 446, 451, 450, 481, - 1079, 461, 1078, 483, 485, 463, 1077, 486, 487, 449, - 488, 491, 495, 489, 497, 501, 499, 505, 503, 506, - - 508, 510, 452, 511, 517, 519, 513, 523, 525, 1076, - 530, 1115, 537, 545, 553, 557, 562, 547, 563, 565, - 566, 1075, 1074, 1073, 567, 545, 569, 1072, 571, 572, - 573, 575, 578, 579, 577, 580, 581, 588, 587, 1071, - 589, 1070, 590, 598, 595, 599, 602, 607, 609, 608, - 610, 1069, 1068, 611, 613, 1067, 606, 614, 0, 618, - 1066, 619, 615, 616, 631, 633, 634, 635, 638, 641, - 644, 639, 1065, 651, 647, 1064, 1063, 652, 1062, 1061, - 655, 649, 657, 663, 664, 665, 667, 669, 645, 1060, - 671, 1059, 673, 674, 679, 1058, 679, 682, 1057, 685, - - 691, 693, 689, 697, 698, 699, 702, 704, 701, 705, - 706, 1056, 707, 1055, 716, 708, 712, 709, 719, 720, - 1054, 726, 730, 727, 731, 733, 735, 1053, 737, 715, - 1052, 1051, 1050, 1049, 1048, 1047, 1046, 741, 747, 1045, - 746, 745, 750, 1044, 1043, 1042, 748, 753, 754, 749, - 752, 1041, 751, 764, 761, 765, 767, 1040, 769, 1039, - 770, 773, 776, 775, 778, 781, 1038, 1037, 1036, 786, - 779, 1035, 789, 1034, 783, 794, 793, 1033, 800, 1032, - 1031, 1030, 1029, 795, 801, 1028, 804, 809, 1027, 1026, - 1025, 808, 810, 1024, 1023, 1022, 1021, 811, 806, 812, - - 814, 815, 817, 1020, 1019, 1018, 823, 824, 825, 831, - 829, 830, 833, 834, 837, 847, 835, 1015, 836, 853, - 843, 854, 855, 842, 860, 858, 863, 1006, 866, 868, - 869, 1005, 870, 871, 872, 873, 1003, 1002, 877, 875, - 876, 879, 880, 1001, 892, 893, 887, 999, 998, 997, - 896, 897, 902, 903, 904, 905, 907, 909, 910, 911, - 912, 913, 916, 915, 919, 918, 922, 924, 927, 930, - 996, 931, 938, 939, 940, 941, 990, 942, 943, 944, - 946, 989, 949, 950, 988, 958, 961, 952, 962, 948, - 964, 970, 971, 972, 974, 976, 975, 977, 987, 978, - - 841, 617, 531, 984, 456, 985, 455, 361, 321, 986, - 261, 1115, 1021, 1023, 228, 1027, 162 + 126, 171, 119, 118, 139, 133, 1121, 1129, 1110, 1129, + 0, 176, 184, 199, 204, 70, 209, 224, 229, 0, + 117, 130, 150, 72, 160, 151, 159, 123, 1109, 230, + 178, 31, 69, 168, 240, 95, 233, 165, 241, 243, + 242, 156, 244, 246, 187, 251, 253, 254, 211, 258, + 256, 263, 260, 265, 190, 267, 283, 1108, 271, 274, + 270, 285, 289, 290, 291, 292, 294, 295, 297, 299, + + 296, 308, 1107, 311, 300, 318, 320, 322, 323, 330, + 325, 328, 327, 337, 342, 216, 336, 345, 1106, 0, + 362, 366, 1105, 380, 397, 0, 1104, 370, 349, 1103, + 373, 1102, 355, 1101, 371, 372, 384, 1100, 392, 326, + 399, 398, 401, 402, 1099, 405, 404, 406, 411, 412, + 409, 413, 415, 422, 423, 425, 424, 426, 428, 429, + 435, 442, 374, 443, 444, 445, 446, 447, 1098, 1097, + 448, 449, 1096, 450, 1095, 1094, 476, 454, 455, 464, + 459, 488, 1093, 470, 1092, 490, 489, 460, 492, 1091, + 493, 494, 495, 496, 501, 502, 504, 507, 508, 512, + + 514, 517, 519, 520, 521, 518, 457, 522, 526, 530, + 539, 540, 541, 1090, 524, 1129, 550, 564, 568, 572, + 577, 578, 458, 579, 580, 1089, 1088, 1087, 581, 582, + 583, 1086, 550, 585, 525, 584, 586, 551, 589, 590, + 587, 593, 603, 1085, 591, 1084, 1083, 594, 599, 607, + 612, 613, 615, 617, 618, 620, 1082, 1081, 619, 623, + 1080, 621, 624, 0, 622, 1079, 626, 641, 630, 640, + 642, 643, 644, 646, 653, 1078, 655, 654, 1077, 657, + 658, 1076, 1075, 659, 1074, 1073, 660, 669, 670, 672, + 674, 1072, 675, 676, 678, 680, 1071, 681, 1070, 684, + + 682, 689, 1069, 693, 692, 1068, 701, 705, 702, 690, + 712, 703, 713, 714, 699, 715, 717, 719, 1067, 720, + 1066, 721, 724, 725, 728, 729, 731, 1065, 733, 735, + 736, 745, 747, 748, 1064, 737, 742, 1063, 1062, 1061, + 1060, 1059, 1058, 1057, 749, 752, 1056, 758, 753, 759, + 1055, 1054, 1053, 760, 766, 761, 763, 767, 1052, 771, + 772, 774, 775, 780, 1051, 777, 1050, 782, 781, 784, + 787, 789, 792, 1049, 1048, 1047, 791, 800, 1046, 801, + 1045, 802, 803, 808, 1044, 814, 1043, 1042, 1041, 1040, + 804, 805, 1039, 806, 816, 1038, 1037, 1036, 818, 820, + + 1035, 1034, 1033, 1032, 819, 824, 827, 828, 830, 829, + 1031, 1030, 1029, 833, 836, 837, 838, 839, 840, 842, + 843, 845, 855, 844, 1028, 850, 856, 862, 868, 861, + 851, 869, 871, 872, 1027, 877, 878, 879, 1026, 880, + 881, 882, 884, 1023, 1014, 886, 887, 885, 889, 891, + 1013, 902, 903, 906, 1011, 1010, 1008, 907, 911, 890, + 910, 914, 916, 917, 918, 921, 922, 923, 925, 926, + 929, 932, 927, 933, 935, 938, 936, 1007, 939, 942, + 949, 950, 952, 1006, 953, 954, 957, 955, 1005, 958, + 960, 1001, 963, 966, 961, 971, 975, 979, 980, 981, + + 982, 984, 985, 983, 986, 999, 987, 995, 628, 627, + 993, 625, 989, 385, 354, 353, 994, 301, 1129, 1029, + 1031, 226, 1035, 166 } ; -static yyconst short int yy_def[518] = +static yyconst short int yy_def[525] = { 0, - 512, 1, 512, 512, 512, 512, 513, 514, 515, 512, - 514, 514, 514, 514, 516, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 513, 512, 514, 512, - 517, 517, 512, 512, 514, 514, 514, 514, 514, 516, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 512, 517, 517, 512, - 514, 514, 514, 49, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 49, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 512, 512, 512, 512, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 175, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 512, 514, 514, 514, 514, 514, - - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - - 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, - 514, 0, 512, 512, 512, 512, 512 + 519, 1, 519, 519, 519, 519, 520, 521, 522, 519, + 521, 521, 521, 521, 523, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 520, 519, 521, 519, + 524, 524, 519, 519, 521, 521, 521, 521, 521, 523, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 519, 524, + 524, 519, 521, 521, 521, 49, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 49, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 519, 519, 519, 519, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 177, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + + 521, 519, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + + 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, + 521, 521, 521, 521, 521, 521, 521, 521, 0, 519, + 519, 519, 519, 519 } ; -static yyconst short int yy_nxt[1159] = +static yyconst short int yy_nxt[1173] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 4, 15, 8, 8, 8, 16, 17, 18, 19, 20, 21, 22, 8, 23, 8, 24, 25, 26, 27, 28, 8, 29, 30, 31, 32, 33, 34, 35, 8, 36, 42, 40, 43, 43, 43, 43, 44, - 44, 44, 44, 45, 45, 45, 45, 40, 46, 137, - 40, 138, 40, 40, 47, 48, 48, 48, 48, 40, - 47, 48, 48, 48, 48, 40, 40, 69, 121, 40, + 44, 44, 44, 45, 45, 45, 45, 40, 46, 139, + 40, 140, 40, 40, 47, 48, 48, 48, 48, 40, + 47, 48, 48, 48, 48, 40, 40, 69, 123, 40, 85, 40, 40, 40, 51, 40, 86, 70, 56, 40, 91, 52, 57, 53, 40, 54, 49, 58, 55, 60, - 59, 61, 40, 139, 129, 77, 78, 64, 40, 40, + 59, 61, 40, 141, 131, 77, 78, 64, 40, 40, 40, 65, 62, 40, 79, 66, 63, 67, 71, 75, 68, 72, 80, 40, 40, 76, 40, 81, 73, 82, - 40, 40, 40, 143, 74, 89, 40, 111, 125, 40, - 113, 90, 83, 40, 101, 87, 40, 88, 84, 92, - 112, 114, 40, 40, 133, 116, 126, 102, 127, 93, - 103, 94, 95, 40, 118, 96, 97, 104, 40, 160, - 115, 119, 119, 119, 119, 40, 98, 99, 40, 100, - 92, 40, 40, 128, 40, 43, 43, 43, 43, 40, - 105, 40, 106, 131, 130, 175, 134, 107, 136, 108, - - 132, 109, 40, 135, 40, 40, 110, 120, 44, 44, - 44, 44, 47, 45, 45, 45, 45, 40, 122, 122, - 122, 122, 40, 152, 40, 123, 145, 140, 40, 170, - 41, 123, 47, 48, 48, 48, 48, 40, 124, 124, - 124, 124, 40, 144, 124, 124, 40, 124, 124, 124, - 124, 124, 124, 141, 40, 40, 40, 40, 40, 40, - 40, 40, 146, 147, 40, 142, 153, 40, 40, 40, - 149, 151, 40, 163, 40, 40, 40, 150, 155, 148, - 156, 40, 154, 166, 161, 164, 157, 158, 40, 159, - 162, 165, 168, 40, 40, 40, 167, 40, 40, 40, - - 176, 40, 40, 169, 40, 178, 171, 172, 187, 185, - 177, 173, 40, 179, 181, 40, 40, 182, 174, 40, - 183, 180, 186, 184, 40, 188, 40, 40, 189, 191, - 40, 40, 40, 40, 40, 40, 190, 208, 193, 195, - 192, 198, 40, 202, 196, 40, 199, 40, 197, 203, - 204, 209, 194, 40, 200, 206, 210, 207, 40, 201, - 40, 40, 205, 119, 119, 119, 119, 40, 211, 213, - 213, 213, 213, 221, 40, 40, 214, 40, 218, 219, - 40, 224, 214, 122, 122, 122, 122, 40, 40, 220, - 123, 40, 222, 248, 40, 40, 123, 215, 216, 40, - - 217, 217, 217, 217, 40, 40, 223, 225, 40, 229, - 226, 40, 40, 228, 227, 40, 40, 238, 40, 40, - 40, 231, 233, 40, 40, 232, 230, 235, 234, 236, - 40, 40, 40, 242, 40, 241, 40, 40, 244, 40, - 243, 237, 239, 40, 40, 246, 247, 40, 240, 245, - 40, 40, 249, 250, 40, 252, 40, 40, 40, 40, - 40, 253, 40, 40, 40, 40, 254, 251, 40, 40, - 287, 256, 263, 274, 40, 258, 40, 257, 255, 259, - 259, 259, 259, 260, 261, 259, 259, 262, 259, 259, - 259, 259, 259, 259, 40, 268, 40, 271, 40, 40, - - 40, 40, 40, 264, 40, 265, 269, 270, 40, 266, - 40, 267, 40, 276, 40, 273, 40, 277, 40, 40, - 275, 40, 272, 40, 40, 278, 40, 282, 284, 281, - 40, 291, 40, 283, 285, 279, 40, 280, 40, 289, - 290, 286, 293, 40, 40, 288, 213, 213, 213, 213, - 292, 215, 215, 214, 295, 295, 295, 295, 40, 214, - 40, 294, 295, 295, 295, 295, 217, 217, 217, 217, - 40, 217, 217, 217, 217, 40, 40, 296, 40, 40, - 40, 301, 40, 297, 40, 40, 40, 300, 40, 303, - 40, 40, 40, 40, 40, 298, 299, 308, 304, 311, - - 40, 40, 40, 40, 306, 302, 307, 313, 40, 309, - 312, 40, 40, 305, 310, 40, 316, 317, 315, 40, - 40, 40, 40, 40, 40, 314, 40, 40, 40, 40, - 40, 40, 40, 318, 320, 330, 319, 321, 323, 322, - 328, 325, 324, 326, 40, 329, 40, 40, 40, 331, - 327, 40, 40, 332, 40, 334, 336, 40, 40, 341, - 40, 338, 40, 339, 40, 40, 340, 333, 40, 335, - 40, 337, 346, 342, 344, 343, 40, 40, 40, 345, - 40, 348, 40, 347, 40, 353, 40, 40, 295, 295, - 295, 295, 40, 352, 349, 40, 355, 358, 40, 350, - - 357, 351, 40, 359, 40, 360, 40, 354, 356, 361, - 40, 40, 40, 362, 40, 40, 364, 40, 40, 40, - 40, 40, 40, 363, 367, 40, 371, 372, 40, 40, - 365, 366, 40, 40, 368, 370, 374, 369, 373, 40, - 40, 375, 378, 40, 40, 376, 40, 381, 40, 377, - 40, 386, 380, 382, 40, 383, 379, 384, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 385, 387, - 388, 389, 391, 393, 40, 394, 396, 40, 40, 399, - 40, 390, 40, 40, 392, 395, 40, 397, 40, 40, - 398, 40, 40, 404, 40, 402, 40, 401, 405, 40, - - 403, 400, 40, 409, 410, 413, 40, 40, 40, 407, - 406, 415, 408, 40, 40, 411, 414, 40, 412, 40, - 416, 40, 40, 40, 40, 40, 419, 40, 40, 417, - 40, 418, 420, 425, 421, 422, 40, 40, 40, 423, - 426, 424, 40, 40, 40, 427, 40, 40, 40, 40, - 40, 433, 434, 428, 40, 40, 40, 429, 430, 432, - 40, 442, 436, 435, 431, 437, 40, 40, 40, 438, - 439, 40, 443, 40, 440, 441, 40, 444, 445, 40, - 446, 40, 40, 40, 40, 40, 40, 448, 40, 40, - 40, 451, 40, 40, 447, 455, 458, 457, 452, 460, - - 40, 453, 449, 456, 450, 40, 40, 459, 454, 40, - 40, 462, 461, 463, 464, 40, 40, 40, 40, 465, - 40, 467, 40, 40, 40, 40, 40, 470, 40, 40, - 474, 40, 40, 468, 476, 40, 472, 40, 466, 473, - 40, 475, 477, 40, 40, 471, 481, 469, 478, 482, - 479, 40, 40, 40, 40, 40, 40, 40, 480, 40, - 485, 40, 40, 40, 489, 40, 483, 486, 487, 488, - 491, 40, 494, 484, 40, 40, 492, 40, 497, 490, - 493, 496, 499, 40, 40, 40, 495, 40, 40, 40, - 40, 40, 498, 503, 504, 500, 505, 40, 40, 40, - - 40, 40, 40, 40, 509, 502, 501, 510, 508, 40, - 40, 40, 40, 507, 40, 40, 40, 506, 40, 40, - 511, 37, 37, 37, 37, 39, 39, 50, 40, 50, - 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 145, 74, 89, 40, 113, 127, 40, + 115, 90, 83, 40, 102, 87, 40, 88, 84, 92, + 114, 116, 40, 40, 135, 118, 128, 103, 129, 93, + 104, 94, 95, 40, 40, 96, 97, 105, 120, 40, + 117, 130, 40, 40, 98, 133, 99, 100, 40, 101, + 92, 40, 153, 134, 40, 121, 121, 121, 121, 132, + 106, 40, 107, 43, 43, 43, 43, 108, 138, 109, + + 40, 110, 147, 40, 142, 111, 112, 122, 44, 44, + 44, 44, 47, 45, 45, 45, 45, 40, 124, 124, + 124, 124, 40, 156, 40, 125, 170, 213, 41, 40, + 162, 125, 47, 48, 48, 48, 48, 40, 126, 126, + 126, 126, 40, 40, 126, 126, 40, 126, 126, 126, + 126, 126, 126, 40, 40, 40, 40, 40, 136, 40, + 143, 146, 148, 149, 40, 137, 40, 40, 155, 40, + 151, 40, 144, 40, 165, 154, 40, 152, 40, 150, + 40, 168, 157, 40, 40, 158, 166, 40, 163, 159, + 160, 167, 161, 169, 164, 171, 40, 173, 40, 175, + + 174, 172, 40, 40, 40, 40, 176, 40, 40, 40, + 40, 180, 40, 40, 40, 187, 179, 188, 190, 181, + 183, 40, 191, 184, 40, 177, 185, 182, 189, 186, + 178, 40, 196, 40, 192, 40, 40, 194, 40, 40, + 40, 40, 193, 40, 207, 208, 198, 205, 195, 40, + 40, 201, 199, 206, 200, 40, 202, 209, 40, 197, + 212, 230, 40, 210, 203, 211, 40, 40, 40, 204, + 214, 121, 121, 121, 121, 217, 217, 217, 217, 215, + 223, 225, 218, 40, 40, 40, 40, 40, 218, 124, + 124, 124, 124, 40, 222, 224, 125, 40, 40, 226, + + 227, 255, 125, 219, 220, 40, 221, 221, 221, 221, + 40, 40, 40, 229, 40, 40, 232, 40, 40, 40, + 228, 231, 40, 237, 40, 40, 40, 235, 40, 233, + 234, 236, 238, 239, 240, 40, 40, 40, 40, 40, + 245, 40, 40, 249, 242, 246, 241, 248, 40, 243, + 251, 252, 247, 244, 250, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 254, 257, 253, 40, 40, 258, + 40, 40, 40, 40, 259, 294, 261, 40, 304, 256, + 263, 268, 262, 40, 260, 264, 264, 264, 264, 276, + 265, 264, 264, 266, 264, 264, 264, 264, 264, 264, + + 267, 40, 40, 40, 273, 40, 40, 40, 40, 40, + 269, 275, 270, 274, 40, 40, 271, 40, 272, 280, + 40, 40, 279, 282, 283, 40, 277, 40, 281, 278, + 40, 40, 40, 40, 40, 40, 288, 40, 40, 40, + 284, 290, 287, 40, 286, 285, 291, 289, 296, 293, + 292, 297, 40, 40, 40, 301, 295, 298, 300, 217, + 217, 217, 217, 40, 40, 312, 218, 299, 310, 315, + 219, 219, 218, 302, 302, 302, 302, 302, 302, 302, + 302, 221, 221, 221, 221, 40, 221, 221, 221, 221, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + + 40, 307, 40, 40, 40, 318, 40, 40, 303, 305, + 306, 311, 40, 313, 314, 319, 40, 323, 308, 309, + 40, 316, 322, 320, 317, 40, 40, 321, 40, 324, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 327, 40, 335, 328, 325, 326, 330, 329, + 331, 332, 336, 40, 40, 40, 40, 40, 333, 40, + 334, 337, 339, 338, 341, 343, 40, 40, 40, 345, + 40, 40, 40, 40, 348, 346, 340, 347, 342, 349, + 344, 351, 40, 40, 352, 40, 350, 40, 40, 40, + 355, 40, 353, 40, 40, 40, 354, 40, 302, 302, + + 302, 302, 359, 40, 356, 40, 40, 362, 364, 357, + 358, 365, 40, 366, 40, 40, 40, 361, 40, 363, + 360, 367, 369, 368, 370, 40, 40, 40, 40, 375, + 40, 371, 40, 40, 40, 372, 374, 40, 40, 378, + 379, 40, 40, 380, 40, 373, 40, 377, 40, 40, + 40, 376, 381, 385, 382, 40, 388, 387, 40, 384, + 40, 40, 40, 386, 383, 40, 40, 389, 392, 390, + 391, 40, 40, 40, 40, 395, 40, 394, 393, 40, + 40, 398, 401, 396, 40, 40, 400, 40, 40, 397, + 40, 403, 406, 40, 40, 40, 399, 40, 405, 402, + + 40, 411, 40, 409, 40, 40, 412, 404, 416, 417, + 408, 407, 410, 40, 40, 40, 40, 40, 40, 40, + 414, 40, 413, 415, 420, 421, 422, 40, 426, 40, + 419, 40, 40, 40, 423, 425, 418, 40, 424, 427, + 40, 40, 40, 40, 428, 429, 40, 430, 432, 40, + 40, 40, 40, 40, 433, 40, 40, 40, 40, 431, + 434, 440, 441, 40, 40, 435, 439, 436, 40, 40, + 437, 443, 442, 444, 40, 40, 438, 445, 448, 446, + 449, 40, 40, 451, 40, 40, 450, 452, 447, 453, + 40, 40, 40, 40, 40, 40, 455, 40, 40, 40, + + 40, 458, 40, 40, 40, 465, 462, 454, 459, 464, + 467, 460, 463, 456, 457, 40, 40, 466, 461, 40, + 40, 469, 468, 40, 40, 471, 473, 40, 474, 40, + 40, 40, 470, 472, 40, 40, 40, 477, 40, 40, + 40, 481, 40, 475, 483, 40, 40, 479, 40, 40, + 480, 40, 40, 482, 478, 40, 484, 488, 476, 486, + 489, 485, 40, 40, 492, 40, 40, 40, 40, 487, + 40, 40, 490, 40, 40, 496, 40, 493, 494, 40, + 495, 491, 501, 498, 40, 499, 503, 504, 40, 500, + 497, 502, 40, 40, 40, 40, 40, 40, 40, 40, + + 40, 505, 40, 510, 511, 512, 40, 40, 40, 506, + 507, 517, 40, 516, 40, 509, 508, 515, 40, 40, + 40, 40, 514, 40, 40, 513, 40, 40, 518, 37, + 37, 37, 37, 39, 39, 50, 40, 50, 50, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, @@ -692,15 +694,17 @@ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 212, 40, 40, 40, 40, - 117, 40, 38, 512, 3, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512 + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 216, + 40, 40, 40, 40, 119, 40, 38, 519, 3, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519 } ; -static yyconst short int yy_chk[1159] = +static yyconst short int yy_chk[1173] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -719,116 +723,118 @@ 51, 34, 33, 66, 21, 28, 58, 33, 51, 31, 34, 28, 25, 52, 31, 27, 36, 27, 25, 30, 33, 35, 35, 30, 58, 36, 52, 31, 52, 30, - 31, 30, 30, 79, 517, 30, 30, 31, 92, 79, - 35, 42, 42, 42, 42, 53, 30, 30, 55, 30, - 32, 60, 56, 53, 32, 43, 43, 43, 43, 57, - 32, 61, 32, 56, 55, 92, 60, 32, 61, 32, + 31, 30, 30, 53, 56, 30, 30, 31, 524, 72, + 35, 53, 57, 55, 30, 56, 30, 30, 68, 30, + 32, 64, 72, 57, 32, 42, 42, 42, 42, 55, + 32, 61, 32, 43, 43, 43, 43, 32, 61, 32, - 57, 32, 68, 60, 64, 73, 32, 44, 44, 44, + 75, 32, 68, 85, 64, 32, 32, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 47, 47, - 47, 47, 47, 73, 87, 47, 68, 64, 67, 87, - 515, 47, 48, 48, 48, 48, 48, 48, 49, 49, - 49, 49, 49, 67, 49, 49, 65, 49, 49, 49, - 49, 49, 49, 65, 69, 71, 70, 74, 72, 75, - 76, 77, 69, 70, 78, 65, 74, 80, 81, 85, - 71, 72, 93, 81, 511, 83, 82, 71, 76, 70, - 77, 84, 75, 83, 80, 81, 78, 78, 86, 78, - 80, 82, 85, 89, 90, 91, 84, 94, 95, 96, - - 93, 97, 99, 86, 98, 95, 89, 90, 99, 97, - 94, 91, 100, 95, 96, 101, 103, 96, 91, 104, - 96, 95, 98, 96, 105, 100, 106, 107, 101, 103, - 108, 110, 113, 109, 509, 115, 101, 113, 104, 106, - 103, 109, 112, 110, 107, 111, 109, 116, 108, 111, - 111, 114, 105, 114, 109, 112, 115, 112, 135, 109, - 131, 127, 111, 119, 119, 119, 119, 126, 116, 120, - 120, 120, 120, 131, 508, 159, 120, 133, 126, 127, - 129, 135, 120, 122, 122, 122, 122, 122, 138, 129, - 122, 134, 133, 159, 141, 149, 122, 123, 123, 137, - - 123, 123, 123, 123, 123, 139, 134, 137, 140, 141, - 138, 142, 144, 140, 139, 146, 145, 149, 147, 150, - 148, 144, 145, 151, 153, 144, 142, 147, 146, 148, - 152, 154, 155, 153, 156, 152, 157, 158, 155, 161, - 154, 148, 150, 160, 162, 157, 158, 163, 151, 156, - 164, 165, 160, 161, 166, 163, 169, 170, 172, 177, - 176, 164, 190, 179, 178, 203, 165, 162, 507, 505, - 203, 169, 179, 190, 182, 172, 186, 170, 166, 175, - 175, 175, 175, 176, 177, 175, 175, 178, 175, 175, - 175, 175, 175, 175, 180, 182, 184, 186, 185, 188, - - 189, 191, 194, 180, 192, 180, 184, 185, 193, 180, - 195, 180, 197, 192, 196, 189, 199, 193, 198, 200, - 191, 201, 188, 202, 204, 194, 207, 198, 200, 197, - 205, 207, 206, 199, 201, 195, 208, 196, 209, 205, - 206, 202, 209, 211, 503, 204, 213, 213, 213, 213, - 208, 214, 214, 213, 214, 214, 214, 214, 226, 213, - 218, 211, 215, 215, 215, 215, 216, 216, 216, 216, - 216, 217, 217, 217, 217, 217, 219, 218, 220, 221, - 225, 226, 227, 219, 229, 230, 231, 225, 232, 229, - 235, 233, 234, 236, 237, 220, 221, 234, 230, 237, - - 239, 238, 241, 243, 232, 227, 233, 239, 245, 235, - 238, 244, 246, 231, 236, 247, 244, 245, 243, 257, - 248, 250, 249, 251, 254, 241, 255, 258, 263, 264, - 502, 260, 262, 246, 248, 263, 247, 249, 251, 250, - 260, 255, 254, 257, 265, 262, 266, 267, 268, 264, - 258, 269, 272, 265, 270, 266, 267, 271, 289, 272, - 275, 269, 282, 270, 274, 278, 271, 265, 281, 266, - 283, 268, 282, 274, 278, 275, 284, 285, 286, 281, - 287, 284, 288, 283, 291, 289, 293, 294, 295, 295, - 295, 295, 297, 288, 285, 298, 293, 297, 300, 286, - - 294, 287, 303, 298, 301, 300, 302, 291, 293, 301, - 304, 305, 306, 302, 309, 307, 304, 308, 310, 311, - 313, 316, 318, 303, 307, 317, 311, 313, 330, 315, - 305, 306, 319, 320, 308, 310, 316, 309, 315, 322, - 324, 317, 320, 323, 325, 318, 326, 324, 327, 319, - 329, 330, 323, 325, 338, 326, 322, 327, 342, 341, - 339, 347, 350, 343, 353, 351, 348, 349, 329, 338, - 339, 341, 343, 348, 355, 349, 351, 354, 356, 355, - 357, 342, 359, 361, 347, 350, 362, 353, 364, 363, - 354, 365, 371, 362, 366, 359, 375, 357, 363, 370, - - 361, 356, 373, 370, 370, 375, 377, 376, 384, 365, - 364, 377, 366, 379, 385, 371, 376, 387, 373, 399, - 379, 392, 388, 393, 398, 400, 387, 401, 402, 384, - 403, 385, 388, 400, 392, 393, 407, 408, 409, 398, - 401, 399, 411, 412, 410, 402, 413, 414, 417, 419, - 415, 411, 412, 403, 501, 424, 421, 407, 408, 410, - 416, 421, 414, 413, 409, 415, 420, 422, 423, 416, - 417, 426, 422, 425, 419, 420, 427, 423, 424, 429, - 425, 430, 431, 433, 434, 435, 436, 427, 440, 441, - 439, 431, 442, 443, 426, 436, 441, 440, 433, 443, - - 447, 434, 429, 439, 430, 445, 446, 442, 435, 451, - 452, 446, 445, 447, 451, 453, 454, 455, 456, 452, - 457, 454, 458, 459, 460, 461, 462, 457, 464, 463, - 461, 466, 465, 455, 463, 467, 459, 468, 453, 460, - 469, 462, 464, 470, 472, 458, 468, 456, 465, 469, - 466, 473, 474, 475, 476, 478, 479, 480, 467, 481, - 473, 490, 483, 484, 478, 488, 470, 474, 475, 476, - 480, 486, 484, 472, 487, 489, 481, 491, 488, 479, - 483, 487, 490, 492, 493, 494, 486, 495, 497, 496, - 498, 500, 489, 494, 495, 491, 496, 504, 506, 510, - - 499, 485, 482, 477, 504, 493, 492, 506, 500, 471, - 450, 449, 448, 498, 444, 438, 437, 497, 432, 428, - 510, 513, 513, 513, 513, 514, 514, 516, 418, 516, - 516, 406, 405, 404, 397, 396, 395, 394, 391, 390, - 389, 386, 383, 382, 381, 380, 378, 374, 372, 369, - 368, 367, 360, 358, 352, 346, 345, 344, 340, 337, - 336, 335, 334, 333, 332, 331, 328, 321, 314, 312, - 299, 296, 292, 290, 280, 279, 277, 276, 273, 261, - 256, 253, 252, 242, 240, 228, 224, 223, 222, 210, - 187, 183, 181, 174, 173, 171, 168, 167, 143, 136, - - 132, 130, 128, 125, 121, 117, 102, 88, 59, 39, - 37, 8, 7, 3, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512 + 47, 47, 47, 75, 79, 47, 85, 116, 522, 116, + 79, 47, 48, 48, 48, 48, 48, 48, 49, 49, + 49, 49, 49, 60, 49, 49, 67, 49, 49, 49, + 49, 49, 49, 65, 69, 71, 70, 73, 60, 74, + 65, 67, 69, 70, 76, 60, 77, 78, 74, 81, + 71, 80, 65, 83, 81, 73, 82, 71, 84, 70, + 86, 83, 76, 91, 89, 77, 81, 90, 80, 78, + 78, 82, 78, 84, 80, 86, 87, 89, 92, 91, + + 90, 87, 93, 94, 95, 96, 91, 97, 98, 101, + 99, 95, 100, 105, 518, 97, 94, 98, 100, 95, + 96, 102, 101, 96, 104, 92, 96, 95, 99, 96, + 93, 106, 105, 107, 102, 108, 109, 104, 111, 140, + 113, 112, 102, 110, 113, 113, 107, 111, 104, 117, + 114, 110, 108, 112, 109, 115, 110, 113, 118, 106, + 115, 140, 129, 114, 110, 114, 516, 515, 133, 110, + 117, 121, 121, 121, 121, 122, 122, 122, 122, 118, + 129, 133, 122, 128, 135, 136, 131, 163, 122, 124, + 124, 124, 124, 124, 128, 131, 124, 137, 514, 135, + + 136, 163, 124, 125, 125, 139, 125, 125, 125, 125, + 125, 142, 141, 139, 143, 144, 142, 147, 146, 148, + 137, 141, 151, 147, 149, 150, 152, 146, 153, 143, + 144, 146, 148, 149, 150, 154, 155, 157, 156, 158, + 154, 159, 160, 157, 151, 155, 150, 156, 161, 152, + 159, 160, 155, 153, 158, 162, 164, 165, 166, 167, + 168, 171, 172, 174, 162, 165, 161, 178, 179, 166, + 207, 223, 181, 188, 167, 207, 171, 180, 223, 164, + 174, 181, 172, 184, 168, 177, 177, 177, 177, 188, + 178, 177, 177, 179, 177, 177, 177, 177, 177, 177, + + 180, 182, 187, 186, 184, 189, 191, 192, 193, 194, + 182, 187, 182, 186, 195, 196, 182, 197, 182, 193, + 198, 199, 192, 195, 196, 200, 189, 201, 194, 191, + 202, 206, 203, 204, 205, 208, 201, 215, 235, 209, + 197, 203, 200, 210, 199, 198, 204, 202, 209, 206, + 205, 210, 211, 212, 213, 215, 208, 211, 213, 217, + 217, 217, 217, 233, 238, 235, 217, 212, 233, 238, + 218, 218, 217, 218, 218, 218, 218, 219, 219, 219, + 219, 220, 220, 220, 220, 220, 221, 221, 221, 221, + 221, 222, 224, 225, 229, 230, 231, 236, 234, 237, + + 241, 229, 239, 240, 245, 241, 242, 248, 222, 224, + 225, 234, 249, 236, 237, 242, 243, 249, 230, 231, + 250, 239, 248, 243, 240, 251, 252, 245, 253, 250, + 254, 255, 259, 256, 262, 265, 260, 263, 512, 267, + 510, 509, 253, 269, 265, 254, 251, 252, 256, 255, + 259, 260, 267, 270, 268, 271, 272, 273, 262, 274, + 263, 268, 270, 269, 271, 272, 275, 278, 277, 274, + 280, 281, 284, 287, 278, 275, 270, 277, 271, 280, + 273, 284, 288, 289, 287, 290, 281, 291, 293, 294, + 290, 295, 288, 296, 298, 301, 289, 300, 302, 302, + + 302, 302, 295, 310, 291, 305, 304, 300, 301, 293, + 294, 304, 315, 305, 307, 309, 312, 298, 308, 300, + 296, 307, 309, 308, 310, 311, 313, 314, 316, 315, + 317, 311, 318, 320, 322, 312, 314, 323, 324, 318, + 320, 325, 326, 322, 327, 313, 329, 317, 330, 331, + 336, 316, 323, 327, 324, 337, 331, 330, 332, 326, + 333, 334, 345, 329, 325, 346, 349, 332, 336, 333, + 334, 348, 350, 354, 356, 346, 357, 345, 337, 355, + 358, 350, 356, 348, 360, 361, 355, 362, 363, 349, + 366, 358, 362, 364, 369, 368, 354, 370, 361, 357, + + 371, 369, 372, 366, 377, 373, 370, 360, 377, 377, + 364, 363, 368, 378, 380, 382, 383, 391, 392, 394, + 372, 384, 371, 373, 382, 383, 384, 386, 394, 395, + 380, 399, 405, 400, 386, 392, 378, 406, 391, 395, + 407, 408, 410, 409, 399, 400, 414, 405, 407, 415, + 416, 417, 418, 419, 408, 420, 421, 424, 422, 406, + 409, 418, 419, 426, 431, 410, 417, 414, 423, 427, + 415, 421, 420, 422, 430, 428, 416, 423, 427, 424, + 428, 429, 432, 430, 433, 434, 429, 431, 426, 432, + 436, 437, 438, 440, 441, 442, 434, 443, 448, 446, + + 447, 438, 449, 460, 450, 448, 443, 433, 440, 447, + 450, 441, 446, 436, 437, 452, 453, 449, 442, 454, + 458, 453, 452, 461, 459, 458, 460, 462, 461, 463, + 464, 465, 454, 459, 466, 467, 468, 464, 469, 470, + 473, 468, 471, 462, 470, 472, 474, 466, 475, 477, + 467, 476, 479, 469, 465, 480, 471, 475, 463, 473, + 476, 472, 481, 482, 480, 483, 485, 486, 488, 474, + 487, 490, 477, 491, 495, 485, 493, 481, 482, 494, + 483, 479, 491, 487, 496, 488, 494, 495, 497, 490, + 486, 493, 498, 499, 500, 501, 504, 502, 503, 505, + + 507, 496, 513, 501, 502, 503, 511, 517, 508, 497, + 498, 513, 506, 511, 492, 500, 499, 507, 489, 484, + 478, 457, 505, 456, 455, 504, 451, 445, 517, 520, + 520, 520, 520, 521, 521, 523, 444, 523, 523, 439, + 435, 425, 413, 412, 411, 404, 403, 402, 401, 398, + 397, 396, 393, 390, 389, 388, 387, 385, 381, 379, + 376, 375, 374, 367, 365, 359, 353, 352, 351, 347, + 344, 343, 342, 341, 340, 339, 338, 335, 328, 321, + 319, 306, 303, 299, 297, 292, 286, 285, 283, 282, + 279, 276, 266, 261, 258, 257, 247, 246, 244, 232, + + 228, 227, 226, 214, 190, 185, 183, 176, 175, 173, + 170, 169, 145, 138, 134, 132, 130, 127, 123, 119, + 103, 88, 59, 39, 37, 8, 7, 3, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, + 519, 519 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -845,7 +851,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 1 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -860,7 +866,7 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 28 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include @@ -996,7 +1002,7 @@ /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ -#line 1000 "Lexer.cpp" +#line 1006 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1147,10 +1153,10 @@ register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 189 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 189 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" -#line 1154 "Lexer.cpp" +#line 1160 "Lexer.cpp" if ( yy_init ) { @@ -1198,14 +1204,14 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 513 ) + if ( yy_current_state >= 520 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_current_state != 512 ); + while ( yy_current_state != 519 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1243,531 +1249,546 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 191 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 191 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 193 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 193 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 194 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 194 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 195 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 195 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 196 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 196 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 197 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 197 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 198 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 198 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 199 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 199 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 200 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 200 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 201 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 201 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 202 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 202 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 203 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 203 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 204 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 204 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 205 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 205 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 206 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 206 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 207 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 207 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } /* Deprecated, turn into external */ YY_BREAK case 17: YY_RULE_SETUP -#line 208 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 208 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 209 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 210 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 211 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 212 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 213 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 214 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 214 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 24: YY_RULE_SETUP -#line 215 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 215 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 25: YY_RULE_SETUP -#line 216 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 216 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return NOT; } /* Deprecated, turned into XOR */ YY_BREAK case 26: YY_RULE_SETUP -#line 217 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 217 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 27: YY_RULE_SETUP -#line 218 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 218 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 28: YY_RULE_SETUP -#line 219 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 219 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 220 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 30: YY_RULE_SETUP -#line 221 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 221 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return ENDIAN; } YY_BREAK case 31: YY_RULE_SETUP -#line 222 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 222 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return POINTERSIZE; } YY_BREAK case 32: YY_RULE_SETUP -#line 223 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 223 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return DATA; } YY_BREAK case 33: YY_RULE_SETUP -#line 224 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 224 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return LITTLE; } YY_BREAK case 34: YY_RULE_SETUP -#line 225 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 225 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return BIG; } YY_BREAK case 35: YY_RULE_SETUP -#line 226 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 226 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 227 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 227 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 37: YY_RULE_SETUP -#line 228 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 228 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 38: YY_RULE_SETUP -#line 229 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 229 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 39: YY_RULE_SETUP -#line 230 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 230 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 231 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 231 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 41: YY_RULE_SETUP -#line 233 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 233 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 234 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 234 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 235 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 235 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return CSRETCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 236 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 236 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 45: YY_RULE_SETUP -#line 237 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 237 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 46: YY_RULE_SETUP -#line 238 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 238 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 47: YY_RULE_SETUP -#line 239 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 239 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 48: YY_RULE_SETUP -#line 241 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 241 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } YY_BREAK case 49: YY_RULE_SETUP -#line 242 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 242 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } YY_BREAK case 50: YY_RULE_SETUP -#line 243 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 243 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } YY_BREAK case 51: YY_RULE_SETUP -#line 244 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 244 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } YY_BREAK case 52: YY_RULE_SETUP -#line 245 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 245 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } YY_BREAK case 53: YY_RULE_SETUP -#line 246 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 246 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } YY_BREAK case 54: YY_RULE_SETUP -#line 247 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 247 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::IntTy ; return INT; } YY_BREAK case 55: YY_RULE_SETUP -#line 248 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 248 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } YY_BREAK case 56: YY_RULE_SETUP -#line 249 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 249 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LongTy ; return LONG; } YY_BREAK case 57: YY_RULE_SETUP -#line 250 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 250 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } YY_BREAK case 58: YY_RULE_SETUP -#line 251 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 251 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } YY_BREAK case 59: YY_RULE_SETUP -#line 252 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 252 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } YY_BREAK case 60: YY_RULE_SETUP -#line 253 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 253 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } YY_BREAK case 61: YY_RULE_SETUP -#line 254 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 254 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 62: YY_RULE_SETUP -#line 255 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 255 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 63: YY_RULE_SETUP -#line 257 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 257 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 64: YY_RULE_SETUP -#line 258 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 258 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 65: YY_RULE_SETUP -#line 259 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 259 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 66: YY_RULE_SETUP -#line 260 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 260 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 67: YY_RULE_SETUP -#line 261 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 261 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 68: YY_RULE_SETUP -#line 262 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 262 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SDiv, SDIV); } YY_BREAK case 69: YY_RULE_SETUP -#line 263 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 263 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FDiv, FDIV); } YY_BREAK case 70: YY_RULE_SETUP -#line 264 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, Rem, REM); } +#line 264 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); } YY_BREAK case 71: YY_RULE_SETUP -#line 265 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, And, AND); } +#line 265 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, URem, UREM); } YY_BREAK case 72: YY_RULE_SETUP -#line 266 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, Or , OR ); } +#line 266 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SRem, SREM); } YY_BREAK case 73: YY_RULE_SETUP -#line 267 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, Xor, XOR); } +#line 267 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, FRem, FREM); } YY_BREAK case 74: YY_RULE_SETUP -#line 268 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetNE, SETNE); } +#line 268 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 75: YY_RULE_SETUP -#line 269 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } +#line 269 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 76: YY_RULE_SETUP -#line 270 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetLT, SETLT); } +#line 270 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 77: YY_RULE_SETUP -#line 271 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetGT, SETGT); } +#line 271 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 78: YY_RULE_SETUP -#line 272 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetLE, SETLE); } +#line 272 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 79: YY_RULE_SETUP -#line 273 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(BinaryOpVal, SetGE, SETGE); } +#line 273 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 80: YY_RULE_SETUP -#line 275 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, PHI, PHI_TOK); } +#line 274 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 81: YY_RULE_SETUP -#line 276 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, Call, CALL); } +#line 275 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 82: YY_RULE_SETUP -#line 277 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, Cast, CAST); } +#line 276 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 83: YY_RULE_SETUP -#line 278 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, Select, SELECT); } +#line 278 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK case 84: YY_RULE_SETUP -#line 279 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, Shl, SHL); } +#line 279 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 85: YY_RULE_SETUP -#line 280 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, Shr, SHR); } +#line 280 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, Cast, CAST); } YY_BREAK case 86: YY_RULE_SETUP -#line 281 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ return VANEXT_old; } +#line 281 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK case 87: YY_RULE_SETUP -#line 282 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ return VAARG_old; } +#line 282 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK case 88: YY_RULE_SETUP -#line 283 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, VAArg , VAARG); } +#line 283 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, Shr, SHR); } YY_BREAK case 89: YY_RULE_SETUP -#line 284 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(TermOpVal, Ret, RET); } +#line 284 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ return VANEXT_old; } YY_BREAK case 90: YY_RULE_SETUP -#line 285 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(TermOpVal, Br, BR); } +#line 285 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ return VAARG_old; } YY_BREAK case 91: YY_RULE_SETUP -#line 286 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(TermOpVal, Switch, SWITCH); } +#line 286 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 92: YY_RULE_SETUP -#line 287 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(TermOpVal, Invoke, INVOKE); } +#line 287 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 93: YY_RULE_SETUP -#line 288 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(TermOpVal, Unwind, UNWIND); } +#line 288 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 94: YY_RULE_SETUP -#line 289 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } +#line 289 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 95: YY_RULE_SETUP -#line 291 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(MemOpVal, Malloc, MALLOC); } +#line 290 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK case 96: YY_RULE_SETUP -#line 292 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(MemOpVal, Alloca, ALLOCA); } +#line 291 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 97: YY_RULE_SETUP -#line 293 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(MemOpVal, Free, FREE); } +#line 292 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK case 98: YY_RULE_SETUP -#line 294 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(MemOpVal, Load, LOAD); } +#line 294 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 99: YY_RULE_SETUP -#line 295 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(MemOpVal, Store, STORE); } +#line 295 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 100: YY_RULE_SETUP -#line 296 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } +#line 296 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 101: YY_RULE_SETUP -#line 298 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } +#line 297 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 102: YY_RULE_SETUP -#line 299 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } +#line 298 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 103: YY_RULE_SETUP -#line 300 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -{ RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } +#line 299 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 104: YY_RULE_SETUP -#line 303 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 301 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } + YY_BREAK +case 105: +YY_RULE_SETUP +#line 302 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } + YY_BREAK +case 106: +YY_RULE_SETUP +#line 303 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" +{ RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } + YY_BREAK +case 107: +YY_RULE_SETUP +#line 306 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip % return VAR_ID; } YY_BREAK -case 105: +case 108: YY_RULE_SETUP -#line 308 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 311 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -1775,9 +1796,9 @@ return LABELSTR; } YY_BREAK -case 106: +case 109: YY_RULE_SETUP -#line 314 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 317 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -1785,9 +1806,9 @@ return LABELSTR; } YY_BREAK -case 107: +case 110: YY_RULE_SETUP -#line 321 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 324 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -1798,14 +1819,14 @@ return STRINGCONSTANT; } YY_BREAK -case 108: +case 111: YY_RULE_SETUP -#line 332 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 335 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK -case 109: +case 112: YY_RULE_SETUP -#line 333 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 336 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1815,17 +1836,17 @@ return ESINT64VAL; } YY_BREAK -case 110: +case 113: YY_RULE_SETUP -#line 341 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 344 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; } YY_BREAK -case 111: +case 114: YY_RULE_SETUP -#line 346 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 349 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -1834,9 +1855,9 @@ return UINTVAL; } YY_BREAK -case 112: +case 115: YY_RULE_SETUP -#line 353 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 356 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1846,18 +1867,18 @@ return SINTVAL; } YY_BREAK -case 113: +case 116: YY_RULE_SETUP -#line 362 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 365 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK -case 114: +case 117: YY_RULE_SETUP -#line 363 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 366 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 365 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 368 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -1866,22 +1887,22 @@ return EOF; } YY_BREAK -case 115: +case 118: YY_RULE_SETUP -#line 373 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 376 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK -case 116: +case 119: YY_RULE_SETUP -#line 374 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 377 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK -case 117: +case 120: YY_RULE_SETUP -#line 376 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 379 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1885 "Lexer.cpp" +#line 1906 "Lexer.cpp" case YY_END_OF_BUFFER: { @@ -2168,7 +2189,7 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 513 ) + if ( yy_current_state >= 520 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2198,11 +2219,11 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 513 ) + if ( yy_current_state >= 520 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 512); + yy_is_jam = (yy_current_state == 519); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2759,5 +2780,5 @@ return 0; } #endif -#line 376 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" +#line 379 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/Lexer.l" Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.78.2.5 llvm/lib/AsmParser/Lexer.l:1.78.2.6 --- llvm/lib/AsmParser/Lexer.l:1.78.2.5 Sun Oct 22 03:59:00 2006 +++ llvm/lib/AsmParser/Lexer.l Mon Oct 23 13:13:26 2006 @@ -261,7 +261,10 @@ udiv { RET_TOK(BinaryOpVal, UDiv, UDIV); } sdiv { RET_TOK(BinaryOpVal, SDiv, SDIV); } fdiv { RET_TOK(BinaryOpVal, FDiv, FDIV); } -rem { RET_TOK(BinaryOpVal, Rem, REM); } +rem { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); } +urem { RET_TOK(BinaryOpVal, URem, UREM); } +srem { RET_TOK(BinaryOpVal, SRem, SREM); } +frem { RET_TOK(BinaryOpVal, FRem, FREM); } and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } xor { RET_TOK(BinaryOpVal, Xor, XOR); } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.8.2.5 llvm/lib/AsmParser/Lexer.l.cvs:1.8.2.6 --- llvm/lib/AsmParser/Lexer.l.cvs:1.8.2.5 Sun Oct 22 03:59:00 2006 +++ llvm/lib/AsmParser/Lexer.l.cvs Mon Oct 23 13:13:26 2006 @@ -261,7 +261,10 @@ udiv { RET_TOK(BinaryOpVal, UDiv, UDIV); } sdiv { RET_TOK(BinaryOpVal, SDiv, SDIV); } fdiv { RET_TOK(BinaryOpVal, FDiv, FDIV); } -rem { RET_TOK(BinaryOpVal, Rem, REM); } +rem { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); } +urem { RET_TOK(BinaryOpVal, URem, UREM); } +srem { RET_TOK(BinaryOpVal, SRem, SREM); } +frem { RET_TOK(BinaryOpVal, FRem, FREM); } and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } xor { RET_TOK(BinaryOpVal, Xor, XOR); } Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.7 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.8 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.7 Mon Oct 23 01:25:18 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Mon Oct 23 13:13:26 2006 @@ -145,33 +145,35 @@ UDIV = 336, SDIV = 337, FDIV = 338, - REM = 339, - AND = 340, - OR = 341, - XOR = 342, - SETLE = 343, - SETGE = 344, - SETLT = 345, - SETGT = 346, - SETEQ = 347, - SETNE = 348, - MALLOC = 349, - ALLOCA = 350, - FREE = 351, - LOAD = 352, - STORE = 353, - GETELEMENTPTR = 354, - PHI_TOK = 355, - CAST = 356, - SELECT = 357, - SHL = 358, - SHR = 359, - VAARG = 360, - EXTRACTELEMENT = 361, - INSERTELEMENT = 362, - SHUFFLEVECTOR = 363, - VAARG_old = 364, - VANEXT_old = 365 + UREM = 339, + SREM = 340, + FREM = 341, + AND = 342, + OR = 343, + XOR = 344, + SETLE = 345, + SETGE = 346, + SETLT = 347, + SETGT = 348, + SETEQ = 349, + SETNE = 350, + MALLOC = 351, + ALLOCA = 352, + FREE = 353, + LOAD = 354, + STORE = 355, + GETELEMENTPTR = 356, + PHI_TOK = 357, + CAST = 358, + SELECT = 359, + SHL = 360, + SHR = 361, + VAARG = 362, + EXTRACTELEMENT = 363, + INSERTELEMENT = 364, + SHUFFLEVECTOR = 365, + VAARG_old = 366, + VANEXT_old = 367 }; #endif /* Tokens. */ @@ -256,39 +258,41 @@ #define UDIV 336 #define SDIV 337 #define FDIV 338 -#define REM 339 -#define AND 340 -#define OR 341 -#define XOR 342 -#define SETLE 343 -#define SETGE 344 -#define SETLT 345 -#define SETGT 346 -#define SETEQ 347 -#define SETNE 348 -#define MALLOC 349 -#define ALLOCA 350 -#define FREE 351 -#define LOAD 352 -#define STORE 353 -#define GETELEMENTPTR 354 -#define PHI_TOK 355 -#define CAST 356 -#define SELECT 357 -#define SHL 358 -#define SHR 359 -#define VAARG 360 -#define EXTRACTELEMENT 361 -#define INSERTELEMENT 362 -#define SHUFFLEVECTOR 363 -#define VAARG_old 364 -#define VANEXT_old 365 +#define UREM 339 +#define SREM 340 +#define FREM 341 +#define AND 342 +#define OR 343 +#define XOR 344 +#define SETLE 345 +#define SETGE 346 +#define SETLT 347 +#define SETGT 348 +#define SETEQ 349 +#define SETNE 350 +#define MALLOC 351 +#define ALLOCA 352 +#define FREE 353 +#define LOAD 354 +#define STORE 355 +#define GETELEMENTPTR 356 +#define PHI_TOK 357 +#define CAST 358 +#define SELECT 359 +#define SHL 360 +#define SHR 361 +#define VAARG 362 +#define EXTRACTELEMENT 363 +#define INSERTELEMENT 364 +#define SHUFFLEVECTOR 365 +#define VAARG_old 366 +#define VANEXT_old 367 /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1117,6 +1121,18 @@ else if (Ty->isUnsigned()) OI.opcode = Instruction::UDiv; break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; + case Instruction::SRem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isUnsigned()) + OI.opcode = Instruction::URem; + break; } OI.obsolete = false; } @@ -1299,7 +1315,7 @@ #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1005 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1017 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1340,7 +1356,7 @@ llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1344 "llvmAsmParser.tab.c" +#line 1360 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1352,7 +1368,7 @@ /* Line 219 of yacc.c. */ -#line 1356 "llvmAsmParser.tab.c" +#line 1372 "llvmAsmParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1503,20 +1519,20 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1288 +#define YYLAST 1357 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 125 +#define YYNTOKENS 127 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 75 /* YYNRULES -- Number of rules. */ -#define YYNRULES 254 +#define YYNRULES 256 /* YYNRULES -- Number of states. */ -#define YYNSTATES 519 +#define YYNSTATES 521 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 365 +#define YYMAXUTOK 367 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -1528,15 +1544,15 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 114, 115, 123, 2, 112, 2, 2, 2, 2, 2, + 116, 117, 125, 2, 114, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 119, 111, 120, 2, 2, 2, 2, 2, 2, 2, + 121, 113, 122, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 116, 113, 118, 2, 2, 2, 2, 2, 124, + 2, 118, 115, 120, 2, 2, 2, 2, 2, 126, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 117, 2, 2, 121, 2, 122, 2, 2, 2, 2, + 119, 2, 2, 123, 2, 124, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1560,7 +1576,7 @@ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110 + 105, 106, 107, 108, 109, 110, 111, 112 }; #if YYDEBUG @@ -1571,148 +1587,148 @@ 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, - 59, 61, 63, 65, 67, 69, 71, 74, 75, 77, - 79, 81, 83, 85, 87, 89, 90, 91, 93, 95, - 97, 99, 101, 103, 106, 107, 110, 111, 115, 118, - 119, 121, 122, 126, 128, 131, 133, 135, 137, 139, + 59, 61, 63, 65, 67, 69, 71, 73, 75, 78, + 79, 81, 83, 85, 87, 89, 91, 93, 94, 95, + 97, 99, 101, 103, 105, 107, 110, 111, 114, 115, + 119, 122, 123, 125, 126, 130, 132, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 165, 167, 169, 171, 173, 176, 181, 187, - 193, 197, 200, 203, 205, 209, 211, 215, 217, 218, - 223, 227, 231, 236, 241, 245, 248, 251, 254, 257, - 260, 263, 266, 269, 272, 275, 282, 288, 297, 304, - 311, 318, 325, 332, 341, 350, 354, 356, 358, 360, - 362, 365, 368, 373, 376, 378, 383, 386, 391, 392, - 400, 401, 409, 410, 418, 419, 427, 431, 436, 437, - 439, 441, 443, 447, 451, 455, 459, 463, 467, 469, - 470, 472, 474, 476, 477, 480, 484, 486, 488, 492, - 494, 495, 504, 506, 508, 512, 514, 516, 519, 520, - 522, 524, 525, 530, 531, 533, 535, 537, 539, 541, - 543, 545, 547, 549, 553, 555, 561, 563, 565, 567, - 569, 572, 575, 578, 582, 585, 586, 588, 591, 594, - 598, 608, 618, 627, 641, 643, 645, 652, 658, 661, - 668, 676, 678, 682, 684, 685, 688, 690, 696, 702, - 708, 711, 716, 721, 728, 733, 738, 743, 748, 755, - 762, 765, 773, 775, 778, 779, 781, 782, 786, 793, - 797, 804, 807, 812, 819 + 161, 163, 165, 167, 169, 171, 173, 175, 177, 180, + 185, 191, 197, 201, 204, 207, 209, 213, 215, 219, + 221, 222, 227, 231, 235, 240, 245, 249, 252, 255, + 258, 261, 264, 267, 270, 273, 276, 279, 286, 292, + 301, 308, 315, 322, 329, 336, 345, 354, 358, 360, + 362, 364, 366, 369, 372, 377, 380, 382, 387, 390, + 395, 396, 404, 405, 413, 414, 422, 423, 431, 435, + 440, 441, 443, 445, 447, 451, 455, 459, 463, 467, + 471, 473, 474, 476, 478, 480, 481, 484, 488, 490, + 492, 496, 498, 499, 508, 510, 512, 516, 518, 520, + 523, 524, 526, 528, 529, 534, 535, 537, 539, 541, + 543, 545, 547, 549, 551, 553, 557, 559, 565, 567, + 569, 571, 573, 576, 579, 582, 586, 589, 590, 592, + 595, 598, 602, 612, 622, 631, 645, 647, 649, 656, + 662, 665, 672, 680, 682, 686, 688, 689, 692, 694, + 700, 706, 712, 715, 720, 725, 732, 737, 742, 747, + 752, 759, 766, 769, 777, 779, 782, 783, 785, 786, + 790, 797, 801, 808, 811, 816, 823 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const short int yyrhs[] = { - 156, 0, -1, 5, -1, 6, -1, 3, -1, 4, + 158, 0, -1, 5, -1, 6, -1, 3, -1, 4, -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, - -1, 93, -1, 103, -1, 104, -1, 16, -1, 14, - -1, 12, -1, 10, -1, 17, -1, 15, -1, 13, - -1, 11, -1, 132, -1, 133, -1, 18, -1, 19, - -1, 168, 111, -1, -1, 41, -1, 42, -1, 43, - -1, 44, -1, 45, -1, 46, -1, 47, -1, -1, - -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, - -1, 70, -1, 64, 4, -1, -1, 57, 4, -1, - -1, 112, 57, 4, -1, 34, 24, -1, -1, 141, - -1, -1, 112, 144, 143, -1, 141, -1, 57, 4, - -1, 147, -1, 8, -1, 149, -1, 8, -1, 149, - -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, - -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, - -1, 19, -1, 20, -1, 21, -1, 48, -1, 148, - -1, 183, -1, 113, 4, -1, 146, 114, 151, 115, - -1, 116, 4, 117, 149, 118, -1, 119, 4, 117, - 149, 120, -1, 121, 150, 122, -1, 121, 122, -1, - 149, 123, -1, 149, -1, 150, 112, 149, -1, 150, - -1, 150, 112, 37, -1, 37, -1, -1, 147, 116, - 154, 118, -1, 147, 116, 118, -1, 147, 124, 24, - -1, 147, 119, 154, 120, -1, 147, 121, 154, 122, - -1, 147, 121, 122, -1, 147, 38, -1, 147, 39, - -1, 147, 183, -1, 147, 153, -1, 147, 26, -1, - 132, 127, -1, 133, 4, -1, 9, 27, -1, 9, - 28, -1, 135, 7, -1, 101, 114, 152, 36, 147, - 115, -1, 99, 114, 152, 197, 115, -1, 102, 114, - 152, 112, 152, 112, 152, 115, -1, 128, 114, 152, - 112, 152, 115, -1, 129, 114, 152, 112, 152, 115, - -1, 130, 114, 152, 112, 152, 115, -1, 131, 114, - 152, 112, 152, 115, -1, 106, 114, 152, 112, 152, - 115, -1, 107, 114, 152, 112, 152, 112, 152, 115, - -1, 108, 114, 152, 112, 152, 112, 152, 115, -1, - 154, 112, 152, -1, 152, -1, 32, -1, 33, -1, - 157, -1, 157, 177, -1, 157, 179, -1, 157, 62, - 61, 163, -1, 157, 25, -1, 158, -1, 158, 136, - 20, 145, -1, 158, 179, -1, 158, 62, 61, 163, - -1, -1, 158, 136, 137, 155, 152, 159, 143, -1, - -1, 158, 136, 50, 155, 147, 160, 143, -1, -1, - 158, 136, 45, 155, 147, 161, 143, -1, -1, 158, - 136, 47, 155, 147, 162, 143, -1, 158, 51, 165, - -1, 158, 58, 111, 166, -1, -1, 24, -1, 56, - -1, 55, -1, 53, 111, 164, -1, 54, 111, 4, - -1, 52, 111, 24, -1, 71, 111, 24, -1, 116, - 167, 118, -1, 167, 112, 24, -1, 24, -1, -1, - 22, -1, 24, -1, 168, -1, -1, 147, 169, -1, - 171, 112, 170, -1, 170, -1, 171, -1, 171, 112, - 37, -1, 37, -1, -1, 138, 145, 168, 114, 172, - 115, 142, 139, -1, 29, -1, 121, -1, 137, 173, - 174, -1, 30, -1, 122, -1, 186, 176, -1, -1, - 45, -1, 47, -1, -1, 31, 180, 178, 173, -1, - -1, 63, -1, 3, -1, 4, -1, 7, -1, 27, - -1, 28, -1, 38, -1, 39, -1, 26, -1, 119, - 154, 120, -1, 153, -1, 61, 181, 24, 112, 24, - -1, 126, -1, 168, -1, 183, -1, 182, -1, 147, - 184, -1, 186, 187, -1, 175, 187, -1, 188, 136, - 189, -1, 188, 191, -1, -1, 23, -1, 72, 185, - -1, 72, 8, -1, 73, 21, 184, -1, 73, 9, - 184, 112, 21, 184, 112, 21, 184, -1, 74, 134, - 184, 112, 21, 184, 116, 190, 118, -1, 74, 134, - 184, 112, 21, 184, 116, 118, -1, 75, 138, 145, - 184, 114, 194, 115, 36, 21, 184, 76, 21, 184, - -1, 76, -1, 77, -1, 190, 134, 182, 112, 21, - 184, -1, 134, 182, 112, 21, 184, -1, 136, 196, - -1, 147, 116, 184, 112, 184, 118, -1, 192, 112, - 116, 184, 112, 184, 118, -1, 185, -1, 193, 112, - 185, -1, 193, -1, -1, 60, 59, -1, 59, -1, - 128, 147, 184, 112, 184, -1, 129, 147, 184, 112, - 184, -1, 130, 147, 184, 112, 184, -1, 49, 185, - -1, 131, 185, 112, 185, -1, 101, 185, 36, 147, - -1, 102, 185, 112, 185, 112, 185, -1, 105, 185, - 112, 147, -1, 109, 185, 112, 147, -1, 110, 185, - 112, 147, -1, 106, 185, 112, 185, -1, 107, 185, - 112, 185, 112, 185, -1, 108, 185, 112, 185, 112, - 185, -1, 100, 192, -1, 195, 138, 145, 184, 114, - 194, 115, -1, 199, -1, 112, 193, -1, -1, 35, - -1, -1, 94, 147, 140, -1, 94, 147, 112, 15, - 184, 140, -1, 95, 147, 140, -1, 95, 147, 112, - 15, 184, 140, -1, 96, 185, -1, 198, 97, 147, - 184, -1, 198, 98, 185, 112, 147, 184, -1, 99, - 147, 184, 197, -1 + -1, 93, -1, 94, -1, 95, -1, 105, -1, 106, + -1, 16, -1, 14, -1, 12, -1, 10, -1, 17, + -1, 15, -1, 13, -1, 11, -1, 134, -1, 135, + -1, 18, -1, 19, -1, 170, 113, -1, -1, 41, + -1, 42, -1, 43, -1, 44, -1, 45, -1, 46, + -1, 47, -1, -1, -1, 65, -1, 66, -1, 67, + -1, 68, -1, 69, -1, 70, -1, 64, 4, -1, + -1, 57, 4, -1, -1, 114, 57, 4, -1, 34, + 24, -1, -1, 143, -1, -1, 114, 146, 145, -1, + 143, -1, 57, 4, -1, 149, -1, 8, -1, 151, + -1, 8, -1, 151, -1, 9, -1, 10, -1, 11, + -1, 12, -1, 13, -1, 14, -1, 15, -1, 16, + -1, 17, -1, 18, -1, 19, -1, 20, -1, 21, + -1, 48, -1, 150, -1, 185, -1, 115, 4, -1, + 148, 116, 153, 117, -1, 118, 4, 119, 151, 120, + -1, 121, 4, 119, 151, 122, -1, 123, 152, 124, + -1, 123, 124, -1, 151, 125, -1, 151, -1, 152, + 114, 151, -1, 152, -1, 152, 114, 37, -1, 37, + -1, -1, 149, 118, 156, 120, -1, 149, 118, 120, + -1, 149, 126, 24, -1, 149, 121, 156, 122, -1, + 149, 123, 156, 124, -1, 149, 123, 124, -1, 149, + 38, -1, 149, 39, -1, 149, 185, -1, 149, 155, + -1, 149, 26, -1, 134, 129, -1, 135, 4, -1, + 9, 27, -1, 9, 28, -1, 137, 7, -1, 103, + 116, 154, 36, 149, 117, -1, 101, 116, 154, 199, + 117, -1, 104, 116, 154, 114, 154, 114, 154, 117, + -1, 130, 116, 154, 114, 154, 117, -1, 131, 116, + 154, 114, 154, 117, -1, 132, 116, 154, 114, 154, + 117, -1, 133, 116, 154, 114, 154, 117, -1, 108, + 116, 154, 114, 154, 117, -1, 109, 116, 154, 114, + 154, 114, 154, 117, -1, 110, 116, 154, 114, 154, + 114, 154, 117, -1, 156, 114, 154, -1, 154, -1, + 32, -1, 33, -1, 159, -1, 159, 179, -1, 159, + 181, -1, 159, 62, 61, 165, -1, 159, 25, -1, + 160, -1, 160, 138, 20, 147, -1, 160, 181, -1, + 160, 62, 61, 165, -1, -1, 160, 138, 139, 157, + 154, 161, 145, -1, -1, 160, 138, 50, 157, 149, + 162, 145, -1, -1, 160, 138, 45, 157, 149, 163, + 145, -1, -1, 160, 138, 47, 157, 149, 164, 145, + -1, 160, 51, 167, -1, 160, 58, 113, 168, -1, + -1, 24, -1, 56, -1, 55, -1, 53, 113, 166, + -1, 54, 113, 4, -1, 52, 113, 24, -1, 71, + 113, 24, -1, 118, 169, 120, -1, 169, 114, 24, + -1, 24, -1, -1, 22, -1, 24, -1, 170, -1, + -1, 149, 171, -1, 173, 114, 172, -1, 172, -1, + 173, -1, 173, 114, 37, -1, 37, -1, -1, 140, + 147, 170, 116, 174, 117, 144, 141, -1, 29, -1, + 123, -1, 139, 175, 176, -1, 30, -1, 124, -1, + 188, 178, -1, -1, 45, -1, 47, -1, -1, 31, + 182, 180, 175, -1, -1, 63, -1, 3, -1, 4, + -1, 7, -1, 27, -1, 28, -1, 38, -1, 39, + -1, 26, -1, 121, 156, 122, -1, 155, -1, 61, + 183, 24, 114, 24, -1, 128, -1, 170, -1, 185, + -1, 184, -1, 149, 186, -1, 188, 189, -1, 177, + 189, -1, 190, 138, 191, -1, 190, 193, -1, -1, + 23, -1, 72, 187, -1, 72, 8, -1, 73, 21, + 186, -1, 73, 9, 186, 114, 21, 186, 114, 21, + 186, -1, 74, 136, 186, 114, 21, 186, 118, 192, + 120, -1, 74, 136, 186, 114, 21, 186, 118, 120, + -1, 75, 140, 147, 186, 116, 196, 117, 36, 21, + 186, 76, 21, 186, -1, 76, -1, 77, -1, 192, + 136, 184, 114, 21, 186, -1, 136, 184, 114, 21, + 186, -1, 138, 198, -1, 149, 118, 186, 114, 186, + 120, -1, 194, 114, 118, 186, 114, 186, 120, -1, + 187, -1, 195, 114, 187, -1, 195, -1, -1, 60, + 59, -1, 59, -1, 130, 149, 186, 114, 186, -1, + 131, 149, 186, 114, 186, -1, 132, 149, 186, 114, + 186, -1, 49, 187, -1, 133, 187, 114, 187, -1, + 103, 187, 36, 149, -1, 104, 187, 114, 187, 114, + 187, -1, 107, 187, 114, 149, -1, 111, 187, 114, + 149, -1, 112, 187, 114, 149, -1, 108, 187, 114, + 187, -1, 109, 187, 114, 187, 114, 187, -1, 110, + 187, 114, 187, 114, 187, -1, 102, 194, -1, 197, + 140, 147, 186, 116, 196, 117, -1, 201, -1, 114, + 195, -1, -1, 35, -1, -1, 96, 149, 142, -1, + 96, 149, 114, 15, 186, 142, -1, 97, 149, 142, + -1, 97, 149, 114, 15, 186, 142, -1, 98, 187, + -1, 200, 99, 149, 186, -1, 200, 100, 187, 114, + 149, 186, -1, 101, 149, 186, 199, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1128, 1128, 1129, 1137, 1138, 1148, 1148, 1148, 1148, - 1148, 1148, 1148, 1149, 1149, 1149, 1150, 1150, 1150, 1150, - 1150, 1150, 1152, 1152, 1156, 1156, 1156, 1156, 1157, 1157, - 1157, 1157, 1158, 1158, 1159, 1159, 1162, 1166, 1171, 1172, - 1173, 1174, 1175, 1176, 1177, 1178, 1180, 1181, 1182, 1183, - 1184, 1185, 1186, 1187, 1196, 1197, 1203, 1204, 1212, 1220, - 1221, 1226, 1227, 1228, 1233, 1247, 1247, 1248, 1248, 1250, - 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1261, 1261, 1261, - 1261, 1261, 1261, 1262, 1266, 1270, 1278, 1286, 1299, 1304, - 1316, 1326, 1330, 1341, 1346, 1352, 1353, 1357, 1361, 1372, - 1398, 1412, 1442, 1468, 1489, 1502, 1512, 1517, 1578, 1585, - 1594, 1600, 1606, 1610, 1614, 1622, 1633, 1665, 1673, 1697, - 1708, 1714, 1722, 1728, 1734, 1743, 1747, 1755, 1755, 1765, - 1773, 1778, 1782, 1786, 1790, 1805, 1827, 1830, 1833, 1833, - 1841, 1841, 1849, 1849, 1857, 1857, 1866, 1869, 1872, 1876, - 1889, 1890, 1892, 1896, 1905, 1910, 1916, 1918, 1923, 1928, - 1937, 1937, 1938, 1938, 1940, 1947, 1953, 1960, 1964, 1970, - 1975, 1980, 2075, 2075, 2077, 2085, 2085, 2087, 2092, 2093, - 2094, 2096, 2096, 2106, 2110, 2115, 2119, 2123, 2127, 2131, - 2135, 2139, 2143, 2147, 2172, 2176, 2190, 2194, 2200, 2200, - 2206, 2211, 2215, 2224, 2235, 2240, 2252, 2265, 2269, 2273, - 2278, 2287, 2306, 2315, 2371, 2375, 2382, 2393, 2406, 2415, - 2424, 2434, 2438, 2445, 2445, 2447, 2451, 2456, 2474, 2489, - 2503, 2516, 2524, 2532, 2540, 2546, 2566, 2589, 2595, 2601, - 2607, 2622, 2681, 2688, 2691, 2696, 2700, 2707, 2712, 2718, - 2723, 2729, 2737, 2749, 2764 + 0, 1140, 1140, 1141, 1149, 1150, 1160, 1160, 1160, 1160, + 1160, 1160, 1160, 1160, 1160, 1161, 1161, 1161, 1162, 1162, + 1162, 1162, 1162, 1162, 1164, 1164, 1168, 1168, 1168, 1168, + 1169, 1169, 1169, 1169, 1170, 1170, 1171, 1171, 1174, 1178, + 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1192, 1193, + 1194, 1195, 1196, 1197, 1198, 1199, 1208, 1209, 1215, 1216, + 1224, 1232, 1233, 1238, 1239, 1240, 1245, 1259, 1259, 1260, + 1260, 1262, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1273, + 1273, 1273, 1273, 1273, 1273, 1274, 1278, 1282, 1290, 1298, + 1311, 1316, 1328, 1338, 1342, 1353, 1358, 1364, 1365, 1369, + 1373, 1384, 1410, 1424, 1454, 1480, 1501, 1514, 1524, 1529, + 1590, 1597, 1606, 1612, 1618, 1622, 1626, 1634, 1645, 1677, + 1685, 1709, 1720, 1726, 1734, 1740, 1746, 1755, 1759, 1767, + 1767, 1777, 1785, 1790, 1794, 1798, 1802, 1817, 1839, 1842, + 1845, 1845, 1853, 1853, 1861, 1861, 1869, 1869, 1878, 1881, + 1884, 1888, 1901, 1902, 1904, 1908, 1917, 1922, 1928, 1930, + 1935, 1940, 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, + 1976, 1982, 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, + 2104, 2105, 2106, 2108, 2108, 2118, 2122, 2127, 2131, 2135, + 2139, 2143, 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, + 2212, 2212, 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, + 2281, 2285, 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, + 2418, 2427, 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, + 2487, 2502, 2516, 2529, 2537, 2545, 2553, 2559, 2579, 2602, + 2608, 2614, 2620, 2635, 2694, 2701, 2704, 2709, 2713, 2720, + 2725, 2731, 2736, 2742, 2750, 2762, 2777 }; #endif @@ -1734,23 +1750,24 @@ "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATA", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", - "UDIV", "SDIV", "FDIV", "REM", "AND", "OR", "XOR", "SETLE", "SETGE", - "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC", "ALLOCA", "FREE", "LOAD", - "STORE", "GETELEMENTPTR", "PHI_TOK", "CAST", "SELECT", "SHL", "SHR", - "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", - "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", - "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", "INTVAL", - "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", "ShiftOps", - "SIntType", "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", - "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection", - "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", - "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", - "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", - "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle", - "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", - "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", - "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", - "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", + "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", "XOR", + "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC", "ALLOCA", + "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", "CAST", "SELECT", + "SHL", "SHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", + "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", + "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", + "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", + "SetCondOps", "ShiftOps", "SIntType", "UIntType", "IntType", "FPType", + "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", + "SectionString", "OptSection", "GlobalVarAttributes", + "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", + "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", + "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1", + "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition", + "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", + "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", + "END", "Function", "FnDeclareLinkage", "FunctionProto", "@5", + "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", @@ -1774,40 +1791,40 @@ 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 61, 44, 92, 40, 41, 91, 120, 93, 60, - 62, 123, 125, 42, 99 + 365, 366, 367, 61, 44, 92, 40, 41, 91, 120, + 93, 60, 62, 123, 125, 42, 99 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 125, 126, 126, 127, 127, 128, 128, 128, 128, - 128, 128, 128, 129, 129, 129, 130, 130, 130, 130, - 130, 130, 131, 131, 132, 132, 132, 132, 133, 133, - 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, - 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, - 138, 138, 138, 138, 139, 139, 140, 140, 141, 142, - 142, 143, 143, 144, 144, 145, 145, 146, 146, 147, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 150, 150, 151, 151, 151, 151, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 154, 154, 155, 155, 156, - 157, 157, 157, 157, 157, 158, 158, 158, 159, 158, - 160, 158, 161, 158, 162, 158, 158, 158, 158, 163, - 164, 164, 165, 165, 165, 165, 166, 167, 167, 167, - 168, 168, 169, 169, 170, 171, 171, 172, 172, 172, - 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, - 178, 180, 179, 181, 181, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 182, 183, 183, 184, 184, - 185, 186, 186, 187, 188, 188, 188, 189, 189, 189, - 189, 189, 189, 189, 189, 189, 190, 190, 191, 192, - 192, 193, 193, 194, 194, 195, 195, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 197, 197, 198, 198, 199, 199, 199, - 199, 199, 199, 199, 199 + 0, 127, 128, 128, 129, 129, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 131, 131, 131, 132, 132, + 132, 132, 132, 132, 133, 133, 134, 134, 134, 134, + 135, 135, 135, 135, 136, 136, 137, 137, 138, 138, + 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, + 140, 140, 140, 140, 140, 140, 141, 141, 142, 142, + 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, + 148, 149, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, + 151, 151, 151, 151, 151, 152, 152, 153, 153, 153, + 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 156, 156, 157, + 157, 158, 159, 159, 159, 159, 159, 160, 160, 160, + 161, 160, 162, 160, 163, 160, 164, 160, 160, 160, + 160, 165, 166, 166, 167, 167, 167, 167, 168, 169, + 169, 169, 170, 170, 171, 171, 172, 173, 173, 174, + 174, 174, 174, 175, 176, 176, 177, 178, 178, 179, + 180, 180, 180, 182, 181, 183, 183, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, + 186, 186, 187, 188, 188, 189, 190, 190, 190, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 192, 192, + 193, 194, 194, 195, 195, 196, 196, 197, 197, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 199, 199, 200, 200, 201, + 201, 201, 201, 201, 201, 201, 201 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1816,502 +1833,519 @@ 0, 2, 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, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, - 1, 1, 1, 2, 0, 2, 0, 3, 2, 0, - 1, 0, 3, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, + 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, + 1, 1, 1, 1, 1, 2, 0, 2, 0, 3, + 2, 0, 1, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 4, 5, 5, - 3, 2, 2, 1, 3, 1, 3, 1, 0, 4, - 3, 3, 4, 4, 3, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 6, 5, 8, 6, 6, - 6, 6, 6, 8, 8, 3, 1, 1, 1, 1, - 2, 2, 4, 2, 1, 4, 2, 4, 0, 7, - 0, 7, 0, 7, 0, 7, 3, 4, 0, 1, - 1, 1, 3, 3, 3, 3, 3, 3, 1, 0, - 1, 1, 1, 0, 2, 3, 1, 1, 3, 1, - 0, 8, 1, 1, 3, 1, 1, 2, 0, 1, - 1, 0, 4, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 0, 1, 2, 2, 3, - 9, 9, 8, 13, 1, 1, 6, 5, 2, 6, - 7, 1, 3, 1, 0, 2, 1, 5, 5, 5, - 2, 4, 4, 6, 4, 4, 4, 4, 6, 6, - 2, 7, 1, 2, 0, 1, 0, 3, 6, 3, - 6, 2, 4, 6, 4 + 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, + 5, 5, 3, 2, 2, 1, 3, 1, 3, 1, + 0, 4, 3, 3, 4, 4, 3, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 6, 5, 8, + 6, 6, 6, 6, 6, 8, 8, 3, 1, 1, + 1, 1, 2, 2, 4, 2, 1, 4, 2, 4, + 0, 7, 0, 7, 0, 7, 0, 7, 3, 4, + 0, 1, 1, 1, 3, 3, 3, 3, 3, 3, + 1, 0, 1, 1, 1, 0, 2, 3, 1, 1, + 3, 1, 0, 8, 1, 1, 3, 1, 1, 2, + 0, 1, 1, 0, 4, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, + 1, 1, 2, 2, 2, 3, 2, 0, 1, 2, + 2, 3, 9, 9, 8, 13, 1, 1, 6, 5, + 2, 6, 7, 1, 3, 1, 0, 2, 1, 5, + 5, 5, 2, 4, 4, 6, 4, 4, 4, 4, + 6, 6, 2, 7, 1, 2, 0, 1, 0, 3, + 6, 3, 6, 2, 4, 6, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned char yydefact[] = +static const unsigned short int yydefact[] = { - 148, 0, 45, 134, 1, 133, 181, 38, 39, 40, - 41, 42, 43, 44, 0, 46, 205, 130, 131, 205, - 160, 161, 0, 0, 0, 45, 0, 136, 178, 0, - 0, 47, 48, 49, 50, 51, 52, 0, 0, 206, - 202, 37, 175, 176, 177, 201, 0, 0, 0, 0, - 146, 0, 0, 0, 0, 0, 0, 0, 36, 179, - 180, 46, 149, 132, 53, 2, 3, 66, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 0, 0, 0, 0, 196, 0, 0, 65, - 84, 69, 197, 85, 172, 173, 174, 246, 204, 0, - 0, 0, 0, 159, 147, 137, 135, 127, 128, 0, - 0, 0, 0, 182, 86, 0, 0, 68, 91, 93, - 0, 0, 98, 92, 245, 0, 226, 0, 0, 0, - 0, 46, 214, 215, 6, 7, 8, 9, 10, 11, + 150, 0, 47, 136, 1, 135, 183, 40, 41, 42, + 43, 44, 45, 46, 0, 48, 207, 132, 133, 207, + 162, 163, 0, 0, 0, 47, 0, 138, 180, 0, + 0, 49, 50, 51, 52, 53, 54, 0, 0, 208, + 204, 39, 177, 178, 179, 203, 0, 0, 0, 0, + 148, 0, 0, 0, 0, 0, 0, 0, 38, 181, + 182, 48, 151, 134, 55, 2, 3, 68, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 0, 0, 0, 0, 198, 0, 0, 67, + 86, 71, 199, 87, 174, 175, 176, 248, 206, 0, + 0, 0, 0, 161, 149, 139, 137, 129, 130, 0, + 0, 0, 0, 184, 88, 0, 0, 70, 93, 95, + 0, 0, 100, 94, 247, 0, 228, 0, 0, 0, + 0, 48, 216, 217, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 0, 0, 0, 0, 0, 0, 0, 22, 23, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, - 46, 218, 0, 242, 154, 151, 150, 152, 153, 155, - 158, 0, 142, 144, 140, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, - 138, 0, 0, 0, 90, 170, 97, 95, 0, 0, - 230, 225, 208, 207, 0, 0, 27, 31, 26, 30, - 25, 29, 24, 28, 32, 33, 0, 0, 56, 56, - 251, 0, 0, 240, 0, 0, 0, 0, 0, 0, + 22, 23, 0, 0, 0, 0, 0, 0, 0, 24, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 205, 48, 220, 0, 244, 156, 153, 152, 154, + 155, 157, 160, 0, 144, 146, 142, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 0, 0, + 0, 0, 140, 0, 0, 0, 92, 172, 99, 97, + 0, 0, 232, 227, 210, 209, 0, 0, 29, 33, + 28, 32, 27, 31, 26, 30, 34, 35, 0, 0, + 58, 58, 253, 0, 0, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 156, 61, 61, 61, 112, 113, 4, 5, 110, 111, - 114, 109, 105, 106, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 108, 107, - 61, 67, 67, 94, 169, 163, 166, 167, 0, 0, - 87, 185, 186, 187, 192, 188, 189, 190, 191, 183, - 0, 194, 199, 198, 200, 0, 209, 0, 0, 0, - 247, 0, 249, 244, 0, 0, 0, 0, 0, 0, + 0, 0, 158, 63, 63, 63, 114, 115, 4, 5, + 112, 113, 116, 111, 107, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 157, 0, 143, 145, 141, 0, 0, 0, 0, - 0, 0, 100, 126, 0, 0, 104, 0, 101, 0, - 0, 0, 0, 139, 88, 89, 162, 164, 0, 59, - 96, 184, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 254, 0, 0, 232, 0, 234, 237, 0, 0, - 235, 236, 0, 0, 0, 231, 0, 252, 0, 0, - 0, 63, 61, 244, 0, 0, 0, 0, 0, 0, - 99, 102, 103, 0, 0, 0, 0, 168, 165, 60, - 54, 0, 193, 0, 0, 224, 56, 57, 56, 221, - 243, 0, 0, 0, 0, 0, 227, 228, 229, 224, - 0, 58, 64, 62, 0, 0, 0, 0, 0, 0, - 125, 0, 0, 0, 0, 0, 171, 0, 0, 0, - 223, 0, 0, 248, 250, 0, 0, 0, 233, 238, - 239, 0, 253, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 55, 195, 0, 0, 0, 222, 219, - 0, 241, 115, 0, 122, 0, 0, 118, 119, 120, - 121, 0, 212, 0, 0, 0, 220, 0, 0, 0, - 210, 0, 211, 0, 0, 117, 123, 124, 0, 0, - 0, 0, 0, 0, 217, 0, 0, 216, 213 + 110, 109, 63, 69, 69, 96, 171, 165, 168, 169, + 0, 0, 89, 187, 188, 189, 194, 190, 191, 192, + 193, 185, 0, 196, 201, 200, 202, 0, 211, 0, + 0, 0, 249, 0, 251, 246, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 159, 0, 145, 147, 143, 0, 0, + 0, 0, 0, 0, 102, 128, 0, 0, 106, 0, + 103, 0, 0, 0, 0, 141, 90, 91, 164, 166, + 0, 61, 98, 186, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 256, 0, 0, 234, 0, 236, 239, + 0, 0, 237, 238, 0, 0, 0, 233, 0, 254, + 0, 0, 0, 65, 63, 246, 0, 0, 0, 0, + 0, 0, 101, 104, 105, 0, 0, 0, 0, 170, + 167, 62, 56, 0, 195, 0, 0, 226, 58, 59, + 58, 223, 245, 0, 0, 0, 0, 0, 229, 230, + 231, 226, 0, 60, 66, 64, 0, 0, 0, 0, + 0, 0, 127, 0, 0, 0, 0, 0, 173, 0, + 0, 0, 225, 0, 0, 250, 252, 0, 0, 0, + 235, 240, 241, 0, 255, 118, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 57, 197, 0, 0, 0, + 224, 221, 0, 243, 117, 0, 124, 0, 0, 120, + 121, 122, 123, 0, 214, 0, 0, 0, 222, 0, + 0, 0, 212, 0, 213, 0, 0, 119, 125, 126, + 0, 0, 0, 0, 0, 0, 219, 0, 0, 218, + 215 }; /* YYDEFGOTO[NTERM-NUM]. */ static const short int yydefgoto[] = { - -1, 86, 258, 274, 275, 276, 277, 196, 197, 226, - 198, 25, 15, 37, 446, 310, 391, 410, 333, 392, - 87, 88, 199, 90, 91, 120, 208, 343, 301, 344, - 109, 1, 2, 3, 280, 253, 251, 252, 63, 177, - 50, 104, 181, 92, 357, 286, 287, 288, 38, 96, - 16, 44, 17, 61, 18, 28, 362, 302, 93, 304, - 419, 19, 40, 41, 169, 494, 98, 233, 450, 451, - 170, 171, 371, 172, 173 + -1, 86, 260, 276, 277, 278, 279, 198, 199, 228, + 200, 25, 15, 37, 448, 312, 393, 412, 335, 394, + 87, 88, 201, 90, 91, 120, 210, 345, 303, 346, + 109, 1, 2, 3, 282, 255, 253, 254, 63, 179, + 50, 104, 183, 92, 359, 288, 289, 290, 38, 96, + 16, 44, 17, 61, 18, 28, 364, 304, 93, 306, + 421, 19, 40, 41, 171, 496, 98, 235, 452, 453, + 172, 173, 373, 174, 175 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -463 +#define YYPACT_NINF -447 static const short int yypact[] = { - -463, 42, 182, 621, -463, -463, -463, -463, -463, -463, - -463, -463, -463, -463, -15, 347, 64, -463, -463, -12, - -463, -463, 15, 1, 33, 360, 10, -463, 89, 114, - 140, -463, -463, -463, -463, -463, -463, 1005, -1, -463, - -463, 115, -463, -463, -463, -463, 40, 56, 67, 68, - -463, 59, 114, 1005, 51, 51, 51, 51, -463, -463, - -463, 347, -463, -463, -463, -463, -463, 66, -463, -463, - -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, - -463, -463, 172, 177, 180, 489, -463, 115, 74, -463, - -463, -97, -463, -463, -463, -463, -463, 1178, -463, 165, - -17, 188, 170, 171, -463, -463, -463, -463, -463, 1046, - 1046, 1046, 1087, -463, -463, 80, 81, -463, -463, -97, - -91, 85, 838, -463, -463, 1046, -463, 142, 1128, 6, - 248, 347, -463, -463, -463, -463, -463, -463, -463, -463, - -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, -463, -463, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, -463, - 347, -463, 35, -463, -463, -463, -463, -463, -463, -463, - -463, -48, -463, -463, -463, 113, 146, 198, 150, 200, - 152, 213, 167, 214, 212, 223, 169, 216, 224, 443, - -463, 1046, 1046, 1046, -463, 879, -463, 109, 117, 620, - -463, -463, 66, -463, 620, 620, -463, -463, -463, -463, - -463, -463, -463, -463, -463, -463, 620, 1005, 128, 129, - -463, 620, 126, 131, 209, 134, 141, 143, 144, 154, - 156, 157, 620, 620, 620, 158, 1005, 1046, 1046, 228, - -463, 161, 161, 161, -463, -463, -463, -463, -463, -463, - -463, -463, -463, -463, 160, 164, 175, 178, 181, 184, - 87, 1087, 574, 230, 185, 186, 187, 189, -463, -463, - 161, -33, -101, -97, -463, 115, -463, 163, 176, 923, - -463, -463, -463, -463, -463, -463, -463, -463, -463, 231, - 1087, -463, -463, -463, -463, 190, -463, 195, 620, -9, - -463, -8, -463, 196, 620, 193, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 199, 201, 202, 1046, 620, 620, - 203, -463, -22, -463, -463, -463, 1087, 1087, 1087, 1087, - 1087, 1087, -463, -463, -47, -79, -463, -82, -463, 1087, - 1087, 1087, 1087, -463, -463, -463, -463, -463, 964, 262, - -463, -463, 293, -75, 301, 302, 210, 620, 324, 620, - 1046, -463, 217, 620, -463, 218, -463, -463, 219, 220, - -463, -463, 620, 620, 620, -463, 229, -463, 1046, 314, - 340, -463, 161, 196, 309, 234, 237, 240, 241, 1087, - -463, -463, -463, 242, 243, 246, 247, -463, -463, -463, - 303, 249, -463, 620, 620, 1046, 250, -463, 250, -463, - 251, 620, 255, 1046, 1046, 1046, -463, -463, -463, 1046, - 620, -463, -463, -463, 253, 1046, 1087, 1087, 1087, 1087, - -463, 1087, 1087, 1087, 1087, 365, -463, 348, 259, 258, - 251, 260, 320, -463, -463, 1046, 261, 620, -463, -463, - -463, 267, -463, -463, 270, 277, 278, 282, 283, 281, - 284, 294, 304, -463, -463, 376, 65, 372, -463, -463, - 305, -463, -463, 1087, -463, 1087, 1087, -463, -463, -463, - -463, 620, -463, 726, 149, 399, -463, 306, 307, 310, - -463, 312, -463, 726, 620, -463, -463, -463, 405, 315, - 352, 620, 409, 411, -463, 620, 620, -463, -463 + -447, 33, 122, 610, -447, -447, -447, -447, -447, -447, + -447, -447, -447, -447, -13, 161, 47, -447, -447, -15, + -447, -447, 15, 10, 91, -6, 48, -447, 19, 138, + 168, -447, -447, -447, -447, -447, -447, 1070, -20, -447, + -447, 70, -447, -447, -447, -447, 60, 61, 64, 67, + -447, 63, 138, 1070, 106, 106, 106, 106, -447, -447, + -447, 161, -447, -447, -447, -447, -447, 59, -447, -447, + -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, + -447, -447, 174, 178, 179, 576, -447, 70, 74, -447, + -447, -54, -447, -447, -447, -447, -447, 1245, -447, 162, + -44, 190, 171, 172, -447, -447, -447, -447, -447, 1111, + 1111, 1111, 1152, -447, -447, 78, 88, -447, -447, -54, + -29, 92, 865, -447, -447, 1111, -447, 150, 1193, 75, + 189, 161, -447, -447, -447, -447, -447, -447, -447, -447, + -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, + -447, -447, 1111, 1111, 1111, 1111, 1111, 1111, 1111, -447, + -447, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, + 1111, -447, 161, -447, 8, -447, -447, -447, -447, -447, + -447, -447, -447, -10, -447, -447, -447, 113, 139, 206, + 145, 211, 147, 215, 152, 216, 214, 225, 154, 218, + 226, 419, -447, 1111, 1111, 1111, -447, 906, -447, 120, + 118, 643, -447, -447, 59, -447, 643, 643, -447, -447, + -447, -447, -447, -447, -447, -447, -447, -447, 643, 1070, + 128, 129, -447, 643, 126, 131, 210, 133, 134, 140, + 141, 142, 143, 144, 643, 643, 643, 146, 1070, 1111, + 1111, 237, -447, 148, 148, 148, -447, -447, -447, -447, + -447, -447, -447, -447, -447, -447, 149, 151, 153, 155, + 156, 159, 947, 1152, 596, 239, 160, 164, 175, 177, + -447, -447, 148, -74, -23, -54, -447, 70, -447, 163, + 180, 988, -447, -447, -447, -447, -447, -447, -447, -447, + -447, 201, 1152, -447, -447, -447, -447, 182, -447, 184, + 643, -2, -447, 6, -447, 186, 643, 176, 1111, 1111, + 1111, 1111, 1111, 1111, 1111, 1111, 187, 188, 191, 1111, + 643, 643, 195, -447, -12, -447, -447, -447, 1152, 1152, + 1152, 1152, 1152, 1152, -447, -447, -9, -21, -447, -27, + -447, 1152, 1152, 1152, 1152, -447, -447, -447, -447, -447, + 1029, 232, -447, -447, 244, -16, 249, 282, 194, 643, + 300, 643, 1111, -447, 197, 643, -447, 199, -447, -447, + 202, 203, -447, -447, 643, 643, 643, -447, 208, -447, + 1111, 291, 315, -447, 148, 186, 289, 212, 217, 219, + 220, 1152, -447, -447, -447, 231, 233, 234, 240, -447, + -447, -447, 273, 241, -447, 643, 643, 1111, 242, -447, + 242, -447, 243, 643, 246, 1111, 1111, 1111, -447, -447, + -447, 1111, 643, -447, -447, -447, 223, 1111, 1152, 1152, + 1152, 1152, -447, 1152, 1152, 1152, 1152, 328, -447, 322, + 247, 245, 243, 248, 294, -447, -447, 1111, 250, 643, + -447, -447, -447, 252, -447, -447, 254, 259, 257, 262, + 263, 264, 265, 267, 270, -447, -447, 341, 14, 343, + -447, -447, 271, -447, -447, 1152, -447, 1152, 1152, -447, + -447, -447, -447, 643, -447, 751, 65, 374, -447, 279, + 280, 281, -447, 285, -447, 751, 643, -447, -447, -447, + 380, 290, 288, 643, 382, 384, -447, 643, 643, -447, + -447 }; /* YYPGOTO[NTERM-NUM]. */ static const short int yypgoto[] = { - -463, -463, -463, 336, 339, 341, 342, -129, -128, -462, - -463, 396, 415, -118, -463, -225, 82, -463, -244, -463, - -50, -463, -37, -463, -56, 321, -463, -102, 252, -247, - 5, -463, -463, -463, -463, -463, -463, -463, 390, -463, - -463, -463, -463, 2, -463, 92, -463, -463, 391, -463, - -463, -463, -463, -463, 450, -463, -463, -459, -57, 62, - -105, -463, 436, -463, -463, -463, -463, -463, 86, 28, - -463, -463, 69, -463, -463 + -447, -447, -447, 309, 310, 311, 312, -129, -128, -446, + -447, 369, 386, -89, -447, -227, 51, -447, -248, -447, + -50, -447, -37, -447, -68, 292, -447, -102, 221, -255, + 57, -447, -447, -447, -447, -447, -447, -447, 361, -447, + -447, -447, -447, 2, -447, 55, -447, -447, 355, -447, + -447, -447, -447, -447, 414, -447, -447, -405, -57, 62, + -105, -447, 399, -447, -447, -447, -447, -447, 49, -8, + -447, -447, 24, -447, -447 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -130 +#define YYTABLE_NINF -132 static const short int yytable[] = { - 89, 224, 225, 106, 312, 26, 367, 369, 334, 335, - 200, 39, 389, 227, 493, 214, 89, -67, 42, 355, - 210, 203, 123, 213, 345, 347, 123, 215, 94, 119, - 399, 204, 503, 399, 501, 390, 353, 399, 175, 176, - 402, 401, 4, 26, 509, 412, 29, 230, 368, 368, - 234, 235, 246, 363, 236, 237, 238, 239, 240, 241, - 110, 111, 112, 245, 249, 399, 119, 46, 47, 48, - 250, 400, 182, 183, 184, 216, 217, 218, 219, 220, - 221, 222, 223, 107, 108, 354, 49, 39, 209, 121, - 123, 209, 65, 66, 52, 117, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 79, 80, 20, - 43, 21, 51, 228, 229, 209, 231, 232, 209, 209, - 95, 58, 209, 209, 209, 209, 209, 209, 242, 243, - 244, 209, 247, 248, 59, 81, 60, 20, 62, 21, - 254, 255, 279, 330, 64, 281, 282, 283, 433, -27, - -27, 99, 303, -26, -26, -25, -25, 303, 303, 216, - 217, 218, 219, 220, 221, 222, 223, 100, 285, 303, - -24, -24, 256, 257, 303, 103, 114, 308, 101, 102, - -68, 115, -129, 492, 116, 303, 303, 303, 122, 174, - 89, 453, 178, 454, 179, 180, 328, 201, 202, 205, - 82, 211, -31, 83, -30, 342, 84, 5, 85, 89, - 329, 209, 375, 6, 377, 378, 379, -29, -28, -34, - 259, 289, 385, 7, 8, 9, 10, 11, 12, 13, - -35, 260, 290, 283, 393, 394, 395, 396, 397, 398, - 309, 311, 314, 315, 14, 316, 317, 403, 404, 405, - 406, 303, 331, 318, 348, 319, 320, 303, 216, 217, - 218, 219, 220, 221, 222, 223, 321, 502, 322, 323, - 327, 303, 303, 332, 336, 358, 305, 306, 337, 374, - 209, 376, 209, 209, 209, 380, 381, 356, 307, 338, - 209, 359, 339, 313, 361, 340, 389, 440, 341, 349, - 350, 351, 364, 352, 324, 325, 326, 365, 370, 373, - 303, 382, 303, 383, 384, 388, 303, 411, 458, 459, - 460, 285, 413, 414, 415, 303, 303, 303, 417, 421, - 423, 424, 425, 209, 465, 466, 467, 468, 431, 469, - 470, 471, 472, 429, 432, 435, 436, 224, 225, 437, - 478, 430, 438, 439, 441, 442, 303, 303, 443, 444, - 445, 447, 452, 455, 303, 224, 225, 457, 463, 473, - 366, 475, 474, 303, 476, 477, 372, 368, 209, 479, - 53, 497, 481, 498, 499, 482, 209, 209, 209, 483, - 386, 387, 209, 484, 485, 486, 487, 491, 464, 488, - 303, 7, 8, 9, 10, 54, 12, 55, 495, 489, - 56, 30, 31, 32, 33, 34, 35, 36, 209, 490, - 504, 505, 506, 496, 508, 507, 511, 512, 513, 416, - 515, 418, 516, 165, 303, 422, 166, 97, 167, 168, - 57, 409, 105, 207, 426, 427, 428, 303, 65, 66, - 408, 278, 113, 27, 303, 45, 420, 461, 303, 303, - 0, 0, 434, 0, 0, 20, 0, 21, 0, 261, - 0, 0, 0, 0, 0, 448, 449, 0, 0, 0, - 0, 262, 263, 456, 0, 0, 0, 0, 0, 0, - 0, 0, 462, 0, 65, 66, 0, 117, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 20, 0, 21, 0, 0, 0, 0, 0, 480, - 0, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 81, 0, 0, - 0, 0, 264, 0, 265, 266, 157, 158, 0, 267, - 268, 269, 0, 500, 0, 0, 0, 0, 0, 270, - 0, 0, 271, 0, 272, 0, 510, 273, 0, 0, - 0, 0, 0, 514, 0, 0, 0, 517, 518, 65, - 66, 0, 117, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 79, 80, 20, 0, 21, 0, - 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, - 85, 118, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 81, 291, 292, 65, 66, 293, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -37, 20, 20, 21, 21, 294, 295, 296, 0, - 0, 0, 6, -37, -37, 0, 0, 0, 297, 298, - 0, 0, -37, -37, -37, -37, -37, -37, -37, 0, - 0, -37, 22, 0, 0, 0, 0, 0, 0, 23, - 0, 299, 0, 24, 0, 0, 0, 82, 0, 0, - 83, 0, 0, 84, 0, 85, 346, 0, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 0, 0, 0, 0, 0, 264, - 0, 265, 266, 157, 158, 0, 267, 268, 269, 291, - 292, 0, 0, 293, 0, 0, 0, 0, 0, 300, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 294, 295, 296, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 297, 298, 0, 0, 0, 0, + 89, 226, 227, 106, 314, 26, 336, 337, 39, 94, + 202, 177, 178, 369, 53, 42, 89, 119, 347, 349, + 212, 371, 391, 215, 218, 219, 220, 221, 222, 223, + 224, 225, 495, 4, 355, 7, 8, 9, 10, 54, + 12, 55, 229, 26, 56, 392, 356, 365, 29, 232, + 505, 123, 236, 237, 119, 370, 238, 239, 240, 241, + 242, 243, -69, 370, 59, 247, 60, 46, 47, 48, + 39, 123, 184, 185, 186, 218, 219, 220, 221, 222, + 223, 224, 225, 248, 216, 205, 49, 401, 211, 121, + 503, 211, 20, 401, 21, 206, 217, 404, 401, 357, + 511, 403, 123, 95, 251, 401, 414, 249, 250, 43, + 252, 402, 110, 111, 112, 230, 231, 211, 233, 234, + 211, 211, -131, 51, 211, 211, 211, 211, 211, 211, + 244, 245, 246, 211, 494, 283, 284, 285, 107, 108, + 256, 257, -29, -29, 281, 332, 435, 5, -28, -28, + -27, -27, 52, 6, 305, -26, -26, 258, 259, 305, + 305, 58, 62, 7, 8, 9, 10, 11, 12, 13, + 287, 305, 64, 99, 100, -70, 305, 101, 114, 310, + 102, 103, 115, 116, 14, 504, 176, 305, 305, 305, + 122, 455, 89, 456, 180, 181, 182, 203, 330, 218, + 219, 220, 221, 222, 223, 224, 225, 204, 207, 213, + -33, 89, 331, 211, 377, -32, 379, 380, 381, -31, + -30, -36, 261, 285, 387, 30, 31, 32, 33, 34, + 35, 36, -37, 262, 291, 292, 395, 396, 397, 398, + 399, 400, 311, 313, 316, 317, 318, 319, 320, 405, + 406, 407, 408, 305, 321, 322, 323, 324, 325, 305, + 329, 333, 334, 350, 363, 338, 391, 339, 413, 340, + 415, 341, 342, 305, 305, 343, 351, 360, 307, 308, + 352, 376, 211, 378, 211, 211, 211, 382, 383, 358, + 309, 353, 211, 354, 375, 315, 366, 361, 367, 442, + 372, 384, 385, 416, 419, 386, 326, 327, 328, 390, + 417, 423, 305, 425, 305, 433, 426, 427, 305, 434, + 460, 461, 462, 287, 431, 437, 438, 305, 305, 305, + 447, 439, 475, 440, 441, 211, 467, 468, 469, 470, + 465, 471, 472, 473, 474, 443, 476, 444, 445, 226, + 227, 370, 480, 432, 446, 449, 454, 457, 305, 305, + 459, 477, 493, 478, 515, 479, 305, 226, 227, 483, + 481, 484, 368, 485, 486, 305, 487, 488, 374, 497, + 211, 489, 490, 499, 491, 500, 501, 492, 211, 211, + 211, 498, 388, 389, 211, 506, 507, 508, 509, 510, + 466, 513, 305, 517, 514, 518, 167, 168, 169, 170, + 97, 57, 411, 105, 209, 410, 113, 27, 45, 436, + 211, 422, 280, 463, 65, 66, 0, 0, 0, 0, + 0, 418, 0, 420, 0, 0, 305, 424, 0, 0, + 0, 20, 0, 21, 0, 263, 428, 429, 430, 305, + 0, 0, 0, 0, 0, 0, 305, 264, 265, 0, + 305, 305, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 450, 451, 0, + 0, 0, 0, 0, 0, 458, 0, 0, 0, 0, + 0, 0, 0, 0, 464, 0, 0, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 0, 0, 0, 0, 0, + 266, 482, 267, 268, 159, 160, 0, 269, 270, 271, + 0, 0, 0, 0, 0, 0, 0, 272, 0, 0, + 273, 0, 274, 0, 0, 275, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 512, 0, + 0, 0, 0, 0, 0, 516, 0, 0, 0, 519, + 520, 65, 66, 0, 117, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, + 21, 65, 66, 0, 117, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 79, 80, 20, 0, + 21, 0, 0, 0, 81, 0, 0, 0, 0, 0, + -39, 0, 20, 0, 21, 0, 0, 0, 0, 0, + 0, 6, -39, -39, 81, 0, 293, 294, 65, 66, + 295, -39, -39, -39, -39, -39, -39, -39, 0, 0, + -39, 22, 0, 0, 0, 20, 0, 21, 23, 296, + 297, 298, 24, 0, 0, 0, 0, 0, 0, 0, + 0, 299, 300, 0, 0, 0, 0, 0, 0, 0, + 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, + 118, 0, 0, 0, 301, 0, 0, 0, 0, 0, + 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, + 348, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 0, + 0, 0, 0, 0, 266, 0, 267, 268, 159, 160, + 0, 269, 270, 271, 293, 294, 0, 0, 295, 0, + 0, 0, 0, 0, 302, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 296, 297, 298, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 299, + 300, 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, 0, 299, 0, 0, + 0, 0, 301, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 0, 0, 0, + 0, 0, 266, 0, 267, 268, 159, 160, 0, 269, + 270, 271, 0, 0, 0, 0, 0, 0, 0, 0, + 65, 66, 302, 117, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 0, 0, 0, 0, 0, 264, 0, 265, 266, 157, - 158, 0, 267, 268, 269, 0, 0, 0, 0, 0, - 0, 0, 0, 65, 66, 300, 117, 68, 69, 70, + 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, + 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, + 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 286, 0, 0, 0, 0, 0, 0, + 0, 0, 65, 66, 81, 117, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 79, 80, 20, + 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, + 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, + 0, 0, 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, + 0, 82, 0, 0, 83, 362, 0, 84, 0, 85, 0, 0, 0, 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 284, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 81, 65, 66, - 0, 117, 68, 69, 70, 71, 72, 73, 74, 75, + 0, 0, 82, 0, 0, 83, 409, 344, 84, 0, + 85, 0, 0, 0, 0, 65, 66, 81, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 0, 0, 0, 0, 65, 66, 81, 117, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, + 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, + 84, 0, 85, 0, 0, 0, 0, 65, 66, 81, + 117, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 79, 80, 20, 0, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, + 0, 84, 0, 85, 0, 0, 0, 0, 65, 66, + 81, 214, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 360, 0, 0, 0, 0, 0, 0, 0, 0, 65, - 66, 81, 117, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, - 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, - 85, 407, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 66, 81, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, - 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 82, 0, 0, - 83, 0, 0, 84, 0, 85, 0, 0, 0, 0, - 0, 0, 65, 66, 81, 117, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 79, 80, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 82, 0, - 0, 83, 0, 0, 84, 0, 85, 0, 0, 0, - 0, 0, 0, 65, 66, 81, 212, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 82, - 0, 0, 83, 0, 0, 84, 0, 85, 0, 0, - 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, - 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164 + 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, + 83, 0, 0, 84, 0, 85, 0, 0, 0, 0, + 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 125, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 126, 127, 0, 0, 82, 0, + 0, 83, 0, 0, 84, 0, 85, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 0, 0, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166 }; static const short int yycheck[] = { - 37, 130, 130, 53, 229, 3, 15, 15, 252, 253, - 112, 23, 34, 131, 476, 9, 53, 114, 30, 120, - 125, 112, 123, 128, 271, 272, 123, 21, 29, 85, - 112, 122, 494, 112, 493, 57, 280, 112, 55, 56, - 122, 120, 0, 41, 503, 120, 61, 152, 57, 57, - 155, 156, 170, 300, 159, 160, 161, 162, 163, 164, - 55, 56, 57, 168, 112, 112, 122, 52, 53, 54, - 118, 118, 109, 110, 111, 10, 11, 12, 13, 14, - 15, 16, 17, 32, 33, 118, 71, 23, 125, 87, - 123, 128, 5, 6, 61, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 122, 24, 111, 150, 151, 152, 153, 154, 155, 156, - 121, 111, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 97, 98, 45, 48, 47, 22, 24, 24, - 27, 28, 199, 248, 4, 201, 202, 203, 392, 3, - 4, 111, 209, 3, 4, 3, 4, 214, 215, 10, - 11, 12, 13, 14, 15, 16, 17, 111, 205, 226, - 3, 4, 3, 4, 231, 116, 4, 227, 111, 111, - 114, 4, 0, 118, 4, 242, 243, 244, 114, 24, - 227, 416, 4, 418, 24, 24, 246, 117, 117, 114, - 113, 59, 4, 116, 4, 118, 119, 25, 121, 246, - 247, 248, 317, 31, 319, 320, 321, 4, 4, 7, - 4, 112, 327, 41, 42, 43, 44, 45, 46, 47, - 7, 7, 115, 289, 336, 337, 338, 339, 340, 341, - 112, 112, 116, 112, 62, 36, 112, 349, 350, 351, - 352, 308, 24, 112, 24, 112, 112, 314, 10, 11, - 12, 13, 14, 15, 16, 17, 112, 118, 112, 112, - 112, 328, 329, 112, 114, 112, 214, 215, 114, 316, - 317, 318, 319, 320, 321, 322, 323, 285, 226, 114, - 327, 115, 114, 231, 63, 114, 34, 399, 114, 114, - 114, 114, 112, 114, 242, 243, 244, 112, 112, 116, - 367, 112, 369, 112, 112, 112, 373, 24, 423, 424, - 425, 358, 21, 21, 114, 382, 383, 384, 4, 112, - 112, 112, 112, 370, 436, 437, 438, 439, 24, 441, - 442, 443, 444, 114, 4, 36, 112, 476, 476, 112, - 455, 388, 112, 112, 112, 112, 413, 414, 112, 112, - 57, 112, 112, 112, 421, 494, 494, 112, 115, 4, - 308, 112, 24, 430, 116, 115, 314, 57, 415, 118, - 20, 483, 115, 485, 486, 115, 423, 424, 425, 112, - 328, 329, 429, 115, 112, 112, 115, 21, 435, 115, - 457, 41, 42, 43, 44, 45, 46, 47, 36, 115, - 50, 64, 65, 66, 67, 68, 69, 70, 455, 115, - 21, 115, 115, 118, 112, 115, 21, 112, 76, 367, - 21, 369, 21, 97, 491, 373, 97, 41, 97, 97, - 25, 359, 52, 122, 382, 383, 384, 504, 5, 6, - 358, 199, 61, 3, 511, 19, 370, 429, 515, 516, - -1, -1, 393, -1, -1, 22, -1, 24, -1, 26, - -1, -1, -1, -1, -1, 413, 414, -1, -1, -1, - -1, 38, 39, 421, -1, -1, -1, -1, -1, -1, - -1, -1, 430, -1, 5, 6, -1, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, -1, -1, -1, -1, -1, 457, - -1, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 48, -1, -1, - -1, -1, 99, -1, 101, 102, 103, 104, -1, 106, - 107, 108, -1, 491, -1, -1, -1, -1, -1, 116, - -1, -1, 119, -1, 121, -1, 504, 124, -1, -1, - -1, -1, -1, 511, -1, -1, -1, 515, 516, 5, - 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, - -1, -1, 113, -1, -1, 116, -1, -1, 119, -1, - 121, 122, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 48, 3, 4, 5, 6, 7, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, 22, 22, 24, 24, 26, 27, 28, -1, - -1, -1, 31, 32, 33, -1, -1, -1, 38, 39, - -1, -1, 41, 42, 43, 44, 45, 46, 47, -1, - -1, 50, 51, -1, -1, -1, -1, -1, -1, 58, - -1, 61, -1, 62, -1, -1, -1, 113, -1, -1, - 116, -1, -1, 119, -1, 121, 122, -1, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, -1, -1, -1, -1, -1, 99, - -1, 101, 102, 103, 104, -1, 106, 107, 108, 3, - 4, -1, -1, 7, -1, -1, -1, -1, -1, 119, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 26, 27, 28, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, + 37, 130, 130, 53, 231, 3, 254, 255, 23, 29, + 112, 55, 56, 15, 20, 30, 53, 85, 273, 274, + 125, 15, 34, 128, 10, 11, 12, 13, 14, 15, + 16, 17, 478, 0, 282, 41, 42, 43, 44, 45, + 46, 47, 131, 41, 50, 57, 120, 302, 61, 154, + 496, 125, 157, 158, 122, 57, 161, 162, 163, 164, + 165, 166, 116, 57, 45, 170, 47, 52, 53, 54, + 23, 125, 109, 110, 111, 10, 11, 12, 13, 14, + 15, 16, 17, 172, 9, 114, 71, 114, 125, 87, + 495, 128, 22, 114, 24, 124, 21, 124, 114, 122, + 505, 122, 125, 123, 114, 114, 122, 99, 100, 124, + 120, 120, 55, 56, 57, 152, 153, 154, 155, 156, + 157, 158, 0, 113, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 120, 203, 204, 205, 32, 33, + 27, 28, 3, 4, 201, 250, 394, 25, 3, 4, + 3, 4, 61, 31, 211, 3, 4, 3, 4, 216, + 217, 113, 24, 41, 42, 43, 44, 45, 46, 47, + 207, 228, 4, 113, 113, 116, 233, 113, 4, 229, + 113, 118, 4, 4, 62, 120, 24, 244, 245, 246, + 116, 418, 229, 420, 4, 24, 24, 119, 248, 10, + 11, 12, 13, 14, 15, 16, 17, 119, 116, 59, + 4, 248, 249, 250, 319, 4, 321, 322, 323, 4, + 4, 7, 4, 291, 329, 64, 65, 66, 67, 68, + 69, 70, 7, 7, 114, 117, 338, 339, 340, 341, + 342, 343, 114, 114, 118, 114, 36, 114, 114, 351, + 352, 353, 354, 310, 114, 114, 114, 114, 114, 316, + 114, 24, 114, 24, 63, 116, 34, 116, 24, 116, + 21, 116, 116, 330, 331, 116, 116, 114, 216, 217, + 116, 318, 319, 320, 321, 322, 323, 324, 325, 287, + 228, 116, 329, 116, 118, 233, 114, 117, 114, 401, + 114, 114, 114, 21, 4, 114, 244, 245, 246, 114, + 116, 114, 369, 114, 371, 24, 114, 114, 375, 4, + 425, 426, 427, 360, 116, 36, 114, 384, 385, 386, + 57, 114, 4, 114, 114, 372, 438, 439, 440, 441, + 117, 443, 444, 445, 446, 114, 24, 114, 114, 478, + 478, 57, 457, 390, 114, 114, 114, 114, 415, 416, + 114, 114, 21, 118, 76, 117, 423, 496, 496, 117, + 120, 117, 310, 114, 117, 432, 114, 114, 316, 36, + 417, 117, 117, 485, 117, 487, 488, 117, 425, 426, + 427, 120, 330, 331, 431, 21, 117, 117, 117, 114, + 437, 21, 459, 21, 114, 21, 97, 97, 97, 97, + 41, 25, 361, 52, 122, 360, 61, 3, 19, 395, + 457, 372, 201, 431, 5, 6, -1, -1, -1, -1, + -1, 369, -1, 371, -1, -1, 493, 375, -1, -1, + -1, 22, -1, 24, -1, 26, 384, 385, 386, 506, + -1, -1, -1, -1, -1, -1, 513, 38, 39, -1, + 517, 518, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 415, 416, -1, + -1, -1, -1, -1, -1, 423, -1, -1, -1, -1, + -1, -1, -1, -1, 432, -1, -1, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, -1, -1, -1, -1, -1, + 101, 459, 103, 104, 105, 106, -1, 108, 109, 110, + -1, -1, -1, -1, -1, -1, -1, 118, -1, -1, + 121, -1, 123, -1, -1, 126, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 493, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 506, -1, + -1, -1, -1, -1, -1, 513, -1, -1, -1, 517, + 518, 5, 6, -1, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, + 24, 5, 6, -1, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, + 24, -1, -1, -1, 48, -1, -1, -1, -1, -1, + 20, -1, 22, -1, 24, -1, -1, -1, -1, -1, + -1, 31, 32, 33, 48, -1, 3, 4, 5, 6, + 7, 41, 42, 43, 44, 45, 46, 47, -1, -1, + 50, 51, -1, -1, -1, 22, -1, 24, 58, 26, + 27, 28, 62, -1, -1, -1, -1, -1, -1, -1, + -1, 38, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 115, -1, -1, 118, -1, -1, 121, -1, 123, + 124, -1, -1, -1, 61, -1, -1, -1, -1, -1, + -1, 115, -1, -1, 118, -1, -1, 121, -1, 123, + 124, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, + -1, -1, -1, -1, 101, -1, 103, 104, 105, 106, + -1, 108, 109, 110, 3, 4, -1, -1, 7, -1, + -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, + 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - -1, -1, -1, -1, -1, 99, -1, 101, 102, 103, - 104, -1, 106, 107, 108, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 119, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, - -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 48, 5, 6, - -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, - -1, 113, -1, -1, 116, -1, -1, 119, -1, 121, - 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, - 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, - -1, -1, 113, -1, -1, 116, -1, -1, 119, -1, - 121, 37, -1, -1, -1, -1, -1, -1, -1, -1, - 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, + -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, -1, -1, -1, + -1, -1, 101, -1, 103, 104, 105, 106, -1, 108, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + 5, 6, 121, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - -1, -1, -1, -1, -1, -1, 113, -1, -1, 116, - -1, -1, 119, -1, 121, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, - 24, -1, -1, -1, -1, -1, -1, 113, -1, -1, - 116, -1, -1, 119, -1, 121, -1, -1, -1, -1, + 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - -1, 24, -1, -1, -1, -1, -1, -1, 113, -1, - -1, 116, -1, -1, 119, -1, 121, -1, -1, -1, + -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, + 115, -1, -1, 118, -1, -1, 121, -1, 123, -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, -1, 24, -1, -1, -1, -1, -1, -1, 113, - -1, -1, 116, -1, -1, 119, -1, 121, -1, -1, - -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, + -1, 115, -1, -1, 118, 37, -1, 121, -1, 123, + -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, + -1, -1, 115, -1, -1, 118, 37, 120, 121, -1, + 123, -1, -1, -1, -1, 5, 6, 48, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, + -1, -1, -1, 115, -1, -1, 118, -1, -1, 121, + -1, 123, -1, -1, -1, -1, 5, 6, 48, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, + -1, -1, -1, -1, 115, -1, -1, 118, -1, -1, + 121, -1, 123, -1, -1, -1, -1, 5, 6, 48, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, + -1, -1, -1, -1, -1, 115, -1, -1, 118, -1, + -1, 121, -1, 123, -1, -1, -1, -1, 5, 6, + 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + -1, -1, -1, -1, -1, -1, 115, -1, -1, 118, + -1, -1, 121, -1, 123, -1, -1, -1, -1, -1, + -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 113, -1, -1, 116, -1, -1, 119, -1, 121, -1, - -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 59, 60, -1, - -1, 113, -1, -1, 116, -1, -1, 119, -1, 121, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, -1, -1, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110 + -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, + 118, -1, -1, 121, -1, 123, -1, -1, -1, -1, + 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 59, 60, -1, -1, 115, -1, + -1, 118, -1, -1, 121, -1, 123, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, -1, -1, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 156, 157, 158, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 137, 175, 177, 179, 186, - 22, 24, 51, 58, 62, 136, 168, 179, 180, 61, - 64, 65, 66, 67, 68, 69, 70, 138, 173, 23, - 187, 188, 30, 122, 176, 187, 52, 53, 54, 71, - 165, 111, 61, 20, 45, 47, 50, 137, 111, 45, - 47, 178, 24, 163, 4, 5, 6, 8, 9, 10, + 0, 158, 159, 160, 0, 25, 31, 41, 42, 43, + 44, 45, 46, 47, 62, 139, 177, 179, 181, 188, + 22, 24, 51, 58, 62, 138, 170, 181, 182, 61, + 64, 65, 66, 67, 68, 69, 70, 140, 175, 23, + 189, 190, 30, 124, 178, 189, 52, 53, 54, 71, + 167, 113, 61, 20, 45, 47, 50, 139, 113, 45, + 47, 180, 24, 165, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 48, 113, 116, 119, 121, 126, 145, 146, 147, - 148, 149, 168, 183, 29, 121, 174, 136, 191, 111, - 111, 111, 111, 116, 166, 163, 145, 32, 33, 155, - 155, 155, 155, 173, 4, 4, 4, 8, 122, 149, - 150, 168, 114, 123, 35, 49, 59, 60, 72, 73, + 21, 48, 115, 118, 121, 123, 128, 147, 148, 149, + 150, 151, 170, 185, 29, 123, 176, 138, 193, 113, + 113, 113, 113, 118, 168, 165, 147, 32, 33, 157, + 157, 157, 157, 175, 4, 4, 4, 8, 124, 151, + 152, 170, 116, 125, 35, 49, 59, 60, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 128, 129, 130, 131, 189, - 195, 196, 198, 199, 24, 55, 56, 164, 4, 24, - 24, 167, 147, 147, 147, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 132, 133, 135, 147, - 152, 117, 117, 112, 122, 114, 37, 150, 151, 147, - 185, 59, 8, 185, 9, 21, 10, 11, 12, 13, - 14, 15, 16, 17, 132, 133, 134, 138, 147, 147, - 185, 147, 147, 192, 185, 185, 185, 185, 185, 185, - 185, 185, 147, 147, 147, 185, 138, 97, 98, 112, - 118, 161, 162, 160, 27, 28, 3, 4, 127, 4, - 7, 26, 38, 39, 99, 101, 102, 106, 107, 108, - 116, 119, 121, 124, 128, 129, 130, 131, 153, 183, - 159, 149, 149, 149, 37, 147, 170, 171, 172, 112, - 115, 3, 4, 7, 26, 27, 28, 38, 39, 61, - 119, 153, 182, 183, 184, 184, 184, 184, 145, 112, - 140, 112, 140, 184, 116, 112, 36, 112, 112, 112, - 112, 112, 112, 112, 184, 184, 184, 112, 145, 147, - 185, 24, 112, 143, 143, 143, 114, 114, 114, 114, - 114, 114, 118, 152, 154, 154, 122, 154, 24, 114, - 114, 114, 114, 143, 118, 120, 168, 169, 112, 115, - 37, 63, 181, 154, 112, 112, 184, 15, 57, 15, - 112, 197, 184, 116, 147, 185, 147, 185, 185, 185, - 147, 147, 112, 112, 112, 185, 184, 184, 112, 34, - 57, 141, 144, 152, 152, 152, 152, 152, 152, 112, - 118, 120, 122, 152, 152, 152, 152, 37, 170, 141, - 142, 24, 120, 21, 21, 114, 184, 4, 184, 185, - 193, 112, 184, 112, 112, 112, 184, 184, 184, 114, - 147, 24, 4, 143, 197, 36, 112, 112, 112, 112, - 152, 112, 112, 112, 112, 57, 139, 112, 184, 184, - 193, 194, 112, 140, 140, 112, 184, 112, 185, 185, - 185, 194, 184, 115, 147, 152, 152, 152, 152, 152, - 152, 152, 152, 4, 24, 112, 116, 115, 185, 118, - 184, 115, 115, 112, 115, 112, 112, 115, 115, 115, - 115, 21, 118, 134, 190, 36, 118, 152, 152, 152, - 184, 182, 118, 134, 21, 115, 115, 115, 112, 182, - 184, 21, 112, 76, 184, 21, 21, 184, 184 + 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 130, 131, 132, + 133, 191, 197, 198, 200, 201, 24, 55, 56, 166, + 4, 24, 24, 169, 149, 149, 149, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 134, 135, + 137, 149, 154, 119, 119, 114, 124, 116, 37, 152, + 153, 149, 187, 59, 8, 187, 9, 21, 10, 11, + 12, 13, 14, 15, 16, 17, 134, 135, 136, 140, + 149, 149, 187, 149, 149, 194, 187, 187, 187, 187, + 187, 187, 187, 187, 149, 149, 149, 187, 140, 99, + 100, 114, 120, 163, 164, 162, 27, 28, 3, 4, + 129, 4, 7, 26, 38, 39, 101, 103, 104, 108, + 109, 110, 118, 121, 123, 126, 130, 131, 132, 133, + 155, 185, 161, 151, 151, 151, 37, 149, 172, 173, + 174, 114, 117, 3, 4, 7, 26, 27, 28, 38, + 39, 61, 121, 155, 184, 185, 186, 186, 186, 186, + 147, 114, 142, 114, 142, 186, 118, 114, 36, 114, + 114, 114, 114, 114, 114, 114, 186, 186, 186, 114, + 147, 149, 187, 24, 114, 145, 145, 145, 116, 116, + 116, 116, 116, 116, 120, 154, 156, 156, 124, 156, + 24, 116, 116, 116, 116, 145, 120, 122, 170, 171, + 114, 117, 37, 63, 183, 156, 114, 114, 186, 15, + 57, 15, 114, 199, 186, 118, 149, 187, 149, 187, + 187, 187, 149, 149, 114, 114, 114, 187, 186, 186, + 114, 34, 57, 143, 146, 154, 154, 154, 154, 154, + 154, 114, 120, 122, 124, 154, 154, 154, 154, 37, + 172, 143, 144, 24, 122, 21, 21, 116, 186, 4, + 186, 187, 195, 114, 186, 114, 114, 114, 186, 186, + 186, 116, 149, 24, 4, 145, 199, 36, 114, 114, + 114, 114, 154, 114, 114, 114, 114, 57, 141, 114, + 186, 186, 195, 196, 114, 142, 142, 114, 186, 114, + 187, 187, 187, 196, 186, 117, 149, 154, 154, 154, + 154, 154, 154, 154, 154, 4, 24, 114, 118, 117, + 187, 120, 186, 117, 117, 114, 117, 114, 114, 117, + 117, 117, 117, 21, 120, 136, 192, 36, 120, 154, + 154, 154, 186, 184, 120, 136, 21, 117, 117, 117, + 114, 184, 186, 21, 114, 76, 186, 21, 21, 186, + 186 }; #define yyerrok (yyerrstatus = 0) @@ -2734,7 +2768,7 @@ #else int yyparse () - + ; #endif #endif { @@ -2981,7 +3015,7 @@ switch (yyn) { case 3: -#line 1129 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -2991,7 +3025,7 @@ break; case 5: -#line 1138 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1150 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -3000,99 +3034,99 @@ ;} break; - case 36: -#line 1162 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 38: +#line 1174 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR ;} break; - case 37: -#line 1166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 39: +#line 1178 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR ;} break; - case 38: -#line 1171 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 40: +#line 1183 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; - case 39: -#line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 41: +#line 1184 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; - case 40: -#line 1173 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 42: +#line 1185 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; - case 41: -#line 1174 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 43: +#line 1186 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; - case 42: -#line 1175 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 44: +#line 1187 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; - case 43: -#line 1176 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 45: +#line 1188 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; - case 44: -#line 1177 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 46: +#line 1189 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; - case 45: -#line 1178 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 47: +#line 1190 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; - case 46: -#line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 48: +#line 1192 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; - case 47: -#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 49: +#line 1193 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; - case 48: -#line 1182 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 50: +#line 1194 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::CSRet; ;} break; - case 49: -#line 1183 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 51: +#line 1195 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; - case 50: -#line 1184 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 52: +#line 1196 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; - case 51: -#line 1185 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 53: +#line 1197 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; - case 52: -#line 1186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 54: +#line 1198 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; - case 53: -#line 1187 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 55: +#line 1199 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large!"); @@ -3101,13 +3135,13 @@ ;} break; - case 54: -#line 1196 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 56: +#line 1208 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 55: -#line 1197 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 57: +#line 1209 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3116,13 +3150,13 @@ ;} break; - case 56: -#line 1203 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 58: +#line 1215 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 57: -#line 1204 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 59: +#line 1216 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3131,8 +3165,8 @@ ;} break; - case 58: -#line 1212 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 60: +#line 1224 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') @@ -3142,28 +3176,28 @@ ;} break; - case 59: -#line 1220 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 61: +#line 1232 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 60: -#line 1221 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 62: +#line 1233 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; - case 61: -#line 1226 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 63: +#line 1238 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 62: -#line 1227 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 64: +#line 1239 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 63: -#line 1228 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 65: +#line 1240 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -3171,8 +3205,8 @@ ;} break; - case 64: -#line 1233 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 66: +#line 1245 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); @@ -3181,18 +3215,18 @@ ;} break; - case 66: -#line 1247 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 68: +#line 1259 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; - case 68: -#line 1248 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 70: +#line 1260 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; - case 69: -#line 1250 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 71: +#line 1262 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -3201,24 +3235,24 @@ ;} break; - case 83: -#line 1262 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 85: +#line 1274 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ;} break; - case 84: -#line 1266 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 86: +#line 1278 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR ;} break; - case 85: -#line 1270 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 87: +#line 1282 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -3226,8 +3260,8 @@ ;} break; - case 86: -#line 1278 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 88: +#line 1290 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3238,8 +3272,8 @@ ;} break; - case 87: -#line 1286 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 89: +#line 1298 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3255,8 +3289,8 @@ ;} break; - case 88: -#line 1299 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 90: +#line 1311 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); delete (yyvsp[-1].TypeVal); @@ -3264,8 +3298,8 @@ ;} break; - case 89: -#line 1304 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 91: +#line 1316 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Packed array type? const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) @@ -3280,8 +3314,8 @@ ;} break; - case 90: -#line 1316 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 92: +#line 1328 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3294,16 +3328,16 @@ ;} break; - case 91: -#line 1326 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 93: +#line 1338 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ;} break; - case 92: -#line 1330 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 94: +#line 1342 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -3313,8 +3347,8 @@ ;} break; - case 93: -#line 1341 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 95: +#line 1353 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); @@ -3322,40 +3356,40 @@ ;} break; - case 94: -#line 1346 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 96: +#line 1358 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 96: -#line 1353 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 98: +#line 1365 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; - case 97: -#line 1357 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 99: +#line 1369 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; - case 98: -#line 1361 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 100: +#line 1373 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR ;} break; - case 99: -#line 1372 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 101: +#line 1384 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) @@ -3384,8 +3418,8 @@ ;} break; - case 100: -#line 1398 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 102: +#line 1410 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3402,8 +3436,8 @@ ;} break; - case 101: -#line 1412 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 103: +#line 1424 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3436,8 +3470,8 @@ ;} break; - case 102: -#line 1442 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 104: +#line 1454 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) @@ -3466,8 +3500,8 @@ ;} break; - case 103: -#line 1468 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 105: +#line 1480 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) @@ -3491,8 +3525,8 @@ ;} break; - case 104: -#line 1489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 106: +#line 1501 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) @@ -3508,8 +3542,8 @@ ;} break; - case 105: -#line 1502 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 107: +#line 1514 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) @@ -3522,8 +3556,8 @@ ;} break; - case 106: -#line 1512 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 108: +#line 1524 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); delete (yyvsp[-1].TypeVal); @@ -3531,8 +3565,8 @@ ;} break; - case 107: -#line 1517 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 109: +#line 1529 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) @@ -3596,8 +3630,8 @@ ;} break; - case 108: -#line 1578 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 110: +#line 1590 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); @@ -3607,8 +3641,8 @@ ;} break; - case 109: -#line 1585 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 111: +#line 1597 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) @@ -3619,8 +3653,8 @@ ;} break; - case 110: -#line 1594 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 112: +#line 1606 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3629,8 +3663,8 @@ ;} break; - case 111: -#line 1600 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 113: +#line 1612 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3639,24 +3673,24 @@ ;} break; - case 112: -#line 1606 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 114: +#line 1618 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getTrue(); CHECK_FOR_ERROR ;} break; - case 113: -#line 1610 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 115: +#line 1622 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getFalse(); CHECK_FOR_ERROR ;} break; - case 114: -#line 1614 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 116: +#line 1626 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); @@ -3665,8 +3699,8 @@ ;} break; - case 115: -#line 1622 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 117: +#line 1634 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + @@ -3680,8 +3714,8 @@ ;} break; - case 116: -#line 1633 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 118: +#line 1645 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); @@ -3716,8 +3750,8 @@ ;} break; - case 117: -#line 1665 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 119: +#line 1677 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); @@ -3728,8 +3762,8 @@ ;} break; - case 118: -#line 1673 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 120: +#line 1685 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); @@ -3756,8 +3790,8 @@ ;} break; - case 119: -#line 1697 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 121: +#line 1709 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); @@ -3771,8 +3805,8 @@ ;} break; - case 120: -#line 1708 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 122: +#line 1720 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); @@ -3781,8 +3815,8 @@ ;} break; - case 121: -#line 1714 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 123: +#line 1726 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); @@ -3793,8 +3827,8 @@ ;} break; - case 122: -#line 1722 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 124: +#line 1734 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -3803,8 +3837,8 @@ ;} break; - case 123: -#line 1728 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 125: +#line 1740 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -3813,8 +3847,8 @@ ;} break; - case 124: -#line 1734 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 126: +#line 1746 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -3823,16 +3857,16 @@ ;} break; - case 125: -#line 1743 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 127: +#line 1755 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 126: -#line 1747 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 128: +#line 1759 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); @@ -3840,18 +3874,18 @@ ;} break; - case 127: -#line 1755 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 129: +#line 1767 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; - case 128: -#line 1755 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 130: +#line 1767 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; - case 129: -#line 1765 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 131: +#line 1777 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); @@ -3859,8 +3893,8 @@ ;} break; - case 130: -#line 1773 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 132: +#line 1785 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); @@ -3868,32 +3902,32 @@ ;} break; - case 131: -#line 1778 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 133: +#line 1790 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; - case 132: -#line 1782 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 134: +#line 1794 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR ;} break; - case 133: -#line 1786 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 135: +#line 1798 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; - case 134: -#line 1790 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 136: +#line 1802 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -3909,8 +3943,8 @@ ;} break; - case 135: -#line 1805 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 137: +#line 1817 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -3935,22 +3969,22 @@ ;} break; - case 136: -#line 1827 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 138: +#line 1839 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; - case 137: -#line 1830 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 139: +#line 1842 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; - case 138: -#line 1833 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 140: +#line 1845 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); @@ -3959,15 +3993,15 @@ ;} break; - case 139: -#line 1838 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 141: +#line 1850 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 140: -#line 1841 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 142: +#line 1853 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -3975,16 +4009,16 @@ ;} break; - case 141: -#line 1845 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 143: +#line 1857 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 142: -#line 1849 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 144: +#line 1861 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -3992,16 +4026,16 @@ ;} break; - case 143: -#line 1853 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 145: +#line 1865 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 144: -#line 1857 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 146: +#line 1869 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); @@ -4010,36 +4044,36 @@ ;} break; - case 145: -#line 1862 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 147: +#line 1874 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 146: -#line 1866 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 148: +#line 1878 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 147: -#line 1869 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 149: +#line 1881 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 148: -#line 1872 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 150: +#line 1884 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ;} break; - case 149: -#line 1876 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 151: +#line 1888 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); @@ -4054,26 +4088,26 @@ ;} break; - case 150: -#line 1889 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 152: +#line 1901 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; - case 151: -#line 1890 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 153: +#line 1902 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; - case 152: -#line 1892 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 154: +#line 1904 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR ;} break; - case 153: -#line 1896 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 155: +#line 1908 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); @@ -4085,8 +4119,8 @@ ;} break; - case 154: -#line 1905 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 156: +#line 1917 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4094,8 +4128,8 @@ ;} break; - case 155: -#line 1910 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 157: +#line 1922 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4103,8 +4137,8 @@ ;} break; - case 157: -#line 1918 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 159: +#line 1930 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4112,8 +4146,8 @@ ;} break; - case 158: -#line 1923 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 160: +#line 1935 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4121,20 +4155,20 @@ ;} break; - case 159: -#line 1928 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 161: +#line 1940 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 163: -#line 1938 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 165: +#line 1950 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 164: -#line 1940 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 166: +#line 1952 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); @@ -4143,8 +4177,8 @@ ;} break; - case 165: -#line 1947 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 167: +#line 1959 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4153,8 +4187,8 @@ ;} break; - case 166: -#line 1953 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 168: +#line 1965 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4163,16 +4197,16 @@ ;} break; - case 167: -#line 1960 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 169: +#line 1972 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR ;} break; - case 168: -#line 1964 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 170: +#line 1976 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyval.ArgList)->push_back(std::pair >(); (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); @@ -4190,16 +4224,16 @@ ;} break; - case 170: -#line 1975 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 172: +#line 1987 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR ;} break; - case 171: -#line 1981 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 173: +#line 1993 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { UnEscapeLexed((yyvsp[-5].StrVal)); std::string FunctionName((yyvsp[-5].StrVal)); @@ -4295,8 +4329,8 @@ ;} break; - case 174: -#line 2077 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 176: +#line 2089 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -4306,31 +4340,31 @@ ;} break; - case 177: -#line 2087 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 179: +#line 2099 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 179: -#line 2093 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 181: +#line 2105 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; - case 180: -#line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 182: +#line 2106 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; - case 181: -#line 2096 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 183: +#line 2108 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; - case 182: -#line 2096 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 184: +#line 2108 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -4338,88 +4372,88 @@ ;} break; - case 183: -#line 2106 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 185: +#line 2118 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 184: -#line 2110 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 186: +#line 2122 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 185: -#line 2115 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 187: +#line 2127 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR ;} break; - case 186: -#line 2119 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 188: +#line 2131 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 187: -#line 2123 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 189: +#line 2135 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR ;} break; - case 188: -#line 2127 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 190: +#line 2139 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR ;} break; - case 189: -#line 2131 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 191: +#line 2143 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR ;} break; - case 190: -#line 2135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 192: +#line 2147 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR ;} break; - case 191: -#line 2139 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 193: +#line 2151 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR ;} break; - case 192: -#line 2143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 194: +#line 2155 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR ;} break; - case 193: -#line 2147 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 195: +#line 2159 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); int NumElements = (yyvsp[-1].ConstVector)->size(); @@ -4447,16 +4481,16 @@ ;} break; - case 194: -#line 2172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 196: +#line 2184 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 195: -#line 2176 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 197: +#line 2188 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); std::string AsmStr = std::string((yyvsp[-2].StrVal), End); @@ -4469,48 +4503,48 @@ ;} break; - case 196: -#line 2190 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 198: +#line 2202 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR ;} break; - case 197: -#line 2194 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 199: +#line 2206 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 200: -#line 2206 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 202: +#line 2218 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 201: -#line 2211 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 203: +#line 2223 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 202: -#line 2215 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 204: +#line 2227 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 203: -#line 2224 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 205: +#line 2236 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR @@ -4523,8 +4557,8 @@ ;} break; - case 204: -#line 2235 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 206: +#line 2247 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); @@ -4532,8 +4566,8 @@ ;} break; - case 205: -#line 2240 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 207: +#line 2252 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR @@ -4548,8 +4582,8 @@ ;} break; - case 206: -#line 2252 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 208: +#line 2264 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); CHECK_FOR_ERROR @@ -4564,24 +4598,24 @@ ;} break; - case 207: -#line 2265 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 209: +#line 2277 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 208: -#line 2269 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 210: +#line 2281 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR ;} break; - case 209: -#line 2273 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 211: +#line 2285 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -4589,8 +4623,8 @@ ;} break; - case 210: -#line 2278 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 212: +#line 2290 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR @@ -4602,8 +4636,8 @@ ;} break; - case 211: -#line 2287 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 213: +#line 2299 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR @@ -4625,8 +4659,8 @@ ;} break; - case 212: -#line 2306 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 214: +#line 2318 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR @@ -4638,8 +4672,8 @@ ;} break; - case 213: -#line 2316 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 215: +#line 2328 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -4697,24 +4731,24 @@ ;} break; - case 214: -#line 2371 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 216: +#line 2383 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR ;} break; - case 215: -#line 2375 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 217: +#line 2387 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR ;} break; - case 216: -#line 2382 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 218: +#line 2394 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[-5].JumpTable); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4728,8 +4762,8 @@ ;} break; - case 217: -#line 2393 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 219: +#line 2405 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4744,8 +4778,8 @@ ;} break; - case 218: -#line 2406 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 220: +#line 2418 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); @@ -4756,8 +4790,8 @@ ;} break; - case 219: -#line 2415 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 221: +#line 2427 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes (yyval.PHIList) = new std::list >(); Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); @@ -4769,8 +4803,8 @@ ;} break; - case 220: -#line 2424 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 222: +#line 2436 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[-6].PHIList); Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); @@ -4781,16 +4815,16 @@ ;} break; - case 221: -#line 2434 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 223: +#line 2446 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); ;} break; - case 222: -#line 2438 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 224: +#line 2450 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[-2].ValueList); (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); @@ -4798,36 +4832,37 @@ ;} break; - case 224: -#line 2445 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 226: +#line 2457 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = 0; ;} break; - case 225: -#line 2447 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 227: +#line 2459 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 226: -#line 2451 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 228: +#line 2463 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 227: -#line 2456 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 229: +#line 2468 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && !isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal).opcode == Instruction::Rem) - GEN_ERROR("Rem not supported on packed types!"); + if (isa((*(yyvsp[-3].TypeVal)).get()) && + ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem || (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem)) + GEN_ERROR("URem and SRem not supported on packed types!"); sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal)); CHECK_FOR_ERROR; Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); @@ -4841,8 +4876,8 @@ ;} break; - case 228: -#line 2474 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 230: +#line 2487 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { if (!isa((yyvsp[-3].TypeVal)->get()) || @@ -4860,8 +4895,8 @@ ;} break; - case 229: -#line 2489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 231: +#line 2502 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if(isa((*(yyvsp[-3].TypeVal)).get())) { GEN_ERROR( @@ -4878,8 +4913,8 @@ ;} break; - case 230: -#line 2503 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 232: +#line 2516 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; @@ -4895,8 +4930,8 @@ ;} break; - case 231: -#line 2516 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 233: +#line 2529 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); @@ -4907,8 +4942,8 @@ ;} break; - case 232: -#line 2524 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 234: +#line 2537 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast instruction to a non-primitive type: '" + @@ -4919,8 +4954,8 @@ ;} break; - case 233: -#line 2532 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 235: +#line 2545 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); @@ -4931,8 +4966,8 @@ ;} break; - case 234: -#line 2540 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 236: +#line 2553 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { NewVarArgs = true; (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); @@ -4941,8 +4976,8 @@ ;} break; - case 235: -#line 2546 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 237: +#line 2559 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -4965,8 +5000,8 @@ ;} break; - case 236: -#line 2566 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 238: +#line 2579 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -4992,8 +5027,8 @@ ;} break; - case 237: -#line 2589 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 239: +#line 2602 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -5002,8 +5037,8 @@ ;} break; - case 238: -#line 2595 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 240: +#line 2608 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -5012,8 +5047,8 @@ ;} break; - case 239: -#line 2601 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 241: +#line 2614 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -5022,8 +5057,8 @@ ;} break; - case 240: -#line 2607 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 242: +#line 2620 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -5041,8 +5076,8 @@ ;} break; - case 241: -#line 2622 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 243: +#line 2635 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -5104,48 +5139,48 @@ ;} break; - case 242: -#line 2681 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 244: +#line 2694 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR ;} break; - case 243: -#line 2688 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 245: +#line 2701 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR ;} break; - case 244: -#line 2691 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 246: +#line 2704 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR ;} break; - case 245: -#line 2696 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 247: +#line 2709 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 246: -#line 2700 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 248: +#line 2713 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 247: -#line 2707 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 249: +#line 2720 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5153,8 +5188,8 @@ ;} break; - case 248: -#line 2712 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 250: +#line 2725 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5163,8 +5198,8 @@ ;} break; - case 249: -#line 2718 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 251: +#line 2731 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5172,8 +5207,8 @@ ;} break; - case 250: -#line 2723 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 252: +#line 2736 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5182,8 +5217,8 @@ ;} break; - case 251: -#line 2729 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 253: +#line 2742 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5193,8 +5228,8 @@ ;} break; - case 252: -#line 2737 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 254: +#line 2750 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + @@ -5209,8 +5244,8 @@ ;} break; - case 253: -#line 2749 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 255: +#line 2762 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) @@ -5228,8 +5263,8 @@ ;} break; - case 254: -#line 2764 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + case 256: +#line 2777 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); @@ -5261,7 +5296,7 @@ } /* Line 1126 of yacc.c. */ -#line 5265 "llvmAsmParser.tab.c" +#line 5300 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -5529,7 +5564,7 @@ } -#line 2790 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2803 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.7 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.8 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.7 Mon Oct 23 01:25:19 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Mon Oct 23 13:13:26 2006 @@ -110,33 +110,35 @@ UDIV = 336, SDIV = 337, FDIV = 338, - REM = 339, - AND = 340, - OR = 341, - XOR = 342, - SETLE = 343, - SETGE = 344, - SETLT = 345, - SETGT = 346, - SETEQ = 347, - SETNE = 348, - MALLOC = 349, - ALLOCA = 350, - FREE = 351, - LOAD = 352, - STORE = 353, - GETELEMENTPTR = 354, - PHI_TOK = 355, - CAST = 356, - SELECT = 357, - SHL = 358, - SHR = 359, - VAARG = 360, - EXTRACTELEMENT = 361, - INSERTELEMENT = 362, - SHUFFLEVECTOR = 363, - VAARG_old = 364, - VANEXT_old = 365 + UREM = 339, + SREM = 340, + FREM = 341, + AND = 342, + OR = 343, + XOR = 344, + SETLE = 345, + SETGE = 346, + SETLT = 347, + SETGT = 348, + SETEQ = 349, + SETNE = 350, + MALLOC = 351, + ALLOCA = 352, + FREE = 353, + LOAD = 354, + STORE = 355, + GETELEMENTPTR = 356, + PHI_TOK = 357, + CAST = 358, + SELECT = 359, + SHL = 360, + SHR = 361, + VAARG = 362, + EXTRACTELEMENT = 363, + INSERTELEMENT = 364, + SHUFFLEVECTOR = 365, + VAARG_old = 366, + VANEXT_old = 367 }; #endif /* Tokens. */ @@ -221,39 +223,41 @@ #define UDIV 336 #define SDIV 337 #define FDIV 338 -#define REM 339 -#define AND 340 -#define OR 341 -#define XOR 342 -#define SETLE 343 -#define SETGE 344 -#define SETLT 345 -#define SETGT 346 -#define SETEQ 347 -#define SETNE 348 -#define MALLOC 349 -#define ALLOCA 350 -#define FREE 351 -#define LOAD 352 -#define STORE 353 -#define GETELEMENTPTR 354 -#define PHI_TOK 355 -#define CAST 356 -#define SELECT 357 -#define SHL 358 -#define SHR 359 -#define VAARG 360 -#define EXTRACTELEMENT 361 -#define INSERTELEMENT 362 -#define SHUFFLEVECTOR 363 -#define VAARG_old 364 -#define VANEXT_old 365 +#define UREM 339 +#define SREM 340 +#define FREM 341 +#define AND 342 +#define OR 343 +#define XOR 344 +#define SETLE 345 +#define SETGE 346 +#define SETLT 347 +#define SETGT 348 +#define SETEQ 349 +#define SETNE 350 +#define MALLOC 351 +#define ALLOCA 352 +#define FREE 353 +#define LOAD 354 +#define STORE 355 +#define GETELEMENTPTR 356 +#define PHI_TOK 357 +#define CAST 358 +#define SELECT 359 +#define SHL 360 +#define SHR 361 +#define VAARG 362 +#define EXTRACTELEMENT 363 +#define INSERTELEMENT 364 +#define SHUFFLEVECTOR 365 +#define VAARG_old 366 +#define VANEXT_old 367 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1005 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1017 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -294,7 +298,7 @@ llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 1447 of yacc.c. */ -#line 298 "llvmAsmParser.tab.h" +#line 302 "llvmAsmParser.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.7 llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.8 --- llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.7 Sun Oct 22 18:26:26 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Mon Oct 23 13:13:26 2006 @@ -839,6 +839,18 @@ else if (Ty->isUnsigned()) OI.opcode = Instruction::UDiv; break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; + case Instruction::SRem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isUnsigned()) + OI.opcode = Instruction::URem; + break; } OI.obsolete = false; } @@ -1107,7 +1119,7 @@ // Binary Operators %type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR +%token ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR %token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions @@ -1145,7 +1157,7 @@ // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ; +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; @@ -2458,8 +2470,9 @@ !isa((*$2).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*$2).get()) && $1.opcode == Instruction::Rem) - GEN_ERROR("Rem not supported on packed types!"); + if (isa((*$2).get()) && + ($1.opcode == Instruction::URem || $1.opcode == Instruction::SRem)) + GEN_ERROR("URem and SRem not supported on packed types!"); sanitizeOpCode($1,*$2); CHECK_FOR_ERROR; Value* val1 = getVal(*$2, $3); Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.7 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.8 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.7 Mon Oct 23 01:25:19 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Mon Oct 23 13:13:26 2006 @@ -839,6 +839,18 @@ else if (Ty->isUnsigned()) OI.opcode = Instruction::UDiv; break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; + case Instruction::SRem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isUnsigned()) + OI.opcode = Instruction::URem; + break; } OI.obsolete = false; } @@ -1107,7 +1119,7 @@ // Binary Operators %type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR +%token ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR %token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions @@ -1145,7 +1157,7 @@ // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ; +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; @@ -2458,8 +2470,9 @@ !isa((*$2).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*$2).get()) && $1.opcode == Instruction::Rem) - GEN_ERROR("Rem not supported on packed types!"); + if (isa((*$2).get()) && + ($1.opcode == Instruction::URem || $1.opcode == Instruction::SRem)) + GEN_ERROR("URem and SRem not supported on packed types!"); sanitizeOpCode($1,*$2); CHECK_FOR_ERROR; Value* val1 = getVal(*$2, $3); From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200610231813.k9NIDwIj004094@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.16.2.3 -> 1.16.2.4 --- Log message: --- Diffs of the changes: (+9 -3) CppWriter.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.16.2.3 llvm/tools/llvm2cpp/CppWriter.cpp:1.16.2.4 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.16.2.3 Sun Oct 22 03:59:01 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Mon Oct 23 13:13:27 2006 @@ -773,10 +773,12 @@ case Instruction::Add: Out << "getAdd"; break; case Instruction::Sub: Out << "getSub"; break; case Instruction::Mul: Out << "getMul"; break; + case Instruction::URem: Out << "getURem"; break; + case Instruction::SRem: Out << "getSRem"; break; + case Instruction::FRem: Out << "getFRem"; break; case Instruction::UDiv: Out << "getUDiv"; break; case Instruction::SDiv: Out << "getSDiv"; break; case Instruction::FDiv: Out << "getFDiv"; break; - case Instruction::Rem: Out << "getRem"; break; case Instruction::And: Out << "getAnd"; break; case Instruction::Or: Out << "getOr"; break; case Instruction::Xor: Out << "getXor"; break; @@ -1023,10 +1025,12 @@ case Instruction::Add: case Instruction::Sub: case Instruction::Mul: + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: - case Instruction::Rem: case Instruction::And: case Instruction::Or: case Instruction::Xor: @@ -1037,10 +1041,12 @@ case Instruction::Add: Out << "Instruction::Add"; break; case Instruction::Sub: Out << "Instruction::Sub"; break; case Instruction::Mul: Out << "Instruction::Mul"; break; + case Instruction::URem:Out << "Instruction::URem"; break; + case Instruction::SRem:Out << "Instruction::SRem"; break; + case Instruction::FRem:Out << "Instruction::FRem"; break; case Instruction::UDiv:Out << "Instruction::UDiv"; break; case Instruction::SDiv:Out << "Instruction::SDiv"; break; case Instruction::FDiv:Out << "Instruction::FDiv"; break; - case Instruction::Rem: Out << "Instruction::Rem"; break; case Instruction::And: Out << "Instruction::And"; break; case Instruction::Or: Out << "Instruction::Or"; break; case Instruction::Xor: Out << "Instruction::Xor"; break; From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200610231813.k9NIDwnw004087@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.139.6.3 -> 1.139.6.4 --- Log message: --- Diffs of the changes: (+5 -2) Execution.cpp | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.3 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.4 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.3 Sun Oct 22 03:59:00 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Mon Oct 23 13:13:26 2006 @@ -95,7 +95,8 @@ return executeDivInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); - case Instruction::Rem: + case Instruction::URem: + case Instruction::SRem: return executeRemInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); @@ -506,10 +507,12 @@ case Instruction::Add: R = executeAddInst (Src1, Src2, Ty); break; case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty); break; case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty); break; + case Instruction::URem: + case Instruction::SRem: + case Instruction::FRem: R = executeRemInst (Src1, Src2, Ty); break; case Instruction::SDiv: case Instruction::UDiv: case Instruction::FDiv: R = executeDivInst (Src1, Src2, Ty); break; - case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty); break; case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break; case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break; case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); break; From zhousheng00 at gmail.com Mon Oct 23 13:13:58 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 23 Oct 2006 13:13:58 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp PredicateSimplifier.cpp Reassociate.cpp Message-ID: <200610231813.k9NIDwNb004077@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.520.2.8 -> 1.520.2.9 PredicateSimplifier.cpp updated: 1.20.2.2 -> 1.20.2.3 Reassociate.cpp updated: 1.62.2.3 -> 1.62.2.4 --- Log message: --- Diffs of the changes: (+186 -93) InstructionCombining.cpp | 271 +++++++++++++++++++++++++++++++---------------- PredicateSimplifier.cpp | 4 Reassociate.cpp | 4 3 files changed, 186 insertions(+), 93 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.8 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.9 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.8 Sun Oct 22 18:27:20 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 23 13:13:27 2006 @@ -131,12 +131,16 @@ Instruction *visitAdd(BinaryOperator &I); Instruction *visitSub(BinaryOperator &I); Instruction *visitMul(BinaryOperator &I); + Instruction *visitURem(BinaryOperator &I); + Instruction *visitSRem(BinaryOperator &I); + Instruction *visitFRem(BinaryOperator &I); + Instruction *commonRemTransforms(BinaryOperator &I); + Instruction *commonIRemTransforms(BinaryOperator &I); Instruction *commonDivTransforms(BinaryOperator &I); Instruction *commonIDivTransforms(BinaryOperator &I); Instruction *visitUDiv(BinaryOperator &I); Instruction *visitSDiv(BinaryOperator &I); Instruction *visitFDiv(BinaryOperator &I); - Instruction *visitRem(BinaryOperator &I); Instruction *visitAnd(BinaryOperator &I); Instruction *visitOr (BinaryOperator &I); Instruction *visitXor(BinaryOperator &I); @@ -2431,9 +2435,9 @@ return Result; } -Instruction *InstCombiner::visitRem(BinaryOperator &I) { +Instruction *InstCombiner::commonRemTransforms(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - + // 0 % X == 0, we don't need to preserve faults! if (Constant *LHS = dyn_cast(Op0)) if (LHS->isNullValue()) @@ -2443,34 +2447,11 @@ return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); if (isa(Op1)) return ReplaceInstUsesWith(I, Op1); // X % undef -> undef - - if (I.getType()->isSigned()) { - if (Value *RHSNeg = dyn_castNegVal(Op1)) - if (!isa(RHSNeg) || !RHSNeg->getType()->isSigned() || - cast(RHSNeg)->getSExtValue() > 0) { - // X % -Y -> X % Y - AddUsesToWorkList(I); - I.setOperand(1, RHSNeg); - return &I; - } - - // If the top bits of both operands are zero (i.e. we can prove they are - // unsigned inputs), turn this into a urem. - uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); - if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { - const Type *NTy = Op0->getType()->getUnsignedVersion(); - Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); - InsertNewInstBefore(LHS, I); - Value *RHS; - if (Constant *R = dyn_cast(Op1)) - RHS = ConstantExpr::getCast(R, NTy); - else - RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); - Instruction *Rem = BinaryOperator::createRem(LHS, RHS, I.getName()); - InsertNewInstBefore(Rem, I); - return new CastInst(Rem, I.getType()); - } - } + return 0; +} + +Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); if (ConstantInt *RHS = dyn_cast(Op1)) { // X % 0 == undef, we don't need to preserve faults! @@ -2480,13 +2461,6 @@ if (RHS->equalsInt(1)) // X % 1 == 0 return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); - // Check to see if this is an unsigned remainder with an exact power of 2, - // if so, convert to a bitwise and. - if (ConstantInt *C = dyn_cast(RHS)) - if (RHS->getType()->isUnsigned()) - if (isPowerOf2_64(C->getZExtValue())) - return BinaryOperator::createAnd(Op0, SubOne(C)); - if (Instruction *Op0I = dyn_cast(Op0)) { if (SelectInst *SI = dyn_cast(Op0I)) { if (Instruction *R = FoldOpIntoSelect(I, SI, this)) @@ -2495,17 +2469,90 @@ if (Instruction *NV = FoldOpIntoPhi(I)) return NV; } + } + } + + // If this is 'urem X, (Cond ? C1, C2)' where C1&C2 are powers of two, + // transform this into: '(Cond ? (urem X, C1) : (urem X, C2))'. + if (SelectInst *SI = dyn_cast(Op1)) { + // rem X, (Cond ? 0 : Y) -> rem X, Y. If the rem and the select are in + // the same basic block, then we replace the select with Y, and the + // condition of the select with false (if the cond value is in the same + // BB). If the select has uses other than the div, this allows them to be + // simplified also. + if (Constant *ST = dyn_cast(SI->getOperand(1))) + if (ST->isNullValue()) { + Instruction *CondI = dyn_cast(SI->getOperand(0)); + if (CondI && CondI->getParent() == I.getParent()) + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) + I.setOperand(1, SI->getOperand(2)); + else + UpdateValueUsesWith(SI, SI->getOperand(2)); + return &I; + } + // Likewise for: rem X, (Cond ? Y : 0) -> rem X, Y + if (Constant *ST = dyn_cast(SI->getOperand(2))) + if (ST->isNullValue()) { + Instruction *CondI = dyn_cast(SI->getOperand(0)); + if (CondI && CondI->getParent() == I.getParent()) + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) + I.setOperand(1, SI->getOperand(1)); + else + UpdateValueUsesWith(SI, SI->getOperand(1)); + return &I; + } + + if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) + if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) + if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { + // STO == 0 and SFO == 0 handled above. + if (isPowerOf2_64(STO->getZExtValue()) && + isPowerOf2_64(SFO->getZExtValue())) { + Value *TrueAnd = InsertNewInstBefore( + BinaryOperator::createAnd(Op0, SubOne(STO), SI->getName()+".t"), + I); + Value *FalseAnd = InsertNewInstBefore( + BinaryOperator::createAnd(Op0, SubOne(SFO), SI->getName()+".f"), + I); + return new SelectInst(SI->getOperand(0), TrueAnd, FalseAnd); + } + } + } + + return 0; +} + +Instruction *InstCombiner::visitURem(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + Instruction* common = commonRemTransforms(I); + if (common) + return common; + + common = commonIRemTransforms(I); + if (common) + return common; + + if (ConstantInt *RHS = dyn_cast(Op1)) { + // Check to see if this is an unsigned remainder with an exact power of 2, + // if so, convert to a bitwise and. + if (ConstantInt *C = dyn_cast(RHS)) + if (isPowerOf2_64(C->getZExtValue())) + return BinaryOperator::createAnd(Op0, SubOne(C)); + + if (Instruction *Op0I = dyn_cast(Op0)) { // X*C1%C2 --> 0 iff C1%C2 == 0 - if (ConstantExpr::getRem(GetFactor(Op0I), RHS)->isNullValue()) + if (ConstantExpr::getURem(GetFactor(Op0I), RHS)->isNullValue()) return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); } } if (Instruction *RHSI = dyn_cast(I.getOperand(1))) { // Turn A % (C << N), where C is 2^k, into A & ((C << N)-1) [urem only]. - if (I.getType()->isUnsigned() && - RHSI->getOpcode() == Instruction::Shl && + if (RHSI->getOpcode() == Instruction::Shl && isa(RHSI->getOperand(0)) && RHSI->getOperand(0)->getType()->isUnsigned()) { unsigned C1 = cast(RHSI->getOperand(0))->getZExtValue(); @@ -2517,57 +2564,97 @@ } } - // If this is 'urem X, (Cond ? C1, C2)' where C1&C2 are powers of two, - // transform this into: '(Cond ? (urem X, C1) : (urem X, C2))'. - if (SelectInst *SI = dyn_cast(Op1)) { - // rem X, (Cond ? 0 : Y) -> rem X, Y. If the rem and the select are in - // the same basic block, then we replace the select with Y, and the - // condition of the select with false (if the cond value is in the same - // BB). If the select has uses other than the div, this allows them to be - // simplified also. - if (Constant *ST = dyn_cast(SI->getOperand(1))) - if (ST->isNullValue()) { - Instruction *CondI = dyn_cast(SI->getOperand(0)); - if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::getFalse()); - else if (I.getParent() != SI->getParent() || SI->hasOneUse()) - I.setOperand(1, SI->getOperand(2)); - else - UpdateValueUsesWith(SI, SI->getOperand(2)); - return &I; - } - // Likewise for: rem X, (Cond ? Y : 0) -> rem X, Y - if (Constant *ST = dyn_cast(SI->getOperand(2))) - if (ST->isNullValue()) { - Instruction *CondI = dyn_cast(SI->getOperand(0)); - if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::getTrue()); - else if (I.getParent() != SI->getParent() || SI->hasOneUse()) - I.setOperand(1, SI->getOperand(1)); - else - UpdateValueUsesWith(SI, SI->getOperand(1)); - return &I; - } + } + + return 0; +} - - if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) - if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) - if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { - // STO == 0 and SFO == 0 handled above. - if (isPowerOf2_64(STO->getZExtValue()) && - isPowerOf2_64(SFO->getZExtValue())) { - Value *TrueAnd = InsertNewInstBefore( - BinaryOperator::createAnd(Op0, SubOne(STO), SI->getName()+".t"), - I); - Value *FalseAnd = InsertNewInstBefore( - BinaryOperator::createAnd(Op0, SubOne(SFO), SI->getName()+".f"), - I); - return new SelectInst(SI->getOperand(0), TrueAnd, FalseAnd); - } - } +Instruction *InstCombiner::visitSRem(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + Instruction *common = commonRemTransforms(I); + if (common) + return common; + + common = commonIRemTransforms(I); + if (common) + return common; + + if (Value *RHSNeg = dyn_castNegVal(Op1)) + if (!isa(RHSNeg) || !RHSNeg->getType()->isSigned() || + cast(RHSNeg)->getSExtValue() > 0) { + // X % -Y -> X % Y + AddUsesToWorkList(I); + I.setOperand(1, RHSNeg); + return &I; + } + + // If the top bits of both operands are zero (i.e. we can prove they are + // unsigned inputs), turn this into a urem. + uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); + if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { + const Type *NTy = Op0->getType()->getUnsignedVersion(); + Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); + InsertNewInstBefore(LHS, I); + Value *RHS; + if (Constant *R = dyn_cast(Op1)) + RHS = ConstantExpr::getCast(R, NTy); + else + RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); + Instruction *URem = BinaryOperator::createURem(LHS, RHS, I.getName()); + InsertNewInstBefore(URem, I); + return new CastInst(URem, I.getType()); + } + + if (ConstantInt *RHS = dyn_cast(Op1)) { + if (Instruction *Op0I = dyn_cast(Op0)) { + // X*C1%C2 --> 0 iff C1%C2 == 0 + if (ConstantExpr::getSRem(GetFactor(Op0I), RHS)->isNullValue()) + return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); } } - + + return 0; +} + +Instruction *InstCombiner::visitFRem(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + Instruction *common = commonRemTransforms(I); + if (common) + return common; + + if (SelectInst *SI = dyn_cast(Op1)) { + // rem X, (Cond ? 0 : Y) -> rem X, Y. If the rem and the select are in + // the same basic block, then we replace the select with Y, and the + // condition of the select with false (if the cond value is in the same + // BB). If the select has uses other than the div, this allows them to be + // simplified also. + if (Constant *ST = dyn_cast(SI->getOperand(1))) + if (ST->isNullValue()) { + Instruction *CondI = dyn_cast(SI->getOperand(0)); + if (CondI && CondI->getParent() == I.getParent()) + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) + I.setOperand(1, SI->getOperand(2)); + else + UpdateValueUsesWith(SI, SI->getOperand(2)); + return &I; + } + // Likewise for: rem X, (Cond ? Y : 0) -> rem X, Y + if (Constant *ST = dyn_cast(SI->getOperand(2))) + if (ST->isNullValue()) { + Instruction *CondI = dyn_cast(SI->getOperand(0)); + if (CondI && CondI->getParent() == I.getParent()) + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) + I.setOperand(1, SI->getOperand(1)); + else + UpdateValueUsesWith(SI, SI->getOperand(1)); + return &I; + } + } + return 0; } @@ -4585,7 +4672,9 @@ break; #endif - case Instruction::Rem: + case Instruction::URem: + break; + case Instruction::SRem: // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. if (CI->isNullValue() && isa(BO->getOperand(1)) && BO->hasOneUse() && BO->getOperand(1)->getType()->isSigned()) { @@ -4596,7 +4685,7 @@ Value *NewX = InsertNewInstBefore(new CastInst(BO->getOperand(0), UTy, "tmp"), I); Constant *RHSCst = ConstantInt::get(UTy, 1ULL << L2); - Value *NewRem =InsertNewInstBefore(BinaryOperator::createRem(NewX, + Value *NewRem =InsertNewInstBefore(BinaryOperator::createURem(NewX, RHSCst, BO->getName()), I); return BinaryOperator::create(I.getOpcode(), NewRem, Constant::getNullValue(UTy)); Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.20.2.2 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.20.2.3 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.20.2.2 Sun Oct 22 03:59:01 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon Oct 23 13:13:27 2006 @@ -726,10 +726,12 @@ Instruction::BinaryOps ops = BO.getOpcode(); switch (ops) { + case Instruction::URem: + case Instruction::SRem: case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: - case Instruction::Rem: { + case Instruction::FRem: { Value *Divisor = BO.getOperand(1); KP.addNotEqual(Constant::getNullValue(Divisor->getType()), Divisor); break; Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.62.2.3 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.62.2.4 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.62.2.3 Sun Oct 22 03:59:01 2006 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Mon Oct 23 13:13:27 2006 @@ -113,10 +113,12 @@ I->getOpcode() == Instruction::Malloc || I->getOpcode() == Instruction::Invoke || I->getOpcode() == Instruction::Call || + I->getOpcode() == Instruction::URem || + I->getOpcode() == Instruction::SRem || I->getOpcode() == Instruction::UDiv || I->getOpcode() == Instruction::SDiv || I->getOpcode() == Instruction::FDiv || - I->getOpcode() == Instruction::Rem) + I->getOpcode() == Instruction::FRem) return true; return false; } From sabre at nondot.org Mon Oct 23 13:38:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 13:38:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610231838.k9NIcbIc005407@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.294 -> 1.295 --- Log message: Minor tweak. Instead of generating: movl 32(%esp), %eax cmpl $1, %eax je LBB1_1 #bb LBB1_4: #entry cmpl $2, %eax je LBB1_2 #bb2 jmp LBB1_3 #UnifiedReturnBlock LBB1_1: #bb notice that we would miss the fall through and emit this instead: movl 32(%esp), %eax cmpl $2, %eax je LBB1_2 #bb2 LBB1_4: #entry cmpl $1, %eax jne LBB1_3 #UnifiedReturnBlock LBB1_1: #bb --- Diffs of the changes: (+13 -0) SelectionDAGISel.cpp | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.294 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.295 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.294 Sun Oct 22 18:00:53 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Oct 23 13:38:22 2006 @@ -936,6 +936,19 @@ // use bit manipulation to do two compares at once. For example: // "if (X == 6 || X == 4)" -> "if ((X|2) == 6)" + // Rearrange the case blocks so that the last one falls through if possible. + if (NextBlock && Default != NextBlock && Cases.back().second != NextBlock) { + // The last case block won't fall through into 'NextBlock' if we emit the + // branches in this order. See if rearranging a case value would help. + for (unsigned i = 0, e = Cases.size()-1; i != e; ++i) { + if (Cases[i].second == NextBlock) { + std::swap(Cases[i], Cases.back()); + break; + } + } + } + + // Create a CaseBlock record representing a conditional branch to // the Case's target mbb if the value being switched on SV is equal // to C. From sabre at nondot.org Mon Oct 23 13:54:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 13:54:50 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll Message-ID: <200610231854.k9NIsov8011065@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SCCP: 2006-10-23-IPSCCP-Crash.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+128 -0) 2006-10-23-IPSCCP-Crash.ll | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 128 insertions(+) Index: llvm/test/Regression/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll diff -c /dev/null llvm/test/Regression/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll:1.1 *** /dev/null Mon Oct 23 13:54:45 2006 --- llvm/test/Regression/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll Mon Oct 23 13:54:35 2006 *************** *** 0 **** --- 1,128 ---- + ; RUN: llvm-as < %s | opt -sccp -disable-output + + target endian = big + target pointersize = 32 + target triple = "powerpc-apple-darwin8.7.0" + %struct.pat_list = type { int, %struct.pat_list* } + %JUMP = external global int ; [#uses=1] + %old_D_pat = external global [16 x ubyte] ; <[16 x ubyte]*> [#uses=0] + + implementation ; Functions: + + void %asearch1(uint %D) { + entry: + %tmp80 = setlt uint 0, %D ; [#uses=1] + br bool %tmp80, label %bb647.preheader, label %cond_true81.preheader + + cond_true81.preheader: ; preds = %entry + ret void + + bb647.preheader: ; preds = %entry + %tmp3.i = call int %read( ) ; [#uses=1] + %tmp6.i = add int %tmp3.i, 0 ; [#uses=1] + %tmp653 = setgt int %tmp6.i, 0 ; [#uses=1] + br bool %tmp653, label %cond_true654, label %UnifiedReturnBlock + + cond_true612: ; preds = %cond_true654 + ret void + + cond_next624: ; preds = %cond_true654 + ret void + + cond_true654: ; preds = %bb647.preheader + br bool undef, label %cond_true612, label %cond_next624 + + UnifiedReturnBlock: ; preds = %bb647.preheader + ret void + } + + void %bitap(int %D) { + entry: + %tmp29 = seteq int 0, 0 ; [#uses=1] + br bool %tmp29, label %cond_next50, label %cond_next37 + + cond_next37: ; preds = %entry + ret void + + cond_next50: ; preds = %entry + %tmp52 = setgt int %D, 0 ; [#uses=1] + br bool %tmp52, label %cond_true53, label %cond_next71 + + cond_true53: ; preds = %cond_next50 + %tmp54 = load int* %JUMP ; [#uses=1] + %tmp55 = seteq int %tmp54, 1 ; [#uses=1] + br bool %tmp55, label %cond_true56, label %cond_next63 + + cond_true56: ; preds = %cond_true53 + %tmp57 = cast int %D to uint ; [#uses=1] + call void %asearch1( uint %tmp57 ) + ret void + + cond_next63: ; preds = %cond_true53 + ret void + + cond_next71: ; preds = %cond_next50 + ret void + } + + declare int %read() + + void %initial_value() { + entry: + ret void + } + + void %main() { + entry: + br label %cond_next252 + + cond_next208: ; preds = %cond_true260 + %tmp229 = call int %atoi( ) ; [#uses=1] + br label %cond_next252 + + bb217: ; preds = %cond_true260 + ret void + + cond_next252: ; preds = %cond_next208, %entry + %D.0.0 = phi int [ 0, %entry ], [ %tmp229, %cond_next208 ] ; [#uses=1] + %tmp254 = getelementptr sbyte** null, int 1 ; [#uses=1] + %tmp256 = load sbyte** %tmp254 ; [#uses=1] + %tmp258 = load sbyte* %tmp256 ; [#uses=1] + %tmp259 = seteq sbyte %tmp258, 45 ; [#uses=1] + br bool %tmp259, label %cond_true260, label %bb263 + + cond_true260: ; preds = %cond_next252 + %tmp205818 = setgt sbyte 0, -1 ; [#uses=1] + br bool %tmp205818, label %cond_next208, label %bb217 + + bb263: ; preds = %cond_next252 + %tmp265 = seteq int 0, 0 ; [#uses=1] + br bool %tmp265, label %cond_next276, label %cond_true266 + + cond_true266: ; preds = %bb263 + ret void + + cond_next276: ; preds = %bb263 + %tmp278 = seteq int 0, 0 ; [#uses=1] + br bool %tmp278, label %cond_next298, label %cond_true279 + + cond_true279: ; preds = %cond_next276 + ret void + + cond_next298: ; preds = %cond_next276 + call void %bitap( int %D.0.0 ) + ret void + } + + declare int %atoi() + + void %subset_pset() { + entry: + ret void + } + + void %strcmp() { + entry: + ret void + } + From sabre at nondot.org Mon Oct 23 13:57:16 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 13:57:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp Message-ID: <200610231857.k9NIvGap011131@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SCCP.cpp updated: 1.134 -> 1.135 --- Log message: Handle fallout from the recent branch-on-undef changes. This fixes Prolangs-C/agrep and SCCP/2006-10-23-IPSCCP-Crash.ll --- Diffs of the changes: (+24 -1) SCCP.cpp | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.134 llvm/lib/Transforms/Scalar/SCCP.cpp:1.135 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.134 Sun Oct 22 00:59:17 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Oct 23 13:57:02 2006 @@ -1360,7 +1360,30 @@ while (!DeadBB->use_empty()) { Instruction *I = cast(DeadBB->use_back()); bool Folded = ConstantFoldTerminator(I->getParent()); - assert(Folded && "Didn't fold away reference to block!"); + if (!Folded) { + // The constant folder may not have been able to fold the termiantor + // if this is a branch or switch on undef. Fold it manually as a + // branch to the first successor. + if (BranchInst *BI = dyn_cast(I)) { + assert(BI->isConditional() && isa(BI->getCondition()) && + "Branch should be foldable!"); + } else if (SwitchInst *SI = dyn_cast(I)) { + assert(isa(SI->getCondition()) && "Switch should fold"); + } else { + assert(0 && "Didn't fold away reference to block!"); + } + + // Make this an uncond branch to the first successor. + TerminatorInst *TI = I->getParent()->getTerminator(); + new BranchInst(TI->getSuccessor(0), TI); + + // Remove entries in successor phi nodes to remove edges. + for (unsigned i = 1, e = TI->getNumSuccessors(); i != e; ++i) + TI->getSuccessor(i)->removePredecessor(TI->getParent()); + + // Remove the old terminator. + TI->eraseFromParent(); + } } // Finally, delete the basic block. From alenhar2 at cs.uiuc.edu Mon Oct 23 14:52:55 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 23 Oct 2006 14:52:55 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll GlobalsGraphFuncPtr.ll constant_globals.ll Message-ID: <200610231952.k9NJqt5K008484@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/DSGraph: FunctionPointerTable-const.ll updated: 1.4 -> 1.5 GlobalsGraphFuncPtr.ll updated: 1.4 -> 1.5 constant_globals.ll updated: 1.4 -> 1.5 --- Log message: restore these tests --- Diffs of the changes: (+3 -7) FunctionPointerTable-const.ll | 4 +--- GlobalsGraphFuncPtr.ll | 3 +-- constant_globals.ll | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) Index: llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll diff -u llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll:1.4 llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll:1.5 --- llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll:1.4 Sun Aug 27 17:47:14 2006 +++ llvm/test/Regression/Analysis/DSGraph/FunctionPointerTable-const.ll Mon Oct 23 14:52:27 2006 @@ -1,6 +1,4 @@ -; FIXME: this should be SHM for bu, but change it for now since besides incompleteness -; this is working -; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=Y:SHIM && \ +; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=Y:SHM && \ ; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=P1:SHM,P2:SHM %G = internal constant [2 x int*(int*)*] [ Index: llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll diff -u llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll:1.4 llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll:1.5 --- llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll:1.4 Sun Aug 27 17:47:14 2006 +++ llvm/test/Regression/Analysis/DSGraph/GlobalsGraphFuncPtr.ll Mon Oct 23 14:52:27 2006 @@ -4,8 +4,7 @@ ; -- latter should remain unresolved in main() and copied to GG ; -- globals in GG pointed to by latter should be marked I, but not other nodes ; -; FIXME: KnownPtr should be just S. -; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-check-flags=KnownPtr:SI,UnknownPtr:SI -dsgc-dspass=bu +; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-check-flags=KnownPtr:S,UnknownPtr:SI -dsgc-dspass=bu %Z = internal global int 0 %X = internal global int 0 Index: llvm/test/Regression/Analysis/DSGraph/constant_globals.ll diff -u llvm/test/Regression/Analysis/DSGraph/constant_globals.ll:1.4 llvm/test/Regression/Analysis/DSGraph/constant_globals.ll:1.5 --- llvm/test/Regression/Analysis/DSGraph/constant_globals.ll:1.4 Sun Aug 27 17:47:14 2006 +++ llvm/test/Regression/Analysis/DSGraph/constant_globals.ll Mon Oct 23 14:52:27 2006 @@ -1,5 +1,4 @@ -; FIXME: A should just be SM -; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=A:SIM +; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=A:SM ; Constant globals should not mark stuff incomplete. This should allow the ; bu pass to resolve the indirect call immediately in "test", allowing %A to ; be marked complete and the store to happen. From alenhar2 at cs.uiuc.edu Mon Oct 23 14:53:21 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 23 Oct 2006 14:53:21 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/DataStructure.h Message-ID: <200610231953.k9NJrL9W009225@apoc.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: DataStructure.h updated: 1.97 -> 1.98 --- Log message: change this back --- Diffs of the changes: (+1 -1) DataStructure.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Analysis/DataStructure/DataStructure.h diff -u llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.97 llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.98 --- llvm/include/llvm/Analysis/DataStructure/DataStructure.h:1.97 Tue Jun 20 10:32:17 2006 +++ llvm/include/llvm/Analysis/DataStructure/DataStructure.h Mon Oct 23 14:52:54 2006 @@ -185,7 +185,7 @@ } private: - bool calculateGraph(DSGraph &G); + void calculateGraph(DSGraph &G); DSGraph &getOrCreateGraph(Function *F); From alenhar2 at cs.uiuc.edu Mon Oct 23 14:54:04 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 23 Oct 2006 14:54:04 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200610231954.k9NJs4YU011290@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.121 -> 1.122 --- Log message: Revert the aggressive inlining for now, it doesn't handle external correctly --- Diffs of the changes: (+78 -112) BottomUpClosure.cpp | 190 +++++++++++++++++++++------------------------------- 1 files changed, 78 insertions(+), 112 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.121 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.122 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.121 Fri Oct 13 12:38:22 2006 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Mon Oct 23 14:53:37 2006 @@ -41,7 +41,7 @@ X("budatastructure", "Bottom-up Data Structure Analysis"); } -static bool GetAllCallees(const DSCallSite &CS, +static bool GetAllCalleesN(const DSCallSite &CS, std::vector &Callees); /// BuildGlobalECs - Look at all of the nodes in the globals graph. If any node @@ -164,7 +164,6 @@ unsigned NextID = 1; Function *MainFunc = M.getMainFunction(); - if (MainFunc) calculateGraphs(MainFunc, Stack, NextID, ValMap); @@ -216,8 +215,9 @@ if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); - ReachabilityCloner RC(MainGraph, GG, DSGraph::DontCloneCallNodes | - DSGraph::DontCloneAuxCallNodes); + ReachabilityCloner RC(MainGraph, GG, + DSGraph::DontCloneCallNodes | + DSGraph::DontCloneAuxCallNodes); // Clone the global nodes into this graph. for (DSScalarMap::global_iterator I = GG.getScalarMap().global_begin(), @@ -232,16 +232,16 @@ //Debug messages if along the way we didn't resolve a call site //also update the call graph and callsites we did find. for(DSGraph::afc_iterator ii = MainGraph.afc_begin(), - ee = MainGraph.afc_end(); ii != ee; ++ii) { + ee = MainGraph.afc_end(); ii != ee; ++ii) { std::vector Funcs; - GetAllCallees(*ii, Funcs); + GetAllCalleesN(*ii, Funcs); DEBUG(std::cerr << "Lost site\n"); DEBUG(ii->getCallSite().getInstruction()->dump()); for (std::vector::iterator iif = Funcs.begin(), eef = Funcs.end(); - iif != eef; ++iif) { - AddGlobalToNode(this, *ii, *iif); - DEBUG(std::cerr << "Adding\n"); - ActualCallees.insert(std::make_pair(ii->getCallSite().getInstruction(), *iif)); + iif != eef; ++iif) { + AddGlobalToNode(this, *ii, *iif); + DEBUG(std::cerr << "Adding\n"); + ActualCallees.insert(std::make_pair(ii->getCallSite().getInstruction(), *iif)); } } @@ -283,8 +283,27 @@ return !callee->isExternal() || isVAHackFn(callee); } +static void GetAllCallees(const DSCallSite &CS, + std::vector &Callees) { + if (CS.isDirectCall()) { + if (isResolvableFunc(CS.getCalleeFunc())) + Callees.push_back(CS.getCalleeFunc()); + } else if (!CS.getCalleeNode()->isIncomplete()) { + // Get all callees. + unsigned OldSize = Callees.size(); + CS.getCalleeNode()->addFullFunctionList(Callees); + + // If any of the callees are unresolvable, remove the whole batch! + for (unsigned i = OldSize, e = Callees.size(); i != e; ++i) + if (!isResolvableFunc(Callees[i])) { + Callees.erase(Callees.begin()+OldSize, Callees.end()); + return; + } + } +} + //returns true if all callees were resolved -static bool GetAllCallees(const DSCallSite &CS, +static bool GetAllCalleesN(const DSCallSite &CS, std::vector &Callees) { if (CS.isDirectCall()) { if (isResolvableFunc(CS.getCalleeFunc())) { @@ -321,7 +340,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F, std::vector &Stack, unsigned &NextID, - hash_map &ValMap) { + hash_map &ValMap) { assert(!ValMap.count(F) && "Shouldn't revisit functions!"); unsigned Min = NextID++, MyID = Min; ValMap[F] = Min; @@ -369,7 +388,7 @@ Stack.pop_back(); DSGraph &G = getDSGraph(*F); DEBUG(std::cerr << " [BU] Calculating graph for: " << F->getName()<< "\n"); - bool redo = calculateGraph(G); + calculateGraph(G); DEBUG(std::cerr << " [BU] Done inlining: " << F->getName() << " [" << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size() << "]\n"); @@ -378,7 +397,8 @@ // Should we revisit the graph? Only do it if there are now new resolvable // callees. - if (redo) { + GetAllAuxCallees(Graph, CalleeFunctions); + if (!CalleeFunctions.empty()) { DEBUG(std::cerr << "Recalculating " << F->getName() << " due to new knowledge\n"); ValMap.erase(F); return calculateGraphs(F, Stack, NextID, ValMap); @@ -421,7 +441,7 @@ Stack.pop_back(); DEBUG(std::cerr << "Calculating graph for SCC #: " << MyID << " of size: " - << SCCSize << "\n"); + << SCCSize << "\n"); // Compute the Max SCC Size. if (MaxSCC < SCCSize) @@ -432,14 +452,10 @@ // Now that we have one big happy family, resolve all of the call sites in // the graph... - bool redo = calculateGraph(SCCGraph); + calculateGraph(SCCGraph); DEBUG(std::cerr << " [BU] Done inlining SCC [" << SCCGraph.getGraphSize() << "+" << SCCGraph.getAuxFunctionCalls().size() << "]\n"); - if (redo) { - DEBUG(std::cerr << "MISSING REDO\n"); - } - DEBUG(std::cerr << "DONE with SCC #: " << MyID << "\n"); // We never have to revisit "SCC" processed functions... @@ -493,8 +509,7 @@ return *DSG; } - -bool BUDataStructures::calculateGraph(DSGraph &Graph) { +void BUDataStructures::calculateGraph(DSGraph &Graph) { // If this graph contains the main function, clone the globals graph into this // graph before we inline callees and other fun stuff. bool ContainsMain = false; @@ -530,27 +545,42 @@ std::list TempFCs; std::list &AuxCallsList = Graph.getAuxFunctionCalls(); TempFCs.swap(AuxCallsList); - //remember what we've seen (or will see) - unsigned oldSize = TempFCs.size(); bool Printed = false; - bool missingNode = false; - + std::vector CalledFuncs; while (!TempFCs.empty()) { DSCallSite &CS = *TempFCs.begin(); - Instruction *TheCall = CS.getCallSite().getInstruction(); - DSGraph *GI; + + CalledFuncs.clear(); // Fast path for noop calls. Note that we don't care about merging globals // in the callee with nodes in the caller here. - if (CS.isDirectCall()) { - if (!isVAHackFn(CS.getCalleeFunc()) && isResolvableFunc(CS.getCalleeFunc())) { - Function* Callee = CS.getCalleeFunc(); + if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) { + TempFCs.erase(TempFCs.begin()); + continue; + } else if (CS.isDirectCall() && isVAHackFn(CS.getCalleeFunc())) { + TempFCs.erase(TempFCs.begin()); + continue; + } + + GetAllCallees(CS, CalledFuncs); + + if (CalledFuncs.empty()) { + // Remember that we could not resolve this yet! + AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); + continue; + } else { + DSGraph *GI; + Instruction *TheCall = CS.getCallSite().getInstruction(); + + if (CalledFuncs.size() == 1) { + Function *Callee = CalledFuncs[0]; ActualCallees.insert(std::make_pair(TheCall, Callee)); - - assert(doneDSGraph(Callee) && "Direct calls should always be precomputed"); + + // Get the data structure graph for the called function. GI = &getDSGraph(*Callee); // Graph to inline DEBUG(std::cerr << " Inlining graph for " << Callee->getName()); + DEBUG(std::cerr << "[" << GI->getGraphSize() << "+" << GI->getAuxFunctionCalls().size() << "] into '" << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" @@ -559,38 +589,22 @@ DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes); ++NumBUInlines; } else { - DEBUG(std::cerr << "Graph " << Graph.getFunctionNames() << " Call Site " << - CS.getCallSite().getInstruction() << " never resolvable\n"); - } - --oldSize; - TempFCs.pop_front(); - continue; - } else { - std::vector CalledFuncs; - bool resolved = GetAllCallees(CS, CalledFuncs); - - if (CalledFuncs.empty()) { - DEBUG(std::cerr << "Graph " << Graph.getFunctionNames() << " Call Site " << - CS.getCallSite().getInstruction() << " delayed\n"); - } else { - DEBUG( if (!Printed) std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; std::cerr << " calls " << CalledFuncs.size() << " fns from site: " << CS.getCallSite().getInstruction() << " " << *CS.getCallSite().getInstruction(); std::cerr << " Fns ="; - ); unsigned NumPrinted = 0; for (std::vector::iterator I = CalledFuncs.begin(), E = CalledFuncs.end(); I != E; ++I) { - DEBUG(if (NumPrinted++ < 8) std::cerr << " " << (*I)->getName();); + if (NumPrinted++ < 8) std::cerr << " " << (*I)->getName(); // Add the call edges to the call graph. ActualCallees.insert(std::make_pair(TheCall, *I)); } - DEBUG(std::cerr << "\n"); + std::cerr << "\n"; // See if we already computed a graph for this set of callees. std::sort(CalledFuncs.begin(), CalledFuncs.end()); @@ -602,14 +616,6 @@ E = CalledFuncs.end(); // Start with a copy of the first graph. - if (!doneDSGraph(*I)) { - AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); - missingNode = true; - continue; - } - - AddGlobalToNode(this, CS, *I); - GI = IndCallGraph.first = new DSGraph(getDSGraph(**I), GlobalECs); GI->setGlobalsGraph(Graph.getGlobalsGraph()); std::vector &Args = IndCallGraph.second; @@ -619,17 +625,10 @@ GI->getFunctionArgumentsForCall(*I, Args); // Merge all of the other callees into this graph. - bool locMissing = false; - for (++I; I != E && !locMissing; ++I) { - AddGlobalToNode(this, CS, *I); + for (++I; I != E; ++I) { // If the graph already contains the nodes for the function, don't // bother merging it in again. if (!GI->containsFunction(*I)) { - if (!doneDSGraph(*I)) { - locMissing = true; - break; - } - GI->cloneInto(getDSGraph(**I)); ++NumBUInlines; } @@ -644,44 +643,29 @@ for (e = NextArgs.size(); i != e; ++i) Args.push_back(NextArgs[i]); } - if (locMissing) { - AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); - missingNode = true; - continue; - } // Clean up the final graph! GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); } else { - DEBUG(std::cerr << "***\n*** RECYCLED GRAPH ***\n***\n"); - for (std::vector::iterator I = CalledFuncs.begin(), E = CalledFuncs.end(); I != E; ++I) { - AddGlobalToNode(this, CS, *I); - } + std::cerr << "***\n*** RECYCLED GRAPH ***\n***\n"; } GI = IndCallGraph.first; - if (AlreadyInlined[CS.getCallSite()] != CalledFuncs) { - AlreadyInlined[CS.getCallSite()].swap(CalledFuncs); - - // Merge the unified graph into this graph now. - DEBUG(std::cerr << " Inlining multi callee graph " - << "[" << GI->getGraphSize() << "+" - << GI->getAuxFunctionCalls().size() << "] into '" - << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" - << Graph.getAuxFunctionCalls().size() << "]\n"); - - Graph.mergeInGraph(CS, IndCallGraph.second, *GI, - DSGraph::StripAllocaBit | - DSGraph::DontCloneCallNodes); + // Merge the unified graph into this graph now. + DEBUG(std::cerr << " Inlining multi callee graph " + << "[" << GI->getGraphSize() << "+" + << GI->getAuxFunctionCalls().size() << "] into '" + << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+" + << Graph.getAuxFunctionCalls().size() << "]\n"); - ++NumBUInlines; - } else { - DEBUG(std::cerr << " Skipping already inlined graph\n"); - } + Graph.mergeInGraph(CS, IndCallGraph.second, *GI, + DSGraph::StripAllocaBit | + DSGraph::DontCloneCallNodes); + ++NumBUInlines; } - AuxCallsList.splice(AuxCallsList.end(), TempFCs, TempFCs.begin()); } + TempFCs.erase(TempFCs.begin()); } // Recompute the Incomplete markers @@ -704,24 +688,6 @@ RC.getClonedNH(MainSM[*I]); //Graph.writeGraphToFile(std::cerr, "bu_" + F.getName()); - AuxCallsList.sort(); - AuxCallsList.unique(); - //conditionally prune the call list keeping only one copy of each actual - //CallSite - if (AuxCallsList.size() > 100) { - DEBUG(std::cerr << "Reducing Aux from " << AuxCallsList.size()); - std::map::iterator> keepers; - TempFCs.swap(AuxCallsList); - for( std::list::iterator ii = TempFCs.begin(), ee = TempFCs.end(); - ii != ee; ++ii) - keepers[ii->getCallSite()] = ii; - for (std::map::iterator>::iterator - ii = keepers.begin(), ee = keepers.end(); - ii != ee; ++ii) - AuxCallsList.splice(AuxCallsList.end(), TempFCs, ii->second); - DEBUG(std::cerr << " to " << AuxCallsList.size() << "\n"); - } - return missingNode || oldSize != AuxCallsList.size(); } static const Function *getFnForValue(const Value *V) { From alenhar2 at cs.uiuc.edu Mon Oct 23 14:55:52 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 23 Oct 2006 14:55:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Message-ID: <200610231955.k9NJtqdZ014572@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp updated: 1.122 -> 1.123 --- Log message: Make these hack flags hidden, like other dsa hack flags --- Diffs of the changes: (+2 -2) BottomUpClosure.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.122 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.123 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.122 Mon Oct 23 14:53:37 2006 +++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Mon Oct 23 14:55:24 2006 @@ -31,10 +31,10 @@ Statistic<> NumCallEdges("budatastructures", "Number of 'actual' call edges"); cl::opt - AddGlobals("budatastructures-annotate-calls", + AddGlobals("budatastructures-annotate-calls", cl::Hidden, cl::desc("Annotate call sites with functions as they are resolved")); cl::opt - UpdateGlobals("budatastructures-update-from-globals", + UpdateGlobals("budatastructures-update-from-globals", cl::Hidden, cl::desc("Update local graph from global graph when processing function")); RegisterPass From rafael.espindola at gmail.com Mon Oct 23 15:08:37 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 23 Oct 2006 15:08:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200610232008.k9NK8b1j012256@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.77 -> 1.78 --- Log message: expand ISD::MEMSET --- Diffs of the changes: (+3 -0) ARMISelDAGToDAG.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.77 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.78 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.77 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Oct 23 15:08:22 2006 @@ -70,6 +70,9 @@ setOperationAction(ISD::SETCC, MVT::f64, Expand); setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); + + setOperationAction(ISD::MEMSET, MVT::Other, Expand); + setOperationAction(ISD::BRIND, MVT::i32, Expand); setOperationAction(ISD::BR_CC, MVT::i32, Custom); setOperationAction(ISD::BR_CC, MVT::f32, Custom); From asl at math.spbu.ru Mon Oct 23 15:25:44 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 24 Oct 2006 00:25:44 +0400 Subject: [llvm-commits] Linkage patch for llvm-gcc Message-ID: <20061024002544.6f6ca79d@asl.dorms.spbu.ru> Hello, Everyone Please find patch for llvm-gcc4 attached. It fixes linkage setup at least for mingw32 platform as target. However, I'm worrying it's no so correct :) -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. -------------- next part -------------- A non-text attachment was scrubbed... Name: linkage.diff Type: text/x-patch Size: 1190 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061024/fa163262/attachment.bin From rafael.espindola at gmail.com Mon Oct 23 15:34:44 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 23 Oct 2006 15:34:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200610232034.k9NKYibq012721@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.69 -> 1.70 --- Log message: implement STRB and STRH --- Diffs of the changes: (+8 -0) ARMInstrInfo.td | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.69 llvm/lib/Target/ARM/ARMInstrInfo.td:1.70 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.69 Thu Oct 19 12:05:03 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Mon Oct 23 15:34:26 2006 @@ -184,6 +184,14 @@ "str $src, $addr", [(store IntRegs:$src, iaddr:$addr)]>; +def STRB : InstARM<(ops IntRegs:$src, IntRegs:$addr), + "strb $src, [$addr]", + [(truncstorei8 IntRegs:$src, IntRegs:$addr)]>; + +def STRH : InstARM<(ops IntRegs:$src, IntRegs:$addr), + "strh $src, [$addr]", + [(truncstorei16 IntRegs:$src, IntRegs:$addr)]>; + def MOV : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), "mov $dst, $src", [(set IntRegs:$dst, addr_mode1:$src)]>; From rafael.espindola at gmail.com Mon Oct 23 15:34:44 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 23 Oct 2006 15:34:44 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/mem.ll Message-ID: <200610232034.k9NKYiNP012724@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: mem.ll added (r1.1) --- Log message: implement STRB and STRH --- Diffs of the changes: (+15 -0) mem.ll | 15 +++++++++++++++ 1 files changed, 15 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/mem.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/mem.ll:1.1 *** /dev/null Mon Oct 23 15:34:37 2006 --- llvm/test/Regression/CodeGen/ARM/mem.ll Mon Oct 23 15:34:27 2006 *************** *** 0 **** --- 1,15 ---- + ; RUN: llvm-as < %s | llc -march=arm && + ; RUN: llvm-as < %s | llc -march=arm | grep strb && + ; RUN: llvm-as < %s | llc -march=arm | grep strh + + void %f1() { + entry: + store ubyte 0, ubyte* null + ret void + } + + void %f2() { + entry: + store short 0, short* null + ret void + } From evan.cheng at apple.com Mon Oct 23 16:47:27 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 23 Oct 2006 16:47:27 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll Message-ID: <200610232147.k9NLlRxP022937@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-10-19-SwitchUnnecessaryBranching.ll updated: 1.2 -> 1.3 --- Log message: Update test case. --- Diffs of the changes: (+1 -1) 2006-10-19-SwitchUnnecessaryBranching.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll diff -u llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll:1.2 llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll:1.3 --- llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll:1.2 Fri Oct 20 13:15:24 2006 +++ llvm/test/Regression/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll Mon Oct 23 16:47:11 2006 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 | %prcontext "jg.*BB1_5" 1 | grep "BB1_4:" +; RUN: llvm-as < %s | llc -march=x86 | %prcontext je 1 | grep "BB1_4:" %str = internal constant [14 x sbyte] c"Hello world!\0A\00" ; <[14 x sbyte]*> [#uses=1] %str = internal constant [13 x sbyte] c"Blah world!\0A\00" ; <[13 x sbyte]*> [#uses=1] From sabre at nondot.org Mon Oct 23 17:10:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 17:10:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610232210.k9NMAQ61032580@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.20 -> 1.21 --- Log message: Enable tail merging by default. --- Diffs of the changes: (+0 -4) BranchFolding.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.20 llvm/lib/CodeGen/BranchFolding.cpp:1.21 --- llvm/lib/CodeGen/BranchFolding.cpp:1.20 Mon Oct 23 09:56:37 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Mon Oct 23 17:10:12 2006 @@ -30,7 +30,6 @@ static Statistic<> NumDeadBlocks("branchfold", "Number of dead blocks removed"); static Statistic<> NumBranchOpts("branchfold", "Number of branches optimized"); static Statistic<> NumTailMerge ("branchfold", "Number of block tails merged"); -static cl::opt EnableTailMerge("enable-tail-merge", cl::init(false)); namespace { struct BranchFolder : public MachineFunctionPass { @@ -207,9 +206,6 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) { MadeChange = false; - if (!EnableTailMerge) - return false; - // Find blocks with no successors. std::vector > MergePotentials; for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { From sabre at nondot.org Mon Oct 23 17:11:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 17:11:14 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200610232211.k9NMBE3E000766@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.233 -> 1.234 --- Log message: revert llcbeta option --- Diffs of the changes: (+2 -2) Makefile.programs | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.233 llvm-test/Makefile.programs:1.234 --- llvm-test/Makefile.programs:1.233 Fri Oct 20 22:16:58 2006 +++ llvm-test/Makefile.programs Mon Oct 23 17:10:59 2006 @@ -193,7 +193,7 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := -enable-tail-merge +LLCBETAOPTION := -regalloc=local -fast endif ifeq ($(ARCH),Alpha) LLCBETAOPTION := -sched=list-td @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-tail-merge +LLCBETAOPTION := -regalloc=local -fast endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From dpatel at apple.com Mon Oct 23 18:12:41 2006 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 Oct 2006 18:12:41 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkTimeOptimizer.h Message-ID: <200610232312.k9NNCfUd010548@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkTimeOptimizer.h updated: 1.8 -> 1.9 --- Log message: Add removeModule(). --- Diffs of the changes: (+2 -0) LinkTimeOptimizer.h | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/LinkTimeOptimizer.h diff -u llvm/include/llvm/LinkTimeOptimizer.h:1.8 llvm/include/llvm/LinkTimeOptimizer.h:1.9 --- llvm/include/llvm/LinkTimeOptimizer.h:1.8 Thu Sep 21 12:22:55 2006 +++ llvm/include/llvm/LinkTimeOptimizer.h Mon Oct 23 18:12:26 2006 @@ -91,6 +91,7 @@ std::vector &, std::string &) = 0; virtual void getTargetTriple(const std::string &, std::string &) = 0; + virtual void removeModule (const std::string &InputFilename) = 0; virtual ~LinkTimeOptimizer() = 0; }; @@ -111,6 +112,7 @@ std::vector &exportList, std::string &targetTriple); void getTargetTriple(const std::string &InputFilename, std::string &targetTriple); + void removeModule (const std::string &InputFilename); private: Module *getModule (const std::string &InputFilename); From dpatel at apple.com Mon Oct 23 18:12:41 2006 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 Oct 2006 18:12:41 -0500 Subject: [llvm-commits] CVS: llvm/tools/lto/lto.cpp Message-ID: <200610232312.k9NNCfUV010553@zion.cs.uiuc.edu> Changes in directory llvm/tools/lto: lto.cpp updated: 1.20 -> 1.21 --- Log message: Add removeModule(). --- Diffs of the changes: (+12 -0) lto.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.20 llvm/tools/lto/lto.cpp:1.21 --- llvm/tools/lto/lto.cpp:1.20 Mon Oct 9 16:16:05 2006 +++ llvm/tools/lto/lto.cpp Mon Oct 23 18:12:26 2006 @@ -102,6 +102,18 @@ findExternalRefs(c->getOperand(i), references, mangler); } +/// If Moduel with InputFilename is available then remove it. +void +LTO::removeModule (const std::string &InputFilename) +{ + NameToModuleMap::iterator pos = allModules.find(InputFilename.c_str()); + if (pos != allModules.end()) { + Module *m = allModules[InputFilename.c_str()]; + allModules.erase(pos); + delete m; + } +} + /// InputFilename is a LLVM bytecode file. If Module with InputFilename is /// available then return it. Otherwise parseInputFilename. Module * From sabre at nondot.org Mon Oct 23 18:35:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 18:35:50 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineBasicBlock.h Message-ID: <200610232335.k9NNZocU011073@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineBasicBlock.h updated: 1.46 -> 1.47 --- Log message: add two helper methods --- Diffs of the changes: (+9 -1) MachineBasicBlock.h | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.46 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.47 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.46 Sat Oct 21 01:50:05 2006 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Mon Oct 23 18:35:35 2006 @@ -125,8 +125,16 @@ unsigned succ_size() const { return Successors.size(); } bool succ_empty() const { return Successors.empty(); } + // Code Layout methods. + + /// moveBefore/moveAfter - move 'this' block before or after the specified + /// block. This only moves the block, it does not modify the CFG or adjust + /// potential fall-throughs at the end of the block. + void moveBefore(MachineBasicBlock *NewAfter); + void moveAfter(MachineBasicBlock *NewBefore); + // Machine-CFG mutators - + /// addSuccessor - Add succ as a successor of this MachineBasicBlock. /// The Predecessors list of succ is automatically updated. /// From dpatel at apple.com Mon Oct 23 18:58:07 2006 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 Oct 2006 18:58:07 -0500 Subject: [llvm-commits] CVS: llvm/tools/lto/lto.cpp Message-ID: <200610232358.k9NNw7Ep011497@zion.cs.uiuc.edu> Changes in directory llvm/tools/lto: lto.cpp updated: 1.21 -> 1.22 --- Log message: Fix typo. Add more comment. Avoid extra hash_map search. --- Diffs of the changes: (+8 -6) lto.cpp | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.21 llvm/tools/lto/lto.cpp:1.22 --- llvm/tools/lto/lto.cpp:1.21 Mon Oct 23 18:12:26 2006 +++ llvm/tools/lto/lto.cpp Mon Oct 23 18:57:53 2006 @@ -102,16 +102,18 @@ findExternalRefs(c->getOperand(i), references, mangler); } -/// If Moduel with InputFilename is available then remove it. +/// If Module with InputFilename is available then remove it from allModules +/// and call delete on it. void LTO::removeModule (const std::string &InputFilename) { NameToModuleMap::iterator pos = allModules.find(InputFilename.c_str()); - if (pos != allModules.end()) { - Module *m = allModules[InputFilename.c_str()]; - allModules.erase(pos); - delete m; - } + if (pos == allModules.end()) + return; + + Module *m = pos->second; + allModules.erase(pos); + delete m; } /// InputFilename is a LLVM bytecode file. If Module with InputFilename is From sabre at nondot.org Mon Oct 23 19:02:40 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 19:02:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp Message-ID: <200610240002.k9O02eEf011600@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineBasicBlock.cpp updated: 1.32 -> 1.33 --- Log message: add moveBefore/moveAfter helper methods --- Diffs of the changes: (+12 -0) MachineBasicBlock.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.32 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.33 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.32 Fri Oct 6 16:28:17 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Mon Oct 23 19:02:26 2006 @@ -120,6 +120,18 @@ } } +void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) { + MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList(); + getParent()->getBasicBlockList().splice(NewAfter, BBList, this); +} + +void MachineBasicBlock::moveAfter(MachineBasicBlock *NewBefore) { + MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList(); + MachineFunction::iterator BBI = NewBefore; + getParent()->getBasicBlockList().splice(++BBI, BBList, this); +} + + void MachineBasicBlock::addSuccessor(MachineBasicBlock *succ) { Successors.push_back(succ); succ->addPredecessor(this); From sabre at nondot.org Mon Oct 23 19:36:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 19:36:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200610240036.k9O0aZwc012568@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.25 -> 1.26 --- Log message: Revert back to r1.21, which was the last revision of predsimplify that passes llvm-gcc bootstrap. --- Diffs of the changes: (+109 -134) PredicateSimplifier.cpp | 243 +++++++++++++++++++++--------------------------- 1 files changed, 109 insertions(+), 134 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.25 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.26 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.25 Sun Oct 22 20:56:02 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Mon Oct 23 19:36:21 2006 @@ -41,7 +41,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/InstVisitor.h" #include -#include using namespace llvm; typedef DominatorTree::Node DTNodeType; @@ -75,14 +74,14 @@ return leaders.empty(); } - iterator findLeader(ElemTy &e) { + iterator findLeader(ElemTy e) { typename std::map::iterator MI = mapping.find(e); if (MI == mapping.end()) return 0; return MI->second; } - const_iterator findLeader(ElemTy &e) const { + const_iterator findLeader(ElemTy e) const { typename std::map::const_iterator MI = mapping.find(e); if (MI == mapping.end()) return 0; @@ -117,11 +116,6 @@ // Mutators - void remove(ElemTy &e) { - ElemTy E = e; // The parameter to erase must not be a reference to - mapping.erase(E); // an element contained in the map. - } - /// Combine two sets referring to the same element, inserting the /// elements as needed. Returns a valid iterator iff two already /// existing disjoint synonym sets were combined. The iterator @@ -130,7 +124,7 @@ /// Returns an iterator pointing to the synonym set containing /// element e. If none exists, a new one is created and returned. - iterator findOrInsert(ElemTy &e) { + iterator findOrInsert(ElemTy e) { iterator I = findLeader(e); if (I) return I; @@ -209,19 +203,6 @@ return union_find.empty(); } - void remove(Value *V) { - SynonymIterator I = union_find.findLeader(V); - if (!I) return; - - union_find.remove(V); - - for (PropertyIterator PI = Properties.begin(), PE = Properties.end(); - PI != PE;) { - Property &P = *PI++; - if (P.I1 == I || P.I2 == I) Properties.erase(PI); - } - } - void addEqual(Value *V1, Value *V2) { // If %x = 0. and %y = -0., seteq %x, %y is true, but // copysign(%x) is not the same as copysign(%y). @@ -230,10 +211,6 @@ order(V1, V2); if (isa(V2)) return; // refuse to set false == true. - if (union_find.findLeader(V1) && - union_find.findLeader(V1) == union_find.findLeader(V2)) - return; // no-op - SynonymIterator deleted = union_find.unionSets(V1, V2); if (deleted) { SynonymIterator replacement = union_find.findLeader(V1); @@ -257,7 +234,7 @@ if (isa(V1) && isa(V2)) return; if (findProperty(NE, V1, V2) != Properties.end()) - return; // no-op. + return; // found. // Add the property. SynonymIterator I1 = union_find.findOrInsert(V1), @@ -331,73 +308,6 @@ } } - void addToResolve(Value *V, std::list &WorkList) { - if (!isa(V) && !isa(V)) { - for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); - UI != UE; ++UI) { - if (!isa(*UI) && !isa(*UI)) { - WorkList.push_back(*UI); - } - } - } - } - - void resolve(std::list &WorkList) { - if (WorkList.empty()) return; - - Value *V = WorkList.front(); - WorkList.pop_front(); - - if (empty()) return; - - Instruction *I = dyn_cast(V); - if (!I) return; - - if (BinaryOperator *BO = dyn_cast(I)) { - Value *lhs = canonicalize(BO->getOperand(0)), - *rhs = canonicalize(BO->getOperand(1)); - - ConstantIntegral *CI1 = dyn_cast(lhs), - *CI2 = dyn_cast(rhs); - - if (CI1 && CI2) { - addToResolve(BO, WorkList); - addEqual(BO, ConstantExpr::get(BO->getOpcode(), CI1, CI2)); - } else if (SetCondInst *SCI = dyn_cast(BO)) { - PropertySet::ConstPropertyIterator NE = - findProperty(PropertySet::NE, lhs, rhs); - - if (NE != Properties.end()) { - switch (SCI->getOpcode()) { - case Instruction::SetEQ: - addToResolve(SCI, WorkList); - addEqual(SCI, ConstantBool::getFalse()); - break; - case Instruction::SetNE: - addToResolve(SCI, WorkList); - addEqual(SCI, ConstantBool::getTrue()); - break; - case Instruction::SetLE: - case Instruction::SetGE: - case Instruction::SetLT: - case Instruction::SetGT: - break; - default: - assert(0 && "Unknown opcode in SetCondInst."); - break; - } - } - } - } else if (SelectInst *SI = dyn_cast(I)) { - Value *Condition = canonicalize(SI->getCondition()); - if (ConstantBool *CB = dyn_cast(Condition)) { - addToResolve(SI, WorkList); - addEqual(SI, CB->getValue() ? SI->getTrueValue() : SI->getFalseValue()); - } - } - if (!WorkList.empty()) resolve(WorkList); - } - // Finds the properties implied by an equivalence and adds them too. // Example: ("seteq %a, %b", true, EQ) --> (%a, %b, EQ) // ("seteq %a, %b", false, EQ) --> (%a, %b, NE) @@ -424,45 +334,32 @@ if (V1 == ConstantBool::getFalse()) add(Opcode, BO->getOperand(0), BO->getOperand(1), true); break; - case Instruction::And: { - ConstantIntegral *CI = dyn_cast(V1); - if (CI && CI->isAllOnesValue()) { + case Instruction::And: + if (V1 == ConstantBool::getTrue()) { add(Opcode, V1, BO->getOperand(0), false); add(Opcode, V1, BO->getOperand(1), false); } - } break; - case Instruction::Or: { - ConstantIntegral *CI = dyn_cast(V1); - if (CI && CI->isNullValue()) { + break; + case Instruction::Or: + if (V1 == ConstantBool::getFalse()) { add(Opcode, V1, BO->getOperand(0), false); add(Opcode, V1, BO->getOperand(1), false); } - } break; - case Instruction::Xor: { - if (ConstantIntegral *CI = dyn_cast(V1)) { - const Type *Ty = BO->getType(); - if (CI->isAllOnesValue()) { - if (BO->getOperand(0) == V1) - add(Opcode, Constant::getNullValue(Ty), - BO->getOperand(1), false); - if (BO->getOperand(1) == V1) - add(Opcode, Constant::getNullValue(Ty), - BO->getOperand(0), false); - } - if (CI->isNullValue()) { - ConstantIntegral *Op0 = - dyn_cast(BO->getOperand(0)); - ConstantIntegral *Op1 = - dyn_cast(BO->getOperand(1)); - if (Op0 && Op0->isAllOnesValue()) - add(Opcode, ConstantIntegral::getAllOnesValue(Ty), - BO->getOperand(1), false); - if (Op1 && Op1->isAllOnesValue()) - add(Opcode, ConstantIntegral::getAllOnesValue(Ty), - BO->getOperand(0), false); - } + break; + case Instruction::Xor: + if (V1 == ConstantBool::getTrue()) { + if (BO->getOperand(0) == V1) + add(Opcode, ConstantBool::getFalse(), BO->getOperand(1), false); + if (BO->getOperand(1) == V1) + add(Opcode, ConstantBool::getFalse(), BO->getOperand(0), false); + } + if (V1 == ConstantBool::getFalse()) { + if (BO->getOperand(0) == ConstantBool::getTrue()) + add(Opcode, ConstantBool::getTrue(), BO->getOperand(1), false); + if (BO->getOperand(1) == ConstantBool::getTrue()) + add(Opcode, ConstantBool::getTrue(), BO->getOperand(0), false); } - } break; + break; default: break; } @@ -479,11 +376,6 @@ else if (Opcode == EQ) assert("Result of select not equal to either value."); } - - std::list WorkList; - addToResolve(V1, WorkList); - addToResolve(V2, WorkList); - resolve(WorkList); } DominatorTree *DT; @@ -514,6 +406,26 @@ virtual void getAnalysisUsage(AnalysisUsage &AU) const; private: + /// Backwards - Try to replace the Use of the instruction with + /// something simpler. This resolves a value by walking backwards + /// through its definition and the operands of that definition to + /// see if any values can now be solved for with the properties + /// that are in effect now, but weren't at definition time. + class Backwards : public InstVisitor { + friend class InstVisitor; + const PropertySet &KP; + + Value &visitSetCondInst(SetCondInst &SCI); + Value &visitBinaryOperator(BinaryOperator &BO); + Value &visitSelectInst(SelectInst &SI); + Value &visitInstruction(Instruction &I); + + public: + explicit Backwards(const PropertySet &KP) : KP(KP) {} + + Value *resolve(Value *V); + }; + /// Forwards - Adds new properties into PropertySet and uses them to /// simplify instructions. Because new properties sometimes apply to /// a transition from one BasicBlock to another, this will use the @@ -628,6 +540,69 @@ AU.addPreservedID(BreakCriticalEdgesID); } +Value &PredicateSimplifier::Backwards::visitSetCondInst(SetCondInst &SCI) { + Value &vBO = visitBinaryOperator(SCI); + if (&vBO != &SCI) return vBO; + + Value *SCI0 = resolve(SCI.getOperand(0)), + *SCI1 = resolve(SCI.getOperand(1)); + + PropertySet::ConstPropertyIterator NE = + KP.findProperty(PropertySet::NE, SCI0, SCI1); + + if (NE != KP.Properties.end()) { + switch (SCI.getOpcode()) { + case Instruction::SetEQ: return *ConstantBool::getFalse(); + case Instruction::SetNE: return *ConstantBool::getTrue(); + case Instruction::SetLE: + case Instruction::SetGE: + case Instruction::SetLT: + case Instruction::SetGT: + break; + default: + assert(0 && "Unknown opcode in SetCondInst."); + break; + } + } + return SCI; +} + +Value &PredicateSimplifier::Backwards::visitBinaryOperator(BinaryOperator &BO) { + Value *V = KP.canonicalize(&BO); + if (V != &BO) return *V; + + Value *lhs = resolve(BO.getOperand(0)), + *rhs = resolve(BO.getOperand(1)); + + ConstantIntegral *CI1 = dyn_cast(lhs), + *CI2 = dyn_cast(rhs); + + if (CI1 && CI2) return *ConstantExpr::get(BO.getOpcode(), CI1, CI2); + + return BO; +} + +Value &PredicateSimplifier::Backwards::visitSelectInst(SelectInst &SI) { + Value *V = KP.canonicalize(&SI); + if (V != &SI) return *V; + + Value *Condition = resolve(SI.getCondition()); + if (ConstantBool *CB = dyn_cast(Condition)) + return *resolve(CB->getValue() ? SI.getTrueValue() : SI.getFalseValue()); + return SI; +} + +Value &PredicateSimplifier::Backwards::visitInstruction(Instruction &I) { + return *KP.canonicalize(&I); +} + +Value *PredicateSimplifier::Backwards::resolve(Value *V) { + if (isa(V) || isa(V) || KP.empty()) return V; + + if (Instruction *I = dyn_cast(V)) return &visit(*I); + return KP.canonicalize(V); +} + void PredicateSimplifier::visitBasicBlock(BasicBlock *BB, PropertySet &KnownProperties) { for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { @@ -638,12 +613,12 @@ void PredicateSimplifier::visitInstruction(Instruction *I, PropertySet &KnownProperties) { // Try to replace the whole instruction. - Value *V = KnownProperties.canonicalize(I); + Backwards resolve(KnownProperties); + Value *V = resolve.resolve(I); if (V != I) { modified = true; ++NumInstruction; DEBUG(std::cerr << "Removing " << *I); - KnownProperties.remove(I); I->replaceAllUsesWith(V); I->eraseFromParent(); return; @@ -652,7 +627,7 @@ // Try to substitute operands. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { Value *Oper = I->getOperand(i); - Value *V = KnownProperties.canonicalize(Oper); + Value *V = resolve.resolve(Oper); if (V != Oper) { modified = true; ++NumVarsReplaced; From sabre at nondot.org Mon Oct 23 20:07:53 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 20:07:53 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/IntrinsicsPowerPC.td Message-ID: <200610240107.k9O17r7M013103@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: IntrinsicsPowerPC.td updated: 1.26 -> 1.27 --- Log message: add missing dcb* intrinsics --- Diffs of the changes: (+8 -3) IntrinsicsPowerPC.td | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm/include/llvm/IntrinsicsPowerPC.td diff -u llvm/include/llvm/IntrinsicsPowerPC.td:1.26 llvm/include/llvm/IntrinsicsPowerPC.td:1.27 --- llvm/include/llvm/IntrinsicsPowerPC.td:1.26 Fri Aug 18 14:25:35 2006 +++ llvm/include/llvm/IntrinsicsPowerPC.td Mon Oct 23 20:07:39 2006 @@ -17,9 +17,14 @@ // Non-altivec intrinsics. let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.". - // dcbz instruction. - def int_ppc_dcbz : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; - // dcbzl (PPC970) instruction. + // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions. + def int_ppc_dcba : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; + def int_ppc_dcbf : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; + def int_ppc_dcbi : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; + def int_ppc_dcbst : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; + def int_ppc_dcbt : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; + def int_ppc_dcbtst: Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; + def int_ppc_dcbz : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; def int_ppc_dcbzl : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>; } From sabre at nondot.org Mon Oct 23 20:08:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 20:08:57 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <200610240108.k9O18vGG013181@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.td updated: 1.248 -> 1.249 --- Log message: Add intrinsics for the rest of the DCB* instructions. --- Diffs of the changes: (+24 -6) PPCInstrInfo.td | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.248 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.249 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.248 Fri Oct 13 16:14:26 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Mon Oct 23 20:08:42 2006 @@ -369,12 +369,30 @@ } // DCB* instructions. -def DCBZ : DCB_Form<1014, 0, (ops memrr:$dst), - "dcbz $dst", LdStDCBF, [(int_ppc_dcbz xoaddr:$dst)]>, - PPC970_DGroup_Single; -def DCBZL : DCB_Form<1014, 1, (ops memrr:$dst), - "dcbzl $dst", LdStDCBF, [(int_ppc_dcbzl xoaddr:$dst)]>, - PPC970_DGroup_Single; +def DCBA : DCB_Form<758, 0, (ops memrr:$dst), + "dcba $dst", LdStDCBF, [(int_ppc_dcba xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBF : DCB_Form<86, 0, (ops memrr:$dst), + "dcbf $dst", LdStDCBF, [(int_ppc_dcbf xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBI : DCB_Form<470, 0, (ops memrr:$dst), + "dcbi $dst", LdStDCBF, [(int_ppc_dcbi xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBST : DCB_Form<54, 0, (ops memrr:$dst), + "dcbst $dst", LdStDCBF, [(int_ppc_dcbst xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBT : DCB_Form<278, 0, (ops memrr:$dst), + "dcbt $dst", LdStDCBF, [(int_ppc_dcbt xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBTST : DCB_Form<246, 0, (ops memrr:$dst), + "dcbtst $dst", LdStDCBF, [(int_ppc_dcbtst xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBZ : DCB_Form<1014, 0, (ops memrr:$dst), + "dcbz $dst", LdStDCBF, [(int_ppc_dcbz xoaddr:$dst)]>, + PPC970_DGroup_Single; +def DCBZL : DCB_Form<1014, 1, (ops memrr:$dst), + "dcbzl $dst", LdStDCBF, [(int_ppc_dcbzl xoaddr:$dst)]>, + PPC970_DGroup_Single; // D-Form instructions. Most instructions that perform an operation on a // register and an immediate are of this type. From sabre at nondot.org Mon Oct 23 20:12:47 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 Oct 2006 20:12:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610240112.k9O1Cluh013340@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.21 -> 1.22 --- Log message: move single basic blocks that are neither fallen into nor fall out of into a place more useful. In particular, if we can put them in a place where code will be able to fall into it, do so. Otherwise, put it in a place it can fall through into a successor. Otherwise, if preventing a fallthrough, move to the end of the function, out of the way. This deletes several hundred unconditional branches from spass. --- Diffs of the changes: (+96 -13) BranchFolding.cpp | 109 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 96 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.21 llvm/lib/CodeGen/BranchFolding.cpp:1.22 --- llvm/lib/CodeGen/BranchFolding.cpp:1.21 Mon Oct 23 17:10:12 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Mon Oct 23 20:12:32 2006 @@ -46,7 +46,7 @@ // Branch optzn. bool OptimizeBranches(MachineFunction &MF); - void OptimizeBlock(MachineFunction::iterator MBB); + void OptimizeBlock(MachineBasicBlock *MBB); void RemoveDeadBlock(MachineBasicBlock *MBB); }; } @@ -394,17 +394,42 @@ } } +/// CanFallThrough - Return true of the specified branch condition can transfer +/// control to FallthroughBlock, the block immediately after the branch. +static bool CanFallThrough(MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond, + MachineFunction::iterator FallthroughBlock) { + // If there is no branch, control always falls through. + if (TBB == 0) return true; + + // If there is some explicit branch to the fallthrough block, it can obviously + // reach, even though the branch should get folded to fall through implicitly. + if (MachineFunction::iterator(TBB) == FallthroughBlock || + MachineFunction::iterator(FBB) == FallthroughBlock) + return true; + + // If it's an unconditional branch to some block not the fall through, it + // doesn't fall through. + if (Cond.empty()) return false; + + // Otherwise, if it is conditional and has no explicit false block, it falls + // through. + return !Cond.empty() && FBB == 0; +} + /// OptimizeBlock - Analyze and optimize control flow related to the specified /// block. This is never called on the entry block. -void BranchFolder::OptimizeBlock(MachineFunction::iterator MBB) { +void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) { + MachineFunction::iterator FallThrough = MBB; + ++FallThrough; + // If this block is empty, make everyone use its fall-through, not the block // explicitly. if (MBB->empty()) { // Dead block? Leave for cleanup later. if (MBB->pred_empty()) return; - MachineFunction::iterator FallThrough = next(MBB); - if (FallThrough == MBB->getParent()->end()) { // TODO: Simplify preds to not branch here if possible! } else { @@ -426,7 +451,7 @@ // Check to see if we can simplify the terminator of the block before this // one. - MachineBasicBlock &PrevBB = *prior(MBB); + MachineBasicBlock &PrevBB = *prior(MachineFunction::iterator(MBB)); MachineBasicBlock *PriorTBB = 0, *PriorFBB = 0; std::vector PriorCond; @@ -443,7 +468,7 @@ if (PriorTBB && PriorTBB == PriorFBB) { TII->RemoveBranch(PrevBB); PriorCond.clear(); - if (PriorTBB != &*MBB) + if (PriorTBB != MBB) TII->InsertBranch(PrevBB, PriorTBB, 0, PriorCond); MadeChange = true; ++NumBranchOpts; @@ -452,7 +477,7 @@ // If the previous branch *only* branches to *this* block (conditional or // not) remove the branch. - if (PriorTBB == &*MBB && PriorFBB == 0) { + if (PriorTBB == MBB && PriorFBB == 0) { TII->RemoveBranch(PrevBB); MadeChange = true; ++NumBranchOpts; @@ -461,7 +486,7 @@ // If the prior block branches somewhere else on the condition and here if // the condition is false, remove the uncond second branch. - if (PriorFBB == &*MBB) { + if (PriorFBB == MBB) { TII->RemoveBranch(PrevBB); TII->InsertBranch(PrevBB, PriorTBB, 0, PriorCond); MadeChange = true; @@ -472,7 +497,7 @@ // If the prior block branches here on true and somewhere else on false, and // if the branch condition is reversible, reverse the branch to create a // fall-through. - if (PriorTBB == &*MBB) { + if (PriorTBB == MBB) { std::vector NewPriorCond(PriorCond); if (!TII->ReverseBranchCondition(NewPriorCond)) { TII->RemoveBranch(PrevBB); @@ -490,12 +515,13 @@ if (!TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond)) { // If the CFG for the prior block has extra edges, remove them. MadeChange |= CorrectExtraCFGEdges(*MBB, CurTBB, CurFBB, - !CurCond.empty(), next(MBB)); + !CurCond.empty(), + ++MachineFunction::iterator(MBB)); // If this branch is the only thing in its block, see if we can forward // other blocks across it. if (CurTBB && CurCond.empty() && CurFBB == 0 && - TII->isBranch(MBB->begin()->getOpcode()) && CurTBB != &*MBB) { + TII->isBranch(MBB->begin()->getOpcode()) && CurTBB != MBB) { // This block may contain just an unconditional branch. Because there can // be 'non-branch terminators' in the block, try removing the branch and // then seeing if the block is empty. @@ -509,7 +535,7 @@ if (MBB->empty() && (!PriorUnAnalyzable || !PrevBB.isSuccessor(MBB))) { // If the prior block falls through into us, turn it into an // explicit branch to us to make updates simpler. - if (PrevBB.isSuccessor(MBB) && PriorTBB != &*MBB && PriorFBB != &*MBB) { + if (PrevBB.isSuccessor(MBB) && PriorTBB != MBB && PriorFBB != MBB) { if (PriorTBB == 0) { assert(PriorCond.empty() && PriorFBB == 0 && "Bad branch analysis"); PriorTBB = MBB; @@ -526,7 +552,7 @@ bool DidChange = false; bool HasBranchToSelf = false; while (PI != MBB->pred_end()) { - if (*PI == &*MBB) { + if (*PI == MBB) { // If this block has an uncond branch to itself, leave it. ++PI; HasBranchToSelf = true; @@ -549,5 +575,62 @@ // Add the branch back if the block is more than just an uncond branch. TII->InsertBranch(*MBB, CurTBB, 0, CurCond); } + + // If the prior block doesn't fall through into this block, and if this + // block doesn't fall through into some other block, see if we can find a + // place to move this block where a fall-through will happen. + if (!PriorUnAnalyzable && !CanFallThrough(PriorTBB, PriorFBB, + PriorCond, MBB)) { + // Now we know that there was no fall-through into this block, check to + // see if it has fall-throughs. + if (!CanFallThrough(CurTBB, CurFBB, CurCond, FallThrough)) { + + // Check all the predecessors of this block. If one of them has no fall + // throughs, move this block right after it. + for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), + E = MBB->pred_end(); PI != E; ++PI) { + // Analyze the branch at the end of the pred. + MachineBasicBlock *PredBB = *PI; + MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough; + MachineBasicBlock *PredTBB = 0, *PredFBB = 0; + std::vector PredCond; + if (PredBB != MBB && + !TII->AnalyzeBranch(*PredBB, PredTBB, PredFBB, PredCond) && + !CanFallThrough(PredTBB, PredFBB, PredCond, PredFallthrough)) { + MBB->moveAfter(PredBB); + MadeChange = true; + return OptimizeBlock(MBB); + } + } + + // Check all successors to see if we can move this block before it. + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + E = MBB->succ_end(); SI != E; ++SI) { + // Analyze the branch at the end of the block before the succ. + MachineBasicBlock *SuccBB = *SI; + MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev; + MachineBasicBlock *SuccPrevTBB = 0, *SuccPrevFBB = 0; + std::vector SuccPrevCond; + if (SuccBB != MBB && + !TII->AnalyzeBranch(*SuccPrev, SuccPrevTBB, SuccPrevFBB, + SuccPrevCond) && + !CanFallThrough(SuccPrevTBB, SuccPrevFBB, SuccPrevCond, SuccBB)) { + MBB->moveBefore(SuccBB); + MadeChange = true; + return OptimizeBlock(MBB); + } + } + + // Okay, there is no really great place to put this block. If, however, + // the block before this one would be a fall-through if this block were + // removed, move this block to the end of the function. + if (FallThrough != MBB->getParent()->end() && + CanFallThrough(PriorTBB, PriorFBB, PriorCond, FallThrough)) { + MBB->moveAfter(--MBB->getParent()->end()); + MadeChange = true; + return; + } + } + } } } From clattner at apple.com Tue Oct 24 00:52:50 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Oct 2006 22:52:50 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review In-Reply-To: <1161571843.29146.564.camel@bashful.x10sys.com> References: <1161571843.29146.564.camel@bashful.x10sys.com> Message-ID: On Oct 22, 2006, at 7:50 PM, Reid Spencer wrote: > Attached is a patch to implement splitting the signless DIV > instruction > into UDiv (unsigned), SDiv (signed), and FDiv (floating point) > instructions. This is part of the Signless Types work I'm doing. Overall, this patch looks like a great first step, but it has significant flaws. In particular, the patch seems unable to produce a [su]div instruction with operands of the opposite sign from that of the instruction. Further, handling of this (very important) case is seriously buggy in many cases. I strongly recommend adding a transformation to instcombine that will produce more divs with such operands. For example, changing something like: %X = cast uint %A to int %Y = sdiv int %X, 1234 %Z = cast int %Y to uint into: %Z = sdiv uint %A, 1234 Fortunately, instcombine already does this for other operations (mul/ add/and/or/xor, etc) at line 5658 of Instcombine in CVS. Please add a case there for UDIV/SDIV. This will hopefully help flush out bugs in the patch that I didn't catch. When you get the comments in this email address and things retested, please resend the patch for review. Comments preceded with ***'s --- include/llvm/Instruction.def 8 Apr 2006 01:15:18 -0000 1.19 +++ include/llvm/Instruction.def 23 Oct 2006 02:43:18 -0000 @@ -88,52 +88,50 @@ HANDLE_TERM_INST ( 5, Unwind , Unwi ... *** Why not reserve some space for all the new instructions you plan to add? That way the CVS bc format won't be changing as much. -HANDLE_BINARY_INST( 7, Add , BinaryOperator) -HANDLE_BINARY_INST( 8, Sub , BinaryOperator) -HANDLE_BINARY_INST( 9, Mul , BinaryOperator) +HANDLE_BINARY_INST( 7, Add , BinaryOperator) +HANDLE_BINARY_INST( 8, Sub , BinaryOperator) +HANDLE_BINARY_INST( 9, Mul , BinaryOperator) *** Why remove the space? --- lib/Analysis/ScalarEvolution.cpp 20 Oct 2006 07:07:24 -0000 1.54 +++ lib/Analysis/ScalarEvolution.cpp 23 Oct 2006 02:43:20 -0000 @@ -1382,12 +1382,12 @@ SCEVHandle ScalarEvolutionsImpl::createS return SCEVAddExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); case Instruction::Mul: return SCEVMulExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); - case Instruction::Div: - if (V->getType()->isInteger() && V->getType()->isSigned()) + case Instruction::SDiv: + if (V->getType()->isInteger()) return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); break; *** No need to check for isInteger anymore. =================================================================== RCS file: /var/cvs/llvm/llvm/lib/AsmParser/llvmAsmParser.y,v retrieving revision 1.269 diff -t -d -u -p -5 -r1.269 llvmAsmParser.y --- lib/AsmParser/llvmAsmParser.y 22 Oct 2006 07:03:09 -0000 1.269 +++ lib/AsmParser/llvmAsmParser.y 23 Oct 2006 02:43:24 -0000 @@ -811,10 +811,41 @@ static PATypeHolder HandleUpRefs(const T +// This template function is used to obtain the correct opcode for an +// instruction when an obsolete opcode is encountered. The OpcodeInfo template +// keeps track of the opcode and the "obsolete" flag. These are generated by +// the lexer and obsolete will be true when the lexer encounters the token for +// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +// to maintain backwards compatibility for asm files that still have the "div" +// instruction. This function handles converting div -> [usf]div appropriately. +template +static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { + if (OI.obsolete) { + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + case Instruction::SDiv: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isUnsigned()) + OI.opcode = Instruction::UDiv; + break; ... *** I like your approach. I don't think sanitizeOpCode should be a template though. This specific one only works for binops, because that is what enum values it has. I'd just have one function for each class of upgraded op, no templates. Also, the lexer can't return an "obsolete sdiv", it appears to only return udiv, so the sdiv case above seems dead. Am I missing something? Finally, the code would be simpler if you started it as "if (!OI.obsolete) return;" Index: lib/Bytecode/Reader/Reader.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Reader/Reader.cpp,v retrieving revision 1.199 diff -t -d -u -p -5 -r1.199 Reader.cpp --- lib/Bytecode/Reader/Reader.cpp 20 Oct 2006 07:07:24 -0000 1.199 +++ lib/Bytecode/Reader/Reader.cpp 23 Oct 2006 02:43:26 -0000 @@ -560,10 +560,239 @@ void BytecodeReader::insertArguments(Fun ... + // Declare the resulting instruction we might build. + Instruction *Result = 0; + + // If this is a bytecode format that did not include the unreachable + // instruction, bump up the opcode number to adjust + if (hasNoUnreachableInst) { + if (Opcode >= Instruction::Unreachable && + Opcode < 62) { // 62 + ++Opcode; + } + } + + // First, short circuit this if no conversion is required. When signless + // instructions were implemented the entire opcode sequence was revised so + // we key on this first which means that the opcode value read is the one + // we should use. + if (!hasSignlessInstructions) + return Result; *** If hasSignlessInstructions is true, hasNoUnreachableInst is false, right? If so, move the fast path above the hasNoUnreachableInst check? It would be more clear to return 0 here explicitly and mention in the method comment that this returns null if no upgrading is needed. +// Upgrade obsolte constant expression opcodes (ver. 5 and prior) to the new *** Typo obsolete. + // need to note that we have signed integer types in prior versions. + hasSignedIntegers = true; + + // FALL THROUGH + + case 6: // SignlessTypes Implementation (1.10 release) *** 1.9? Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/CodeGen/SelectionDAG/ SelectionDAGISel.cpp,v retrieving revision 1.294 diff -t -d -u -p -5 -r1.294 SelectionDAGISel.cpp --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 22 Oct 2006 23:00:53 -0000 1.294 +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 23 Oct 2006 02:43:28 -0000 +void +SelectionDAGLowering::visitIntBinary(User &I, unsigned IntOp, unsigned VecOp) { const Type *Ty = I.getType(); SDOperand Op1 = getValue(I.getOperand(0)); SDOperand Op2 = getValue(I.getOperand(1)); if (Ty->isIntegral()) { setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); - } else if (Ty->isFloatingPoint()) { + } else { + const PackedType *PTy = cast(Ty); + SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); + SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy- >getElementType())); + setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, Typ)); + } +} *** In visitIntBinary/visitFPBinary please change the condition to "if (const PackedType *PTy = dyn_cast(Ty)) {", swapping the order of the if conditions. Checking "isIntegral" is a non- obvious way to check that it's not a vector type (your code is correct, just not obvious what it does). --- lib/ExecutionEngine/Interpreter/Execution.cpp 20 Oct 2006 07:07:24 -0000 1.140 +++ lib/ExecutionEngine/Interpreter/Execution.cpp 23 Oct 2006 02:43:29 -0000 @@ -87,11 +87,13 @@ GenericValue Interpreter::getConstantExp CE->getOperand(0)->getType()); case Instruction::Mul: return executeMulInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); - case Instruction::Div: + case Instruction::SDiv: + case Instruction::UDiv: + case Instruction::FDiv: return executeDivInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); case Instruction::Rem: return executeRemInst(getOperandValue(CE->getOperand(0), SF), @@ -502,11 +504,13 @@ void Interpreter::visitBinaryOperator(Bi switch (I.getOpcode()) { case Instruction::Add: R = executeAddInst (Src1, Src2, Ty); break; case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty); break; case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty); break; - case Instruction::Div: R = executeDivInst (Src1, Src2, Ty); break; + case Instruction::SDiv: + case Instruction::UDiv: + case Instruction::FDiv: R = executeDivInst (Src1, Src2, Ty); break; case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty); break; case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break; case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break; case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); break; case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty); break; *** This is flat out incorrect. It should have separate execute*DivInst functions that do the operation not based on the type. This would misinterpret 'udiv int -4, 2' for example. This must be fixed before you checkin. --- lib/Target/CBackend/Writer.cpp 22 Oct 2006 09:58:21 -0000 1.274 +++ lib/Target/CBackend/Writer.cpp 23 Oct 2006 02:43:30 -0000 @@ -584,11 +584,13 @@ void CWriter::printConstant(Constant *CP @@ -603,11 +605,13 @@ void CWriter::printConstant(Constant *CP printConstant(CE->getOperand(0)); switch (CE->getOpcode()) { case Instruction::Add: Out << " + "; break; case Instruction::Sub: Out << " - "; break; case Instruction::Mul: Out << " * "; break; - case Instruction::Div: Out << " / "; break; + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: Out << " / "; break; case Instruction::Rem: Out << " % "; break; case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; case Instruction::Xor: Out << " ^ "; break; case Instruction::SetEQ: Out << " == "; break; *** The CBE has the same problem. You need to force the operands to the right sign in the C output so that the C compiler will generate the appropriately signed operation. This must be fixed before you checkin. --- lib/Transforms/IPO/SimplifyLibCalls.cpp 20 Oct 2006 07:07:24 -0000 1.70 +++ lib/Transforms/IPO/SimplifyLibCalls.cpp 23 Oct 2006 02:43:30 -0000 @@ -1273,11 +1273,11 @@ public: ci->replaceAllUsesWith(base); ci->eraseFromParent(); return true; } else if (Op2V == -1.0) { // pow(x,-1.0) -> 1.0/x - BinaryOperator* div_inst= BinaryOperator::createDiv( + BinaryOperator* div_inst= BinaryOperator::createSDiv( ConstantFP::get(Ty,1.0), base, ci->getName()+".pow", ci); ci->replaceAllUsesWith(div_inst); ci->eraseFromParent(); return true; } *** Shouldn't this be fdiv? Please fix before you checkin, and add a regression test. Index: lib/Transforms/Scalar/InstructionCombining.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/ InstructionCombining.cpp,v retrieving revision 1.527 diff -t -d -u -p -5 -r1.527 InstructionCombining.cpp --- lib/Transforms/Scalar/InstructionCombining.cpp 20 Oct 2006 18:20:21 -0000 1.527 +++ lib/Transforms/Scalar/InstructionCombining.cpp 23 Oct 2006 02:43:34 -0000 @@ -1973,15 +1979,15 @@ Instruction *InstCombiner::visitSub(Bina InsertNewInstBefore(BinaryOperator::createNot(OtherOp, "B.not"), I); return BinaryOperator::createAnd(Op0, NewNot); } // 0 - (X sdiv C) -> (X sdiv -C) - if (Op1I->getOpcode() == Instruction::Div) + if (Op1I->getOpcode() == Instruction::SDiv) if (ConstantInt *CSI = dyn_cast(Op0)) if (CSI->getType()->isSigned() && CSI->isNullValue()) if (Constant *DivRHS = dyn_cast(Op1I- >getOperand(1))) - return BinaryOperator::createDiv(Op1I->getOperand(0), + return BinaryOperator::createSDiv(Op1I->getOperand(0), ConstantExpr::getNeg (DivRHS)); *** You should be able to drop the 'CSI->getType()->isSigned()' check. + // (X / C1) / C2 -> X / (C1*C2) if (Instruction *LHS = dyn_cast(Op0)) - if (LHS->getOpcode() == Instruction::Div) + if (LHS->getOpcode() == Instruction::SDiv || + LHS->getOpcode()==Instruction::UDiv || + LHS->getOpcode()==Instruction::FDiv) *** This isn't quite right. This will miscompile ((X sdiv C1) udiv C2). You want something like: // (X / C1) / C2 -> X / (C1*C2) if (Instruction *LHS = dyn_cast(Op0)) if (LHS->getOpcode() == I.getOpcode()) which is also simpler. if (ConstantInt *LHSRHS = dyn_cast(LHS- >getOperand(1))) { - // (X / C1) / C2 -> X / (C1*C2) - return BinaryOperator::createDiv(LHS->getOperand(0), - ConstantExpr::getMul(RHS, LHSRHS)); + return BinaryOperator::create( + Instruction::BinaryOps(LHS->getOpcode()), LHS->getOperand (0), + ConstantExpr::getMul(RHS, LHSRHS)); } *** If you use I.getOpcode(), you can drop the BinaryOps cast. *** Why not have commonIDivTransforms call commonDivTransforms? It would be nicer to just have: + if (Instruction *Common = commonIDivTransforms(I)) + return Common; Also, please try to stick with the established style when modifying existing code. In this case, putting the '*' in the right place, capitalizing variables, etc. + // Check to see if this is an unsigned division with an exact power of 2, + // if so, convert to a right shift. + // X udiv C^2 -> X >> C + if (ConstantInt *C = dyn_cast(Op1)) { + if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 + if (isPowerOf2_64(Val)) { + uint64_t C = Log2_64(Val); + return new ShiftInst(Instruction::Shr, Op0, + ConstantInt::get(Type::UByteTy, C)); + } + } *** This will assert and die on something like 'udiv int %C, 64'. You need to insert casts of the input value and of the output result if the operands/result is signed. This specific issue goes away when shifts are split up. + if (Instruction *RHSI = dyn_cast(I.getOperand(1))) { + // Turn A / (C1 << N), where C1 is "1<> (N+C2) [udiv only]. + if (RHSI->getOpcode() == Instruction::Shl && + isa(RHSI->getOperand(0)) && + RHSI->getOperand(0)->getType()->isUnsigned()) { + uint64_t C1 = cast(RHSI->getOperand(0))- >getZExtValue(); + if (isPowerOf2_64(C1)) { + uint64_t C2 = Log2_64(C1); + Value *Add = RHSI->getOperand(1); + if (C2) { + Constant *C2V = ConstantInt::get(Add->getType(), C2); + Add = InsertNewInstBefore(BinaryOperator::createAdd(Add, C2V, + "tmp"), I); } + return new ShiftInst(Instruction::Shr, Op0, Add); } } } *** This code doesn't need to check 'RHSI->getOperand(0)->getType()- >isUnsigned()', but that will make you have to handle the signed case right (inserting casts). + // If the sign bits of both operands are zero (i.e. we can prove they are + // unsigned inputs), turn this into a udiv. + uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); + if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { + const Type *NTy = Op0->getType()->getUnsignedVersion(); + Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); + InsertNewInstBefore(LHS, I); + Value *RHS; + if (Constant *R = dyn_cast(Op1)) + RHS = ConstantExpr::getCast(R, NTy); + else + RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName ()), I); + Instruction *Div = BinaryOperator::createUDiv(LHS, RHS, I.getName ()); + InsertNewInstBefore(Div, I); + return new CastInst(Div, I.getType()); + } *** This code gets much simpler now. Try: uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) return BinaryOperator::createUDiv(LHS, RHS, I.getName()); The cast sequence *is* needed for converting stuff to shifts etc, above. + // Handle div X, Cond?Y:Z + if (SelectInst *SI = dyn_cast(Op1)) { + // div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select are in the + // same basic block, then we replace the select with Y, and the condition of + // the select with false (if the cond value is in the same BB). If the + // select has uses other than the div, this allows them to be simplified + // also. + if (Constant *ST = dyn_cast(SI->getOperand(1))) + if (ST->isNullValue()) { + Instruction *CondI = dyn_cast(SI->getOperand(0)); + if (CondI && CondI->getParent() == I.getParent()) + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) + I.setOperand(1, SI->getOperand(2)); + else + UpdateValueUsesWith(SI, SI->getOperand(2)); + return &I; + } + + // Likewise for: div X, (Cond ? Y : 0) -> div X, Y + if (Constant *ST = dyn_cast(SI->getOperand(2))) + if (ST->isNullValue()) { + Instruction *CondI = dyn_cast(SI->getOperand(0)); + if (CondI && CondI->getParent() == I.getParent()) + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) + I.setOperand(1, SI->getOperand(1)); + else + UpdateValueUsesWith(SI, SI->getOperand(1)); + return &I; + } + } *** This sequence should be in commonDivTransforms, no? You have cloned this code in commonIDivTransforms, please merge the two copies. Another significant issue not obvious from your diff is that you left this hunk of code: // If this is 'udiv X, (Cond ? C1, C2)' where C1&C2 are powers of two, // transform this into: '(Cond ? (udiv X, C1) : (udiv X, C2))'. if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) if (STO->getType()->isUnsigned() && SFO->getType()- >isUnsigned()) { // STO == 0 and SFO == 0 handled above. uint64_t TVA = STO->getZExtValue(), FVA = SFO->getZExtValue (); if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); Constant *TC = ConstantInt::get(Type::UByteTy, TSA); Instruction *TSI = new ShiftInst(Instruction::Shr, Op0, TC, SI->getName()+".t"); TSI = InsertNewInstBefore(TSI, I); Constant *FC = ConstantInt::get(Type::UByteTy, FSA); Instruction *FSI = new ShiftInst(Instruction::Shr, Op0, FC, SI->getName()+".f"); FSI = InsertNewInstBefore(FSI, I); return new SelectInst(SI->getOperand(0), TSI, FSI); } } in the commonIDivTransforms method, but it is specific to udiv. Please move it to the udiv case, and make it insert casts etc as needed. @@ -3720,11 +3803,13 @@ Instruction *InstCombiner::visitXor(Bina /// MulWithOverflow - Compute Result = In1*In2, returning true if the result /// overflowed for this type. static bool MulWithOverflow(ConstantInt *&Result, ConstantInt *In1, ConstantInt *In2) { Result = cast(ConstantExpr::getMul(In1, In2)); - return !In2->isNullValue() && ConstantExpr::getDiv(Result, In2) != In1; + return !In2->isNullValue() && (In2->getType()->isSigned() ? + ConstantExpr::getSDiv(Result, In2) : + ConstantExpr::getUDiv(Result, In2)) != In1; } static bool isPositive(ConstantInt *C) { return C->getSExtValue() >= 0; } *** This is subtly buggy. If you look at how MulWithOverflow is used, it is called from the "Fold: (div X, C1) op C2 -> range check" case. You need to pass in whether or not the *operation* is signed or unsigned, ignoring the sign of the values. @@ -4377,11 +4462,12 @@ Instruction *InstCombiner::visitSetCondI } } } break; - case Instruction::Div: + case Instruction::SDiv: + case Instruction::UDiv: // Fold: (div X, C1) op C2 -> range check if (ConstantInt *DivRHS = dyn_cast(LHSI- >getOperand(1))) { // Fold this div into the comparison, producing a range check. // Determine, based on the divide type, what the range is being // checked. If there is an overflow on the low or high side, remember *** Likewise, this is extremely buggy. The original code uses knowledge of the signedness of the operands to determine the signedness of the comparisons it makes. For example, the code (which your diff doesn't include) has stuff like: } else if (LHSI->getType()->isUnsigned()) { // udiv LoBound = Prod; LoOverflow = ProdOV; HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, DivRHS); ... this is looking at the type of the operands, not the operation code, this *must* be fixed. Later it has: else if (HiOverflow) return new SetCondInst(Instruction::SetGE, X, LoBound); else if (LoOverflow) return new SetCondInst(Instruction::SetLT, X, HiBound); These create signed/unsigned comparisons where the sign matched the sign of the operator, because they follow the sign of the operands. This needs to be fixed to cast the operands to be the same sign as the sign of the opcode. =================================================================== RCS file: /var/cvs/llvm/llvm/lib/VMCore/ConstantFolding.cpp,v retrieving revision 1.94 diff -t -d -u -p -5 -r1.94 ConstantFolding.cpp --- lib/VMCore/ConstantFolding.cpp 20 Oct 2006 07:07:24 -0000 1.94 +++ lib/VMCore/ConstantFolding.cpp 23 Oct 2006 02:43:35 -0000 @@ -491,20 +507,32 @@ struct VISIBILITY_HIDDEN DirectIntRules DEF_CAST(ULong , ConstantInt, uint64_t) DEF_CAST(Float , ConstantFP , float) DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST - static Constant *Div(const ConstantInt *V1, const ConstantInt *V2) { - if (V2->isNullValue()) return 0; + static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) { + if (V2->isNullValue()) + return 0; if (V2->isAllOnesValue() && // MIN_INT / -1 (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1- >getZExtValue()) return 0; BuiltinType R = (BuiltinType)V1->getZExtValue() / (BuiltinType)V2- >getZExtValue(); return ConstantInt::get(*Ty, R); } + static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) { + if (V2->isNullValue()) + return 0; + if (V2->isAllOnesValue() && // MIN_INT / -1 + (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1- >getSExtValue()) + return 0; + BuiltinType R = + (BuiltinType)V1->getSExtValue() / (BuiltinType)V2->getSExtValue (); + return ConstantInt::get(*Ty, R); + } + You properly sign/zero extend the values here, but then proceed to do the wrong division. For example, this will do signed division for 'udiv int -2, 2'. What does the -constfold pass produce for: int %test() { %X = udiv int -2, 2 ret int %X } I bet it is folded to -1, which is incorrect. =================================================================== RCS file: /var/cvs/llvm/llvm/lib/VMCore/Constants.cpp,v retrieving revision 1.165 diff -t -d -u -p -5 -r1.165 Constants.cpp --- lib/VMCore/Constants.cpp 20 Oct 2006 07:07:24 -0000 1.165 +++ lib/VMCore/Constants.cpp 23 Oct 2006 02:43:36 -0000 .. @@ -444,12 +446,18 @@ Constant *ConstantExpr::getSub(Constant return get(Instruction::Sub, C1, C2); } Constant *ConstantExpr::getMul(Constant *C1, Constant *C2) { return get(Instruction::Mul, C1, C2); } -Constant *ConstantExpr::getDiv(Constant *C1, Constant *C2) { - return get(Instruction::Div, C1, C2); +Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2) { + return get(Instruction::UDiv, C1, C2); +} +Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) { + return get(Instruction::SDiv, C1, C2); +} +Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { + return get(Instruction::FDiv, C1, C2); } Constant *ConstantExpr::getRem(Constant *C1, Constant *C2) { return get(Instruction::Rem, C1, C2); } Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) { *** This would be an excellent place to assert that the arguments are integer or fp (or vectors of) as appropriate. =================================================================== RCS file: /var/cvs/llvm/llvm/lib/VMCore/Instructions.cpp,v retrieving revision 1.43 diff -t -d -u -p -5 -r1.43 Instructions.cpp --- lib/VMCore/Instructions.cpp 20 Oct 2006 07:07:24 -0000 1.43 +++ lib/VMCore/Instructions.cpp 23 Oct 2006 02:43:36 -0000 @@ -1020,11 +1020,11 @@ void BinaryOperator::init(BinaryOps iTyp assert(LHS->getType() == RHS->getType() && "Binary operator operand types must match!"); #ifndef NDEBUG switch (iType) { case Add: case Sub: - case Mul: case Div: + case Mul: case UDiv: case SDiv: case FDiv: case Rem: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); assert((getType()->isInteger() || getType()->isFloatingPoint() || isa(getType())) && *** Likewise, this would be a good place to assert that the operands are int/fp(or vectors of) as appropriate. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061023/5f225fa0/attachment.html From clattner at apple.com Tue Oct 24 00:57:39 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 23 Oct 2006 22:57:39 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review In-Reply-To: References: <1161571843.29146.564.camel@bashful.x10sys.com> Message-ID: n Oct 23, 2006, at 10:52 PM, Chris Lattner wrote: > On Oct 22, 2006, at 7:50 PM, Reid Spencer wrote: > >> Attached is a patch to implement splitting the signless DIV >> instruction >> into UDiv (unsigned), SDiv (signed), and FDiv (floating point) >> instructions. This is part of the Signless Types work I'm doing. > > Overall, this patch looks like a great first step Crap, that was obviously supposed to just go to Reid. :( -Chris From sabre at nondot.org Tue Oct 24 01:26:22 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 01:26:22 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll Message-ID: <200610240626.k9O6QMZx018138@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ScalarRepl: 2006-10-23-PointerUnionCrash.ll added (r1.1) --- Log message: New testcase that crashes scalarrepl --- Diffs of the changes: (+75 -0) 2006-10-23-PointerUnionCrash.ll | 75 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+) Index: llvm/test/Regression/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll diff -c /dev/null llvm/test/Regression/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll:1.1 *** /dev/null Tue Oct 24 01:26:18 2006 --- llvm/test/Regression/Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll Tue Oct 24 01:26:08 2006 *************** *** 0 **** --- 1,75 ---- + ; RUN: llvm-as < %s | opt -scalarrepl -disable-output + + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-apple-darwin8.7.2" + + implementation ; Functions: + + void %glgProcessColor() { + entry: + %source_ptr = alloca sbyte*, align 4 ; [#uses=2] + br bool false, label %bb1357, label %cond_next583 + + cond_next583: ; preds = %entry + ret void + + bb1357: ; preds = %entry + br bool false, label %bb1365, label %bb27055 + + bb1365: ; preds = %bb1357 + switch uint 0, label %cond_next10377 [ + uint 0, label %bb4679 + uint 1, label %bb4679 + uint 2, label %bb4679 + uint 3, label %bb4679 + uint 4, label %bb5115 + uint 5, label %bb6651 + uint 6, label %bb7147 + uint 7, label %bb8683 + uint 8, label %bb9131 + uint 9, label %bb9875 + uint 10, label %bb4679 + uint 11, label %bb4859 + uint 12, label %bb4679 + uint 16, label %bb10249 + ] + + bb4679: ; preds = %bb1365, %bb1365, %bb1365, %bb1365, %bb1365, %bb1365 + ret void + + bb4859: ; preds = %bb1365 + ret void + + bb5115: ; preds = %bb1365 + ret void + + bb6651: ; preds = %bb1365 + ret void + + bb7147: ; preds = %bb1365 + ret void + + bb8683: ; preds = %bb1365 + ret void + + bb9131: ; preds = %bb1365 + ret void + + bb9875: ; preds = %bb1365 + %source_ptr9884 = cast sbyte** %source_ptr to ubyte** ; [#uses=1] + %tmp9885 = load ubyte** %source_ptr9884 ; [#uses=0] + ret void + + bb10249: ; preds = %bb1365 + %source_ptr10257 = cast sbyte** %source_ptr to ushort** ; [#uses=1] + %tmp10258 = load ushort** %source_ptr10257 ; [#uses=0] + ret void + + cond_next10377: ; preds = %bb1365 + ret void + + bb27055: ; preds = %bb1357 + ret void + } From sabre at nondot.org Tue Oct 24 01:26:46 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 01:26:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200610240626.k9O6QkKJ018172@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.45 -> 1.46 --- Log message: Fix Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll --- Diffs of the changes: (+10 -5) ScalarReplAggregates.cpp | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.45 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.46 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.45 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Oct 24 01:26:32 2006 @@ -611,11 +611,16 @@ NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), "tmp", LI); } else { - assert(NV->getType()->isInteger() && "Unknown promotion!"); - if (Offset && Offset < TD.getTypeSize(NV->getType())*8) - NV = new ShiftInst(Instruction::Shr, NV, - ConstantInt::get(Type::UByteTy, Offset), - LI->getName(), LI); + if (Offset) { + assert(NV->getType()->isInteger() && "Unknown promotion!"); + if (Offset < TD.getTypeSize(NV->getType())*8) + NV = new ShiftInst(Instruction::Shr, NV, + ConstantInt::get(Type::UByteTy, Offset), + LI->getName(), LI); + } else { + assert((NV->getType()->isInteger() || + isa(NV->getType())) && "Unknown promotion!"); + } NV = new CastInst(NV, LI->getType(), LI->getName(), LI); } } From jlaskey at apple.com Tue Oct 24 06:50:59 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 24 Oct 2006 06:50:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineDebugInfo.cpp Message-ID: <200610241150.k9OBoxKL032607@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.84 -> 1.85 MachineDebugInfo.cpp updated: 1.52 -> 1.53 --- Log message: Tighter data structure for deleted debug labels. --- Diffs of the changes: (+20 -4) DwarfWriter.cpp | 3 +-- MachineDebugInfo.cpp | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.84 llvm/lib/CodeGen/DwarfWriter.cpp:1.85 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.84 Mon Oct 23 09:56:37 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Oct 24 06:50:43 2006 @@ -2207,8 +2207,7 @@ const SourceLineInfo &LineInfo = LineInfos[i]; unsigned LabelID = LineInfo.getLabelID(); - // Throw out line info if label is invalid. - if (!DebugInfo->isLabelValid(LabelID)) continue; + // Source line labels are validated at the MachineDebugInfo level. if (DwarfVerbose) { unsigned SourceID = LineInfo.getSourceID(); Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.52 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.53 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.52 Mon Oct 23 09:56:37 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Tue Oct 24 06:50:43 2006 @@ -1544,16 +1544,33 @@ return ID; } +static bool LabelUIDComparison(const SourceLineInfo &LI, unsigned UID) { + return LI.getLabelID() < UID; +} + /// InvalidateLabel - Inhibit use of the specified label # from /// MachineDebugInfo, for example because the code was deleted. void MachineDebugInfo::InvalidateLabel(unsigned LabelID) { - DeletedLabelIDs.insert(LabelID); + // Check source line list first. SourceLineInfo is sorted by LabelID. + std::vector::iterator I = + std::lower_bound(Lines.begin(), Lines.end(), LabelID, LabelUIDComparison); + if (I != Lines.end() && I->getLabelID() == LabelID) { + Lines.erase(I); + return; + } + + // Otherwise add for use by isLabelValid. + std::vector::iterator J = + std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID); + DeletedLabelIDs.insert(J, LabelID); } /// isLabelValid - Check to make sure the label is still valid before /// attempting to use. bool MachineDebugInfo::isLabelValid(unsigned LabelID) { - return DeletedLabelIDs.find(LabelID) == DeletedLabelIDs.end(); + std::vector::iterator I = + std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID); + return I != DeletedLabelIDs.end() && *I == LabelID; } /// RecordSource - Register a source file with debug info. Returns an source From jlaskey at apple.com Tue Oct 24 06:50:58 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 24 Oct 2006 06:50:58 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Message-ID: <200610241150.k9OBowgl032600@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.43 -> 1.44 --- Log message: Tighter data structure for deleted debug labels. --- Diffs of the changes: (+2 -4) MachineDebugInfo.h | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.43 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.43 Mon Oct 23 09:56:37 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Tue Oct 24 06:50:43 2006 @@ -30,8 +30,6 @@ #ifndef LLVM_CODEGEN_MACHINEDEBUGINFO_H #define LLVM_CODEGEN_MACHINEDEBUGINFO_H -#include - #include "llvm/Support/Dwarf.h" #include "llvm/Support/DataTypes.h" #include "llvm/ADT/UniqueVector.h" @@ -981,9 +979,9 @@ // DebugScope *RootScope; - // DeletedLabelIDs - List of label IDs that have been removed from the + // DeletedLabelIDs - Sorted list of label IDs that have been removed from the // module. - std::set DeletedLabelIDs; + std::vector DeletedLabelIDs; // FrameMoves - List of moves done by a function's prolog. Used to construct // frame maps by debug consumers. From jlaskey at apple.com Tue Oct 24 09:35:39 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 24 Oct 2006 09:35:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200610241435.k9OEZdeQ002836@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.128 -> 1.129 --- Log message: LinearScanner hotspot. --- Diffs of the changes: (+2 -3) RegAllocLinearScan.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.128 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.128 Sun Aug 27 07:54:01 2006 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Oct 24 09:35:25 2006 @@ -460,11 +460,10 @@ bool ConflictsWithFixed = false; for (unsigned i = 0, e = fixed_.size(); i != e; ++i) { - if (physReg == fixed_[i].first->reg || - RegAliases.count(fixed_[i].first->reg)) { + IntervalPtr &IP = fixed_[i]; + if (physReg == IP.first->reg || RegAliases.count(IP.first->reg)) { // Okay, this reg is on the fixed list. Check to see if we actually // conflict. - IntervalPtr &IP = fixed_[i]; LiveInterval *I = IP.first; if (I->endNumber() > StartPosition) { LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition); From rafael.espindola at gmail.com Tue Oct 24 09:47:42 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 09:47:42 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200610241447.k9OElge5003075@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.96 -> 1.97 --- Log message: fix assert comment --- Diffs of the changes: (+1 -1) TargetInstrInfo.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.96 llvm/include/llvm/Target/TargetInstrInfo.h:1.97 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.96 Tue Oct 17 17:39:05 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Tue Oct 24 09:47:28 2006 @@ -314,7 +314,7 @@ virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const std::vector &Cond) const { - assert(0 && "Target didn't implement TargetInstrInfo::RemoveBranch!"); + assert(0 && "Target didn't implement TargetInstrInfo::InsertBranch!"); } /// ReverseBranchCondition - Reverses the branch condition of the specified From jlaskey at apple.com Tue Oct 24 11:12:03 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 24 Oct 2006 11:12:03 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LLVMTargetMachine.cpp Message-ID: <200610241612.k9OGC3ON004762@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LLVMTargetMachine.cpp updated: 1.3 -> 1.4 --- Log message: Don't do dead block elimination in fast mode. --- Diffs of the changes: (+2 -1) LLVMTargetMachine.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/LLVMTargetMachine.cpp diff -u llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.3 llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.4 --- llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.3 Fri Oct 13 15:45:56 2006 +++ llvm/lib/CodeGen/LLVMTargetMachine.cpp Tue Oct 24 11:11:49 2006 @@ -64,7 +64,8 @@ PM.add(createPrologEpilogCodeInserter()); // Branch folding must be run after regalloc and prolog/epilog insertion. - PM.add(createBranchFoldingPass()); + if (!Fast) + PM.add(createBranchFoldingPass()); if (PrintMachineCode) // Print the register-allocated code PM.add(createMachineFunctionPrinterPass(&std::cerr)); From sabre at nondot.org Tue Oct 24 11:13:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 11:13:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200610241613.k9OGD1tm004802@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.42 -> 1.43 --- Log message: new bad case --- Diffs of the changes: (+19 -0) README.txt | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.42 llvm/lib/Target/README.txt:1.43 --- llvm/lib/Target/README.txt:1.42 Thu Sep 28 01:01:17 2006 +++ llvm/lib/Target/README.txt Tue Oct 24 11:12:47 2006 @@ -300,3 +300,22 @@ } //===---------------------------------------------------------------------===// + +-scalarrepl should promote this to be a vector scalar. + + %struct..0anon = type { <4 x float> } +implementation ; Functions: +void %test1(<4 x float> %V, float* %P) { +entry: + %u = alloca %struct..0anon, align 16 ; <%struct..0anon*> [#uses=2] + %tmp = getelementptr %struct..0anon* %u, int 0, uint 0 ; <<4 x float>*> [#uses=1] + store <4 x float> %V, <4 x float>* %tmp + %tmp1 = cast %struct..0anon* %u to [4 x float]* ; <[4 x float]*> [#uses=1] + %tmp = getelementptr [4 x float]* %tmp1, int 0, int 1 ; [#uses=1] + %tmp = load float* %tmp ; [#uses=1] + %tmp3 = mul float %tmp, 2.000000e+00 ; [#uses=1] + store float %tmp3, float* %P + ret void +} + +//===---------------------------------------------------------------------===// From sabre at nondot.org Tue Oct 24 11:39:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 11:39:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.cpp SparcInstrInfo.h Message-ID: <200610241639.k9OGdXQI005266@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrInfo.cpp updated: 1.13 -> 1.14 SparcInstrInfo.h updated: 1.9 -> 1.10 --- Log message: implement uncond branch insertion for sparc to fix regressions from last night due to branchfolding --- Diffs of the changes: (+13 -0) SparcInstrInfo.cpp | 8 ++++++++ SparcInstrInfo.h | 5 +++++ 2 files changed, 13 insertions(+) Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.13 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.14 --- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.13 Sat Feb 4 23:50:24 2006 +++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp Tue Oct 24 11:39:19 2006 @@ -96,3 +96,11 @@ } return 0; } + +void SparcInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond)const{ + // Can only insert uncond branches so far. + assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); + BuildMI(&MBB, SP::BA, 1).addMBB(TBB); +} \ No newline at end of file Index: llvm/lib/Target/Sparc/SparcInstrInfo.h diff -u llvm/lib/Target/Sparc/SparcInstrInfo.h:1.9 llvm/lib/Target/Sparc/SparcInstrInfo.h:1.10 --- llvm/lib/Target/Sparc/SparcInstrInfo.h:1.9 Wed May 24 12:04:04 2006 +++ llvm/lib/Target/Sparc/SparcInstrInfo.h Tue Oct 24 11:39:19 2006 @@ -61,6 +61,11 @@ /// not, return 0. This predicate must return 0 if the instruction has /// any side effects other than storing to the stack slot. virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; + + + virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond) const; }; } From sabre at nondot.org Tue Oct 24 11:41:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 11:41:50 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp AlphaInstrInfo.h Message-ID: <200610241641.k9OGfolH005334@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.cpp updated: 1.9 -> 1.10 AlphaInstrInfo.h updated: 1.5 -> 1.6 --- Log message: implement uncond branch insertion so alpha works work branchfolding. --- Diffs of the changes: (+11 -0) AlphaInstrInfo.cpp | 7 +++++++ AlphaInstrInfo.h | 4 ++++ 2 files changed, 11 insertions(+) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.9 llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.10 --- llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.9 Thu Mar 9 12:18:51 2006 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.cpp Tue Oct 24 11:41:36 2006 @@ -83,3 +83,10 @@ return 0; } +void AlphaInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond)const{ + // Can only insert uncond branches so far. + assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); + BuildMI(&MBB, Alpha::BR, 1).addMBB(TBB); +} \ No newline at end of file Index: llvm/lib/Target/Alpha/AlphaInstrInfo.h diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.5 llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.6 --- llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.5 Thu Feb 2 21:07:37 2006 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.h Tue Oct 24 11:41:36 2006 @@ -38,6 +38,10 @@ virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; + + virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond) const; }; } From sabre at nondot.org Tue Oct 24 11:45:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 11:45:10 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64InstrInfo.cpp IA64InstrInfo.h Message-ID: <200610241645.k9OGjAnQ005423@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64InstrInfo.cpp updated: 1.4 -> 1.5 IA64InstrInfo.h updated: 1.2 -> 1.3 --- Log message: implement uncond branch insertion for the branch folding pass --- Diffs of the changes: (+11 -5) IA64InstrInfo.cpp | 7 +++++++ IA64InstrInfo.h | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) Index: llvm/lib/Target/IA64/IA64InstrInfo.cpp diff -u llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.4 llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.5 --- llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.4 Tue Jan 24 20:23:38 2006 +++ llvm/lib/Target/IA64/IA64InstrInfo.cpp Tue Oct 24 11:44:55 2006 @@ -46,3 +46,10 @@ // move instruction } +void IA64InstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond)const { + // Can only insert uncond branches so far. + assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); + BuildMI(&MBB, IA64::BRL_NOTCALL, 1).addMBB(TBB); +} \ No newline at end of file Index: llvm/lib/Target/IA64/IA64InstrInfo.h diff -u llvm/lib/Target/IA64/IA64InstrInfo.h:1.2 llvm/lib/Target/IA64/IA64InstrInfo.h:1.3 --- llvm/lib/Target/IA64/IA64InstrInfo.h:1.2 Thu Apr 21 18:13:11 2005 +++ llvm/lib/Target/IA64/IA64InstrInfo.h Tue Oct 24 11:44:55 2006 @@ -19,11 +19,7 @@ namespace llvm { -/// IA64II - This namespace holds all of the target specific flags that -/// instruction info tracks. -/// FIXME: now gone! - - class IA64InstrInfo : public TargetInstrInfo { +class IA64InstrInfo : public TargetInstrInfo { const IA64RegisterInfo RI; public: IA64InstrInfo(); @@ -41,6 +37,9 @@ virtual bool isMoveInstr(const MachineInstr& MI, unsigned& sourceReg, unsigned& destReg) const; + virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond) const; }; From sabre at nondot.org Tue Oct 24 11:48:12 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 11:48:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.cpp ARMInstrInfo.h ARMInstrInfo.td Message-ID: <200610241648.k9OGmCd9005514@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.cpp updated: 1.7 -> 1.8 ARMInstrInfo.h updated: 1.3 -> 1.4 ARMInstrInfo.td updated: 1.70 -> 1.71 --- Log message: implement uncond branch insertion, mark branches with isBranch. --- Diffs of the changes: (+13 -1) ARMInstrInfo.cpp | 8 ++++++++ ARMInstrInfo.h | 4 ++++ ARMInstrInfo.td | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.cpp diff -u llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.7 llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.8 --- llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.7 Wed Sep 13 07:09:43 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.cpp Tue Oct 24 11:47:57 2006 @@ -48,3 +48,11 @@ } return false; } + +void ARMInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond)const{ + // Can only insert uncond branches so far. + assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); + BuildMI(&MBB, ARM::b, 1).addMBB(TBB); +} \ No newline at end of file Index: llvm/lib/Target/ARM/ARMInstrInfo.h diff -u llvm/lib/Target/ARM/ARMInstrInfo.h:1.3 llvm/lib/Target/ARM/ARMInstrInfo.h:1.4 --- llvm/lib/Target/ARM/ARMInstrInfo.h:1.3 Tue Aug 8 15:35:03 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.h Tue Oct 24 11:47:57 2006 @@ -40,6 +40,10 @@ /// virtual bool isMoveInstr(const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg) const; + + virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + const std::vector &Cond) const; }; } Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.70 llvm/lib/Target/ARM/ARMInstrInfo.td:1.71 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.70 Mon Oct 23 15:34:26 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Tue Oct 24 11:47:57 2006 @@ -227,7 +227,7 @@ def UMULL : IntBinOp<"umull r12,", mulhu>; } -let isTerminator = 1 in { +let isTerminator = 1, isBranch = 1 in { def bcond : InstARM<(ops brtarget:$dst, CCOp:$cc), "b$cc $dst", [(armbr bb:$dst, imm:$cc)]>; From sabre at nondot.org Tue Oct 24 12:03:49 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:03:49 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200610241703.k9OH3n4W005885@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h updated: 1.27 -> 1.28 --- Log message: generalize 'CaseBlock'. It really allows any comparison to be inserted. --- Diffs of the changes: (+7 -8) SelectionDAGISel.h | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.27 llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.28 --- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.27 Sat Oct 14 03:30:53 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Tue Oct 24 12:03:35 2006 @@ -82,20 +82,19 @@ /// SDISel for the code generation of additional basic blocks needed by multi- /// case switch statements. struct CaseBlock { - CaseBlock(ISD::CondCode cc, Value *s, Constant *c, MachineBasicBlock *lhs, - MachineBasicBlock *rhs, MachineBasicBlock *me) : - CC(cc), SwitchV(s), CaseC(c), LHSBB(lhs), RHSBB(rhs), ThisBB(me) {} + CaseBlock(ISD::CondCode cc, Value *cmplhs, Value *cmprhs, + MachineBasicBlock *lhs, MachineBasicBlock *rhs, + MachineBasicBlock *me) : + CC(cc), CmpLHS(cmplhs), CmpRHS(cmprhs), LHSBB(lhs), RHSBB(rhs), ThisBB(me){} // CC - the condition code to use for the case block's setcc node ISD::CondCode CC; - // SwitchV - the value to be switched on, 'foo' in switch(foo) - Value *SwitchV; - // CaseC - the constant the setcc node will compare against SwitchV - Constant *CaseC; + // CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit. + Value *CmpLHS, *CmpRHS; // LHSBB - the block to branch to if the setcc is true MachineBasicBlock *LHSBB; // RHSBB - the block to branch to if the setcc is false MachineBasicBlock *RHSBB; - // ThisBB - the blcok into which to emit the code for the setcc and branches + // ThisBB - the block into which to emit the code for the setcc and branches MachineBasicBlock *ThisBB; }; struct JumpTable { From sabre at nondot.org Tue Oct 24 12:03:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:03:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610241703.k9OH3pEW005890@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.295 -> 1.296 --- Log message: generalize 'CaseBlock'. It really allows any comparison to be inserted. --- Diffs of the changes: (+2 -3) SelectionDAGISel.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.295 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.296 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.295 Mon Oct 23 13:38:22 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct 24 12:03:35 2006 @@ -819,9 +819,8 @@ /// visitSwitchCase - Emits the necessary code to represent a single node in /// the binary search tree resulting from lowering a switch instruction. void SelectionDAGLowering::visitSwitchCase(SelectionDAGISel::CaseBlock &CB) { - SDOperand SwitchOp = getValue(CB.SwitchV); - SDOperand CaseOp = getValue(CB.CaseC); - SDOperand Cond = DAG.getSetCC(MVT::i1, SwitchOp, CaseOp, CB.CC); + SDOperand Cond = DAG.getSetCC(MVT::i1, getValue(CB.CmpLHS), + getValue(CB.CmpRHS), CB.CC); // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. From rafael.espindola at gmail.com Tue Oct 24 12:07:31 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 12:07:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.cpp Message-ID: <200610241707.k9OH7Vk0006023@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcInstrInfo.cpp updated: 1.14 -> 1.15 --- Log message: fix warning about missing newline at end of file --- Diffs of the changes: (+1 -1) SparcInstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.14 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.15 --- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.14 Tue Oct 24 11:39:19 2006 +++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp Tue Oct 24 12:07:11 2006 @@ -103,4 +103,4 @@ // Can only insert uncond branches so far. assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); BuildMI(&MBB, SP::BA, 1).addMBB(TBB); -} \ No newline at end of file +} From rafael.espindola at gmail.com Tue Oct 24 12:07:31 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 12:07:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64InstrInfo.cpp Message-ID: <200610241707.k9OH7Val006018@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64InstrInfo.cpp updated: 1.5 -> 1.6 --- Log message: fix warning about missing newline at end of file --- Diffs of the changes: (+1 -1) IA64InstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/IA64/IA64InstrInfo.cpp diff -u llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.5 llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.6 --- llvm/lib/Target/IA64/IA64InstrInfo.cpp:1.5 Tue Oct 24 11:44:55 2006 +++ llvm/lib/Target/IA64/IA64InstrInfo.cpp Tue Oct 24 12:07:11 2006 @@ -52,4 +52,4 @@ // Can only insert uncond branches so far. assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); BuildMI(&MBB, IA64::BRL_NOTCALL, 1).addMBB(TBB); -} \ No newline at end of file +} From rafael.espindola at gmail.com Tue Oct 24 12:07:29 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 12:07:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp Message-ID: <200610241707.k9OH7TQc006013@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.cpp updated: 1.10 -> 1.11 --- Log message: fix warning about missing newline at end of file --- Diffs of the changes: (+1 -1) AlphaInstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.10 llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.11 --- llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.10 Tue Oct 24 11:41:36 2006 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.cpp Tue Oct 24 12:07:11 2006 @@ -89,4 +89,4 @@ // Can only insert uncond branches so far. assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); BuildMI(&MBB, Alpha::BR, 1).addMBB(TBB); -} \ No newline at end of file +} From sabre at nondot.org Tue Oct 24 12:09:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:09:35 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/IA64/ret-0.ll Message-ID: <200610241709.k9OH9Z7k006132@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/IA64: ret-0.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+5 -0) ret-0.ll | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/test/Regression/CodeGen/IA64/ret-0.ll diff -c /dev/null llvm/test/Regression/CodeGen/IA64/ret-0.ll:1.1 *** /dev/null Tue Oct 24 12:09:30 2006 --- llvm/test/Regression/CodeGen/IA64/ret-0.ll Tue Oct 24 12:09:20 2006 *************** *** 0 **** --- 1,5 ---- + ; RUN: llvm-as < %s | llc -march=ia64 + + double %test() { + ret double 0.0 + } From sabre at nondot.org Tue Oct 24 12:09:58 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:09:58 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp Message-ID: <200610241709.k9OH9wfa006149@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64ISelDAGToDAG.cpp updated: 1.58 -> 1.59 --- Log message: Fix CodeGen/IA64/ret-0.ll, which has apparently been broken since some of the isel changes happened months ago. --- Diffs of the changes: (+6 -2) IA64ISelDAGToDAG.cpp | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp diff -u llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.58 llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.59 --- llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.58 Fri Oct 13 16:14:26 2006 +++ llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp Tue Oct 24 12:09:43 2006 @@ -408,12 +408,16 @@ case ISD::TargetConstantFP: { SDOperand Chain = CurDAG->getEntryNode(); // this is a constant, so.. + SDOperand V; if (cast(N)->isExactlyValue(+0.0)) { - return CurDAG->getCopyFromReg(Chain, IA64::F0, MVT::f64).Val; + V = CurDAG->getCopyFromReg(Chain, IA64::F0, MVT::f64); } else if (cast(N)->isExactlyValue(+1.0)) { - return CurDAG->getCopyFromReg(Chain, IA64::F1, MVT::f64).Val; + V = CurDAG->getCopyFromReg(Chain, IA64::F1, MVT::f64); } else assert(0 && "Unexpected FP constant!"); + + ReplaceUses(SDOperand(N, 0), V); + return 0; } case ISD::FrameIndex: { // TODO: reduce creepyness From rspencer at reidspencer.com Tue Oct 24 12:10:25 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 24 Oct 2006 10:10:25 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review In-Reply-To: References: <1161571843.29146.564.camel@bashful.x10sys.com> Message-ID: <1161709825.6672.59.camel@bashful.x10sys.com> Chris, Thanks for your detailed review. Obviously there's still much I need to learn about InstCombine. I'll try to slow down a bit and review things myself on the next patches. Below are some comments on your comments. I've made all the changes except for InstCombine. That will take a little more thought so I'll follow up on InstCombine separately. On Mon, 2006-10-23 at 22:52 -0700, Chris Lattner wrote: > > On Oct 22, 2006, at 7:50 PM, Reid Spencer wrote: > > > Attached is a patch to implement splitting the signless DIV > > instruction > > into UDiv (unsigned), SDiv (signed), and FDiv (floating point) > > instructions. This is part of the Signless Types work I'm doing. > > Overall, this patch looks like a great first step, but it has > significant flaws. In particular, the patch seems unable to produce a > [su]div instruction with operands of the opposite sign from that of > the instruction. Well, I didn't think it was a requirement. However, I can see why it is because of the pending removal of signedness from types. > Further, handling of this (very important) case is seriously buggy in > many cases. I will look into it. > I strongly recommend adding a transformation to instcombine that will > produce more divs with such operands. For example, changing something > like: > > > %X = cast uint %A to int > %Y = sdiv int %X, 1234 > %Z = cast int %Y to uint > > > into: > > > %Z = sdiv uint %A, 1234 > > > Fortunately, instcombine already does this for other operations > (mul/add/and/or/xor, etc) at line 5658 of Instcombine in CVS. Please > add a case there for UDIV/SDIV. This will hopefully help flush out > bugs in the patch that I didn't catch. My goal is not to add any new functionality and make the smallest change set possible to get existing functionality working with the the new instructions. However, I see your point. This transform could help locate bugs elsewhere. I'll add this transform. > When you get the comments in this email address and things retested, > please resend the patch for review. Okay. > Comments preceded with ***'s > > > --- include/llvm/Instruction.def 8 Apr 2006 01:15:18 -0000 1.19 > +++ include/llvm/Instruction.def 23 Oct 2006 02:43:18 -0000 > @@ -88,52 +88,50 @@ HANDLE_TERM_INST ( 5, Unwind , Unwi > ... > > > *** Why not reserve some space for all the new instructions you plan > to add? That way the CVS bc format won't be changing as much. > > > -HANDLE_BINARY_INST( 7, Add , BinaryOperator) > -HANDLE_BINARY_INST( 8, Sub , BinaryOperator) > -HANDLE_BINARY_INST( 9, Mul , BinaryOperator) > +HANDLE_BINARY_INST( 7, Add , BinaryOperator) > +HANDLE_BINARY_INST( 8, Sub , BinaryOperator) > +HANDLE_BINARY_INST( 9, Mul , BinaryOperator) > > > *** Why remove the space? > > > --- lib/Analysis/ScalarEvolution.cpp 20 Oct 2006 07:07:24 -0000 1.54 > +++ lib/Analysis/ScalarEvolution.cpp 23 Oct 2006 02:43:20 -0000 > @@ -1382,12 +1382,12 @@ SCEVHandle ScalarEvolutionsImpl::createS > return SCEVAddExpr::get(getSCEV(I->getOperand(0)), > getSCEV(I->getOperand(1))); > case Instruction::Mul: > return SCEVMulExpr::get(getSCEV(I->getOperand(0)), > getSCEV(I->getOperand(1))); > - case Instruction::Div: > - if (V->getType()->isInteger() && V->getType()->isSigned()) > + case Instruction::SDiv: > + if (V->getType()->isInteger()) > return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), > getSCEV(I->getOperand(1))); > break; > > > *** No need to check for isInteger anymore. Done. > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/AsmParser/llvmAsmParser.y,v > retrieving revision 1.269 > diff -t -d -u -p -5 -r1.269 llvmAsmParser.y > --- lib/AsmParser/llvmAsmParser.y 22 Oct 2006 07:03:09 -0000 1.269 > +++ lib/AsmParser/llvmAsmParser.y 23 Oct 2006 02:43:24 -0000 > @@ -811,10 +811,41 @@ static PATypeHolder HandleUpRefs(const T > +// This template function is used to obtain the correct opcode for > an > +// instruction when an obsolete opcode is encountered. The OpcodeInfo > template > +// keeps track of the opcode and the "obsolete" flag. These are > generated by > +// the lexer and obsolete will be true when the lexer encounters the > token for > +// an obsolete opcode. For example, "div" was replaced by [usf]div > but we need > +// to maintain backwards compatibility for asm files that still have > the "div" > +// instruction. This function handles converting div -> [usf]div > appropriately. > +template > +static void sanitizeOpCode(OpcodeInfo &OI, const > PATypeHolder& Ty) { > + if (OI.obsolete) { > + switch (OI.opcode) { > + default: > + GenerateError("Invalid Obsolete OpCode"); > + break; > + case Instruction::UDiv: > + if (Ty->isFloatingPoint()) > + OI.opcode = Instruction::FDiv; > + else if (Ty->isSigned()) > + OI.opcode = Instruction::SDiv; > + break; > + case Instruction::SDiv: > + if (Ty->isFloatingPoint()) > + OI.opcode = Instruction::FDiv; > + else if (Ty->isUnsigned()) > + OI.opcode = Instruction::UDiv; > + break; > ... > > > *** I like your approach. I don't think sanitizeOpCode should be a > template though. This specific one only works for binops, because > that is what enum values it has. > I'd just have one function for each class of upgraded op, no > templates. I was designing for the future. Soon enough there will be a category of instructions named ConvertOps which will contain the 10 conversion instructions that will replace cast. I was thinking they could share the same code, but I see what you mean. Each enum corresponds to a particular group of case values so they might as well be separate non-template functions. Done. > Also, the lexer can't return an "obsolete sdiv", it appears to only > return udiv, so the sdiv case above seems dead. Am I missing > something? Nope. It was just a little defensive programming. When depending on things in another file, I tend to be a bit more cautious. There's nothing to stop someone from using the RET_TOK_OBSOLETE with SDiv in Lexer.l. However its guarding against an obscure case that probably won't happen in practice so I'll remove it. > Finally, the code would be simpler if you started it as "if (! > OI.obsolete) return;" Yup. Done. > > > Index: lib/Bytecode/Reader/Reader.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Bytecode/Reader/Reader.cpp,v > retrieving revision 1.199 > diff -t -d -u -p -5 -r1.199 Reader.cpp > --- lib/Bytecode/Reader/Reader.cpp 20 Oct 2006 07:07:24 -0000 1.199 > +++ lib/Bytecode/Reader/Reader.cpp 23 Oct 2006 02:43:26 -0000 > @@ -560,10 +560,239 @@ void BytecodeReader::insertArguments(Fun > ... > + // Declare the resulting instruction we might build. > + Instruction *Result = 0; > + > + // If this is a bytecode format that did not include the > unreachable > + // instruction, bump up the opcode number to adjust > + if (hasNoUnreachableInst) { > + if (Opcode >= Instruction::Unreachable && > + Opcode < 62) { // 62 > + ++Opcode; > + } > + } > + > + // First, short circuit this if no conversion is required. When > signless > + // instructions were implemented the entire opcode sequence was > revised so > + // we key on this first which means that the opcode value read is > the one > + // we should use. > + if (!hasSignlessInstructions) > + return Result; > > > *** If hasSignlessInstructions is true, hasNoUnreachableInst is false, > right? Theoretically, yes :) > If so, move the fast path above the hasNoUnreachableInst check? Yup. Done. > It would be more clear to return 0 here explicitly and mention in the > method comment that this returns null if no upgrading is needed. Except that's not quite the case. The function can return 0 but alter the OpCode argument. I'll fix the comment to explain in more detail. > > > +// Upgrade obsolte constant expression opcodes (ver. 5 and prior) to > the new > > > *** Typo obsolete. Done. > > > > > + // need to note that we have signed integer types in prior > versions. > + hasSignedIntegers = true; > + > + // FALL THROUGH > + > + case 6: // SignlessTypes Implementation (1.10 > release) > > > *** 1.9? Yes. I wrote that code before we had our discussion about whether this change set was going into the 1.9 release or not. I was assuming it was not, but would make it into the next release, 1.10 > > > Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > =================================================================== > RCS > file: /var/cvs/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp,v > retrieving revision 1.294 > diff -t -d -u -p -5 -r1.294 SelectionDAGISel.cpp > --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 22 Oct 2006 23:00:53 > -0000 1.294 > +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 23 Oct 2006 02:43:28 > -0000 > +void > +SelectionDAGLowering::visitIntBinary(User &I, unsigned IntOp, > unsigned VecOp) { > const Type *Ty = I.getType(); > SDOperand Op1 = getValue(I.getOperand(0)); > SDOperand Op2 = getValue(I.getOperand(1)); > > > if (Ty->isIntegral()) { > setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); > - } else if (Ty->isFloatingPoint()) { > + } else { > + const PackedType *PTy = cast(Ty); > + SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); > + SDOperand Typ = > DAG.getValueType(TLI.getValueType(PTy->getElementType())); > + setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, > Typ)); > + } > +} > > > *** In visitIntBinary/visitFPBinary please change the condition to "if > (const PackedType *PTy = dyn_cast(Ty)) {", swapping the > order of the if conditions. Checking "isIntegral" is a non-obvious > way to check that it's not a vector type (your code is correct, just > not obvious what it does). Okay. Done. > > > --- lib/ExecutionEngine/Interpreter/Execution.cpp 20 Oct 2006 07:07:24 > -0000 1.140 > +++ lib/ExecutionEngine/Interpreter/Execution.cpp 23 Oct 2006 02:43:29 > -0000 > @@ -87,11 +87,13 @@ GenericValue Interpreter::getConstantExp > CE->getOperand(0)->getType()); > case Instruction::Mul: > return executeMulInst(getOperandValue(CE->getOperand(0), SF), > getOperandValue(CE->getOperand(1), SF), > CE->getOperand(0)->getType()); > - case Instruction::Div: > + case Instruction::SDiv: > + case Instruction::UDiv: > + case Instruction::FDiv: > return executeDivInst(getOperandValue(CE->getOperand(0), SF), > getOperandValue(CE->getOperand(1), SF), > CE->getOperand(0)->getType()); > case Instruction::Rem: > return executeRemInst(getOperandValue(CE->getOperand(0), SF), > @@ -502,11 +504,13 @@ void Interpreter::visitBinaryOperator(Bi > > > switch (I.getOpcode()) { > case Instruction::Add: R = executeAddInst (Src1, Src2, Ty); > break; > case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty); > break; > case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty); > break; > - case Instruction::Div: R = executeDivInst (Src1, Src2, Ty); > break; > + case Instruction::SDiv: > + case Instruction::UDiv: > + case Instruction::FDiv: R = executeDivInst (Src1, Src2, Ty); > break; > case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty); > break; > case Instruction::And: R = executeAndInst (Src1, Src2, Ty); > break; > case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); > break; > case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); > break; > case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty); > break; > *** This is flat out incorrect. It should have separate > execute*DivInst functions that do the operation not based on the type. > This would misinterpret 'udiv int -4, 2' for example. This must be > fixed before you checkin. > Another casualty of thinking the operand types had to match the instruction type. I've created the three functions. The SDiv case now looks like: static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; ** if (Ty->isUnsigned()) ** Ty = Ty->getSignedVersion(); switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(/, SByte); IMPLEMENT_BINARY_OPERATOR(/, Short); IMPLEMENT_BINARY_OPERATOR(/, Int); IMPLEMENT_BINARY_OPERATOR(/, Long); default: std::cout << "Unhandled type for SDiv instruction: " << *Ty << "\n"; abort(); } return Dest; } I've added the ** lines. and removed the floating point and unsigned cases from the switch. Basically, I'm forcing it to select the signed member from the GenericValue union. Since I used getSignedVersion() the only difference should be the sign (no size difference) and I shouldn't need to do anything special for sign extension. If the SDiv is provided unsigned values, they will be plucked out of the union as signed values. I did a similar thing for UDiv. For FDiv, nothing special is needed for sign management but there are only two cases in the switch: Float and Double. > > --- lib/Target/CBackend/Writer.cpp 22 Oct 2006 09:58:21 -0000 1.274 > +++ lib/Target/CBackend/Writer.cpp 23 Oct 2006 02:43:30 -0000 > @@ -584,11 +584,13 @@ void CWriter::printConstant(Constant *CP > @@ -603,11 +605,13 @@ void CWriter::printConstant(Constant *CP > printConstant(CE->getOperand(0)); > switch (CE->getOpcode()) { > case Instruction::Add: Out << " + "; break; > case Instruction::Sub: Out << " - "; break; > case Instruction::Mul: Out << " * "; break; > - case Instruction::Div: Out << " / "; break; > + case Instruction::UDiv: > + case Instruction::SDiv: > + case Instruction::FDiv: Out << " / "; break; > case Instruction::Rem: Out << " % "; break; > case Instruction::And: Out << " & "; break; > case Instruction::Or: Out << " | "; break; > case Instruction::Xor: Out << " ^ "; break; > case Instruction::SetEQ: Out << " == "; break; > > > *** The CBE has the same problem. You need to force the operands to > the right sign in the C output so that the C compiler will generate > the appropriately signed operation. This must be fixed before you > checkin. Yes. Done. I added a writeOperandWithCast(Value*, unsigned opcode) method to the CWriter. It writes the operand with the correct cast based on the opcode the value is used with. I call this instead of writeOperand(Value*) to write the operands for these binary operators (just before and after the switch statement you quoted above). > > --- lib/Transforms/IPO/SimplifyLibCalls.cpp 20 Oct 2006 07:07:24 -0000 > 1.70 > +++ lib/Transforms/IPO/SimplifyLibCalls.cpp 23 Oct 2006 02:43:30 -0000 > @@ -1273,11 +1273,11 @@ public: > ci->replaceAllUsesWith(base); > ci->eraseFromParent(); > return true; > } else if (Op2V == -1.0) { > // pow(x,-1.0) -> 1.0/x > - BinaryOperator* div_inst= BinaryOperator::createDiv( > + BinaryOperator* div_inst= BinaryOperator::createSDiv( > ConstantFP::get(Ty,1.0), base, ci->getName()+".pow", ci); > ci->replaceAllUsesWith(div_inst); > ci->eraseFromParent(); > return true; > } > > > *** Shouldn't this be fdiv? Please fix before you checkin, and add a > regression test. Yes, I caught that one too after I sent the patches. > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/VMCore/ConstantFolding.cpp,v > retrieving revision 1.94 > diff -t -d -u -p -5 -r1.94 ConstantFolding.cpp > --- lib/VMCore/ConstantFolding.cpp 20 Oct 2006 07:07:24 -0000 1.94 > +++ lib/VMCore/ConstantFolding.cpp 23 Oct 2006 02:43:35 -0000 > @@ -491,20 +507,32 @@ struct VISIBILITY_HIDDEN DirectIntRules > DEF_CAST(ULong , ConstantInt, uint64_t) > DEF_CAST(Float , ConstantFP , float) > DEF_CAST(Double, ConstantFP , double) > #undef DEF_CAST > > > - static Constant *Div(const ConstantInt *V1, const ConstantInt *V2) > { > - if (V2->isNullValue()) return 0; > + static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) > { > + if (V2->isNullValue()) > + return 0; > if (V2->isAllOnesValue() && // MIN_INT / -1 > (BuiltinType)V1->getZExtValue() == > -(BuiltinType)V1->getZExtValue()) > return 0; > BuiltinType R = > (BuiltinType)V1->getZExtValue() / > (BuiltinType)V2->getZExtValue(); > return ConstantInt::get(*Ty, R); > } > > > + static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) > { > + if (V2->isNullValue()) > + return 0; > + if (V2->isAllOnesValue() && // MIN_INT / -1 > + (BuiltinType)V1->getSExtValue() == > -(BuiltinType)V1->getSExtValue()) > + return 0; > + BuiltinType R = > + (BuiltinType)V1->getSExtValue() / > (BuiltinType)V2->getSExtValue(); > + return ConstantInt::get(*Ty, R); > + } > + > > > You properly sign/zero extend the values here, but then proceed to do > the wrong division. For example, this will do signed division for > 'udiv int -2, 2'. What does the -constfold pass produce for: > > > int %test() { %X = udiv int -2, 2 ret int %X } > > > I bet it is folded to -1, which is incorrect. There's no -constfold pass on opt, but I ran it through gccas and yes, it does produce -1. I fixed it by changing: BuiltinType R = > (BuiltinType)V1->getSExtValue() / (BuiltinType)V2->getSExtValue(); to: BuiltinType R = (BuiltinType)(V1->getSExtValue() / V2->getSExtValue()); That produced the value of 2147483647 ((MAX_UINT-1)/2) for your test case which I think is correct. Please confirm. > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/VMCore/Constants.cpp,v > retrieving revision 1.165 > diff -t -d -u -p -5 -r1.165 Constants.cpp > --- lib/VMCore/Constants.cpp 20 Oct 2006 07:07:24 -0000 1.165 > +++ lib/VMCore/Constants.cpp 23 Oct 2006 02:43:36 -0000 > .. > @@ -444,12 +446,18 @@ Constant *ConstantExpr::getSub(Constant > return get(Instruction::Sub, C1, C2); > } > Constant *ConstantExpr::getMul(Constant *C1, Constant *C2) { > return get(Instruction::Mul, C1, C2); > } > -Constant *ConstantExpr::getDiv(Constant *C1, Constant *C2) { > - return get(Instruction::Div, C1, C2); > +Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2) { > + return get(Instruction::UDiv, C1, C2); > +} > +Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) { > + return get(Instruction::SDiv, C1, C2); > +} > +Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { > + return get(Instruction::FDiv, C1, C2); > } > Constant *ConstantExpr::getRem(Constant *C1, Constant *C2) { > return get(Instruction::Rem, C1, C2); > } > Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) { > > > *** This would be an excellent place to assert that the arguments are > integer or fp (or vectors of) as appropriate. All of these cases call ConstantExpr::get(Opcode, C1, C2). That function provides copious asserts. I didn't think it was reasonable to double them up, especially since the asserts in ConstantExpr::get are ifdef'd for debug only. I took that to mean that they were performance sensitive for a release+asserts build. Let me know if that's not the case (i.e. if I should remove the #ifndef DEBUG code in ConstantExpr::get). I looked at ConstantExpr::get and tightened up the asserts there. It was allowing FP for UDiv and SDiv and integer for FDiv. Now it doesn't. > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/VMCore/Instructions.cpp,v > retrieving revision 1.43 > diff -t -d -u -p -5 -r1.43 Instructions.cpp > --- lib/VMCore/Instructions.cpp 20 Oct 2006 07:07:24 -0000 1.43 > +++ lib/VMCore/Instructions.cpp 23 Oct 2006 02:43:36 -0000 > @@ -1020,11 +1020,11 @@ void BinaryOperator::init(BinaryOps iTyp > assert(LHS->getType() == RHS->getType() && > "Binary operator operand types must match!"); > #ifndef NDEBUG > switch (iType) { > case Add: case Sub: > - case Mul: case Div: > + case Mul: case UDiv: case SDiv: case FDiv: > case Rem: > assert(getType() == LHS->getType() && > "Arithmetic operation should return same type as > operands!"); > assert((getType()->isInteger() || getType()->isFloatingPoint() || > isa(getType())) && > > > *** Likewise, this would be a good place to assert that the operands > are int/fp(or vectors of) as appropriate. Yes. Done. Thanks Chris. Your comments are always useful and instructive. Reid. From rspencer at reidspencer.com Tue Oct 24 12:12:26 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 24 Oct 2006 10:12:26 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review In-Reply-To: References: <1161571843.29146.564.camel@bashful.x10sys.com> Message-ID: <1161709946.6672.60.camel@bashful.x10sys.com> On Mon, 2006-10-23 at 22:57 -0700, Chris Lattner wrote: > n Oct 23, 2006, at 10:52 PM, Chris Lattner wrote: > > On Oct 22, 2006, at 7:50 PM, Reid Spencer wrote: > > > >> Attached is a patch to implement splitting the signless DIV > >> instruction > >> into UDiv (unsigned), SDiv (signed), and FDiv (floating point) > >> instructions. This is part of the Signless Types work I'm doing. > > > > Overall, this patch looks like a great first step > > Crap, that was obviously supposed to just go to Reid. :( No worries. I learned a lot from it. Hopefully someone else will too. :) Reid. From sabre at nondot.org Tue Oct 24 12:41:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:41:37 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200610241741.k9OHfbOG006964@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.97 -> 1.98 --- Log message: update comment --- Diffs of the changes: (+3 -2) TargetInstrInfo.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.97 llvm/include/llvm/Target/TargetInstrInfo.h:1.98 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.97 Tue Oct 24 09:47:28 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Tue Oct 24 12:41:22 2006 @@ -309,8 +309,9 @@ /// InsertBranch - Insert a branch into the end of the specified /// MachineBasicBlock. This operands to this method are the same as those - /// returned by AnalyzeBranch. This nis invoked in cases where AnalyzeBranch - /// returns success. + /// returned by AnalyzeBranch. This is invoked in cases where AnalyzeBranch + /// returns success and when an unconditional branch (TBB is non-null, FBB is + /// null, Cond is empty) needs to be inserted. virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const std::vector &Cond) const { From rafael.espindola at gmail.com Tue Oct 24 12:07:27 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 12:07:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.cpp Message-ID: <200610241707.k9OH7RIH006005@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.cpp updated: 1.8 -> 1.9 --- Log message: fix warning about missing newline at end of file --- Diffs of the changes: (+1 -1) ARMInstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.cpp diff -u llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.8 llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.9 --- llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.8 Tue Oct 24 11:47:57 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.cpp Tue Oct 24 12:07:11 2006 @@ -55,4 +55,4 @@ // Can only insert uncond branches so far. assert(Cond.empty() && !FBB && TBB && "Can only handle uncond branches!"); BuildMI(&MBB, ARM::b, 1).addMBB(TBB); -} \ No newline at end of file +} From sabre at nondot.org Tue Oct 24 12:58:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:58:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610241758.k9OHwEqe007384@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.296 -> 1.297 --- Log message: Generalize CaseBlock a bit more: Rename LHSBB/RHSBB to TrueBB/FalseBB. Allow the RHS value to be null, in which case the LHS is treated as a bool. --- Diffs of the changes: (+74 -57) SelectionDAGISel.cpp | 131 ++++++++++++++++++++++++++++----------------------- 1 files changed, 74 insertions(+), 57 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.296 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.297 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.296 Tue Oct 24 12:03:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct 24 12:57:59 2006 @@ -766,7 +766,6 @@ void SelectionDAGLowering::visitBr(BranchInst &I) { // Update machine-CFG edges. MachineBasicBlock *Succ0MBB = FuncInfo.MBBMap[I.getSuccessor(0)]; - CurMBB->addSuccessor(Succ0MBB); // Figure out which block is immediately after the current one. MachineBasicBlock *NextBlock = 0; @@ -779,48 +778,67 @@ if (Succ0MBB != NextBlock) DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(), DAG.getBasicBlock(Succ0MBB))); - } else { - MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; - CurMBB->addSuccessor(Succ1MBB); - SDOperand Cond = getValue(I.getCondition()); - if (Succ1MBB == NextBlock) { - // If the condition is false, fall through. This means we should branch - // if the condition is true to Succ #0. - DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), - Cond, DAG.getBasicBlock(Succ0MBB))); - } else if (Succ0MBB == NextBlock) { - // If the condition is true, fall through. This means we should branch if - // the condition is false to Succ #1. Invert the condition first. + // Update machine-CFG edges. + CurMBB->addSuccessor(Succ0MBB); + + return; + } + + // If this condition is one of the special cases we handle, do special stuff + // now. + Value *CondVal = I.getCondition(); + + + // Update machine-CFG edges. + CurMBB->addSuccessor(Succ0MBB); + MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; + CurMBB->addSuccessor(Succ1MBB); + + SDOperand Cond = getValue(CondVal); + if (Succ1MBB == NextBlock) { + // If the condition is false, fall through. This means we should branch + // if the condition is true to Succ #0. + DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), + Cond, DAG.getBasicBlock(Succ0MBB))); + } else if (Succ0MBB == NextBlock) { + // If the condition is true, fall through. This means we should branch if + // the condition is false to Succ #1. Invert the condition first. + SDOperand True = DAG.getConstant(1, Cond.getValueType()); + Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); + DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), + Cond, DAG.getBasicBlock(Succ1MBB))); + } else { + std::vector Ops; + Ops.push_back(getRoot()); + // If the false case is the current basic block, then this is a self + // loop. We do not want to emit "Loop: ... brcond Out; br Loop", as it + // adds an extra instruction in the loop. Instead, invert the + // condition and emit "Loop: ... br!cond Loop; br Out. + if (CurMBB == Succ1MBB) { + std::swap(Succ0MBB, Succ1MBB); SDOperand True = DAG.getConstant(1, Cond.getValueType()); Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); - DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), - Cond, DAG.getBasicBlock(Succ1MBB))); - } else { - std::vector Ops; - Ops.push_back(getRoot()); - // If the false case is the current basic block, then this is a self - // loop. We do not want to emit "Loop: ... brcond Out; br Loop", as it - // adds an extra instruction in the loop. Instead, invert the - // condition and emit "Loop: ... br!cond Loop; br Out. - if (CurMBB == Succ1MBB) { - std::swap(Succ0MBB, Succ1MBB); - SDOperand True = DAG.getConstant(1, Cond.getValueType()); - Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); - } - SDOperand True = DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), Cond, - DAG.getBasicBlock(Succ0MBB)); - DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, True, - DAG.getBasicBlock(Succ1MBB))); } + SDOperand True = DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), Cond, + DAG.getBasicBlock(Succ0MBB)); + DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, True, + DAG.getBasicBlock(Succ1MBB))); } } /// visitSwitchCase - Emits the necessary code to represent a single node in /// the binary search tree resulting from lowering a switch instruction. void SelectionDAGLowering::visitSwitchCase(SelectionDAGISel::CaseBlock &CB) { - SDOperand Cond = DAG.getSetCC(MVT::i1, getValue(CB.CmpLHS), - getValue(CB.CmpRHS), CB.CC); + SDOperand Cond; + SDOperand CondLHS = getValue(CB.CmpLHS); + + // If the CaseBlock has both LHS/RHS comparisons, build the setcc now, + // otherwise, just use the LHS value as a bool comparison value. + if (CB.CmpRHS) + Cond = DAG.getSetCC(MVT::i1, CondLHS, getValue(CB.CmpRHS), CB.CC); + else + Cond = CondLHS; // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. @@ -831,21 +849,21 @@ // If the lhs block is the next block, invert the condition so that we can // fall through to the lhs instead of the rhs block. - if (CB.LHSBB == NextBlock) { - std::swap(CB.LHSBB, CB.RHSBB); + if (CB.TrueBB == NextBlock) { + std::swap(CB.TrueBB, CB.FalseBB); SDOperand True = DAG.getConstant(1, Cond.getValueType()); Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); } SDOperand BrCond = DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), Cond, - DAG.getBasicBlock(CB.LHSBB)); - if (CB.RHSBB == NextBlock) + DAG.getBasicBlock(CB.TrueBB)); + if (CB.FalseBB == NextBlock) DAG.setRoot(BrCond); else DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, BrCond, - DAG.getBasicBlock(CB.RHSBB))); + DAG.getBasicBlock(CB.FalseBB))); // Update successor info - CurMBB->addSuccessor(CB.LHSBB); - CurMBB->addSuccessor(CB.RHSBB); + CurMBB->addSuccessor(CB.TrueBB); + CurMBB->addSuccessor(CB.FalseBB); } void SelectionDAGLowering::visitJumpTable(SelectionDAGISel::JumpTable &JT) { @@ -947,7 +965,6 @@ } } - // Create a CaseBlock record representing a conditional branch to // the Case's target mbb if the value being switched on SV is equal // to C. @@ -1098,7 +1115,7 @@ CaseRange LHSR(CR.Range.first, Pivot); CaseRange RHSR(Pivot, CR.Range.second); Constant *C = Pivot->first; - MachineBasicBlock *RHSBB = 0, *LHSBB = 0; + MachineBasicBlock *FalseBB = 0, *TrueBB = 0; // We know that we branch to the LHS if the Value being switched on is // less than the Pivot value, C. We use this to optimize our binary @@ -1110,11 +1127,11 @@ LHSR.first->first == CR.GE && cast(C)->getZExtValue() == (cast(CR.GE)->getZExtValue() + 1ULL)) { - LHSBB = LHSR.first->second; + TrueBB = LHSR.first->second; } else { - LHSBB = new MachineBasicBlock(LLVMBB); - CurMF->getBasicBlockList().insert(BBI, LHSBB); - CaseVec.push_back(CaseRec(LHSBB,C,CR.GE,LHSR)); + TrueBB = new MachineBasicBlock(LLVMBB); + CurMF->getBasicBlockList().insert(BBI, TrueBB); + CaseVec.push_back(CaseRec(TrueBB, C, CR.GE, LHSR)); } // Similar to the optimization above, if the Value being switched on is @@ -1124,18 +1141,18 @@ if ((RHSR.second - RHSR.first) == 1 && CR.LT && cast(RHSR.first->first)->getZExtValue() == (cast(CR.LT)->getZExtValue() - 1ULL)) { - RHSBB = RHSR.first->second; + FalseBB = RHSR.first->second; } else { - RHSBB = new MachineBasicBlock(LLVMBB); - CurMF->getBasicBlockList().insert(BBI, RHSBB); - CaseVec.push_back(CaseRec(RHSBB,CR.LT,C,RHSR)); + FalseBB = new MachineBasicBlock(LLVMBB); + CurMF->getBasicBlockList().insert(BBI, FalseBB); + CaseVec.push_back(CaseRec(FalseBB,CR.LT,C,RHSR)); } // Create a CaseBlock record representing a conditional branch to // the LHS node if the value being switched on SV is less than C. // Otherwise, branch to LHS. ISD::CondCode CC = C->getType()->isSigned() ? ISD::SETLT : ISD::SETULT; - SelectionDAGISel::CaseBlock CB(CC, SV, C, LHSBB, RHSBB, CR.CaseBB); + SelectionDAGISel::CaseBlock CB(CC, SV, C, TrueBB, FalseBB, CR.CaseBB); if (CR.CaseBB == CurMBB) visitSwitchCase(CB); @@ -3733,7 +3750,7 @@ // from the original BB before switch expansion. Note that PHI nodes can // occur multiple times in PHINodesToUpdate. We have to be very careful to // handle them the right number of times. - while ((BB = SwitchCases[i].LHSBB)) { // Handle LHS and RHS. + while ((BB = SwitchCases[i].TrueBB)) { // Handle LHS and RHS. for (MachineBasicBlock::iterator Phi = BB->begin(); Phi != BB->end() && Phi->getOpcode() == TargetInstrInfo::PHI; ++Phi){ // This value for this PHI node is recorded in PHINodesToUpdate, get it. @@ -3748,14 +3765,14 @@ } // Don't process RHS if same block as LHS. - if (BB == SwitchCases[i].RHSBB) - SwitchCases[i].RHSBB = 0; + if (BB == SwitchCases[i].FalseBB) + SwitchCases[i].FalseBB = 0; // If we haven't handled the RHS, do so now. Otherwise, we're done. - SwitchCases[i].LHSBB = SwitchCases[i].RHSBB; - SwitchCases[i].RHSBB = 0; + SwitchCases[i].TrueBB = SwitchCases[i].TrueBB; + SwitchCases[i].FalseBB = 0; } - assert(SwitchCases[i].LHSBB == 0 && SwitchCases[i].RHSBB == 0); + assert(SwitchCases[i].TrueBB == 0 && SwitchCases[i].FalseBB == 0); } } From sabre at nondot.org Tue Oct 24 12:58:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 12:58:15 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200610241758.k9OHwFWQ007390@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h updated: 1.28 -> 1.29 --- Log message: Generalize CaseBlock a bit more: Rename LHSBB/RHSBB to TrueBB/FalseBB. Allow the RHS value to be null, in which case the LHS is treated as a bool. --- Diffs of the changes: (+8 -8) SelectionDAGISel.h | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.28 llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.29 --- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.28 Tue Oct 24 12:03:35 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Tue Oct 24 12:57:59 2006 @@ -83,17 +83,17 @@ /// case switch statements. struct CaseBlock { CaseBlock(ISD::CondCode cc, Value *cmplhs, Value *cmprhs, - MachineBasicBlock *lhs, MachineBasicBlock *rhs, - MachineBasicBlock *me) : - CC(cc), CmpLHS(cmplhs), CmpRHS(cmprhs), LHSBB(lhs), RHSBB(rhs), ThisBB(me){} + MachineBasicBlock *truebb, MachineBasicBlock *falsebb, + MachineBasicBlock *me) + : CC(cc), CmpLHS(cmplhs), CmpRHS(cmprhs), + TrueBB(truebb), FalseBB(falsebb), ThisBB(me) {} // CC - the condition code to use for the case block's setcc node ISD::CondCode CC; - // CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit. + // CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit. If CmpRHS is + // null, CmpLHS is treated as a bool condition for the branch. Value *CmpLHS, *CmpRHS; - // LHSBB - the block to branch to if the setcc is true - MachineBasicBlock *LHSBB; - // RHSBB - the block to branch to if the setcc is false - MachineBasicBlock *RHSBB; + // TrueBB/FalseBB - the block to branch to if the setcc is true/false. + MachineBasicBlock *TrueBB, *FalseBB; // ThisBB - the block into which to emit the code for the setcc and branches MachineBasicBlock *ThisBB; }; From sabre at nondot.org Tue Oct 24 13:07:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 13:07:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610241807.k9OI7pok007588@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.297 -> 1.298 --- Log message: visitSwitchCase knows how to insert conditional branches well. Change visitBr to just call visitSwitchCase, eliminating duplicate logic. --- Diffs of the changes: (+8 -37) SelectionDAGISel.cpp | 45 ++++++++------------------------------------- 1 files changed, 8 insertions(+), 37 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.297 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.298 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.297 Tue Oct 24 12:57:59 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Oct 24 13:07:37 2006 @@ -788,43 +788,14 @@ // If this condition is one of the special cases we handle, do special stuff // now. Value *CondVal = I.getCondition(); - - - // Update machine-CFG edges. - CurMBB->addSuccessor(Succ0MBB); MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; - CurMBB->addSuccessor(Succ1MBB); - - SDOperand Cond = getValue(CondVal); - if (Succ1MBB == NextBlock) { - // If the condition is false, fall through. This means we should branch - // if the condition is true to Succ #0. - DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), - Cond, DAG.getBasicBlock(Succ0MBB))); - } else if (Succ0MBB == NextBlock) { - // If the condition is true, fall through. This means we should branch if - // the condition is false to Succ #1. Invert the condition first. - SDOperand True = DAG.getConstant(1, Cond.getValueType()); - Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); - DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), - Cond, DAG.getBasicBlock(Succ1MBB))); - } else { - std::vector Ops; - Ops.push_back(getRoot()); - // If the false case is the current basic block, then this is a self - // loop. We do not want to emit "Loop: ... brcond Out; br Loop", as it - // adds an extra instruction in the loop. Instead, invert the - // condition and emit "Loop: ... br!cond Loop; br Out. - if (CurMBB == Succ1MBB) { - std::swap(Succ0MBB, Succ1MBB); - SDOperand True = DAG.getConstant(1, Cond.getValueType()); - Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); - } - SDOperand True = DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), Cond, - DAG.getBasicBlock(Succ0MBB)); - DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, True, - DAG.getBasicBlock(Succ1MBB))); - } + + // Create a CaseBlock record representing this branch. + SelectionDAGISel::CaseBlock CB(ISD::SETEQ, CondVal, 0, + Succ0MBB, Succ1MBB, CurMBB); + // Use visitSwitchCase to actually insert the fast branch sequence for this + // cond branch. + visitSwitchCase(CB); } /// visitSwitchCase - Emits the necessary code to represent a single node in @@ -3769,7 +3740,7 @@ SwitchCases[i].FalseBB = 0; // If we haven't handled the RHS, do so now. Otherwise, we're done. - SwitchCases[i].TrueBB = SwitchCases[i].TrueBB; + SwitchCases[i].TrueBB = SwitchCases[i].FalseBB; SwitchCases[i].FalseBB = 0; } assert(SwitchCases[i].TrueBB == 0 && SwitchCases[i].FalseBB == 0); From dpatel at apple.com Tue Oct 24 13:41:22 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 13:41:22 -0500 Subject: [llvm-commits] CVS: llvm/tools/lto/lto.cpp Message-ID: <200610241841.k9OIfMmR014515@zion.cs.uiuc.edu> Changes in directory llvm/tools/lto: lto.cpp updated: 1.22 -> 1.23 --- Log message: Instead of hard coding global prefix, use TargetAsmInfo. Add LTO destructor. --- Diffs of the changes: (+55 -31) lto.cpp | 86 ++++++++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 55 insertions(+), 31 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.22 llvm/tools/lto/lto.cpp:1.23 --- llvm/tools/lto/lto.cpp:1.22 Mon Oct 23 18:57:53 2006 +++ llvm/tools/lto/lto.cpp Tue Oct 24 13:41:02 2006 @@ -32,6 +32,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoadValueNumbering.h" @@ -56,16 +57,6 @@ gv->setLinkage(GlobalValue::InternalLinkage); } -// Helper routine -// FIXME : Take advantage of GlobalPrefix from AsmPrinter -static const char *addUnderscore(const char *name) { - size_t namelen = strlen(name); - char *symName = (char*)malloc(namelen+2); - symName[0] = '_'; - strcpy(&symName[1], name); - return symName; -} - // Map LLVM LinkageType to LTO LinakgeType static LTOLinkageTypes getLTOLinkageType(GlobalValue *v) @@ -157,10 +148,16 @@ if (!m) return LTO_READ_FAILURE; + // Collect Target info + if (!Target) + getTarget(m); + + if (!Target) + return LTO_READ_FAILURE; + // Use mangler to add GlobalPrefix to names to match linker names. // FIXME : Instead of hard coding "-" use GlobalPrefix. - Mangler mangler(*m, "_"); - + Mangler mangler(*m, Target->getTargetAsmInfo()->getGlobalPrefix()); modules.push_back(m); for (Module::iterator f = m->begin(), e = m->end(); f != e; ++f) { @@ -204,37 +201,46 @@ return LTO_READ_SUCCESS; } +/// Get TargetMachine. +/// Use module M to find appropriate Target. +void +LTO::getTarget (Module *M) { + + std::string Err; + const TargetMachineRegistry::Entry* March = + TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err); + + if (March == 0) + return; + + // Create target + std::string Features; + Target = March->CtorFn(*M, Features); +} + /// Optimize module M using various IPO passes. Use exportList to /// internalize selected symbols. Target platform is selected /// based on information available to module M. No new target /// features are selected. -static enum LTOStatus lto_optimize(Module *M, std::ostream &Out, - std::vector &exportList) +enum LTOStatus +LTO::optimize(Module *M, std::ostream &Out, + std::vector &exportList) { // Instantiate the pass manager to organize the passes. PassManager Passes; // Collect Target info - std::string Err; - const TargetMachineRegistry::Entry* March = - TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err); - - if (March == 0) - return LTO_NO_TARGET; - - // Create target - std::string Features; - std::auto_ptr target(March->CtorFn(*M, Features)); - if (!target.get()) + if (!Target) + getTarget(M); + + if (!Target) return LTO_NO_TARGET; - TargetMachine &Target = *target.get(); - // Start off with a verification pass. Passes.add(createVerifierPass()); // Add an appropriate TargetData instance for this module... - Passes.add(new TargetData(*Target.getTargetData())); + Passes.add(new TargetData(*Target->getTargetData())); // Often if the programmer does not specify proper prototypes for the // functions they are calling, they end up calling a vararg version of the @@ -302,8 +308,8 @@ FunctionPassManager *CodeGenPasses = new FunctionPassManager(new ExistingModuleProvider(M)); - CodeGenPasses->add(new TargetData(*Target.getTargetData())); - Target.addPassesToEmitFile(*CodeGenPasses, Out, TargetMachine::AssemblyFile, + CodeGenPasses->add(new TargetData(*Target->getTargetData())); + Target->addPassesToEmitFile(*CodeGenPasses, Out, TargetMachine::AssemblyFile, true); // Run our queue of passes all at once now, efficiently. @@ -384,7 +390,7 @@ return LTO_WRITE_FAILURE; } - enum LTOStatus status = lto_optimize(bigOne, asmFile, exportList); + enum LTOStatus status = optimize(bigOne, asmFile, exportList); asmFile.close(); if (status != LTO_OPT_SUCCESS) { tmpAsmFilePath.eraseFromDisk(); @@ -427,3 +433,21 @@ return LTO_OPT_SUCCESS; } + +/// Destruct LTO. Delete all modules, symbols and target. +LTO::~LTO() { + + for (std::vector::iterator itr = modules.begin(), e = modules.end(); + itr != e; ++itr) + delete *itr; + + modules.clear(); + + for (NameToSymbolMap::iterator itr = allSymbols.begin(), e = allSymbols.end(); + itr != e; ++itr) + delete itr->second; + + allSymbols.clear(); + + delete Target; +} From dpatel at apple.com Tue Oct 24 13:41:22 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 13:41:22 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkTimeOptimizer.h Message-ID: <200610241841.k9OIfM1T014514@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkTimeOptimizer.h updated: 1.9 -> 1.10 --- Log message: Instead of hard coding global prefix, use TargetAsmInfo. Add LTO destructor. --- Diffs of the changes: (+12 -0) LinkTimeOptimizer.h | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/include/llvm/LinkTimeOptimizer.h diff -u llvm/include/llvm/LinkTimeOptimizer.h:1.9 llvm/include/llvm/LinkTimeOptimizer.h:1.10 --- llvm/include/llvm/LinkTimeOptimizer.h:1.9 Mon Oct 23 18:12:26 2006 +++ llvm/include/llvm/LinkTimeOptimizer.h Tue Oct 24 13:41:02 2006 @@ -24,6 +24,7 @@ class Module; class GlobalValue; + class TargetMachine; enum LTOStatus { LTO_UNKNOWN, @@ -114,13 +115,24 @@ void getTargetTriple(const std::string &InputFilename, std::string &targetTriple); void removeModule (const std::string &InputFilename); + // Constructors and destructors + LTO() { + /// TODO: Use Target info, it is available at this time. + Target = NULL; + } + ~LTO(); + private: Module *getModule (const std::string &InputFilename); + enum LTOStatus optimize(Module *, std::ostream &, + std::vector &); + void getTarget(Module *); private: std::vector modules; NameToSymbolMap allSymbols; NameToModuleMap allModules; + TargetMachine *Target; }; } // End llvm namespace From criswell at cs.uiuc.edu Tue Oct 24 14:10:22 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 24 Oct 2006 14:10:22 -0500 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200610241910.OAA15842@choi.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.269 -> 1.270 llvmAsmParser.y.cvs updated: 1.21 -> 1.22 --- Log message: Removed extraneous semi-colon; this was prevening the grammar file from bison'ing correctly. --- Diffs of the changes: (+2 -2) llvmAsmParser.y | 2 +- llvmAsmParser.y.cvs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.269 llvm/lib/AsmParser/llvmAsmParser.y:1.270 --- llvm/lib/AsmParser/llvmAsmParser.y:1.269 Sun Oct 22 02:03:09 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Tue Oct 24 14:09:48 2006 @@ -1872,7 +1872,7 @@ | TRIPLE '=' STRINGCONSTANT { CurModule.CurrentModule->setTargetTriple($3); free($3); - }; + } | DATALAYOUT '=' STRINGCONSTANT { CurModule.CurrentModule->setDataLayout($3); free($3); Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.21 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.22 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.21 Sun Oct 22 02:03:43 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Tue Oct 24 14:09:48 2006 @@ -1872,7 +1872,7 @@ | TRIPLE '=' STRINGCONSTANT { CurModule.CurrentModule->setTargetTriple($3); free($3); - }; + } | DATALAYOUT '=' STRINGCONSTANT { CurModule.CurrentModule->setDataLayout($3); free($3); From rafael.espindola at gmail.com Tue Oct 24 15:15:38 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 15:15:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200610242015.k9OKFcpv016979@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.78 -> 1.79 --- Log message: expand ISD::VACOPY --- Diffs of the changes: (+1 -0) ARMISelDAGToDAG.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.78 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.79 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.78 Mon Oct 23 15:08:22 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Oct 24 15:15:21 2006 @@ -89,6 +89,7 @@ setOperationAction(ISD::UREM, MVT::i32, Expand); setOperationAction(ISD::VASTART, MVT::Other, Custom); + setOperationAction(ISD::VACOPY, MVT::Other, Expand); setOperationAction(ISD::VAEND, MVT::Other, Expand); setOperationAction(ISD::ConstantFP, MVT::f64, Expand); From rafael.espindola at gmail.com Tue Oct 24 15:15:38 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 24 Oct 2006 15:15:38 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/vargs2.ll Message-ID: <200610242015.k9OKFcVX016980@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: vargs2.ll updated: 1.1 -> 1.2 --- Log message: expand ISD::VACOPY --- Diffs of the changes: (+35 -17) vargs2.ll | 52 +++++++++++++++++++++++++++++++++++----------------- 1 files changed, 35 insertions(+), 17 deletions(-) Index: llvm/test/Regression/CodeGen/ARM/vargs2.ll diff -u llvm/test/Regression/CodeGen/ARM/vargs2.ll:1.1 llvm/test/Regression/CodeGen/ARM/vargs2.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/vargs2.ll:1.1 Fri Aug 25 12:57:36 2006 +++ llvm/test/Regression/CodeGen/ARM/vargs2.ll Tue Oct 24 15:15:21 2006 @@ -1,33 +1,51 @@ ; RUN: llvm-as < %s | llc -march=arm -%str = internal constant [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1] +%str = internal constant [7 x ubyte] c"%d %d\0A\00" ; <[7 x ubyte]*> [#uses=1] implementation ; Functions: void %f(int %a, ...) { entry: - %va = alloca sbyte*, align 4 ; [#uses=4] - call void %llvm.va_start( sbyte** %va ) - br label %bb + %a = cast int %a to uint ; [#uses=1] + %l1 = alloca sbyte*, align 4 ; [#uses=5] + %l2 = alloca sbyte*, align 4 ; [#uses=4] + %memtmp = alloca sbyte* ; [#uses=2] + call void %llvm.va_start( sbyte** %l1 ) + %tmp22 = seteq int %a, 0 ; [#uses=1] + %tmp23 = volatile load sbyte** %l1 ; [#uses=2] + br bool %tmp22, label %bb8, label %bb bb: ; preds = %bb, %entry - %a_addr.0 = phi int [ %a, %entry ], [ %tmp5, %bb ] ; [#uses=2] - %tmp = volatile load sbyte** %va ; [#uses=2] - %tmp2 = getelementptr sbyte* %tmp, int 4 ; [#uses=1] - volatile store sbyte* %tmp2, sbyte** %va - %tmp5 = add int %a_addr.0, -1 ; [#uses=1] - %tmp = seteq int %a_addr.0, 1 ; [#uses=1] - br bool %tmp, label %bb7, label %bb - -bb7: ; preds = %bb - %tmp3 = cast sbyte* %tmp to int* ; [#uses=1] + %indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=1] + %tmp.0 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; [#uses=2] + %tmp2 = getelementptr sbyte* %tmp.0, int 4 ; [#uses=1] + volatile store sbyte* %tmp2, sbyte** %l1 + %tmp3 = cast sbyte* %tmp.0 to int* ; [#uses=1] %tmp = load int* %tmp3 ; [#uses=1] - %tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %tmp ) ; [#uses=0] - call void %llvm.va_end( sbyte** %va ) + %tmp = volatile load sbyte** %l1 ; [#uses=2] + %indvar.next = add uint %indvar, 1 ; [#uses=2] + %exitcond = seteq uint %indvar.next, %a ; [#uses=1] + br bool %exitcond, label %bb8, label %bb + +bb8: ; preds = %bb, %entry + %p1.0.1 = phi int [ undef, %entry ], [ %tmp, %bb ] ; [#uses=1] + %tmp.1 = phi sbyte* [ %tmp23, %entry ], [ %tmp, %bb ] ; [#uses=1] + store sbyte* %tmp.1, sbyte** %memtmp + call void %llvm.va_copy( sbyte** %l2, sbyte** %memtmp ) + %tmp10 = volatile load sbyte** %l2 ; [#uses=2] + %tmp12 = getelementptr sbyte* %tmp10, int 4 ; [#uses=1] + volatile store sbyte* %tmp12, sbyte** %l2 + %tmp13 = cast sbyte* %tmp10 to int* ; [#uses=1] + %tmp14 = load int* %tmp13 ; [#uses=1] + %tmp17 = call int (ubyte*, ...)* %printf( ubyte* getelementptr ([7 x ubyte]* %str, int 0, uint 0), int %p1.0.1, int %tmp14 ) ; [#uses=0] + call void %llvm.va_end( sbyte** %l1 ) + call void %llvm.va_end( sbyte** %l2 ) ret void } declare void %llvm.va_start(sbyte**) -declare int %printf(sbyte*, ...) +declare void %llvm.va_copy(sbyte**, sbyte**) + +declare int %printf(ubyte*, ...) declare void %llvm.va_end(sbyte**) From dpatel at apple.com Tue Oct 24 15:32:39 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200610242032.k9OKWdBd017394@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.201 -> 1.202 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+1 -1) PPCAsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.201 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.202 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.201 Wed Oct 4 22:01:21 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Oct 24 15:32:14 2006 @@ -513,7 +513,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Size = TD->getTypeSize(C->getType()); - unsigned Align = getPreferredAlignmentLog(I); + unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && /* FIXME: Verify correct */ (I->hasInternalLinkage() || I->hasWeakLinkage() || From dpatel at apple.com Tue Oct 24 15:32:39 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetData.cpp Message-ID: <200610242032.k9OKWdS7017392@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetData.cpp updated: 1.71 -> 1.72 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+23 -0) TargetData.cpp | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/lib/Target/TargetData.cpp diff -u llvm/lib/Target/TargetData.cpp:1.71 llvm/lib/Target/TargetData.cpp:1.72 --- llvm/lib/Target/TargetData.cpp:1.71 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Target/TargetData.cpp Tue Oct 24 15:32:14 2006 @@ -354,3 +354,26 @@ return Result; } +/// getPreferredAlignmentLog - Return the preferred alignment of the +/// specified global, returned in log form. This includes an explicitly +/// requested alignment (if the global has one). +unsigned TargetData::getPreferredAlignmentLog(const GlobalVariable *GV) const { + const Type *ElemType = GV->getType()->getElementType(); + unsigned Alignment = getTypeAlignmentShift(ElemType); + if (GV->getAlignment() > (1U << Alignment)) + Alignment = Log2_32(GV->getAlignment()); + + if (GV->hasInitializer()) { + // Always round up alignment of global doubles to 8 bytes. + if (GV->getType()->getElementType() == Type::DoubleTy && Alignment < 3) + Alignment = 3; + if (Alignment < 4) { + // If the global is not external, see if it is large. If so, give it a + // larger alignment. + if (getTypeSize(ElemType) > 128) + Alignment = 4; // 16-byte alignment. + } + } + return Alignment; +} + From dpatel at apple.com Tue Oct 24 15:32:39 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200610242032.k9OKWd1g017407@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.112 -> 1.113 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+0 -23) AsmPrinter.cpp | 23 ----------------------- 1 files changed, 23 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.112 llvm/lib/CodeGen/AsmPrinter.cpp:1.113 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.112 Fri Oct 20 02:07:24 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Tue Oct 24 15:32:14 2006 @@ -326,29 +326,6 @@ } } -/// getPreferredAlignmentLog - Return the preferred alignment of the -/// specified global, returned in log form. This includes an explicitly -/// requested alignment (if the global has one). -unsigned AsmPrinter::getPreferredAlignmentLog(const GlobalVariable *GV) const { - const Type *ElemType = GV->getType()->getElementType(); - unsigned Alignment = TM.getTargetData()->getTypeAlignmentShift(ElemType); - if (GV->getAlignment() > (1U << Alignment)) - Alignment = Log2_32(GV->getAlignment()); - - if (GV->hasInitializer()) { - // Always round up alignment of global doubles to 8 bytes. - if (GV->getType()->getElementType() == Type::DoubleTy && Alignment < 3) - Alignment = 3; - if (Alignment < 4) { - // If the global is not external, see if it is large. If so, give it a - // larger alignment. - if (TM.getTargetData()->getTypeSize(ElemType) > 128) - Alignment = 4; // 16-byte alignment. - } - } - return Alignment; -} - /// getGlobalLinkName - Returns the asm/link name of of the specified /// global variable. Should be overridden by each target asm printer to /// generate the appropriate value. From dpatel at apple.com Tue Oct 24 15:32:37 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Message-ID: <200610242032.k9OKWbBN017382@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.52 -> 1.53 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+1 -1) AlphaAsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.52 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.53 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.52 Wed Oct 4 22:01:21 2006 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Tue Oct 24 15:32:14 2006 @@ -232,7 +232,7 @@ Constant *C = I->getInitializer(); unsigned Size = TD->getTypeSize(C->getType()); // unsigned Align = TD->getTypeAlignmentShift(C->getType()); - unsigned Align = getPreferredAlignmentLog(I); + unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || From sabre at nondot.org Tue Oct 24 15:32:58 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 24 Oct 2006 15:32:58 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200610242032.k9OKWwom017429@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.406 -> 1.407 --- Log message: Targets should depend on all the intrinsics.td files also, otherwise they will compute a locally wrong numbering for the intrinsics. This fixes a nasty issue where the x86 backend started miscompiling stuff in a 'cvs up'd build after the altivec intrinsics were added. --- Diffs of the changes: (+2 -1) Makefile.rules | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.406 llvm/Makefile.rules:1.407 --- llvm/Makefile.rules:1.406 Fri Sep 29 13:47:13 2006 +++ llvm/Makefile.rules Tue Oct 24 15:32:44 2006 @@ -1129,7 +1129,8 @@ TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \ $(LLVM_SRC_ROOT)/lib/Target/Target.td \ $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td \ - $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) + $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \ + $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td) INCFiles := $(filter %.inc,$(BUILT_SOURCES)) INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp) .PRECIOUS: $(INCTMPFiles) $(INCFiles) From dpatel at apple.com Tue Oct 24 15:32:38 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:38 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h Message-ID: <200610242032.k9OKWcro017387@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.40 -> 1.41 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+6 -0) TargetData.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.40 llvm/include/llvm/Target/TargetData.h:1.41 --- llvm/include/llvm/Target/TargetData.h:1.40 Fri Jun 16 13:21:53 2006 +++ llvm/include/llvm/Target/TargetData.h Tue Oct 24 15:32:14 2006 @@ -31,6 +31,7 @@ class Type; class StructType; class StructLayout; +class GlobalVariable; class TargetData : public ImmutablePass { bool LittleEndian; // Defaults to false @@ -142,6 +143,11 @@ /// removed, this method must be called whenever a StructType is removed to /// avoid a dangling pointer in this cache. void InvalidateStructLayoutInfo(const StructType *Ty) const; + + /// getPreferredAlignmentLog - Return the preferred alignment of the + /// specified global, returned in log form. This includes an explicitly + /// requested alignment (if the global has one). + virtual unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; }; /// StructLayout - used to lazily calculate structure layout information for a From dpatel at apple.com Tue Oct 24 15:32:39 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp X86IntelAsmPrinter.cpp Message-ID: <200610242032.k9OKWdWw017411@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.204 -> 1.205 X86IntelAsmPrinter.cpp updated: 1.61 -> 1.62 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+2 -2) X86AsmPrinter.cpp | 2 +- X86IntelAsmPrinter.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.204 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.205 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.204 Sun Oct 22 16:37:13 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue Oct 24 15:32:14 2006 @@ -139,7 +139,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Size = TD->getTypeSize(C->getType()); - unsigned Align = getPreferredAlignmentLog(I); + unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && /* FIXME: Verify correct */ (I->hasInternalLinkage() || I->hasWeakLinkage() || Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.61 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.62 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.61 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Tue Oct 24 15:32:14 2006 @@ -387,7 +387,7 @@ std::string name = Mang->getValueName(I); Constant *C = I->getInitializer(); unsigned Size = TD->getTypeSize(C->getType()); - unsigned Align = getPreferredAlignmentLog(I); + unsigned Align = TD->getPreferredAlignmentLog(I); bool bCustomSegment = false; switch (I->getLinkage()) { From dpatel at apple.com Tue Oct 24 15:32:39 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:32:39 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200610242032.k9OKWd5m017402@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.54 -> 1.55 --- Log message: Move getPreferredAlignmentLog from AsmPrinter to TargetData --- Diffs of the changes: (+0 -5) AsmPrinter.h | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.54 llvm/include/llvm/CodeGen/AsmPrinter.h:1.55 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.54 Tue Oct 17 12:17:24 2006 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Tue Oct 24 15:32:14 2006 @@ -95,11 +95,6 @@ /// void SwitchToDataSection(const char *NewSection, const GlobalValue *GV); - /// getPreferredAlignmentLog - Return the preferred alignment of the - /// specified global, returned in log form. This includes an explicitly - /// requested alignment (if the global has one). - unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; - /// getGlobalLinkName - Returns the asm/link name of of the specified /// global variable. Should be overridden by each target asm printer to /// generate the appropriate value. From dpatel at apple.com Tue Oct 24 15:48:43 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 24 Oct 2006 15:48:43 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetData.h Message-ID: <200610242048.k9OKmhiw017688@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetData.h updated: 1.41 -> 1.42 --- Log message: TargetData is not subclassed. So no need to have virtual method. --- Diffs of the changes: (+1 -1) TargetData.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetData.h diff -u llvm/include/llvm/Target/TargetData.h:1.41 llvm/include/llvm/Target/TargetData.h:1.42 --- llvm/include/llvm/Target/TargetData.h:1.41 Tue Oct 24 15:32:14 2006 +++ llvm/include/llvm/Target/TargetData.h Tue Oct 24 15:48:29 2006 @@ -147,7 +147,7 @@ /// getPreferredAlignmentLog - Return the preferred alignment of the /// specified global, returned in log form. This includes an explicitly /// requested alignment (if the global has one). - virtual unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; + unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; }; /// StructLayout - used to lazily calculate structure layout information for a From criswell at cs.uiuc.edu Tue Oct 24 16:44:13 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 24 Oct 2006 16:44:13 -0500 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/Macroscopic/DeadFieldElimination.cpp Message-ID: <200610242144.QAA19143@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/Macroscopic: DeadFieldElimination.cpp updated: 1.3 -> 1.4 --- Log message: Updated to newer LLVM API: 1) Changed RegisterOpt to RegisterPass 2) Changed Constant[U|S]Int to ConstantInt --- Diffs of the changes: (+1 -1) DeadFieldElimination.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/Macroscopic/DeadFieldElimination.cpp diff -u llvm-poolalloc/lib/Macroscopic/DeadFieldElimination.cpp:1.3 llvm-poolalloc/lib/Macroscopic/DeadFieldElimination.cpp:1.4 --- llvm-poolalloc/lib/Macroscopic/DeadFieldElimination.cpp:1.3 Wed May 18 14:56:26 2005 +++ llvm-poolalloc/lib/Macroscopic/DeadFieldElimination.cpp Tue Oct 24 16:43:47 2006 @@ -43,7 +43,7 @@ AU.addPreserved(); } }; - RegisterOpt + RegisterPass X("rds-deadfieldelim", "Macroscopic Dead Field Elimination"); } // end anonymous namespace From criswell at cs.uiuc.edu Tue Oct 24 16:44:13 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 24 Oct 2006 16:44:13 -0500 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp PointerCompress.cpp PoolAllocate.cpp PoolOptimize.cpp TransformFunctionBody.cpp Message-ID: <200610242144.QAA19152@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: AccessTrace.cpp updated: 1.5 -> 1.6 PointerCompress.cpp updated: 1.70 -> 1.71 PoolAllocate.cpp updated: 1.125 -> 1.126 PoolOptimize.cpp updated: 1.6 -> 1.7 TransformFunctionBody.cpp updated: 1.56 -> 1.57 --- Log message: Updated to newer LLVM API: 1) Changed RegisterOpt to RegisterPass 2) Changed Constant[U|S]Int to ConstantInt --- Diffs of the changes: (+23 -23) AccessTrace.cpp | 2 +- PointerCompress.cpp | 18 +++++++++--------- PoolAllocate.cpp | 12 ++++++------ PoolOptimize.cpp | 2 +- TransformFunctionBody.cpp | 12 ++++++------ 5 files changed, 23 insertions(+), 23 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp diff -u llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.5 llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6 --- llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.5 Wed Jul 26 10:07:40 2006 +++ llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Tue Oct 24 16:43:50 2006 @@ -45,7 +45,7 @@ PA::FuncInfo *FI, DSGraph &DSG); }; - RegisterOpt + RegisterPass X("poolaccesstrace", "Instrument program to print trace of accesses"); } Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.70 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.71 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.70 Wed Jul 26 10:07:40 2006 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Tue Oct 24 16:43:50 2006 @@ -163,7 +163,7 @@ Function &F, DSGraph &DSG, PA::FuncInfo *FI); }; - RegisterOpt + RegisterPass X("pointercompress", "Compress type-safe data structures"); } @@ -682,11 +682,11 @@ for (unsigned i = 1, e = GEPI.getNumOperands(); i != e; ++i, ++GTI) { Value *Idx = GEPI.getOperand(i); if (const StructType *STy = dyn_cast(*GTI)) { - unsigned Field = (unsigned)cast(Idx)->getValue(); + uint64_t Field = (unsigned)cast(Idx)->getZExtValue(); if (Field) { uint64_t FieldOffs = TD.getStructLayout(cast(NTy)) ->MemberOffsets[Field]; - Constant *FieldOffsCst = ConstantUInt::get(SCALARUINTTYPE, FieldOffs); + Constant *FieldOffsCst = ConstantInt::get(SCALARUINTTYPE, FieldOffs); Val = BinaryOperator::createAdd(Val, FieldOffsCst, GEPI.getName(), &GEPI); } @@ -705,7 +705,7 @@ if (Idx->getType() != SCALARUINTTYPE) Idx = new CastInst(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI); - Constant *Scale = ConstantUInt::get(SCALARUINTTYPE, + Constant *Scale = ConstantInt::get(SCALARUINTTYPE, TD.getTypeSize(ElTy)); Idx = BinaryOperator::createMul(Idx, Scale, "fieldidx", &GEPI); Val = BinaryOperator::createAdd(Val, Idx, GEPI.getName(), &GEPI); @@ -836,11 +836,11 @@ std::vector Ops; Ops.push_back(CI.getOperand(1)); // Transform to pass in the compressed size. - Ops.push_back(ConstantUInt::get(Type::UIntTy, PI->getNewSize())); + Ops.push_back(ConstantInt::get(Type::UIntTy, PI->getNewSize())); // Pointer compression can reduce the alignment restriction to 4 bytes from 8. // Reevaluate the desired alignment. - Ops.push_back(ConstantUInt::get(Type::UIntTy, + Ops.push_back(ConstantInt::get(Type::UIntTy, PA::Heuristic::getRecommendedAlignment(PI->getNewType(), TD))); // TODO: Compression could reduce the alignment restriction for the pool! Value *PB = new CallInst(PtrComp.PoolInitPC, Ops, "", &CI); @@ -880,11 +880,11 @@ if (OldSizeV != PI->getNewSize()) { // Emit code to scale the allocated size down by the old size then up by // the new size. We actually compute (N+OS-1)/OS * NS. - Value *OldSize = ConstantUInt::get(Type::UIntTy, OldSizeV); - Value *NewSize = ConstantUInt::get(Type::UIntTy, PI->getNewSize()); + Value *OldSize = ConstantInt::get(Type::UIntTy, OldSizeV); + Value *NewSize = ConstantInt::get(Type::UIntTy, PI->getNewSize()); Size = BinaryOperator::createAdd(Size, - ConstantUInt::get(Type::UIntTy, OldSizeV-1), + ConstantInt::get(Type::UIntTy, OldSizeV-1), "roundup", &CI); Size = BinaryOperator::createDiv(Size, OldSize, "numnodes", &CI); Size = BinaryOperator::createMul(Size, NewSize, "newbytes", &CI); Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.125 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.126 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.125 Wed Jul 26 10:07:40 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Tue Oct 24 16:43:50 2006 @@ -52,9 +52,9 @@ #endif namespace { - RegisterOpt + RegisterPass X("poolalloc", "Pool allocate disjoint data structures"); - RegisterOpt + RegisterPass Y("poolalloc-passing-all-pools", "Pool allocate disjoint data structures"); Statistic<> NumArgsAdded("poolalloc", "Number of function arguments added"); @@ -523,8 +523,8 @@ while (isa(InsertPt)) ++InsertPt; } - Value *ElSize = ConstantUInt::get(Type::UIntTy, RecSize); - Value *AlignV = ConstantUInt::get(Type::UIntTy, Align); + Value *ElSize = ConstantInt::get(Type::UIntTy, RecSize); + Value *AlignV = ConstantInt::get(Type::UIntTy, Align); new CallInst(PoolInit, make_vector((Value*)GV, ElSize, AlignV, 0), "", InsertPt); ++NumPools; @@ -861,9 +861,9 @@ // Insert the calls to initialize the pool. unsigned ElSizeV = Heuristic::getRecommendedSize(Node); - Value *ElSize = ConstantUInt::get(Type::UIntTy, ElSizeV); + Value *ElSize = ConstantInt::get(Type::UIntTy, ElSizeV); unsigned AlignV = Heuristic::getRecommendedAlignment(Node); - Value *Align = ConstantUInt::get(Type::UIntTy, AlignV); + Value *Align = ConstantInt::get(Type::UIntTy, AlignV); for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) { new CallInst(PoolInit, make_vector((Value*)PD, ElSize, Align, 0), Index: llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.6 llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.7 --- llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.6 Wed Jan 25 16:07:36 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp Tue Oct 24 16:43:50 2006 @@ -26,7 +26,7 @@ bool runOnModule(Module &M); }; - RegisterOpt + RegisterPass X("pooloptimize", "Optimize a pool allocated program"); } Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.56 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.56 Wed Jul 26 10:07:40 2006 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Tue Oct 24 16:43:50 2006 @@ -197,7 +197,7 @@ TargetData &TD = PAInfo.getAnalysis(); Value *AllocSize = - ConstantUInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType())); + ConstantInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType())); if (MI.isArrayAllocation()) AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, @@ -239,7 +239,7 @@ if (PH == 0 || isa(PH)) return; TargetData &TD = PAInfo.getAnalysis(); Value *AllocSize = - ConstantUInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType())); + ConstantInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType())); if (MI.isArrayAllocation()) AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize, @@ -328,8 +328,8 @@ BBI); // We know that the memory returned by poolalloc is at least 4 byte aligned. - new CallInst(MemSet, make_vector(Ptr, ConstantUInt::get(Type::UByteTy, 0), - V2, ConstantUInt::get(Type::UIntTy, 4), 0), + new CallInst(MemSet, make_vector(Ptr, ConstantInt::get(Type::UByteTy, 0), + V2, ConstantInt::get(Type::UIntTy, 4), 0), "", BBI); } @@ -649,8 +649,8 @@ BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin(); Type *VoidPtrTy = PointerType::get(Type::SByteTy); ArgVal = new AllocaInst(ArrayType::get(VoidPtrTy, 16), 0, "PD", InsertPt); - Value *ElSize = ConstantUInt::get(Type::UIntTy,0); - Value *Align = ConstantUInt::get(Type::UIntTy,0); + Value *ElSize = ConstantInt::get(Type::UIntTy,0); + Value *Align = ConstantInt::get(Type::UIntTy,0); new CallInst(PAInfo.PoolInit, make_vector(ArgVal, ElSize, Align, 0),"", TheCall); new CallInst(PAInfo.PoolDestroy, make_vector(ArgVal, 0), "", TheCall->getNext()); From llvm at cs.uiuc.edu Tue Oct 24 18:52:19 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Tue, 24 Oct 2006 18:52:19 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/ Message-ID: <200610242352.k9ONqJaK020872@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: --- Log message: Directory /var/cvs/llvm/llvm-test/SingleSource/UnitTests/SignlessTypes added to the repository --> Using per-directory sticky tag `SignlessTypes' --- Diffs of the changes: (+0 -0) 0 files changed From reid at x10sys.com Tue Oct 24 19:28:03 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Oct 2006 19:28:03 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile div.c Message-ID: <200610250028.k9P0S3To021459@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: Makefile added (r1.1) div.c added (r1.1) --- Log message: Add a unit test directory for testing basic operations affected by the Signless Types feature. This unit tests are aimed at making sure that various InstCombine transforms continue to work correctly after the SignlessTypes feature is implemented. --- Diffs of the changes: (+63 -0) Makefile | 5 +++++ div.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.1 *** /dev/null Tue Oct 24 19:27:58 2006 --- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Tue Oct 24 19:27:48 2006 *************** *** 0 **** --- 1,5 ---- + # SingleSource/UnitTests/Vector/Makefile + LEVEL = ../../.. + + include $(LEVEL)/Makefile.config + include $(LEVEL)/SingleSource/Makefile.singlesrc Index: llvm-test/SingleSource/UnitTests/SignlessTypes/div.c diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.1 *** /dev/null Tue Oct 24 19:28:03 2006 --- llvm-test/SingleSource/UnitTests/SignlessTypes/div.c Tue Oct 24 19:27:48 2006 *************** *** 0 **** --- 1,58 ---- + /* + * This file is used to test division operations in conjunction with + * the Signless Types feature. The DIV instruction was replaced with + * UDIV, SDIV and FDIV instructions. The tests here are aimed at + * triggering InstructionCombining transforms to exercise them and + * ensure they are not altering the computed values. + */ + + #include + + unsigned + udivTest1(unsigned X, unsigned Y) { + + unsigned Tally = 0; + /* 0 / X == 0 */ + Tally += 0 / X; + + /* div X, 1 == X */ + Tally += X / 1; + + /* div X, -1 == -X */ + Tally += X / -1; + + /* div X, (Cond ? 0 : Y) -> div X, Y. */ + Tally += ( X == Y ? 0 : Y ); + Tally += ( X == Y ? ((unsigned)0) : Y ); + + /* div X, (Cond ? Y : 0) -> div X, Y */ + Tally += ( X != Y ? Y : 0 ); + Tally += ( X != Y ? Y : ((unsigned)0) ); + + /* (X / C1) / C2 -> X / (C1*C2) */ + Tally += ( X / 2 ) / 4; + Tally += ( X / ((unsigned)2)) / ((unsigned)4); + + /* X udiv C^2 -> X >> C */ + Tally += X / 4; + Tally += X / ((unsigned)4); + + /* X udiv (C1 << N), where C1 is "1< X >> (N+C2) */ + Tally += X / (4 << Y); + Tally += X / (((unsigned)4) << Y); + + /* udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) */ + Tally += X / (X == Y, 2, 4); + Tally += X / (X == Y, ((unsigned)2), ((unsigned)4)); + + /* -X/C -> X/-C */ + Tally += -X / 2; + Tally += -X / ((unsigned)2); + + return Tally; + } + + int main(int argc, char**argv) { + unsigned result = udivTest1(42, 3); + printf("udivTest1(42,17) = %u\n", udivTest1(42,17)); + } From reid at x10sys.com Tue Oct 24 19:59:15 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 24 Oct 2006 19:59:15 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile div.c Message-ID: <200610250059.k9P0xFTf021968@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: Makefile updated: 1.1 -> 1.2 div.c updated: 1.1 -> 1.2 --- Log message: Fine-grainify the tests so the output will tell us specifically which optimization is failing. --- Diffs of the changes: (+76 -35) Makefile | 2 - div.c | 109 +++++++++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 76 insertions(+), 35 deletions(-) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.1 llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 --- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.1 Tue Oct 24 19:27:48 2006 +++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Tue Oct 24 19:59:01 2006 @@ -1,5 +1,5 @@ # SingleSource/UnitTests/Vector/Makefile LEVEL = ../../.. - +PROG=div include $(LEVEL)/Makefile.config include $(LEVEL)/SingleSource/Makefile.singlesrc Index: llvm-test/SingleSource/UnitTests/SignlessTypes/div.c diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.1 llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.2 --- llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.1 Tue Oct 24 19:27:48 2006 +++ llvm-test/SingleSource/UnitTests/SignlessTypes/div.c Tue Oct 24 19:59:01 2006 @@ -8,51 +8,92 @@ #include -unsigned -udivTest1(unsigned X, unsigned Y) { - - unsigned Tally = 0; +unsigned uDivTest1(unsigned X, unsigned Y) { /* 0 / X == 0 */ - Tally += 0 / X; - + return 0 / X; +} +unsigned uDivTest2(unsigned X, unsigned Y) { /* div X, 1 == X */ - Tally += X / 1; - + return X / 1; +} +unsigned uDivTest3(unsigned X, unsigned Y) { /* div X, -1 == -X */ - Tally += X / -1; - + return X / -1; +} +unsigned uDivTest4(unsigned X, unsigned Y) { /* div X, (Cond ? 0 : Y) -> div X, Y. */ - Tally += ( X == Y ? 0 : Y ); - Tally += ( X == Y ? ((unsigned)0) : Y ); - + return ( X == Y ? 0 : Y ); +} +unsigned uDivTest5(unsigned X, unsigned Y) { + /* div X, (Cond ? 0 : Y) -> div X, Y. */ + return ( X == Y ? ((unsigned)0) : Y ); +} +unsigned uDivTest6(unsigned X, unsigned Y) { /* div X, (Cond ? Y : 0) -> div X, Y */ - Tally += ( X != Y ? Y : 0 ); - Tally += ( X != Y ? Y : ((unsigned)0) ); - + return ( X != Y ? Y : 0 ); +} +unsigned uDivTest7(unsigned X, unsigned Y) { + /* div X, (Cond ? Y : 0) -> div X, Y */ + return ( X != Y ? Y : ((unsigned)0) ); +} +unsigned uDivTest8(unsigned X, unsigned Y) { /* (X / C1) / C2 -> X / (C1*C2) */ - Tally += ( X / 2 ) / 4; - Tally += ( X / ((unsigned)2)) / ((unsigned)4); - + return ( X / 2 ) / 4; +} +unsigned uDivTest9(unsigned X, unsigned Y) { + /* (X / C1) / C2 -> X / (C1*C2) */ + return ( X / ((unsigned)2)) / ((unsigned)4); +} +unsigned uDivTest10(unsigned X, unsigned Y) { /* X udiv C^2 -> X >> C */ - Tally += X / 4; - Tally += X / ((unsigned)4); - + return X / 4; +} +unsigned uDivTest11(unsigned X, unsigned Y) { + /* X udiv C^2 -> X >> C */ + return X / ((unsigned)4); +} +unsigned uDivTest12(unsigned X, unsigned Y) { /* X udiv (C1 << N), where C1 is "1< X >> (N+C2) */ - Tally += X / (4 << Y); - Tally += X / (((unsigned)4) << Y); - + return X / (4 << Y); +} +unsigned uDivTest13(unsigned X, unsigned Y) { + /* X udiv (C1 << N), where C1 is "1< X >> (N+C2) */ + return X / (((unsigned)4) << Y); +} +unsigned uDivTest14(unsigned X, unsigned Y) { /* udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) */ - Tally += X / (X == Y, 2, 4); - Tally += X / (X == Y, ((unsigned)2), ((unsigned)4)); - + return X / (X == Y, 2, 4); +} +unsigned uDivTest15(unsigned X, unsigned Y) { + /* udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) */ + return X / (X == Y, ((unsigned)2), ((unsigned)4)); +} +unsigned uDivTest16(unsigned X, unsigned Y) { /* -X/C -> X/-C */ - Tally += -X / 2; - Tally += -X / ((unsigned)2); - - return Tally; + return -X / 2; +} +unsigned uDivTest17(unsigned X, unsigned Y) { + /* -X/C -> X/-C */ + return -X / ((unsigned)2); } int main(int argc, char**argv) { - unsigned result = udivTest1(42, 3); - printf("udivTest1(42,17) = %u\n", udivTest1(42,17)); + printf("uDivTest1(42,3) = %u\n", uDivTest1(42,3)); + printf("uDivTest2(42,3) = %u\n", uDivTest2(42,3)); + printf("uDivTest3(42,3) = %u\n", uDivTest3(42,3)); + printf("uDivTest4(42,3) = %u\n", uDivTest4(42,3)); + printf("uDivTest5(42,3) = %u\n", uDivTest5(42,3)); + printf("uDivTest6(42,3) = %u\n", uDivTest6(42,3)); + printf("uDivTest7(42,3) = %u\n", uDivTest7(42,3)); + printf("uDivTest8(42,3) = %u\n", uDivTest8(42,3)); + printf("uDivTest9(42,3) = %u\n", uDivTest9(42,3)); + printf("uDivTest10(42,3) = %u\n", uDivTest10(42,3)); + printf("uDivTest11(42,3) = %u\n", uDivTest11(42,3)); + printf("uDivTest12(42,3) = %u\n", uDivTest12(42,3)); + printf("uDivTest13(42,3) = %u\n", uDivTest13(42,3)); + printf("uDivTest14(42,3) = %u\n", uDivTest14(42,3)); + printf("uDivTest15(42,3) = %u\n", uDivTest15(42,3)); + printf("uDivTest16(42,3) = %u\n", uDivTest16(42,3)); + printf("uDivTest17(42,3) = %u\n", uDivTest17(42,3)); + return 0; } From rspencer at reidspencer.com Tue Oct 24 23:33:17 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 24 Oct 2006 21:33:17 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review (Followup) In-Reply-To: References: <1161571843.29146.564.camel@bashful.x10sys.com> Message-ID: <1161750797.6672.113.camel@bashful.x10sys.com> Chris, Here's my InstCombine feedback .. On Mon, 2006-10-23 at 22:52 -0700, Chris Lattner wrote: > > Index: lib/Transforms/Scalar/InstructionCombining.cpp > =================================================================== > RCS > file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/InstructionCombining.cpp,v > retrieving revision 1.527 > diff -t -d -u -p -5 -r1.527 InstructionCombining.cpp > --- lib/Transforms/Scalar/InstructionCombining.cpp 20 Oct 2006 > 18:20:21 -0000 1.527 > +++ lib/Transforms/Scalar/InstructionCombining.cpp 23 Oct 2006 > 02:43:34 -0000 > @@ -1973,15 +1979,15 @@ Instruction *InstCombiner::visitSub(Bina > InsertNewInstBefore(BinaryOperator::createNot(OtherOp, > "B.not"), I); > return BinaryOperator::createAnd(Op0, NewNot); > } > > > // 0 - (X sdiv C) -> (X sdiv -C) > - if (Op1I->getOpcode() == Instruction::Div) > + if (Op1I->getOpcode() == Instruction::SDiv) > if (ConstantInt *CSI = dyn_cast(Op0)) > if (CSI->getType()->isSigned() && CSI->isNullValue()) > if (Constant *DivRHS = > dyn_cast(Op1I->getOperand(1))) > - return BinaryOperator::createDiv(Op1I->getOperand(0), > + return BinaryOperator::createSDiv(Op1I->getOperand(0), > > ConstantExpr::getNeg(DivRHS)); > > > *** You should be able to drop the 'CSI->getType()->isSigned()' check. Yup. Done. > > > > > + // (X / C1) / C2 -> X / (C1*C2) > if (Instruction *LHS = dyn_cast(Op0)) > - if (LHS->getOpcode() == Instruction::Div) > + if (LHS->getOpcode() == Instruction::SDiv || > + LHS->getOpcode()==Instruction::UDiv || > + LHS->getOpcode()==Instruction::FDiv) > > > *** This isn't quite right. This will miscompile ((X sdiv C1) udiv > C2). You want something like: > > > // (X / C1) / C2 -> X / (C1*C2) > if (Instruction *LHS = dyn_cast(Op0)) > if (LHS->getOpcode() == I.getOpcode()) > > > which is also simpler. Right. Done. > > > if (ConstantInt *LHSRHS = > dyn_cast(LHS->getOperand(1))) { > - // (X / C1) / C2 -> X / (C1*C2) > - return BinaryOperator::createDiv(LHS->getOperand(0), > - ConstantExpr::getMul(RHS, > LHSRHS)); > + return BinaryOperator::create( > + Instruction::BinaryOps(LHS->getOpcode()), > LHS->getOperand(0), > + ConstantExpr::getMul(RHS, > LHSRHS)); > } > > > *** If you use I.getOpcode(), you can drop the BinaryOps cast. > > Done. > > > *** Why not have commonIDivTransforms call commonDivTransforms? It > would be nicer to just have: > > > + if (Instruction *Common = commonIDivTransforms(I)) > + return Common; > Done. > > Also, please try to stick with the established style when modifying > existing code. In this case, putting the '*' in the right place, > capitalizing variables, etc. > Old habits die hard. I've had it drilled into my head for decades that putting the * next to the var name is the *wrong* place to put it as the * modifies the type not the var. I'll try to retain style consistency, however. > > + // Check to see if this is an unsigned division with an exact power > of 2, > + // if so, convert to a right shift. > + // X udiv C^2 -> X >> C > + if (ConstantInt *C = dyn_cast(Op1)) { > + if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 > + if (isPowerOf2_64(Val)) { > + uint64_t C = Log2_64(Val); > + return new ShiftInst(Instruction::Shr, Op0, > + ConstantInt::get(Type::UByteTy, C)); > + } > + } > > > *** This will assert and die on something like 'udiv int %C, 64'. You > need to insert casts of the input value and of the output result if > the operands/result is signed. This specific issue goes away when > shifts are split up. Okay. > > > + if (Instruction *RHSI = dyn_cast(I.getOperand(1))) { > + // Turn A / (C1 << N), where C1 is "1<> (N+C2) [udiv > only]. > + if (RHSI->getOpcode() == Instruction::Shl && > + isa(RHSI->getOperand(0)) && > + RHSI->getOperand(0)->getType()->isUnsigned()) { > + uint64_t C1 = > cast(RHSI->getOperand(0))->getZExtValue(); > + if (isPowerOf2_64(C1)) { > + uint64_t C2 = Log2_64(C1); > + Value *Add = RHSI->getOperand(1); > + if (C2) { > + Constant *C2V = ConstantInt::get(Add->getType(), C2); > + Add = InsertNewInstBefore(BinaryOperator::createAdd(Add, > C2V, > + "tmp"), > I); > } > + return new ShiftInst(Instruction::Shr, Op0, Add); > } > } > } > > > *** This code doesn't need to check > 'RHSI->getOperand(0)->getType()->isUnsigned()', but that will make you > have to handle the signed case right (inserting casts). Okay. > > > + // If the sign bits of both operands are zero (i.e. we can prove > they are > + // unsigned inputs), turn this into a udiv. > + uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); > + if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { > + const Type *NTy = Op0->getType()->getUnsignedVersion(); > + Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); > + InsertNewInstBefore(LHS, I); > + Value *RHS; > + if (Constant *R = dyn_cast(Op1)) > + RHS = ConstantExpr::getCast(R, NTy); > + else > + RHS = InsertNewInstBefore(new CastInst(Op1, NTy, > Op1->getName()), I); > + Instruction *Div = BinaryOperator::createUDiv(LHS, RHS, > I.getName()); > + InsertNewInstBefore(Div, I); > + return new CastInst(Div, I.getType()); > + } > > > *** This code gets much simpler now. Try: > > > uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); > if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) > return BinaryOperator::createUDiv(LHS, RHS, I.getName()); actually .. return BinaryOperator::createUDiv(Op0, Op1, I.getName()); but that's just being picky. > The cast sequence *is* needed for converting stuff to shifts etc, > above. I'm not following this comment. What cast sequence? The one where we're trying to turn it into a udiv if the sign bits are zero? If so, that contradicts your simplification for this transform. > > + // Handle div X, Cond?Y:Z > + if (SelectInst *SI = dyn_cast(Op1)) { > + // div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select > are in the > + // same basic block, then we replace the select with Y, and the > condition of > + // the select with false (if the cond value is in the same BB). > If the > + // select has uses other than the div, this allows them to be > simplified > + // also. > + if (Constant *ST = dyn_cast(SI->getOperand(1))) > + if (ST->isNullValue()) { > + Instruction *CondI = > dyn_cast(SI->getOperand(0)); > + if (CondI && CondI->getParent() == I.getParent()) > + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); > + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) > + I.setOperand(1, SI->getOperand(2)); > + else > + UpdateValueUsesWith(SI, SI->getOperand(2)); > + return &I; > + } > + > + // Likewise for: div X, (Cond ? Y : 0) -> div X, Y > + if (Constant *ST = dyn_cast(SI->getOperand(2))) > + if (ST->isNullValue()) { > + Instruction *CondI = > dyn_cast(SI->getOperand(0)); > + if (CondI && CondI->getParent() == I.getParent()) > + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); > + else if (I.getParent() != SI->getParent() || SI->hasOneUse()) > + I.setOperand(1, SI->getOperand(1)); > + else > + UpdateValueUsesWith(SI, SI->getOperand(1)); > + return &I; > + } > + } > > > *** This sequence should be in commonDivTransforms, no? You have > cloned this code in commonIDivTransforms, please merge the two copies. I was trying to preserve order of execution of the tests. I looked into it and it doesn't matter so I merged it. > > > Another significant issue not obvious from your diff is that you left > this hunk of code: > > > // If this is 'udiv X, (Cond ? C1, C2)' where C1&C2 are powers of > two, > // transform this into: '(Cond ? (udiv X, C1) : (udiv X, C2))'. > if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) > if (ConstantInt *SFO = > dyn_cast(SI->getOperand(2))) > if (STO->getType()->isUnsigned() && > SFO->getType()->isUnsigned()) { > // STO == 0 and SFO == 0 handled above. > uint64_t TVA = STO->getZExtValue(), FVA = > SFO->getZExtValue(); > if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { > unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); > Constant *TC = ConstantInt::get(Type::UByteTy, TSA); > Instruction *TSI = new ShiftInst(Instruction::Shr, Op0, > TC, SI->getName()+".t"); > TSI = InsertNewInstBefore(TSI, I); > > > Constant *FC = ConstantInt::get(Type::UByteTy, FSA); > Instruction *FSI = new ShiftInst(Instruction::Shr, Op0, > FC, SI->getName()+".f"); > FSI = InsertNewInstBefore(FSI, I); > return new SelectInst(SI->getOperand(0), TSI, FSI); > } > } > > > in the commonIDivTransforms method, but it is specific to udiv. > Please move it to the udiv case, and make it insert casts etc as > needed. Actually, I think I lost it completely. I don't see this in my file. I added it back to the udiv case as a separate transform. It now checks for the STO==0 and SFO==0 cases because they are no longer "handled above" (the "above" code is in commonDivTransforms). > > > @@ -3720,11 +3803,13 @@ Instruction *InstCombiner::visitXor(Bina > /// MulWithOverflow - Compute Result = In1*In2, returning true if the > result > /// overflowed for this type. > static bool MulWithOverflow(ConstantInt *&Result, ConstantInt *In1, > ConstantInt *In2) { > Result = cast(ConstantExpr::getMul(In1, In2)); > - return !In2->isNullValue() && ConstantExpr::getDiv(Result, In2) != > In1; > + return !In2->isNullValue() && (In2->getType()->isSigned() ? > + ConstantExpr::getSDiv(Result, In2) : > + ConstantExpr::getUDiv(Result, In2)) != In1; > } > > > static bool isPositive(ConstantInt *C) { > return C->getSExtValue() >= 0; > } > > > *** This is subtly buggy. If you look at how MulWithOverflow is used, > it is called from the "Fold: (div X, C1) op C2 -> range check" case. > You need to pass in whether or not the *operation* is signed or > unsigned, ignoring the sign of the values. MulWithOverflow isn't used elsewhere in the file so I merged it into visitSelectCC so its a little more clear what's going on. No point making a function with 4 arguments called from only one place. > > > @@ -4377,11 +4462,12 @@ Instruction *InstCombiner::visitSetCondI > } > } > } > break; > > > - case Instruction::Div: > + case Instruction::SDiv: > + case Instruction::UDiv: > // Fold: (div X, C1) op C2 -> range check > if (ConstantInt *DivRHS = > dyn_cast(LHSI->getOperand(1))) { > // Fold this div into the comparison, producing a range > check. > // Determine, based on the divide type, what the range is > being > // checked. If there is an overflow on the low or high > side, remember > > > *** Likewise, this is extremely buggy. The original code uses > knowledge of the signedness of the operands to determine the > signedness of the comparisons it makes. For example, the code (which > your diff doesn't include) has stuff like: > > > } else if (LHSI->getType()->isUnsigned()) { // udiv > LoBound = Prod; > LoOverflow = ProdOV; > HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, > DivRHS); Changed the else if condition to LHSI->getOpcode() == Instruction::UDiv > > ... this is looking at the type of the operands, not the operation > code, this *must* be fixed. Later it has: > > > else if (HiOverflow) > return new SetCondInst(Instruction::SetGE, X, > LoBound); > else if (LoOverflow) > return new SetCondInst(Instruction::SetLT, X, > HiBound); > > > These create signed/unsigned comparisons where the sign matched the > sign of the operator, because they follow the sign of the operands. > This needs to be fixed to cast the operands to be the same sign as the > sign of the opcode. Okay, I"m not completely following this but I'll look into it in more detail. Reid. From clattner at apple.com Tue Oct 24 23:40:04 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Oct 2006 21:40:04 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review In-Reply-To: <1161709825.6672.59.camel@bashful.x10sys.com> References: <1161571843.29146.564.camel@bashful.x10sys.com> <1161709825.6672.59.camel@bashful.x10sys.com> Message-ID: <4C79FB80-9512-432E-915B-DFA21B18A0C0@apple.com> > >> It would be more clear to return 0 here explicitly and mention in the >> method comment that this returns null if no upgrading is needed. > > Except that's not quite the case. The function can return 0 but alter > the OpCode argument. I'll fix the comment to explain in more detail. Great, thx. >> *** This is flat out incorrect. It should have separate >> execute*DivInst functions that do the operation not based on the >> type. >> This would misinterpret 'udiv int -4, 2' for example. This must be >> fixed before you checkin. >> > Another casualty of thinking the operand types had to match the > instruction type. I've created the three functions. The SDiv case now > looks like: > > static GenericValue executeSDivInst(GenericValue Src1, GenericValue > Src2, > const Type *Ty) { *snip* Looks good. >> *** The CBE has the same problem. You need to force the operands to >> the right sign in the C output so that the C compiler will generate >> the appropriately signed operation. This must be fixed before you >> checkin. > > Yes. Done. I added a writeOperandWithCast(Value*, unsigned opcode) > method to the CWriter. It writes the operand with the correct cast > based > on the opcode the value is used with. I call this instead of > writeOperand(Value*) to write the operands for these binary operators > (just before and after the switch statement you quoted above). Sounds good. Make sure that the result also ends up as the right type though. >> You properly sign/zero extend the values here, but then proceed to do >> the wrong division. For example, this will do signed division for >> 'udiv int -2, 2'. What does the -constfold pass produce for: >> >> >> int %test() { %X = udiv int -2, 2 ret int %X } >> >> >> I bet it is folded to -1, which is incorrect. > > There's no -constfold pass on opt, but I ran it through gccas and yes, > it does produce -1. I fixed it by changing: Sorry, -constprop. > BuiltinType R = >> (BuiltinType)V1->getSExtValue() / (BuiltinType)V2->getSExtValue(); > > to: > > BuiltinType R = (BuiltinType)(V1->getSExtValue() / V2->getSExtValue > ()); > > That produced the value of 2147483647 ((MAX_UINT-1)/2) for your test > case which I think is correct. Please confirm. Sounds right. getSExtValue returns a signed type, forcing a signed operation. You do the same for udiv, right? >> Constant *ConstantExpr::getAnd(Constant *C1, Constant *C2) { >> >> >> *** This would be an excellent place to assert that the arguments are >> integer or fp (or vectors of) as appropriate. > > All of these cases call ConstantExpr::get(Opcode, C1, C2). That > function > provides copious asserts. I didn't think it was reasonable to double > them up, especially since the asserts in ConstantExpr::get are ifdef'd > for debug only. I took that to mean that they were performance > sensitive > for a release+asserts build. Let me know if that's not the case (i.e. > if I should remove the #ifndef DEBUG code in ConstantExpr::get). > > I looked at ConstantExpr::get and tightened up the asserts there. > It was > allowing FP for UDiv and SDiv and integer for FDiv. Now it doesn't. Sounds good! -Chris From rspencer at reidspencer.com Tue Oct 24 23:45:16 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 24 Oct 2006 21:45:16 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review (Followup #2) In-Reply-To: References: <1161571843.29146.564.camel@bashful.x10sys.com> Message-ID: <1161751516.6672.120.camel@bashful.x10sys.com> On Mon, 2006-10-23 at 22:52 -0700, Chris Lattner wrote: > I strongly recommend adding a transformation to instcombine that will > produce more divs with such operands. For example, changing something > like: > > %X = cast uint %A to int > %Y = sdiv int %X, 1234 > %Z = cast int %Y to uint > into: > %Z = sdiv uint %A, 1234 > Fortunately, instcombine already does this for other operations > (mul/add/and/or/xor, etc) at line 5658 of Instcombine in CVS. Please > add a case there for UDIV/SDIV. This will hopefully help flush out > bugs in the patch that I didn't catch. I took a look at doing this but there are corner cases I'm dealing with. If the input is: %X = cast uint %A to int %Y = sdiv int %X, -1234 %Z = cast int %Y to uint then its a little more challenging to make the sdiv work with unsigned operands. So I'm assuming this only works with positive constants. There are other corner cases too, like if the 2nd operand isn't a constant but an instruction. I would rather not risk breaking things now by trying to add a new transform. After implementing all your other suggestions the patch is passing all the tests. Can we implement this later? Reid. From clattner at apple.com Tue Oct 24 23:47:15 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Oct 2006 21:47:15 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review (Followup) In-Reply-To: <1161750797.6672.113.camel@bashful.x10sys.com> References: <1161571843.29146.564.camel@bashful.x10sys.com> <1161750797.6672.113.camel@bashful.x10sys.com> Message-ID: >> Also, please try to stick with the established style when modifying >> existing code. In this case, putting the '*' in the right place, >> capitalizing variables, etc. >> > Old habits die hard. I've had it drilled into my head for decades that > putting the * next to the var name is the *wrong* place to put it > as the > * modifies the type not the var. I'll try to retain style consistency, > however. I agree with the theoretical idea behind that style, but... :) >> The cast sequence *is* needed for converting stuff to shifts etc, >> above. > > I'm not following this comment. What cast sequence? The one where > we're > trying to turn it into a udiv if the sign bits are zero? If so, that > contradicts your simplification for this transform. The specific transform this was attached to get simpler (no casts) but others get temporarily nastier (new casts) until other operations become signless. >> in the commonIDivTransforms method, but it is specific to udiv. >> Please move it to the udiv case, and make it insert casts etc as >> needed. > > Actually, I think I lost it completely. I don't see this in my file. I > added it back to the udiv case as a separate transform. It now checks > for the STO==0 and SFO==0 cases because they are no longer "handled > above" (the "above" code is in commonDivTransforms). Ok. >> *** This is subtly buggy. If you look at how MulWithOverflow is >> used, >> it is called from the "Fold: (div X, C1) op C2 -> range check" case. >> You need to pass in whether or not the *operation* is signed or >> unsigned, ignoring the sign of the values. > > MulWithOverflow isn't used elsewhere in the file so I merged it into > visitSelectCC so its a little more clear what's going on. No point > making a function with 4 arguments called from only one place. Ok, though sometimes names do give useful info to the reader. A comment does just the same though. Thx Reid, -Chris From clattner at apple.com Tue Oct 24 23:49:06 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 24 Oct 2006 21:49:06 -0700 Subject: [llvm-commits] DIV -> U/S/FDiv Patch For Review (Followup #2) In-Reply-To: <1161751516.6672.120.camel@bashful.x10sys.com> References: <1161571843.29146.564.camel@bashful.x10sys.com> <1161751516.6672.120.camel@bashful.x10sys.com> Message-ID: On Oct 24, 2006, at 9:45 PM, Reid Spencer wrote: > On Mon, 2006-10-23 at 22:52 -0700, Chris Lattner wrote: > >> I strongly recommend adding a transformation to instcombine that will >> produce more divs with such operands. For example, changing >> something >> like: >> >> %X = cast uint %A to int >> %Y = sdiv int %X, 1234 >> %Z = cast int %Y to uint >> into: >> %Z = sdiv uint %A, 1234 >> Fortunately, instcombine already does this for other operations >> (mul/add/and/or/xor, etc) at line 5658 of Instcombine in CVS. Please >> add a case there for UDIV/SDIV. This will hopefully help flush out >> bugs in the patch that I didn't catch. > > I took a look at doing this but there are corner cases I'm dealing > with. > If the input is: > > %X = cast uint %A to int > %Y = sdiv int %X, -1234 > %Z = cast int %Y to uint > > then its a little more challenging to make the sdiv work with unsigned > operands. So I'm assuming this only works with positive constants. > There are other corner cases too, like if the 2nd operand isn't a > constant but an instruction. > > I would rather not risk breaking things now by trying to add a new > transform. After implementing all your other suggestions the patch is > passing all the tests. I don't follow. The existing code should transform this into: %Z = sdiv uint %A, 4294966062 This is exactly what you want. "4294966062" treated as a signed value (which is what sdiv does) is -1234. -Chris From sabre at nondot.org Wed Oct 25 11:35:25 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Oct 2006 11:35:25 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/compare_folding.llx Message-ID: <200610251635.k9PGZPjT013547@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: compare_folding.llx updated: 1.3 -> 1.4 --- Log message: Modernize the testcase, allow it to pass on ppc --- Diffs of the changes: (+4 -4) compare_folding.llx | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/test/Regression/CodeGen/X86/compare_folding.llx diff -u llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3 llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.4 --- llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3 Wed Oct 11 20:42:03 2006 +++ llvm/test/Regression/CodeGen/X86/compare_folding.llx Wed Oct 25 11:35:10 2006 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=x86 | grep movsd | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=x86 | grep ucomisd -declare bool %llvm.isunordered(double,double) +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep movsd | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep ucomisd +declare bool %llvm.isunordered.f64(double,double) bool %test1(double %X, double %Y) { ;; Returns isunordered(X,Y) - %COM = call bool %llvm.isunordered(double %X, double %Y) + %COM = call bool %llvm.isunordered.f64(double %X, double %Y) ret bool %COM } From sabre at nondot.org Wed Oct 25 11:38:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Oct 2006 11:38:01 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_ss_load_fold.ll Message-ID: <200610251638.k9PGc1Eo013607@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_ss_load_fold.ll updated: 1.1 -> 1.2 --- Log message: Allow this to pass on ppc --- Diffs of the changes: (+2 -2) vec_ss_load_fold.ll | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/X86/vec_ss_load_fold.ll diff -u llvm/test/Regression/CodeGen/X86/vec_ss_load_fold.ll:1.1 llvm/test/Regression/CodeGen/X86/vec_ss_load_fold.ll:1.2 --- llvm/test/Regression/CodeGen/X86/vec_ss_load_fold.ll:1.1 Wed Oct 11 17:07:38 2006 +++ llvm/test/Regression/CodeGen/X86/vec_ss_load_fold.ll Wed Oct 25 11:37:47 2006 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse | grep minss | grep CPI | wc -l | grep 2 && -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse | grep CPI | not grep movss +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,+sse2 | grep minss | grep CPI | wc -l | grep 2 && +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,+sse2 | grep CPI | not grep movss target endian = little target pointersize = 32 From sabre at nondot.org Wed Oct 25 13:08:28 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Oct 2006 13:08:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp Message-ID: <200610251808.k9PI8SAR015154@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineInstr.cpp updated: 1.126 -> 1.127 --- Log message: be more aggressive about matching identical instructions. --- Diffs of the changes: (+1 -1) MachineInstr.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.126 llvm/lib/CodeGen/MachineInstr.cpp:1.127 --- llvm/lib/CodeGen/MachineInstr.cpp:1.126 Fri Oct 20 17:39:59 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Wed Oct 25 13:08:14 2006 @@ -120,7 +120,7 @@ case MachineOperand::MO_GlobalAddress: return getGlobal() == Other.getGlobal() && getOffset() == Other.getOffset(); case MachineOperand::MO_ExternalSymbol: - return getSymbolName() == Other.getSymbolName() && + return !strcmp(getSymbolName(), Other.getSymbolName()) && getOffset() == Other.getOffset(); } } From sabre at nondot.org Wed Oct 25 13:09:05 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Oct 2006 13:09:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610251809.k9PI95JX015216@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.22 -> 1.23 --- Log message: turn off tail merging for now --- Diffs of the changes: (+2 -0) BranchFolding.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.22 llvm/lib/CodeGen/BranchFolding.cpp:1.23 --- llvm/lib/CodeGen/BranchFolding.cpp:1.22 Mon Oct 23 20:12:32 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Wed Oct 25 13:08:50 2006 @@ -206,6 +206,8 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) { MadeChange = false; + return false; + // Find blocks with no successors. std::vector > MergePotentials; for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { From dpatel at apple.com Wed Oct 25 13:13:46 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 25 Oct 2006 11:13:46 -0700 Subject: [llvm-commits] Linkage patch for llvm-gcc In-Reply-To: <20061024002544.6f6ca79d@asl.dorms.spbu.ru> References: <20061024002544.6f6ca79d@asl.dorms.spbu.ru> Message-ID: <77F00BAE-F976-4420-B70E-C43AF0C7F7D6@apple.com> On Oct 23, 2006, at 1:25 PM, Anton Korobeynikov wrote: > Hello, Everyone > > Please find patch for llvm-gcc4 attached. It fixes linkage setup at > least for mingw32 platform as target. However, I'm worrying it's no so > correct :) Thanks. I applied this patch today. - Devang From dpatel at apple.com Wed Oct 25 13:10:23 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 25 Oct 2006 13:10:23 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkTimeOptimizer.h Message-ID: <200610251810.k9PIANEw015279@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkTimeOptimizer.h updated: 1.10 -> 1.11 --- Log message: Supply alignment info to linker through LLVMSymbol. --- Diffs of the changes: (+4 -2) LinkTimeOptimizer.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/LinkTimeOptimizer.h diff -u llvm/include/llvm/LinkTimeOptimizer.h:1.10 llvm/include/llvm/LinkTimeOptimizer.h:1.11 --- llvm/include/llvm/LinkTimeOptimizer.h:1.10 Tue Oct 24 13:41:02 2006 +++ llvm/include/llvm/LinkTimeOptimizer.h Wed Oct 25 13:10:07 2006 @@ -57,17 +57,19 @@ void mayBeNotUsed(); LLVMSymbol (enum LTOLinkageTypes lt, GlobalValue *g, const std::string &n, - const std::string &m) : linkage(lt), gv(g), name(n), - mangledName(m) {} + const std::string &m, int a) : linkage(lt), gv(g), name(n), + mangledName(m), alignment(a) {} const char *getName() { return name.c_str(); } const char *getMangledName() { return mangledName.c_str(); } + int getAlignment() { return alignment; } private: enum LTOLinkageTypes linkage; GlobalValue *gv; std::string name; std::string mangledName; + int alignment; }; class string_compare { From dpatel at apple.com Wed Oct 25 13:10:22 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 25 Oct 2006 13:10:22 -0500 Subject: [llvm-commits] CVS: llvm/tools/lto/lto.cpp Message-ID: <200610251810.k9PIAMCv015274@zion.cs.uiuc.edu> Changes in directory llvm/tools/lto: lto.cpp updated: 1.23 -> 1.24 --- Log message: Supply alignment info to linker through LLVMSymbol. --- Diffs of the changes: (+12 -6) lto.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.23 llvm/tools/lto/lto.cpp:1.24 --- llvm/tools/lto/lto.cpp:1.23 Tue Oct 24 13:41:02 2006 +++ llvm/tools/lto/lto.cpp Wed Oct 25 13:10:07 2006 @@ -36,6 +36,7 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoadValueNumbering.h" +#include "llvm/Support/MathExtras.h" #include "llvm/LinkTimeOptimizer.h" #include #include @@ -149,8 +150,7 @@ return LTO_READ_FAILURE; // Collect Target info - if (!Target) - getTarget(m); + getTarget(m); if (!Target) return LTO_READ_FAILURE; @@ -166,8 +166,10 @@ if (!f->isExternal() && lt != LTOInternalLinkage && strncmp (f->getName().c_str(), "llvm.", 5)) { + int alignment = ( 16 > f->getAlignment() ? 16 : f->getAlignment()); LLVMSymbol *newSymbol = new LLVMSymbol(lt, f, f->getName(), - mangler.getValueName(f)); + mangler.getValueName(f), + Log2_32(alignment)); symbols[newSymbol->getMangledName()] = newSymbol; allSymbols[newSymbol->getMangledName()] = newSymbol; } @@ -186,8 +188,10 @@ LTOLinkageTypes lt = getLTOLinkageType(v); if (!v->isExternal() && lt != LTOInternalLinkage && strncmp (v->getName().c_str(), "llvm.", 5)) { + const TargetData *TD = Target->getTargetData(); LLVMSymbol *newSymbol = new LLVMSymbol(lt, v, v->getName(), - mangler.getValueName(v)); + mangler.getValueName(v), + TD->getPreferredAlignmentLog(v)); symbols[newSymbol->getMangledName()] = newSymbol; allSymbols[newSymbol->getMangledName()] = newSymbol; @@ -206,6 +210,9 @@ void LTO::getTarget (Module *M) { + if (Target) + return; + std::string Err; const TargetMachineRegistry::Entry* March = TargetMachineRegistry::getClosestStaticTargetForModule(*M, Err); @@ -230,8 +237,7 @@ PassManager Passes; // Collect Target info - if (!Target) - getTarget(M); + getTarget(M); if (!Target) return LTO_NO_TARGET; From isanbard at gmail.com Wed Oct 25 13:36:29 2006 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 25 Oct 2006 13:36:29 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.cpp BugDriver.h CrashDebugger.cpp Message-ID: <200610251836.k9PIaTeO015706@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: BugDriver.cpp updated: 1.48 -> 1.49 BugDriver.h updated: 1.46 -> 1.47 CrashDebugger.cpp updated: 1.49 -> 1.50 --- Log message: Fix for PR960: http://llvm.org/PR960 . Improves bugpoint so that it removes global variable initializers as well. This is only a first pass. It can be slow because it clones the module for each pass. An obvious improvement is not to do that. --- Diffs of the changes: (+110 -23) BugDriver.cpp | 10 ++++ BugDriver.h | 5 ++ CrashDebugger.cpp | 118 +++++++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 110 insertions(+), 23 deletions(-) Index: llvm/tools/bugpoint/BugDriver.cpp diff -u llvm/tools/bugpoint/BugDriver.cpp:1.48 llvm/tools/bugpoint/BugDriver.cpp:1.49 --- llvm/tools/bugpoint/BugDriver.cpp:1.48 Fri Aug 18 03:43:06 2006 +++ llvm/tools/bugpoint/BugDriver.cpp Wed Oct 25 13:36:14 2006 @@ -221,3 +221,13 @@ std::cout << "... <" << Funcs.size() << " total>"; std::cout << std::flush; } + +void llvm::PrintGlobalVariableList(const std::vector &GVs) { + unsigned NumPrint = GVs.size(); + if (NumPrint > 10) NumPrint = 10; + for (unsigned i = 0; i != NumPrint; ++i) + std::cout << " " << GVs[i]->getName(); + if (NumPrint < GVs.size()) + std::cout << "... <" << GVs.size() << " total>"; + std::cout << std::flush; +} Index: llvm/tools/bugpoint/BugDriver.h diff -u llvm/tools/bugpoint/BugDriver.h:1.46 llvm/tools/bugpoint/BugDriver.h:1.47 --- llvm/tools/bugpoint/BugDriver.h:1.46 Fri Sep 15 16:29:15 2006 +++ llvm/tools/bugpoint/BugDriver.h Wed Oct 25 13:36:14 2006 @@ -23,6 +23,7 @@ class PassInfo; class Module; +class GlobalVariable; class Function; class BasicBlock; class AbstractInterpreter; @@ -295,6 +296,10 @@ /// void PrintFunctionList(const std::vector &Funcs); +/// PrintGlobalVariableList - prints out list of problematic global variables +/// +void PrintGlobalVariableList(const std::vector &GVs); + // DeleteFunctionBody - "Remove" the function by deleting all of it's basic // blocks, making it external. // Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.49 llvm/tools/bugpoint/CrashDebugger.cpp:1.50 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.49 Tue Aug 15 11:40:49 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Wed Oct 25 13:36:14 2006 @@ -15,12 +15,12 @@ #include "ToolRunner.h" #include "ListReducer.h" #include "llvm/Constant.h" +#include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/PassManager.h" #include "llvm/SymbolTable.h" -#include "llvm/Type.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bytecode/Writer.h" #include "llvm/Support/CFG.h" @@ -94,7 +94,81 @@ return NoFailure; } +namespace { + /// ReduceCrashingGlobalVariables - This works by removing the global + /// variable's initializer and seeing if the program still crashes. If it + /// does, then we keep that program and try again. + /// + class ReduceCrashingGlobalVariables : public ListReducer { + BugDriver &BD; + bool (*TestFn)(BugDriver &, Module *); + public: + ReduceCrashingGlobalVariables(BugDriver &bd, + bool (*testFn)(BugDriver&, Module*)) + : BD(bd), TestFn(testFn) {} + + virtual TestResult doTest(std::vector& Prefix, + std::vector& Kept) { + if (!Kept.empty() && TestGlobalVariables(Kept)) + return KeepSuffix; + + if (!Prefix.empty() && TestGlobalVariables(Prefix)) + return KeepPrefix; + + return NoFailure; + } + + bool TestGlobalVariables(std::vector& GVs); + }; +} + +bool +ReduceCrashingGlobalVariables::TestGlobalVariables( + std::vector& GVs) { + // Clone the program to try hacking it apart... + Module *M = CloneModule(BD.getProgram()); + + // Convert list to set for fast lookup... + std::set GVSet; + + for (unsigned i = 0, e = GVs.size(); i != e; ++i) { + GlobalVariable* CMGV = M->getNamedGlobal(GVs[i]->getName()); + assert(CMGV && "Global Variable not in module?!"); + GVSet.insert(CMGV); + } + + std::cout << "Checking for crash with only these global variables: "; + PrintGlobalVariableList(GVs); + std::cout << ": "; + + // Loop over and delete any global variables which we aren't supposed to be + // playing with... + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); + I != E; ++I) + if (I->hasInitializer()) { + I->setInitializer(0); + I->setLinkage(GlobalValue::ExternalLinkage); + } + + // Try running the hacked up program... + if (TestFn(BD, M)) { + BD.setNewProgram(M); // It crashed, keep the trimmed version... + + // Make sure to use global variable pointers that point into the now-current + // module. + GVs.assign(GVSet.begin(), GVSet.end()); + return true; + } + + delete M; + return false; +} + namespace llvm { + /// ReduceCrashingFunctions reducer - This works by removing functions and + /// seeing if the program still crashes. If it does, then keep the newer, + /// smaller program. + /// class ReduceCrashingFunctions : public ListReducer { BugDriver &BD; bool (*TestFn)(BugDriver &, Module *); @@ -119,7 +193,8 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { //if main isn't present, claim there is no problem - if (KeepMain && find(Funcs.begin(), Funcs.end(), BD.getProgram()->getMainFunction()) == Funcs.end()) + if (KeepMain && find(Funcs.begin(), Funcs.end(), + BD.getProgram()->getMainFunction()) == Funcs.end()) return false; // Clone the program to try hacking it apart... @@ -277,30 +352,27 @@ /// on a program, try to destructively reduce the program while still keeping /// the predicate true. static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { - // See if we can get away with nuking all of the global variable initializers + // See if we can get away with nuking some of the global variable initializers // in the program... if (BD.getProgram()->global_begin() != BD.getProgram()->global_end()) { - Module *M = CloneModule(BD.getProgram()); - bool DeletedInit = false; - for (Module::global_iterator I = M->global_begin(), E = M->global_end(); I != E; ++I) - if (I->hasInitializer()) { - I->setInitializer(0); - I->setLinkage(GlobalValue::ExternalLinkage); - DeletedInit = true; - } + // Now try to reduce the number of global variable initializers in the + // module to something small. + std::vector GVs; + + for (Module::global_iterator I = BD.getProgram()->global_begin(), + E = BD.getProgram()->global_end(); I != E; ++I) + if (I->hasInitializer()) + GVs.push_back(I); + + if (GVs.size() > 1 && !BugpointIsInterrupted) { + std::cout << "\n*** Attempting to reduce the number of global variables " + << "in the testcase\n"; - if (!DeletedInit) { - delete M; // No change made... - } else { - // See if the program still causes a crash... - std::cout << "\nChecking to see if we can delete global inits: "; - if (TestFn(BD, M)) { // Still crashes? - BD.setNewProgram(M); - std::cout << "\n*** Able to remove all global initializers!\n"; - } else { // No longer crashes? - std::cout << " - Removing all global inits hides problem!\n"; - delete M; - } + unsigned OldSize = GVs.size(); + ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs); + + if (GVs.size() < OldSize) + BD.EmitProgressBytecode("reduced-global-variables"); } } From rspencer at reidspencer.com Wed Oct 25 14:15:50 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 25 Oct 2006 12:15:50 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 Message-ID: <1161803750.32005.17.camel@bashful.x10sys.com> Attached are two patch files to replace the DIV instruction with 3 instructions: SDiv, UDiv, FDiv. The first file patches llvm. The second file patches llvm-gcc4. This is the 2nd attempt to provide the patch. All comments are welcome. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: DIV.patch Type: text/x-patch Size: 150461 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061025/58d91b13/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: DIV-llvmgcc.patch Type: text/x-patch Size: 3381 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061025/58d91b13/attachment-0001.bin From evan.cheng at apple.com Wed Oct 25 15:48:34 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Oct 2006 15:48:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200610252048.k9PKmYAG017947@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.277 -> 1.278 --- Log message: Remove -disable-x86-shuffle-opti --- Diffs of the changes: (+53 -61) X86ISelLowering.cpp | 114 ++++++++++++++++++++++++---------------------------- 1 files changed, 53 insertions(+), 61 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.277 llvm/lib/Target/X86/X86ISelLowering.cpp:1.278 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.277 Fri Oct 20 12:42:20 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Oct 25 15:48:19 2006 @@ -37,9 +37,6 @@ // FIXME: temporary. static cl::opt EnableFastCC("enable-x86-fastcc", cl::Hidden, cl::desc("Enable fastcc on X86")); -static cl::opt NoShuffleOpti("disable-x86-shuffle-opti", cl::Hidden, - cl::desc("Disable vector shuffle optimizations on X86")); - X86TargetLowering::X86TargetLowering(TargetMachine &TM) : TargetLowering(TM) { Subtarget = &TM.getSubtarget(); @@ -3310,7 +3307,7 @@ return SDOperand(); // Special case for single non-zero element. - if (!NoShuffleOpti && NumNonZero == 1) { + if (NumNonZero == 1) { unsigned Idx = CountTrailingZeros_32(NonZeros); SDOperand Item = Op.getOperand(Idx); Item = DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, Item); @@ -3389,7 +3386,7 @@ // FIXME: we can do the same for v4f32 case when we know both parts of // the lower half come from scalar_to_vector (loadf32). We should do // that in post legalizer dag combiner with target specific hooks. - if (!NoShuffleOpti && MVT::isInteger(EVT) && (NonZeros & (0x3 << 2)) == 0) + if (MVT::isInteger(EVT) && (NonZeros & (0x3 << 2)) == 0) return V[0]; MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NumElems); MVT::ValueType EVT = MVT::getVectorBaseType(MaskVT); @@ -3451,52 +3448,49 @@ if (isSplatMask(PermMask.Val)) { if (NumElems <= 4) return Op; // Promote it to a v4i32 splat. - if (!NoShuffleOpti) - return PromoteSplat(Op, DAG); + return PromoteSplat(Op, DAG); } - if (!NoShuffleOpti) { - if (X86::isMOVLMask(PermMask.Val)) - return (V1IsUndef) ? V2 : Op; + if (X86::isMOVLMask(PermMask.Val)) + return (V1IsUndef) ? V2 : Op; - if (X86::isMOVSHDUPMask(PermMask.Val) || - X86::isMOVSLDUPMask(PermMask.Val) || - X86::isMOVHLPSMask(PermMask.Val) || - X86::isMOVHPMask(PermMask.Val) || - X86::isMOVLPMask(PermMask.Val)) - return Op; - - if (ShouldXformToMOVHLPS(PermMask.Val) || - ShouldXformToMOVLP(V1.Val, V2.Val, PermMask.Val)) - return CommuteVectorShuffle(Op, DAG); - - V1IsSplat = isSplatVector(V1.Val); - V2IsSplat = isSplatVector(V2.Val); - if ((V1IsSplat || V1IsUndef) && !(V2IsSplat || V2IsUndef)) { - Op = CommuteVectorShuffle(Op, DAG); - V1 = Op.getOperand(0); - V2 = Op.getOperand(1); - PermMask = Op.getOperand(2); - std::swap(V1IsSplat, V2IsSplat); - std::swap(V1IsUndef, V2IsUndef); - } + if (X86::isMOVSHDUPMask(PermMask.Val) || + X86::isMOVSLDUPMask(PermMask.Val) || + X86::isMOVHLPSMask(PermMask.Val) || + X86::isMOVHPMask(PermMask.Val) || + X86::isMOVLPMask(PermMask.Val)) + return Op; - if (isCommutedMOVL(PermMask.Val, V2IsSplat, V2IsUndef)) { - if (V2IsUndef) return V1; - Op = CommuteVectorShuffle(Op, DAG); - V1 = Op.getOperand(0); - V2 = Op.getOperand(1); - PermMask = Op.getOperand(2); - if (V2IsSplat) { - // V2 is a splat, so the mask may be malformed. That is, it may point - // to any V2 element. The instruction selectior won't like this. Get - // a corrected mask and commute to form a proper MOVS{S|D}. - SDOperand NewMask = getMOVLMask(NumElems, DAG); - if (NewMask.Val != PermMask.Val) - Op = DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, NewMask); - } - return Op; + if (ShouldXformToMOVHLPS(PermMask.Val) || + ShouldXformToMOVLP(V1.Val, V2.Val, PermMask.Val)) + return CommuteVectorShuffle(Op, DAG); + + V1IsSplat = isSplatVector(V1.Val); + V2IsSplat = isSplatVector(V2.Val); + if ((V1IsSplat || V1IsUndef) && !(V2IsSplat || V2IsUndef)) { + Op = CommuteVectorShuffle(Op, DAG); + V1 = Op.getOperand(0); + V2 = Op.getOperand(1); + PermMask = Op.getOperand(2); + std::swap(V1IsSplat, V2IsSplat); + std::swap(V1IsUndef, V2IsUndef); + } + + if (isCommutedMOVL(PermMask.Val, V2IsSplat, V2IsUndef)) { + if (V2IsUndef) return V1; + Op = CommuteVectorShuffle(Op, DAG); + V1 = Op.getOperand(0); + V2 = Op.getOperand(1); + PermMask = Op.getOperand(2); + if (V2IsSplat) { + // V2 is a splat, so the mask may be malformed. That is, it may point + // to any V2 element. The instruction selectior won't like this. Get + // a corrected mask and commute to form a proper MOVS{S|D}. + SDOperand NewMask = getMOVLMask(NumElems, DAG); + if (NewMask.Val != PermMask.Val) + Op = DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, NewMask); } + return Op; } if (X86::isUNPCKL_v_undef_Mask(PermMask.Val) || @@ -3504,26 +3498,24 @@ X86::isUNPCKHMask(PermMask.Val)) return Op; - if (!NoShuffleOpti) { - if (V2IsSplat) { - // Normalize mask so all entries that point to V2 points to its first - // element then try to match unpck{h|l} again. If match, return a - // new vector_shuffle with the corrected mask. - SDOperand NewMask = NormalizeMask(PermMask, DAG); - if (NewMask.Val != PermMask.Val) { - if (X86::isUNPCKLMask(PermMask.Val, true)) { - SDOperand NewMask = getUnpacklMask(NumElems, DAG); - return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, NewMask); - } else if (X86::isUNPCKHMask(PermMask.Val, true)) { - SDOperand NewMask = getUnpackhMask(NumElems, DAG); - return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, NewMask); - } + if (V2IsSplat) { + // Normalize mask so all entries that point to V2 points to its first + // element then try to match unpck{h|l} again. If match, return a + // new vector_shuffle with the corrected mask. + SDOperand NewMask = NormalizeMask(PermMask, DAG); + if (NewMask.Val != PermMask.Val) { + if (X86::isUNPCKLMask(PermMask.Val, true)) { + SDOperand NewMask = getUnpacklMask(NumElems, DAG); + return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, NewMask); + } else if (X86::isUNPCKHMask(PermMask.Val, true)) { + SDOperand NewMask = getUnpackhMask(NumElems, DAG); + return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, NewMask); } } } // Normalize the node to match x86 shuffle ops if needed - if (!NoShuffleOpti && V2.getOpcode() != ISD::UNDEF) + if (V2.getOpcode() != ISD::UNDEF) if (isCommutedSHUFP(PermMask.Val)) { Op = CommuteVectorShuffle(Op, DAG); V1 = Op.getOperand(0); From sabre at nondot.org Wed Oct 25 16:14:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Oct 2006 16:14:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200610252114.k9PLEj0m018408@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.26 -> 1.27 --- Log message: hide symbols properly --- Diffs of the changes: (+1 -1) PredicateSimplifier.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.26 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.27 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.26 Mon Oct 23 19:36:21 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Oct 25 16:14:31 2006 @@ -400,7 +400,7 @@ /// PredicateSimplifier - This class is a simplifier that replaces /// one equivalent variable with another. It also tracks what /// can't be equal and will solve setcc instructions when possible. - class PredicateSimplifier : public FunctionPass { + class VISIBILITY_HIDDEN PredicateSimplifier : public FunctionPass { public: bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const; From evan.cheng at apple.com Wed Oct 25 16:35:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Oct 2006 16:35:19 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrSSE.td Message-ID: <200610252135.k9PLZJI0018812@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrSSE.td updated: 1.165 -> 1.166 --- Log message: X86ISD::PEXTRW 3rd operand type is always target pointer type. --- Diffs of the changes: (+1 -1) X86InstrSSE.td | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.165 llvm/lib/Target/X86/X86InstrSSE.td:1.166 --- llvm/lib/Target/X86/X86InstrSSE.td:1.165 Wed Oct 11 16:05:24 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Wed Oct 25 16:35:05 2006 @@ -1580,7 +1580,7 @@ (ops GR32:$dst, VR128:$src1, i32i8imm:$src2), "pextrw {$src2, $src1, $dst|$dst, $src1, $src2}", [(set GR32:$dst, (X86pextrw (v8i16 VR128:$src1), - (i32 imm:$src2)))]>; + (iPTR imm:$src2)))]>; let isTwoAddress = 1 in { def PINSRWrri : PDIi8<0xC4, MRMSrcReg, (ops VR128:$dst, VR128:$src1, GR32:$src2, i32i8imm:$src3), From evan.cheng at apple.com Wed Oct 25 16:50:05 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Oct 2006 16:50:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200610252150.k9PLo5Zg019111@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.278 -> 1.279 --- Log message: During vector shuffle lowering, we sometimes commute a vector shuffle to try to match MOVL (movss, movsd, etc.). Don't forget to commute it back and try unpck* and shufp* if that doesn't pan out. --- Diffs of the changes: (+21 -21) X86ISelLowering.cpp | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.278 llvm/lib/Target/X86/X86ISelLowering.cpp:1.279 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.278 Wed Oct 25 15:48:19 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Oct 25 16:49:50 2006 @@ -2954,10 +2954,9 @@ /// CommuteVectorShuffle - Swap vector_shuffle operandsas well as /// values in ther permute mask. -static SDOperand CommuteVectorShuffle(SDOperand Op, SelectionDAG &DAG) { - SDOperand V1 = Op.getOperand(0); - SDOperand V2 = Op.getOperand(1); - SDOperand Mask = Op.getOperand(2); +static SDOperand CommuteVectorShuffle(SDOperand Op, SDOperand &V1, + SDOperand &V2, SDOperand &Mask, + SelectionDAG &DAG) { MVT::ValueType VT = Op.getValueType(); MVT::ValueType MaskVT = Mask.getValueType(); MVT::ValueType EltVT = MVT::getVectorBaseType(MaskVT); @@ -2978,8 +2977,9 @@ MaskVec.push_back(DAG.getConstant(Val - NumElems, EltVT)); } + std::swap(V1, V2); Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], MaskVec.size()); - return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V2, V1, Mask); + return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, V1, V2, Mask); } /// ShouldXformToMOVHLPS - Return true if the node should be transformed to @@ -3463,25 +3463,21 @@ if (ShouldXformToMOVHLPS(PermMask.Val) || ShouldXformToMOVLP(V1.Val, V2.Val, PermMask.Val)) - return CommuteVectorShuffle(Op, DAG); + return CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); + bool Commuted = false; V1IsSplat = isSplatVector(V1.Val); V2IsSplat = isSplatVector(V2.Val); if ((V1IsSplat || V1IsUndef) && !(V2IsSplat || V2IsUndef)) { - Op = CommuteVectorShuffle(Op, DAG); - V1 = Op.getOperand(0); - V2 = Op.getOperand(1); - PermMask = Op.getOperand(2); + Op = CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); std::swap(V1IsSplat, V2IsSplat); std::swap(V1IsUndef, V2IsUndef); + Commuted = true; } if (isCommutedMOVL(PermMask.Val, V2IsSplat, V2IsUndef)) { if (V2IsUndef) return V1; - Op = CommuteVectorShuffle(Op, DAG); - V1 = Op.getOperand(0); - V2 = Op.getOperand(1); - PermMask = Op.getOperand(2); + Op = CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); if (V2IsSplat) { // V2 is a splat, so the mask may be malformed. That is, it may point // to any V2 element. The instruction selectior won't like this. Get @@ -3515,13 +3511,17 @@ } // Normalize the node to match x86 shuffle ops if needed - if (V2.getOpcode() != ISD::UNDEF) - if (isCommutedSHUFP(PermMask.Val)) { - Op = CommuteVectorShuffle(Op, DAG); - V1 = Op.getOperand(0); - V2 = Op.getOperand(1); - PermMask = Op.getOperand(2); - } + if (V2.getOpcode() != ISD::UNDEF && isCommutedSHUFP(PermMask.Val)) + Op = CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); + + if (Commuted) { + // Commute is back and try unpck* again. + Op = CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); + if (X86::isUNPCKL_v_undef_Mask(PermMask.Val) || + X86::isUNPCKLMask(PermMask.Val) || + X86::isUNPCKHMask(PermMask.Val)) + return Op; + } // If VT is integer, try PSHUF* first, then SHUFP*. if (MVT::isInteger(VT)) { From evan.cheng at apple.com Wed Oct 25 16:59:14 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 25 Oct 2006 16:59:14 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_shuffle-9.ll Message-ID: <200610252159.k9PLxEJl019284@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_shuffle-9.ll added (r1.1) --- Log message: New shuffle test case. --- Diffs of the changes: (+20 -0) vec_shuffle-9.ll | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm/test/Regression/CodeGen/X86/vec_shuffle-9.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/vec_shuffle-9.ll:1.1 *** /dev/null Wed Oct 25 16:59:10 2006 --- llvm/test/Regression/CodeGen/X86/vec_shuffle-9.ll Wed Oct 25 16:59:00 2006 *************** *** 0 **** --- 1,20 ---- + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 && + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep punpck | wc -l | grep 2 && + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep pextrw + + <4 x int> %test(sbyte** %ptr) { + entry: + %tmp = load sbyte** %ptr + %tmp = cast sbyte* %tmp to float* + %tmp = load float* %tmp + %tmp = insertelement <4 x float> undef, float %tmp, uint 0 + %tmp9 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 + %tmp10 = insertelement <4 x float> %tmp9, float 0.000000e+00, uint 2 + %tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, uint 3 + %tmp21 = cast <4 x float> %tmp11 to <16 x sbyte> + %tmp22 = shufflevector <16 x sbyte> %tmp21, <16 x sbyte> zeroinitializer, <16 x uint> < uint 0, uint 16, uint 1, uint 17, uint 2, uint 18, uint 3, uint 19, uint 4, uint 20, uint 5, uint 21, uint 6, uint 22, uint 7, uint 23 > + %tmp31 = cast <16 x sbyte> %tmp22 to <8 x short> + %tmp = shufflevector <8 x short> zeroinitializer, <8 x short> %tmp31, <8 x uint> < uint 0, uint 8, uint 1, uint 9, uint 2, uint 10, uint 3, uint 11 > + %tmp36 = cast <8 x short> %tmp to <4 x int> + ret <4 x int> %tmp36 + } From sabre at nondot.org Wed Oct 25 17:21:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 25 Oct 2006 17:21:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610252221.k9PMLpfU019964@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.23 -> 1.24 --- Log message: simplify code --- Diffs of the changes: (+1 -1) BranchFolding.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.23 llvm/lib/CodeGen/BranchFolding.cpp:1.24 --- llvm/lib/CodeGen/BranchFolding.cpp:1.23 Wed Oct 25 13:08:50 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Wed Oct 25 17:21:37 2006 @@ -417,7 +417,7 @@ // Otherwise, if it is conditional and has no explicit false block, it falls // through. - return !Cond.empty() && FBB == 0; + return FBB == 0; } /// OptimizeBlock - Analyze and optimize control flow related to the specified From nicholas at mxc.ca Wed Oct 25 18:48:39 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Oct 2006 18:48:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200610252348.k9PNmd3v022125@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.27 -> 1.28 --- Log message: Resurrect r1.25. Fix and comment the "or", "and" and "xor" transformations. --- Diffs of the changes: (+154 -117) PredicateSimplifier.cpp | 271 +++++++++++++++++++++++++++--------------------- 1 files changed, 154 insertions(+), 117 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.27 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.28 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.27 Wed Oct 25 16:14:31 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Oct 25 18:48:24 2006 @@ -41,6 +41,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/InstVisitor.h" #include +#include using namespace llvm; typedef DominatorTree::Node DTNodeType; @@ -74,14 +75,14 @@ return leaders.empty(); } - iterator findLeader(ElemTy e) { + iterator findLeader(ElemTy &e) { typename std::map::iterator MI = mapping.find(e); if (MI == mapping.end()) return 0; return MI->second; } - const_iterator findLeader(ElemTy e) const { + const_iterator findLeader(ElemTy &e) const { typename std::map::const_iterator MI = mapping.find(e); if (MI == mapping.end()) return 0; @@ -116,6 +117,11 @@ // Mutators + void remove(ElemTy &e) { + ElemTy E = e; // The parameter to erase must not be a reference to + mapping.erase(E); // an element contained in the map. + } + /// Combine two sets referring to the same element, inserting the /// elements as needed. Returns a valid iterator iff two already /// existing disjoint synonym sets were combined. The iterator @@ -124,7 +130,7 @@ /// Returns an iterator pointing to the synonym set containing /// element e. If none exists, a new one is created and returned. - iterator findOrInsert(ElemTy e) { + iterator findOrInsert(ElemTy &e) { iterator I = findLeader(e); if (I) return I; @@ -203,6 +209,19 @@ return union_find.empty(); } + void remove(Value *V) { + SynonymIterator I = union_find.findLeader(V); + if (!I) return; + + union_find.remove(V); + + for (PropertyIterator PI = Properties.begin(), PE = Properties.end(); + PI != PE;) { + Property &P = *PI++; + if (P.I1 == I || P.I2 == I) Properties.erase(PI); + } + } + void addEqual(Value *V1, Value *V2) { // If %x = 0. and %y = -0., seteq %x, %y is true, but // copysign(%x) is not the same as copysign(%y). @@ -211,6 +230,10 @@ order(V1, V2); if (isa(V2)) return; // refuse to set false == true. + if (union_find.findLeader(V1) && + union_find.findLeader(V1) == union_find.findLeader(V2)) + return; // no-op + SynonymIterator deleted = union_find.unionSets(V1, V2); if (deleted) { SynonymIterator replacement = union_find.findLeader(V1); @@ -234,7 +257,7 @@ if (isa(V1) && isa(V2)) return; if (findProperty(NE, V1, V2) != Properties.end()) - return; // found. + return; // no-op. // Add the property. SynonymIterator I1 = union_find.findOrInsert(V1), @@ -308,6 +331,73 @@ } } + void addToResolve(Value *V, std::list &WorkList) { + if (!isa(V) && !isa(V)) { + for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); + UI != UE; ++UI) { + if (!isa(*UI) && !isa(*UI)) { + WorkList.push_back(*UI); + } + } + } + } + + void resolve(std::list &WorkList) { + if (WorkList.empty()) return; + + Value *V = WorkList.front(); + WorkList.pop_front(); + + if (empty()) return; + + Instruction *I = dyn_cast(V); + if (!I) return; + + if (BinaryOperator *BO = dyn_cast(I)) { + Value *lhs = canonicalize(BO->getOperand(0)), + *rhs = canonicalize(BO->getOperand(1)); + + ConstantIntegral *CI1 = dyn_cast(lhs), + *CI2 = dyn_cast(rhs); + + if (CI1 && CI2) { + addToResolve(BO, WorkList); + addEqual(BO, ConstantExpr::get(BO->getOpcode(), CI1, CI2)); + } else if (SetCondInst *SCI = dyn_cast(BO)) { + PropertySet::ConstPropertyIterator NE = + findProperty(PropertySet::NE, lhs, rhs); + + if (NE != Properties.end()) { + switch (SCI->getOpcode()) { + case Instruction::SetEQ: + addToResolve(SCI, WorkList); + addEqual(SCI, ConstantBool::getFalse()); + break; + case Instruction::SetNE: + addToResolve(SCI, WorkList); + addEqual(SCI, ConstantBool::getTrue()); + break; + case Instruction::SetLE: + case Instruction::SetGE: + case Instruction::SetLT: + case Instruction::SetGT: + break; + default: + assert(0 && "Unknown opcode in SetCondInst."); + break; + } + } + } + } else if (SelectInst *SI = dyn_cast(I)) { + Value *Condition = canonicalize(SI->getCondition()); + if (ConstantBool *CB = dyn_cast(Condition)) { + addToResolve(SI, WorkList); + addEqual(SI, CB->getValue() ? SI->getTrueValue() : SI->getFalseValue()); + } + } + if (!WorkList.empty()) resolve(WorkList); + } + // Finds the properties implied by an equivalence and adds them too. // Example: ("seteq %a, %b", true, EQ) --> (%a, %b, EQ) // ("seteq %a, %b", false, EQ) --> (%a, %b, NE) @@ -334,38 +424,65 @@ if (V1 == ConstantBool::getFalse()) add(Opcode, BO->getOperand(0), BO->getOperand(1), true); break; - case Instruction::And: - if (V1 == ConstantBool::getTrue()) { - add(Opcode, V1, BO->getOperand(0), false); - add(Opcode, V1, BO->getOperand(1), false); + case Instruction::And: { + // "and int %a, %b" EQ 0xff then %a EQ 0xff and %b EQ 0xff + // "and bool %a, %b" EQ true then %a EQ true and %b EQ true + // "and bool %a, %b" NE false then %a EQ true and %b EQ true + if (ConstantIntegral *CI = dyn_cast(V1)) { + if (Opcode == EQ && CI->isAllOnesValue()) { + addEqual(CI, BO->getOperand(0)); + addEqual(CI, BO->getOperand(1)); + } else if (Opcode == NE && CI == ConstantBool::getFalse()) { + addEqual(ConstantBool::getTrue(), BO->getOperand(0)); + addEqual(ConstantBool::getTrue(), BO->getOperand(1)); + } } - break; - case Instruction::Or: - if (V1 == ConstantBool::getFalse()) { - add(Opcode, V1, BO->getOperand(0), false); - add(Opcode, V1, BO->getOperand(1), false); + } break; + case Instruction::Or: { + // "or int %a, %b" EQ 0 then %a EQ 0 and %b EQ 0 + // "or bool %a, %b" EQ false then %a EQ false and %b EQ false + // "or bool %a, %b" NE true then %a EQ false and %b EQ false + if (ConstantIntegral *CI = dyn_cast(V1)) { + if (Opcode == EQ && CI->isNullValue()) { + addEqual(CI, BO->getOperand(0)); + addEqual(CI, BO->getOperand(1)); + } else if (Opcode == NE && CI == ConstantBool::getTrue()) { + addEqual(ConstantBool::getFalse(), BO->getOperand(0)); + addEqual(ConstantBool::getFalse(), BO->getOperand(1)); + } } - break; - case Instruction::Xor: - if (V1 == ConstantBool::getTrue()) { - if (BO->getOperand(0) == V1) - add(Opcode, ConstantBool::getFalse(), BO->getOperand(1), false); - if (BO->getOperand(1) == V1) - add(Opcode, ConstantBool::getFalse(), BO->getOperand(0), false); + } break; + case Instruction::Xor: { + // "xor bool true, %a" EQ true then %a = false + // "xor bool true, %a" EQ false then %a = true + // "xor bool false, %a" EQ true then %a = true + // "xor bool false, %a" EQ false then %a = false + // 1. Repeat all of the above, with "NE false" in place of + // "EQ true" and "NE true" in place of "EQ false". + // "xor int %c, %a" EQ %c then %a = 0 + // "xor int %c, %a" NE %c then %a != 0 + // 2. Repeat all of the above, with the operands swapped. + + Value *LHS = BO->getOperand(0), *RHS = BO->getOperand(1); + if (!isa(LHS)) std::swap(LHS, RHS); + + if (ConstantBool *CB = dyn_cast(V1)) { + if (ConstantBool *A = dyn_cast(LHS)) { + addEqual(RHS, ConstantBool::get(A->getValue() ^ CB->getValue() + ^ Opcode==NE)); + } } - if (V1 == ConstantBool::getFalse()) { - if (BO->getOperand(0) == ConstantBool::getTrue()) - add(Opcode, ConstantBool::getTrue(), BO->getOperand(1), false); - if (BO->getOperand(1) == ConstantBool::getTrue()) - add(Opcode, ConstantBool::getTrue(), BO->getOperand(0), false); + else if (ConstantIntegral *CI = dyn_cast(V1)) { + if (ConstantIntegral *A = dyn_cast(LHS)) { + if (A == CI) + add(Opcode, RHS, Constant::getNullValue(A->getType()), false); + } } - break; + } break; default: break; } } else if (SelectInst *SI = dyn_cast(V2)) { - if (Opcode != EQ && Opcode != NE) return; - ConstantBool *True = ConstantBool::get(Opcode==EQ), *False = ConstantBool::get(Opcode!=EQ); @@ -373,9 +490,12 @@ addEqual(SI->getCondition(), True); else if (V1 == SI->getFalseValue()) addEqual(SI->getCondition(), False); - else if (Opcode == EQ) - assert("Result of select not equal to either value."); } + + std::list WorkList; + addToResolve(V1, WorkList); + addToResolve(V2, WorkList); + resolve(WorkList); } DominatorTree *DT; @@ -400,32 +520,12 @@ /// PredicateSimplifier - This class is a simplifier that replaces /// one equivalent variable with another. It also tracks what /// can't be equal and will solve setcc instructions when possible. - class VISIBILITY_HIDDEN PredicateSimplifier : public FunctionPass { + class PredicateSimplifier : public FunctionPass { public: bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const; private: - /// Backwards - Try to replace the Use of the instruction with - /// something simpler. This resolves a value by walking backwards - /// through its definition and the operands of that definition to - /// see if any values can now be solved for with the properties - /// that are in effect now, but weren't at definition time. - class Backwards : public InstVisitor { - friend class InstVisitor; - const PropertySet &KP; - - Value &visitSetCondInst(SetCondInst &SCI); - Value &visitBinaryOperator(BinaryOperator &BO); - Value &visitSelectInst(SelectInst &SI); - Value &visitInstruction(Instruction &I); - - public: - explicit Backwards(const PropertySet &KP) : KP(KP) {} - - Value *resolve(Value *V); - }; - /// Forwards - Adds new properties into PropertySet and uses them to /// simplify instructions. Because new properties sometimes apply to /// a transition from one BasicBlock to another, this will use the @@ -540,69 +640,6 @@ AU.addPreservedID(BreakCriticalEdgesID); } -Value &PredicateSimplifier::Backwards::visitSetCondInst(SetCondInst &SCI) { - Value &vBO = visitBinaryOperator(SCI); - if (&vBO != &SCI) return vBO; - - Value *SCI0 = resolve(SCI.getOperand(0)), - *SCI1 = resolve(SCI.getOperand(1)); - - PropertySet::ConstPropertyIterator NE = - KP.findProperty(PropertySet::NE, SCI0, SCI1); - - if (NE != KP.Properties.end()) { - switch (SCI.getOpcode()) { - case Instruction::SetEQ: return *ConstantBool::getFalse(); - case Instruction::SetNE: return *ConstantBool::getTrue(); - case Instruction::SetLE: - case Instruction::SetGE: - case Instruction::SetLT: - case Instruction::SetGT: - break; - default: - assert(0 && "Unknown opcode in SetCondInst."); - break; - } - } - return SCI; -} - -Value &PredicateSimplifier::Backwards::visitBinaryOperator(BinaryOperator &BO) { - Value *V = KP.canonicalize(&BO); - if (V != &BO) return *V; - - Value *lhs = resolve(BO.getOperand(0)), - *rhs = resolve(BO.getOperand(1)); - - ConstantIntegral *CI1 = dyn_cast(lhs), - *CI2 = dyn_cast(rhs); - - if (CI1 && CI2) return *ConstantExpr::get(BO.getOpcode(), CI1, CI2); - - return BO; -} - -Value &PredicateSimplifier::Backwards::visitSelectInst(SelectInst &SI) { - Value *V = KP.canonicalize(&SI); - if (V != &SI) return *V; - - Value *Condition = resolve(SI.getCondition()); - if (ConstantBool *CB = dyn_cast(Condition)) - return *resolve(CB->getValue() ? SI.getTrueValue() : SI.getFalseValue()); - return SI; -} - -Value &PredicateSimplifier::Backwards::visitInstruction(Instruction &I) { - return *KP.canonicalize(&I); -} - -Value *PredicateSimplifier::Backwards::resolve(Value *V) { - if (isa(V) || isa(V) || KP.empty()) return V; - - if (Instruction *I = dyn_cast(V)) return &visit(*I); - return KP.canonicalize(V); -} - void PredicateSimplifier::visitBasicBlock(BasicBlock *BB, PropertySet &KnownProperties) { for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { @@ -613,12 +650,12 @@ void PredicateSimplifier::visitInstruction(Instruction *I, PropertySet &KnownProperties) { // Try to replace the whole instruction. - Backwards resolve(KnownProperties); - Value *V = resolve.resolve(I); + Value *V = KnownProperties.canonicalize(I); if (V != I) { modified = true; ++NumInstruction; DEBUG(std::cerr << "Removing " << *I); + KnownProperties.remove(I); I->replaceAllUsesWith(V); I->eraseFromParent(); return; @@ -627,7 +664,7 @@ // Try to substitute operands. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { Value *Oper = I->getOperand(i); - Value *V = resolve.resolve(Oper); + Value *V = KnownProperties.canonicalize(Oper); if (V != Oper) { modified = true; ++NumVarsReplaced; From nicholas at mxc.ca Wed Oct 25 19:52:12 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Oct 2006 19:52:12 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll Message-ID: <200610260052.k9Q0qCrY023080@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: 2006-10-22-IntOr.ll updated: 1.1 -> 1.2 --- Log message: This testcase was logically wrong! Fixing, and including the test for the mistake that I made in the file too. --- Diffs of the changes: (+24 -3) 2006-10-22-IntOr.ll | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll diff -u llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.1 llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.2 --- llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.1 Sun Oct 22 16:36:41 2006 +++ llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll Wed Oct 25 19:51:58 2006 @@ -1,9 +1,11 @@ -; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg && +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep -c fail | grep 1 && +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep -c pass | grep 1 -int %f(int %x, int %y) { +int %test1(int %x, int %y) { entry: %tmp2 = or int %x, %y ; [#uses=1] - %tmp = setne int %tmp2, 0 ; [#uses=1] + %tmp = seteq int %tmp2, 0 ; [#uses=1] br bool %tmp, label %cond_true, label %return cond_true: ; preds = %entry @@ -18,4 +20,23 @@ ret int 0 } +int %test2(int %x, int %y) { +entry: + %tmp2 = or int %x, %y ; [#uses=1] + %tmp = setne int %tmp2, 0 ; [#uses=1] + br bool %tmp, label %cond_true, label %return + +cond_true: ; preds = %entry + %tmp4 = seteq int %x, 0 ; [#uses=1] + br bool %tmp4, label %cond_true5, label %return + +cond_true5: ; preds = %cond_true + %tmp6 = call int %pass( ) ; [#uses=0] + ret int %tmp6 + +return: ; preds = %cond_next7 + ret int 0 +} + declare int %fail() +declare int %pass() From reid at x10sys.com Wed Oct 25 20:42:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:42:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Makefile Message-ID: <200610260142.k9Q1gbnL024123@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Makefile updated: 1.18 -> 1.19 --- Log message: Make the makefile tell us when Intrinsics.gen is being updated. --- Diffs of the changes: (+3 -1) Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/Makefile diff -u llvm/lib/VMCore/Makefile:1.18 llvm/lib/VMCore/Makefile:1.19 --- llvm/lib/VMCore/Makefile:1.18 Thu Jul 20 14:08:27 2006 +++ llvm/lib/VMCore/Makefile Wed Oct 25 20:42:23 2006 @@ -24,7 +24,9 @@ $(Verb) $(TableGen) $(INTRINSICTD) -o $@ -gen-intrinsic $(GENFILE): $(ObjDir)/Intrinsics.gen.tmp - $(Verb) $(CMP) -s $@ $< || $(CP) $< $@ + $(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \ + $(EchoCmd) Updated Intrinsics.gen because Intrinsics.gen.tmp \ + changed significantly. ) install-local:: $(GENFILE) $(Echo) Installing $(PROJ_includedir)/llvm/Intrinsics.gen From reid at x10sys.com Wed Oct 25 20:58:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:36 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200610260158.k9Q1waee024530@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.272.2.6 -> 1.272.2.7 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+152 -4) Writer.cpp | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 152 insertions(+), 4 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.272.2.6 llvm/lib/Target/CBackend/Writer.cpp:1.272.2.7 --- llvm/lib/Target/CBackend/Writer.cpp:1.272.2.6 Mon Oct 23 13:13:27 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Wed Oct 25 20:58:05 2006 @@ -121,6 +121,8 @@ void writeOperand(Value *Operand); void writeOperandInternal(Value *Operand); + void writeOperandWithCast(Value* Operand, unsigned Opcode); + bool writeInstructionCast(const Instruction &I); private : void lowerIntrinsics(Function &F); @@ -136,6 +138,8 @@ void printLoop(Loop *L); void printConstant(Constant *CPV); + void printConstantWithCast(Constant *CPV, unsigned Opcode); + bool printConstExprCast(const ConstantExpr *CE); void printConstantArray(ConstantArray *CPA); void printConstantPacked(ConstantPacked *CP); @@ -604,7 +608,8 @@ case Instruction::Shl: case Instruction::Shr: Out << '('; - printConstant(CE->getOperand(0)); + bool NeedsClosingParens = printConstExprCast(CE); + printConstantWithCast(CE->getOperand(0), CE->getOpcode()); switch (CE->getOpcode()) { case Instruction::Add: Out << " + "; break; case Instruction::Sub: Out << " - "; break; @@ -628,7 +633,9 @@ case Instruction::Shr: Out << " >> "; break; default: assert(0 && "Illegal opcode here!"); } - printConstant(CE->getOperand(1)); + printConstantWithCast(CE->getOperand(1), CE->getOpcode()); + if (NeedsClosingParens) + Out << "))"; Out << ')'; return; @@ -813,6 +820,71 @@ } } +// Some constant expressions need to be casted back to the original types +// because their operands were casted to the expected type. This function takes +// care of detecting that case and printing the cast for the ConstantExpr. +bool CWriter::printConstExprCast(const ConstantExpr* CE) { + bool Result = false; + const Type* Ty = CE->getOperand(0)->getType(); + switch (CE->getOpcode()) { + case Instruction::UDiv: Result = Ty->isSigned(); break; + case Instruction::SDiv: Result = Ty->isUnsigned(); break; + default: break; + } + if (Result) { + Out << "(("; + printType(Out, Ty); + Out << ")("; + } + return Result; +} + +// Print a constant assuming that it is the operand for a given Opcode. The +// opcodes that care about sign need to cast their operands to the expected +// type before the operation proceeds. This function does the casting. +void CWriter::printConstantWithCast(Constant* CPV, unsigned Opcode) { + + // Extract the operand's type, we'll need it. + const Type* OpTy = CPV->getType(); + + // Indicate whether to do the cast or not. + bool shouldCast = false; + + // Based on the Opcode for which this Constant is being written, determine + // the new type to which the operand should be casted by setting the value + // of OpTy. If we change OpTy, also set shouldCast to true. + switch (Opcode) { + default: + // for most instructions, it doesn't matter + break; + case Instruction::UDiv: + // For UDiv to have unsigned operands + if (OpTy->isSigned()) { + OpTy = OpTy->getUnsignedVersion(); + shouldCast = true; + } + break; + case Instruction::SDiv: + if (OpTy->isUnsigned()) { + OpTy = OpTy->getSignedVersion(); + shouldCast = true; + } + break; + } + + // Write out the casted constnat if we should, otherwise just write the + // operand. + if (shouldCast) { + Out << "(("; + printType(Out, OpTy); + Out << ")"; + printConstant(CPV); + Out << ")"; + } else + writeOperand(CPV); + +} + void CWriter::writeOperandInternal(Value *Operand) { if (Instruction *I = dyn_cast(Operand)) if (isInlinableInst(*I) && !isDirectAlloca(I)) { @@ -841,6 +913,72 @@ Out << ')'; } +// Some instructions need to have their result value casted back to the +// original types because their operands were casted to the expected type. +// This function takes care of detecting that case and printing the cast +// for the Instruction. +bool CWriter::writeInstructionCast(const Instruction &I) { + bool Result = false; + const Type* Ty = I.getOperand(0)->getType(); + switch (I.getOpcode()) { + case Instruction::UDiv: Result = Ty->isSigned(); break; + case Instruction::SDiv: Result = Ty->isUnsigned(); break; + default: break; + } + if (Result) { + Out << "(("; + printType(Out, Ty); + Out << ")("; + } + return Result; +} + +// Write the operand with a cast to another type based on the Opcode being used. +// This will be used in cases where an instruction has specific type +// requirements (usually signedness) for its operands. +void CWriter::writeOperandWithCast(Value* Operand, unsigned Opcode) { + + // Extract the operand's type, we'll need it. + const Type* OpTy = Operand->getType(); + + // Indicate whether to do the cast or not. + bool shouldCast = false; + + // Based on the Opcode for which this Operand is being written, determine + // the new type to which the operand should be casted by setting the value + // of OpTy. If we change OpTy, also set shouldCast to true. + switch (Opcode) { + default: + // for most instructions, it doesn't matter + break; + case Instruction::UDiv: + // For UDiv to have unsigned operands + if (OpTy->isSigned()) { + OpTy = OpTy->getUnsignedVersion(); + shouldCast = true; + } + break; + case Instruction::SDiv: + if (OpTy->isUnsigned()) { + OpTy = OpTy->getSignedVersion(); + shouldCast = true; + } + break; + } + + // Write out the casted operand if we should, otherwise just write the + // operand. + if (shouldCast) { + Out << "(("; + printType(Out, OpTy); + Out << ")"; + writeOperand(Operand); + Out << ")"; + } else + writeOperand(Operand); + +} + // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // @@ -1651,7 +1789,15 @@ writeOperand(I.getOperand(1)); Out << ")"; } else { - writeOperand(I.getOperand(0)); + + // Write out the cast of the instruction's value back to the proper type + // if necessary. + bool NeedsClosingParens = writeInstructionCast(I); + + // Certain instructions require the operand to be forced to a specific type + // so we use writeOperandWithCast here instead of writeOperand. Similarly + // below for operand 1 + writeOperandWithCast(I.getOperand(0), I.getOpcode()); switch (I.getOpcode()) { case Instruction::Add: Out << " + "; break; @@ -1677,7 +1823,9 @@ default: std::cerr << "Invalid operator type!" << I; abort(); } - writeOperand(I.getOperand(1)); + writeOperandWithCast(I.getOperand(1), I.getOpcode()); + if (NeedsClosingParens) + Out << "))"; } if (needsCast) { From reid at x10sys.com Wed Oct 25 20:58:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:36 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610260158.k9Q1wavh024508@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.289.2.6 -> 1.289.2.7 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+6 -8) SelectionDAGISel.cpp | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.6 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.7 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.6 Mon Oct 23 13:13:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Oct 25 20:58:05 2006 @@ -1109,13 +1109,12 @@ SDOperand Op1 = getValue(I.getOperand(0)); SDOperand Op2 = getValue(I.getOperand(1)); - if (Ty->isIntegral()) { - setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); - } else { - const PackedType *PTy = cast(Ty); + if (const PackedType *PTy = dyn_cast(Ty)) { SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy->getElementType())); setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, Typ)); + } else { + setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); } } @@ -1125,13 +1124,12 @@ SDOperand Op1 = getValue(I.getOperand(0)); SDOperand Op2 = getValue(I.getOperand(1)); - if (Ty->isFloatingPoint()) { - setValue(&I, DAG.getNode(FPOp, Op1.getValueType(), Op1, Op2)); - } else { - const PackedType *PTy = cast(Ty); + if (const PackedType *PTy = dyn_cast(Ty)) { SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy->getElementType())); setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, Typ)); + } else { + setValue(&I, DAG.getNode(FPOp, Op1.getValueType(), Op1, Op2)); } } From reid at x10sys.com Wed Oct 25 20:58:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:37 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Message-ID: <200610260158.k9Q1wbKw024547@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.69.2.3 -> 1.69.2.4 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+1 -1) SimplifyLibCalls.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.69.2.3 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.69.2.4 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.69.2.3 Fri Oct 20 03:19:49 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Wed Oct 25 20:58:05 2006 @@ -1275,7 +1275,7 @@ return true; } else if (Op2V == -1.0) { // pow(x,-1.0) -> 1.0/x - BinaryOperator* div_inst= BinaryOperator::createSDiv( + BinaryOperator* div_inst= BinaryOperator::createFDiv( ConstantFP::get(Ty,1.0), base, ci->getName()+".pow", ci); ci->replaceAllUsesWith(div_inst); ci->eraseFromParent(); From reid at x10sys.com Wed Oct 25 20:58:33 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:33 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200610260158.k9Q1wXJh024500@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.198.2.7 -> 1.198.2.8 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+348 -342) Reader.cpp | 690 ++++++++++++++++++++++++++++++------------------------------- 1 files changed, 348 insertions(+), 342 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.7 llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.8 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.7 Mon Oct 23 13:13:26 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Oct 25 20:58:05 2006 @@ -562,10 +562,17 @@ insertValue(AI, getTypeSlot(AI->getType()), FunctionValues); } -/// Convert previous opcode values into the current value and/or construct -/// the instruction. This function handles all *abnormal* cases for instruction -/// generation based on obsolete opcode values. The normal cases are handled -/// in ParseInstruction below. +// Convert previous opcode values into the current value and/or construct +// the instruction. This function handles all *abnormal* cases for instruction +// generation based on obsolete opcode values. The normal cases are handled +// in ParseInstruction below. Generally this function just produces a new +// Opcode value (first argument). In a few cases (VAArg, VANext) the upgrade +// path requies that the instruction (sequence) be generated differently from +// the normal case in order to preserve the original semantics. In these +// cases the result of the function will be a non-zero Instruction pointer. In +// all other cases, zero will be returned indicating that the *normal* +// instruction generation should be used, but with the new Opcode value. +// Instruction* BytecodeReader::handleObsoleteOpcodes( unsigned &Opcode, ///< The old opcode, possibly updated by this function @@ -575,11 +582,21 @@ BasicBlock* BB ///< The basic block to insert into, if we need to ) { - // Declare the resulting instruction we might build. + // First, short circuit this if no conversion is required. When signless + // instructions were implemented the entire opcode sequence was revised so + // we key on this first which means that the opcode value read is the one + // we should use. + if (!hasSignlessInstructions) + return 0; // The opcode is fine the way it is. + + // Declare the resulting instruction we might build. In general we just + // change the Opcode argument but in a few cases we need to generate the + // Instruction here because the upgrade case is significantly different from + // the normal case. Instruction *Result = 0; // If this is a bytecode format that did not include the unreachable - // instruction, bump up the opcode number to adjust + // instruction, bump up the opcode number to adjust it. if (hasNoUnreachableInst) { if (Opcode >= Instruction::Unreachable && Opcode < 62) { // 62 @@ -587,20 +604,15 @@ } } - // First, short circuit this if no conversion is required. When signless - // instructions were implemented the entire opcode sequence was revised so - // we key on this first which means that the opcode value read is the one - // we should use. - if (!hasSignlessInstructions) - return Result; - // We're dealing with an upgrade situation. For each of the opcode values, // perform the necessary conversion. switch (Opcode) { - default: // Pass Through - // If we don't match any of the cases here then the opcode is fine the - // way it is. That will happen for the opcodes > 53 which are the - // volatile load/store, and call/invoke with calling conventions. + default: // Error + // This switch statement provides cases for all known opcodes prior to + // version 6 bytecode format. We know we're in an upgrade situation so + // if there isn't a match in this switch, then something is horribly + // wrong. + error("Unknown obsolete opcode encountered."); break; case 1: // Ret Opcode = Instruction::Ret; @@ -886,12 +898,12 @@ handleObsoleteOpcodes(Opcode, Oprnds, iType, InstTy, BB); // We have enough info to inform the handler now. - if (Handler) Handler->handleInstruction(Opcode, InstTy, Oprnds, At-SaveAt); + if (Handler) + Handler->handleInstruction(Opcode, InstTy, Oprnds, At-SaveAt); // If the backwards compatibility code didn't produce an instruction then // we do the *normal* thing .. if (!Result) { - // First, handle the easy binary operators case if (Opcode >= Instruction::BinaryOpsBegin && Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2) @@ -900,361 +912,355 @@ getValue(iType, Oprnds[1])); // Indicate that we don't think this is a call instruction (yet). - bool isCall = false; - // Process based on the Opcode read switch (Opcode) { - default: // There was an error, this shouldn't happen. - if (Result == 0) - error("Illegal instruction read!"); - break; - case Instruction::VAArg: - if (Oprnds.size() != 2) - error("Invalid VAArg instruction!"); - Result = new VAArgInst(getValue(iType, Oprnds[0]), - getSanitizedType(Oprnds[1])); - break; - case Instruction::ExtractElement: { - if (Oprnds.size() != 2) - error("Invalid extractelement instruction!"); - Value *V1 = getValue(iType, Oprnds[0]); - Value *V2 = getValue(Type::UIntTyID, Oprnds[1]); - - if (!ExtractElementInst::isValidOperands(V1, V2)) - error("Invalid extractelement instruction!"); + default: // There was an error, this shouldn't happen. + if (Result == 0) + error("Illegal instruction read!"); + break; + case Instruction::VAArg: + if (Oprnds.size() != 2) + error("Invalid VAArg instruction!"); + Result = new VAArgInst(getValue(iType, Oprnds[0]), + getSanitizedType(Oprnds[1])); + break; + case Instruction::ExtractElement: { + if (Oprnds.size() != 2) + error("Invalid extractelement instruction!"); + Value *V1 = getValue(iType, Oprnds[0]); + Value *V2 = getValue(Type::UIntTyID, Oprnds[1]); + + if (!ExtractElementInst::isValidOperands(V1, V2)) + error("Invalid extractelement instruction!"); - Result = new ExtractElementInst(V1, V2); - break; - } - case Instruction::InsertElement: { - const PackedType *PackedTy = dyn_cast(InstTy); - if (!PackedTy || Oprnds.size() != 3) - error("Invalid insertelement instruction!"); + Result = new ExtractElementInst(V1, V2); + break; + } + case Instruction::InsertElement: { + const PackedType *PackedTy = dyn_cast(InstTy); + if (!PackedTy || Oprnds.size() != 3) + error("Invalid insertelement instruction!"); + + Value *V1 = getValue(iType, Oprnds[0]); + Value *V2 = getValue(getTypeSlot(PackedTy->getElementType()),Oprnds[1]); + Value *V3 = getValue(Type::UIntTyID, Oprnds[2]); - Value *V1 = getValue(iType, Oprnds[0]); - Value *V2 = getValue(getTypeSlot(PackedTy->getElementType()),Oprnds[1]); - Value *V3 = getValue(Type::UIntTyID, Oprnds[2]); - - if (!InsertElementInst::isValidOperands(V1, V2, V3)) - error("Invalid insertelement instruction!"); - Result = new InsertElementInst(V1, V2, V3); - break; - } - case Instruction::ShuffleVector: { - const PackedType *PackedTy = dyn_cast(InstTy); - if (!PackedTy || Oprnds.size() != 3) - error("Invalid shufflevector instruction!"); - Value *V1 = getValue(iType, Oprnds[0]); - Value *V2 = getValue(iType, Oprnds[1]); - const PackedType *EltTy = - PackedType::get(Type::UIntTy, PackedTy->getNumElements()); - Value *V3 = getValue(getTypeSlot(EltTy), Oprnds[2]); - if (!ShuffleVectorInst::isValidOperands(V1, V2, V3)) - error("Invalid shufflevector instruction!"); - Result = new ShuffleVectorInst(V1, V2, V3); - break; - } - case Instruction::Cast: - if (Oprnds.size() != 2) - error("Invalid Cast instruction!"); - Result = new CastInst(getValue(iType, Oprnds[0]), - getSanitizedType(Oprnds[1])); - break; - case Instruction::Select: - if (Oprnds.size() != 3) - error("Invalid Select instruction!"); - Result = new SelectInst(getValue(Type::BoolTyID, Oprnds[0]), - getValue(iType, Oprnds[1]), - getValue(iType, Oprnds[2])); - break; - case Instruction::PHI: { - if (Oprnds.size() == 0 || (Oprnds.size() & 1)) - error("Invalid phi node encountered!"); - - PHINode *PN = new PHINode(InstTy); - PN->reserveOperandSpace(Oprnds.size()); - for (unsigned i = 0, e = Oprnds.size(); i != e; i += 2) - PN->addIncoming( - getValue(iType, Oprnds[i]), getBasicBlock(Oprnds[i+1])); - Result = PN; - break; - } + if (!InsertElementInst::isValidOperands(V1, V2, V3)) + error("Invalid insertelement instruction!"); + Result = new InsertElementInst(V1, V2, V3); + break; + } + case Instruction::ShuffleVector: { + const PackedType *PackedTy = dyn_cast(InstTy); + if (!PackedTy || Oprnds.size() != 3) + error("Invalid shufflevector instruction!"); + Value *V1 = getValue(iType, Oprnds[0]); + Value *V2 = getValue(iType, Oprnds[1]); + const PackedType *EltTy = + PackedType::get(Type::UIntTy, PackedTy->getNumElements()); + Value *V3 = getValue(getTypeSlot(EltTy), Oprnds[2]); + if (!ShuffleVectorInst::isValidOperands(V1, V2, V3)) + error("Invalid shufflevector instruction!"); + Result = new ShuffleVectorInst(V1, V2, V3); + break; + } + case Instruction::Cast: + if (Oprnds.size() != 2) + error("Invalid Cast instruction!"); + Result = new CastInst(getValue(iType, Oprnds[0]), + getSanitizedType(Oprnds[1])); + break; + case Instruction::Select: + if (Oprnds.size() != 3) + error("Invalid Select instruction!"); + Result = new SelectInst(getValue(Type::BoolTyID, Oprnds[0]), + getValue(iType, Oprnds[1]), + getValue(iType, Oprnds[2])); + break; + case Instruction::PHI: { + if (Oprnds.size() == 0 || (Oprnds.size() & 1)) + error("Invalid phi node encountered!"); + + PHINode *PN = new PHINode(InstTy); + PN->reserveOperandSpace(Oprnds.size()); + for (unsigned i = 0, e = Oprnds.size(); i != e; i += 2) + PN->addIncoming( + getValue(iType, Oprnds[i]), getBasicBlock(Oprnds[i+1])); + Result = PN; + break; + } - case Instruction::Shl: - case Instruction::Shr: - Result = new ShiftInst(Instruction::OtherOps(Opcode), - getValue(iType, Oprnds[0]), - getValue(Type::UByteTyID, Oprnds[1])); - break; - case Instruction::Ret: - if (Oprnds.size() == 0) - Result = new ReturnInst(); - else if (Oprnds.size() == 1) - Result = new ReturnInst(getValue(iType, Oprnds[0])); - else - error("Unrecognized instruction!"); - break; - - case Instruction::Br: - if (Oprnds.size() == 1) - Result = new BranchInst(getBasicBlock(Oprnds[0])); - else if (Oprnds.size() == 3) - Result = new BranchInst(getBasicBlock(Oprnds[0]), - getBasicBlock(Oprnds[1]), getValue(Type::BoolTyID , Oprnds[2])); - else - error("Invalid number of operands for a 'br' instruction!"); - break; - case Instruction::Switch: { - if (Oprnds.size() & 1) - error("Switch statement with odd number of arguments!"); - - SwitchInst *I = new SwitchInst(getValue(iType, Oprnds[0]), - getBasicBlock(Oprnds[1]), - Oprnds.size()/2-1); - for (unsigned i = 2, e = Oprnds.size(); i != e; i += 2) - I->addCase(cast(getValue(iType, Oprnds[i])), - getBasicBlock(Oprnds[i+1])); - Result = I; - break; - } + case Instruction::Shl: + case Instruction::Shr: + Result = new ShiftInst(Instruction::OtherOps(Opcode), + getValue(iType, Oprnds[0]), + getValue(Type::UByteTyID, Oprnds[1])); + break; + case Instruction::Ret: + if (Oprnds.size() == 0) + Result = new ReturnInst(); + else if (Oprnds.size() == 1) + Result = new ReturnInst(getValue(iType, Oprnds[0])); + else + error("Unrecognized instruction!"); + break; - case 58: // Call with extra operand for calling conv - case 59: // tail call, Fast CC - case 60: // normal call, Fast CC - case 61: // tail call, C Calling Conv - case Instruction::Call: { // Normal Call, C Calling Convention - if (Oprnds.size() == 0) - error("Invalid call instruction encountered!"); + case Instruction::Br: + if (Oprnds.size() == 1) + Result = new BranchInst(getBasicBlock(Oprnds[0])); + else if (Oprnds.size() == 3) + Result = new BranchInst(getBasicBlock(Oprnds[0]), + getBasicBlock(Oprnds[1]), getValue(Type::BoolTyID , Oprnds[2])); + else + error("Invalid number of operands for a 'br' instruction!"); + break; + case Instruction::Switch: { + if (Oprnds.size() & 1) + error("Switch statement with odd number of arguments!"); + + SwitchInst *I = new SwitchInst(getValue(iType, Oprnds[0]), + getBasicBlock(Oprnds[1]), + Oprnds.size()/2-1); + for (unsigned i = 2, e = Oprnds.size(); i != e; i += 2) + I->addCase(cast(getValue(iType, Oprnds[i])), + getBasicBlock(Oprnds[i+1])); + Result = I; + break; + } + case 58: // Call with extra operand for calling conv + case 59: // tail call, Fast CC + case 60: // normal call, Fast CC + case 61: // tail call, C Calling Conv + case Instruction::Call: { // Normal Call, C Calling Convention + if (Oprnds.size() == 0) + error("Invalid call instruction encountered!"); - Value *F = getValue(iType, Oprnds[0]); + Value *F = getValue(iType, Oprnds[0]); - unsigned CallingConv = CallingConv::C; - bool isTailCall = false; + unsigned CallingConv = CallingConv::C; + bool isTailCall = false; - if (Opcode == 61 || Opcode == 59) - isTailCall = true; - - if (Opcode == 58) { - isTailCall = Oprnds.back() & 1; - CallingConv = Oprnds.back() >> 1; - Oprnds.pop_back(); - } else if (Opcode == 59 || Opcode == 60) { - CallingConv = CallingConv::Fast; - } - - // Check to make sure we have a pointer to function type - const PointerType *PTy = dyn_cast(F->getType()); - if (PTy == 0) error("Call to non function pointer value!"); - const FunctionType *FTy = dyn_cast(PTy->getElementType()); - if (FTy == 0) error("Call to non function pointer value!"); - - std::vector Params; - if (!FTy->isVarArg()) { - FunctionType::param_iterator It = FTy->param_begin(); - - for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { - if (It == FTy->param_end()) - error("Invalid call instruction!"); - Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); - } - if (It != FTy->param_end()) - error("Invalid call instruction!"); - } else { - Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); + if (Opcode == 61 || Opcode == 59) + isTailCall = true; + + if (Opcode == 58) { + isTailCall = Oprnds.back() & 1; + CallingConv = Oprnds.back() >> 1; + Oprnds.pop_back(); + } else if (Opcode == 59 || Opcode == 60) { + CallingConv = CallingConv::Fast; + } + + // Check to make sure we have a pointer to function type + const PointerType *PTy = dyn_cast(F->getType()); + if (PTy == 0) error("Call to non function pointer value!"); + const FunctionType *FTy = dyn_cast(PTy->getElementType()); + if (FTy == 0) error("Call to non function pointer value!"); + + std::vector Params; + if (!FTy->isVarArg()) { + FunctionType::param_iterator It = FTy->param_begin(); - unsigned FirstVariableOperand; - if (Oprnds.size() < FTy->getNumParams()) - error("Call instruction missing operands!"); + for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { + if (It == FTy->param_end()) + error("Invalid call instruction!"); + Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); + } + if (It != FTy->param_end()) + error("Invalid call instruction!"); + } else { + Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); - // Read all of the fixed arguments - for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) - Params.push_back( - getValue(getTypeSlot(FTy->getParamType(i)),Oprnds[i])); + unsigned FirstVariableOperand; + if (Oprnds.size() < FTy->getNumParams()) + error("Call instruction missing operands!"); - FirstVariableOperand = FTy->getNumParams(); + // Read all of the fixed arguments + for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) + Params.push_back( + getValue(getTypeSlot(FTy->getParamType(i)),Oprnds[i])); - if ((Oprnds.size()-FirstVariableOperand) & 1) - error("Invalid call instruction!"); // Must be pairs of type/value + FirstVariableOperand = FTy->getNumParams(); - for (unsigned i = FirstVariableOperand, e = Oprnds.size(); - i != e; i += 2) - Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); - } + if ((Oprnds.size()-FirstVariableOperand) & 1) + error("Invalid call instruction!"); // Must be pairs of type/value - Result = new CallInst(F, Params); - if (isTailCall) cast(Result)->setTailCall(); - if (CallingConv) cast(Result)->setCallingConv(CallingConv); - break; + for (unsigned i = FirstVariableOperand, e = Oprnds.size(); + i != e; i += 2) + Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); } - case 56: // Invoke with encoded CC - case 57: // Invoke Fast CC - case Instruction::Invoke: { // Invoke C CC - if (Oprnds.size() < 3) - error("Invalid invoke instruction!"); - Value *F = getValue(iType, Oprnds[0]); - // Check to make sure we have a pointer to function type - const PointerType *PTy = dyn_cast(F->getType()); - if (PTy == 0) - error("Invoke to non function pointer value!"); - const FunctionType *FTy = dyn_cast(PTy->getElementType()); - if (FTy == 0) - error("Invoke to non function pointer value!"); - - std::vector Params; - BasicBlock *Normal, *Except; - unsigned CallingConv = CallingConv::C; - - if (Opcode == 57) - CallingConv = CallingConv::Fast; - else if (Opcode == 56) { - CallingConv = Oprnds.back(); - Oprnds.pop_back(); - } + Result = new CallInst(F, Params); + if (isTailCall) cast(Result)->setTailCall(); + if (CallingConv) cast(Result)->setCallingConv(CallingConv); + break; + } + case 56: // Invoke with encoded CC + case 57: // Invoke Fast CC + case Instruction::Invoke: { // Invoke C CC + if (Oprnds.size() < 3) + error("Invalid invoke instruction!"); + Value *F = getValue(iType, Oprnds[0]); + + // Check to make sure we have a pointer to function type + const PointerType *PTy = dyn_cast(F->getType()); + if (PTy == 0) + error("Invoke to non function pointer value!"); + const FunctionType *FTy = dyn_cast(PTy->getElementType()); + if (FTy == 0) + error("Invoke to non function pointer value!"); + + std::vector Params; + BasicBlock *Normal, *Except; + unsigned CallingConv = CallingConv::C; + + if (Opcode == 57) + CallingConv = CallingConv::Fast; + else if (Opcode == 56) { + CallingConv = Oprnds.back(); + Oprnds.pop_back(); + } - if (!FTy->isVarArg()) { - Normal = getBasicBlock(Oprnds[1]); - Except = getBasicBlock(Oprnds[2]); - - FunctionType::param_iterator It = FTy->param_begin(); - for (unsigned i = 3, e = Oprnds.size(); i != e; ++i) { - if (It == FTy->param_end()) - error("Invalid invoke instruction!"); - Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); - } - if (It != FTy->param_end()) + if (!FTy->isVarArg()) { + Normal = getBasicBlock(Oprnds[1]); + Except = getBasicBlock(Oprnds[2]); + + FunctionType::param_iterator It = FTy->param_begin(); + for (unsigned i = 3, e = Oprnds.size(); i != e; ++i) { + if (It == FTy->param_end()) error("Invalid invoke instruction!"); - } else { - Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); - - Normal = getBasicBlock(Oprnds[0]); - Except = getBasicBlock(Oprnds[1]); + Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); + } + if (It != FTy->param_end()) + error("Invalid invoke instruction!"); + } else { + Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); - unsigned FirstVariableArgument = FTy->getNumParams()+2; - for (unsigned i = 2; i != FirstVariableArgument; ++i) - Params.push_back(getValue(getTypeSlot(FTy->getParamType(i-2)), - Oprnds[i])); + Normal = getBasicBlock(Oprnds[0]); + Except = getBasicBlock(Oprnds[1]); - // Must be type/value pairs. If not, error out. - if (Oprnds.size()-FirstVariableArgument & 1) - error("Invalid invoke instruction!"); + unsigned FirstVariableArgument = FTy->getNumParams()+2; + for (unsigned i = 2; i != FirstVariableArgument; ++i) + Params.push_back(getValue(getTypeSlot(FTy->getParamType(i-2)), + Oprnds[i])); - for (unsigned i = FirstVariableArgument; i < Oprnds.size(); i += 2) - Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); - } + // Must be type/value pairs. If not, error out. + if (Oprnds.size()-FirstVariableArgument & 1) + error("Invalid invoke instruction!"); - Result = new InvokeInst(F, Normal, Except, Params); - if (CallingConv) cast(Result)->setCallingConv(CallingConv); - break; - } - case Instruction::Malloc: { - unsigned Align = 0; - if (Oprnds.size() == 2) - Align = (1 << Oprnds[1]) >> 1; - else if (Oprnds.size() > 2) - error("Invalid malloc instruction!"); - if (!isa(InstTy)) - error("Invalid malloc instruction!"); - - Result = new MallocInst(cast(InstTy)->getElementType(), - getValue(Type::UIntTyID, Oprnds[0]), Align); - break; + for (unsigned i = FirstVariableArgument; i < Oprnds.size(); i += 2) + Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); } - case Instruction::Alloca: { - unsigned Align = 0; - if (Oprnds.size() == 2) - Align = (1 << Oprnds[1]) >> 1; - else if (Oprnds.size() > 2) - error("Invalid alloca instruction!"); - if (!isa(InstTy)) - error("Invalid alloca instruction!"); - - Result = new AllocaInst(cast(InstTy)->getElementType(), - getValue(Type::UIntTyID, Oprnds[0]), Align); - break; - } - case Instruction::Free: - if (!isa(InstTy)) - error("Invalid free instruction!"); - Result = new FreeInst(getValue(iType, Oprnds[0])); - break; - case Instruction::GetElementPtr: { - if (Oprnds.size() == 0 || !isa(InstTy)) + Result = new InvokeInst(F, Normal, Except, Params); + if (CallingConv) cast(Result)->setCallingConv(CallingConv); + break; + } + case Instruction::Malloc: { + unsigned Align = 0; + if (Oprnds.size() == 2) + Align = (1 << Oprnds[1]) >> 1; + else if (Oprnds.size() > 2) + error("Invalid malloc instruction!"); + if (!isa(InstTy)) + error("Invalid malloc instruction!"); + + Result = new MallocInst(cast(InstTy)->getElementType(), + getValue(Type::UIntTyID, Oprnds[0]), Align); + break; + } + case Instruction::Alloca: { + unsigned Align = 0; + if (Oprnds.size() == 2) + Align = (1 << Oprnds[1]) >> 1; + else if (Oprnds.size() > 2) + error("Invalid alloca instruction!"); + if (!isa(InstTy)) + error("Invalid alloca instruction!"); + + Result = new AllocaInst(cast(InstTy)->getElementType(), + getValue(Type::UIntTyID, Oprnds[0]), Align); + break; + } + case Instruction::Free: + if (!isa(InstTy)) + error("Invalid free instruction!"); + Result = new FreeInst(getValue(iType, Oprnds[0])); + break; + case Instruction::GetElementPtr: { + if (Oprnds.size() == 0 || !isa(InstTy)) + error("Invalid getelementptr instruction!"); + + std::vector Idx; + + const Type *NextTy = InstTy; + for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { + const CompositeType *TopTy = dyn_cast_or_null(NextTy); + if (!TopTy) error("Invalid getelementptr instruction!"); - std::vector Idx; - - const Type *NextTy = InstTy; - for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { - const CompositeType *TopTy = dyn_cast_or_null(NextTy); - if (!TopTy) - error("Invalid getelementptr instruction!"); - - unsigned ValIdx = Oprnds[i]; - unsigned IdxTy = 0; - if (!hasRestrictedGEPTypes) { - // Struct indices are always uints, sequential type indices can be - // any of the 32 or 64-bit integer types. The actual choice of - // type is encoded in the low two bits of the slot number. - if (isa(TopTy)) - IdxTy = Type::UIntTyID; - else { - switch (ValIdx & 3) { - default: - case 0: IdxTy = Type::UIntTyID; break; - case 1: IdxTy = Type::IntTyID; break; - case 2: IdxTy = Type::ULongTyID; break; - case 3: IdxTy = Type::LongTyID; break; - } - ValIdx >>= 2; + unsigned ValIdx = Oprnds[i]; + unsigned IdxTy = 0; + if (!hasRestrictedGEPTypes) { + // Struct indices are always uints, sequential type indices can be + // any of the 32 or 64-bit integer types. The actual choice of + // type is encoded in the low two bits of the slot number. + if (isa(TopTy)) + IdxTy = Type::UIntTyID; + else { + switch (ValIdx & 3) { + default: + case 0: IdxTy = Type::UIntTyID; break; + case 1: IdxTy = Type::IntTyID; break; + case 2: IdxTy = Type::ULongTyID; break; + case 3: IdxTy = Type::LongTyID; break; } - } else { - IdxTy = isa(TopTy) ? Type::UByteTyID : Type::LongTyID; + ValIdx >>= 2; } + } else { + IdxTy = isa(TopTy) ? Type::UByteTyID : Type::LongTyID; + } - Idx.push_back(getValue(IdxTy, ValIdx)); - - // Convert ubyte struct indices into uint struct indices. - if (isa(TopTy) && hasRestrictedGEPTypes) - if (ConstantInt *C = dyn_cast(Idx.back())) - if (C->getType() == Type::UByteTy) - Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy); + Idx.push_back(getValue(IdxTy, ValIdx)); - NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); - } + // Convert ubyte struct indices into uint struct indices. + if (isa(TopTy) && hasRestrictedGEPTypes) + if (ConstantInt *C = dyn_cast(Idx.back())) + if (C->getType() == Type::UByteTy) + Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy); - Result = new GetElementPtrInst(getValue(iType, Oprnds[0]), Idx); - break; + NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); } - case 62: // volatile load - case Instruction::Load: - if (Oprnds.size() != 1 || !isa(InstTy)) - error("Invalid load instruction!"); - Result = new LoadInst(getValue(iType, Oprnds[0]), "", Opcode == 62); - break; - - case 63: // volatile store - case Instruction::Store: { - if (!isa(InstTy) || Oprnds.size() != 2) - error("Invalid store instruction!"); - - Value *Ptr = getValue(iType, Oprnds[1]); - const Type *ValTy = cast(Ptr->getType())->getElementType(); - Result = new StoreInst(getValue(getTypeSlot(ValTy), Oprnds[0]), Ptr, - Opcode == 63); - break; - } - case Instruction::Unwind: - if (Oprnds.size() != 0) error("Invalid unwind instruction!"); - Result = new UnwindInst(); - break; - case Instruction::Unreachable: - if (Oprnds.size() != 0) error("Invalid unreachable instruction!"); - Result = new UnreachableInst(); - break; - } // end switch(Opcode) + Result = new GetElementPtrInst(getValue(iType, Oprnds[0]), Idx); + break; + } + case 62: // volatile load + case Instruction::Load: + if (Oprnds.size() != 1 || !isa(InstTy)) + error("Invalid load instruction!"); + Result = new LoadInst(getValue(iType, Oprnds[0]), "", Opcode == 62); + break; + case 63: // volatile store + case Instruction::Store: { + if (!isa(InstTy) || Oprnds.size() != 2) + error("Invalid store instruction!"); + + Value *Ptr = getValue(iType, Oprnds[1]); + const Type *ValTy = cast(Ptr->getType())->getElementType(); + Result = new StoreInst(getValue(getTypeSlot(ValTy), Oprnds[0]), Ptr, + Opcode == 63); + break; + } + case Instruction::Unwind: + if (Oprnds.size() != 0) error("Invalid unwind instruction!"); + Result = new UnwindInst(); + break; + case Instruction::Unreachable: + if (Oprnds.size() != 0) error("Invalid unreachable instruction!"); + Result = new UnreachableInst(); + break; + } // end switch(Opcode) } // end if *normal* BB->getInstList().push_back(Result); @@ -1622,7 +1628,7 @@ } } -// Upgrade obsolte constant expression opcodes (ver. 5 and prior) to the new +// Upgrade obsolete constant expression opcodes (ver. 5 and prior) to the new // values used after ver 6. bytecode format. The operands are provided to the // function so that decisions based on the operand type can be made when // auto-upgrading obsolete opcodes to the new ones. @@ -2652,7 +2658,7 @@ // FALL THROUGH - case 6: // SignlessTypes Implementation (1.10 release) + case 6: // SignlessTypes Implementation (1.9 release) break; default: From reid at x10sys.com Wed Oct 25 20:58:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:37 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200610260158.k9Q1wb9E024554@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.520.2.9 -> 1.520.2.10 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+185 -165) InstructionCombining.cpp | 350 ++++++++++++++++++++++++----------------------- 1 files changed, 185 insertions(+), 165 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.9 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.10 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.9 Mon Oct 23 13:13:27 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 25 20:58:05 2006 @@ -1987,7 +1987,7 @@ // 0 - (X sdiv C) -> (X sdiv -C) if (Op1I->getOpcode() == Instruction::SDiv) if (ConstantInt *CSI = dyn_cast(Op0)) - if (CSI->getType()->isSigned() && CSI->isNullValue()) + if (CSI->isNullValue()) if (Constant *DivRHS = dyn_cast(Op1I->getOperand(1))) return BinaryOperator::createSDiv(Op1I->getOperand(0), ConstantExpr::getNeg(DivRHS)); @@ -2169,53 +2169,21 @@ Instruction* InstCombiner::commonDivTransforms(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - if (isa(Op0)) // undef / X -> 0 + // undef / X -> 0 + if (isa(Op0)) return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); - if (isa(Op1)) - return ReplaceInstUsesWith(I, Op1); // X / undef -> undef - return 0; -} - -Instruction* InstCombiner::commonIDivTransforms(BinaryOperator &I) { - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - - if (ConstantInt *RHS = dyn_cast(Op1)) { - // div X, 1 == X - if (RHS->equalsInt(1)) - return ReplaceInstUsesWith(I, Op0); - - // div X, -1 == -X - if (RHS->isAllOnesValue()) - return BinaryOperator::createNeg(Op0); - - // (X / C1) / C2 -> X / (C1*C2) - if (Instruction *LHS = dyn_cast(Op0)) - if (LHS->getOpcode() == Instruction::SDiv || - LHS->getOpcode()==Instruction::UDiv || - LHS->getOpcode()==Instruction::FDiv) - if (ConstantInt *LHSRHS = dyn_cast(LHS->getOperand(1))) { - return BinaryOperator::create( - Instruction::BinaryOps(LHS->getOpcode()), LHS->getOperand(0), - ConstantExpr::getMul(RHS, LHSRHS)); - } - if (!RHS->isNullValue()) { // avoid X udiv 0 - if (SelectInst *SI = dyn_cast(Op0)) - if (Instruction *R = FoldOpIntoSelect(I, SI, this)) - return R; - if (isa(Op0)) - if (Instruction *NV = FoldOpIntoPhi(I)) - return NV; - } - } + // X / undef -> undef + if (isa(Op1)) + return ReplaceInstUsesWith(I, Op1); - // Handle div X, Cond?Y:Z + // Handle cases involving: div X, (select Cond, Y, Z) if (SelectInst *SI = dyn_cast(Op1)) { // div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select are in the - // same basic block, then we replace the select with Y, and the condition of - // the select with false (if the cond value is in the same BB). If the + // same basic block, then we replace the select with Y, and the condition + // of the select with false (if the cond value is in the same BB). If the // select has uses other than the div, this allows them to be simplified - // also. + // also. Note that div X, Y is just as good as div X, 0 (undef) if (Constant *ST = dyn_cast(SI->getOperand(1))) if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); @@ -2227,6 +2195,7 @@ UpdateValueUsesWith(SI, SI->getOperand(2)); return &I; } + // Likewise for: div X, (Cond ? Y : 0) -> div X, Y if (Constant *ST = dyn_cast(SI->getOperand(2))) if (ST->isNullValue()) { @@ -2239,28 +2208,38 @@ UpdateValueUsesWith(SI, SI->getOperand(1)); return &I; } + } - // If this is 'udiv X, (Cond ? C1, C2)' where C1&C2 are powers of two, - // transform this into: '(Cond ? (udiv X, C1) : (udiv X, C2))'. - if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) - if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) - if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { - // STO == 0 and SFO == 0 handled above. - uint64_t TVA = STO->getZExtValue(), FVA = SFO->getZExtValue(); - if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { - unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); - Constant *TC = ConstantInt::get(Type::UByteTy, TSA); - Instruction *TSI = new ShiftInst(Instruction::Shr, Op0, - TC, SI->getName()+".t"); - TSI = InsertNewInstBefore(TSI, I); - - Constant *FC = ConstantInt::get(Type::UByteTy, FSA); - Instruction *FSI = new ShiftInst(Instruction::Shr, Op0, - FC, SI->getName()+".f"); - FSI = InsertNewInstBefore(FSI, I); - return new SelectInst(SI->getOperand(0), TSI, FSI); - } + return 0; +} + +Instruction* InstCombiner::commonIDivTransforms(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + if (Instruction *Common = commonDivTransforms(I)) + return Common; + + if (ConstantInt *RHS = dyn_cast(Op1)) { + // div X, 1 == X + if (RHS->equalsInt(1)) + return ReplaceInstUsesWith(I, Op0); + + // (X / C1) / C2 -> X / (C1*C2) + if (Instruction *LHS = dyn_cast(Op0)) + if (Instruction::BinaryOps(LHS->getOpcode()) == I.getOpcode()) + if (ConstantInt *LHSRHS = dyn_cast(LHS->getOperand(1))) { + return BinaryOperator::create(I.getOpcode(), LHS->getOperand(0), + ConstantExpr::getMul(RHS, LHSRHS)); } + + if (!RHS->isNullValue()) { // avoid X udiv 0 + if (SelectInst *SI = dyn_cast(Op0)) + if (Instruction *R = FoldOpIntoSelect(I, SI, this)) + return R; + if (isa(Op0)) + if (Instruction *NV = FoldOpIntoPhi(I)) + return NV; + } } // 0 / X == 0, we don't need to preserve faults! @@ -2274,60 +2253,107 @@ Instruction *InstCombiner::visitUDiv(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - Instruction* common = commonDivTransforms(I); - if (common) - return common; - - common = commonIDivTransforms(I); - if (common) - return common; + // Handle the integer div common cases + if (Instruction *Common = commonIDivTransforms(I)) + return Common; + // X udiv C^2 -> X >> C // Check to see if this is an unsigned division with an exact power of 2, // if so, convert to a right shift. - // X udiv C^2 -> X >> C if (ConstantInt *C = dyn_cast(Op1)) { if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 if (isPowerOf2_64(Val)) { - uint64_t C = Log2_64(Val); - return new ShiftInst(Instruction::Shr, Op0, - ConstantInt::get(Type::UByteTy, C)); + uint64_t ShiftAmt = Log2_64(Val); + Value* X = Op0; + const Type* XTy = X->getType(); + bool isSigned = XTy->isSigned(); + if (isSigned) + X = InsertNewInstBefore( + new CastInst(X, XTy->getUnsignedVersion(),"tmp"), I); + Instruction* Result = + new ShiftInst(Instruction::Shr, X, + ConstantInt::get(Type::UByteTy, ShiftAmt)); + if (!isSigned) + return Result; + InsertNewInstBefore(Result, I); + return new CastInst(Result, XTy->getSignedVersion(), I.getName()); } } - if (Instruction *RHSI = dyn_cast(I.getOperand(1))) { - // Turn A / (C1 << N), where C1 is "1<> (N+C2) [udiv only]. + // X udiv (C1 << N), where C1 is "1< X >> (N+C2) + if (ShiftInst *RHSI = dyn_cast(I.getOperand(1))) { if (RHSI->getOpcode() == Instruction::Shl && - isa(RHSI->getOperand(0)) && - RHSI->getOperand(0)->getType()->isUnsigned()) { + isa(RHSI->getOperand(0))) { uint64_t C1 = cast(RHSI->getOperand(0))->getZExtValue(); if (isPowerOf2_64(C1)) { - uint64_t C2 = Log2_64(C1); - Value *Add = RHSI->getOperand(1); - if (C2) { - Constant *C2V = ConstantInt::get(Add->getType(), C2); - Add = InsertNewInstBefore(BinaryOperator::createAdd(Add, C2V, - "tmp"), I); + Value *N = RHSI->getOperand(1); + const Type* NTy = N->getType(); + bool isSigned = NTy->isSigned(); + if (uint64_t C2 = Log2_64(C1)) { + if (isSigned) { + NTy = NTy->getUnsignedVersion(); + N = InsertNewInstBefore(new CastInst(N, NTy, "tmp"), I); + } + Constant *C2V = ConstantInt::get(NTy, C2); + N = InsertNewInstBefore(BinaryOperator::createAdd(N, C2V, "tmp"), I); } - return new ShiftInst(Instruction::Shr, Op0, Add); + Instruction* Result = new ShiftInst(Instruction::Shr, Op0, N); + if (!isSigned) + return Result; + InsertNewInstBefore(Result, I); + return new CastInst(Result, NTy->getSignedVersion(), I.getName()); } } } + // udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) + // where C1&C2 are powers of two. + if (SelectInst *SI = dyn_cast(Op1)) { + if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) + if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) + if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) + if (!STO->isNullValue() && !STO->isNullValue()) { + uint64_t TVA = STO->getZExtValue(), FVA = SFO->getZExtValue(); + if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { + // Compute the shift amounts + unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); + // Make sure we get the unsigned version of X + Value* X = Op0; + if (X->getType()->isSigned()) + X = InsertNewInstBefore( + new CastInst(X, X->getType()->getUnsignedVersion()), I); + // Construct the "on true" case of the select + Constant *TC = ConstantInt::get(Type::UByteTy, TSA); + Instruction *TSI = + new ShiftInst(Instruction::Shr, X, TC, SI->getName()+".t"); + TSI = InsertNewInstBefore(TSI, I); + + // Construct the "on false" case of the select + Constant *FC = ConstantInt::get(Type::UByteTy, FSA); + Instruction *FSI = + new ShiftInst(Instruction::Shr, X, FC, SI->getName()+".f"); + FSI = InsertNewInstBefore(FSI, I); + + // Finally, construct the select instruction and return it. + return new SelectInst(SI->getOperand(0), TSI, FSI); + } + } + } return 0; } Instruction *InstCombiner::visitSDiv(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - Instruction* common = commonDivTransforms(I); - if (common) - return common; - - common = commonIDivTransforms(I); - if (common) - return common; + // Handle the integer div common cases + if (Instruction *Common = commonIDivTransforms(I)) + return Common; if (ConstantInt *RHS = dyn_cast(Op1)) { + // sdiv X, -1 == -X + if (RHS->isAllOnesValue()) + return BinaryOperator::createNeg(Op0); + // -X/C -> X/-C if (Value *LHSNeg = dyn_castNegVal(Op0)) return BinaryOperator::createSDiv(LHSNeg, ConstantExpr::getNeg(RHS)); @@ -2337,17 +2363,7 @@ // unsigned inputs), turn this into a udiv. uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { - const Type *NTy = Op0->getType()->getUnsignedVersion(); - Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); - InsertNewInstBefore(LHS, I); - Value *RHS; - if (Constant *R = dyn_cast(Op1)) - RHS = ConstantExpr::getCast(R, NTy); - else - RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); - Instruction *Div = BinaryOperator::createUDiv(LHS, RHS, I.getName()); - InsertNewInstBefore(Div, I); - return new CastInst(Div, I.getType()); + return BinaryOperator::createUDiv(Op0, Op1, I.getName()); } return 0; @@ -2356,44 +2372,7 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - Instruction* common = commonDivTransforms(I); - if (common) - return common; - - // Handle div X, Cond?Y:Z - if (SelectInst *SI = dyn_cast(Op1)) { - // div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select are in the - // same basic block, then we replace the select with Y, and the condition of - // the select with false (if the cond value is in the same BB). If the - // select has uses other than the div, this allows them to be simplified - // also. - if (Constant *ST = dyn_cast(SI->getOperand(1))) - if (ST->isNullValue()) { - Instruction *CondI = dyn_cast(SI->getOperand(0)); - if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::getFalse()); - else if (I.getParent() != SI->getParent() || SI->hasOneUse()) - I.setOperand(1, SI->getOperand(2)); - else - UpdateValueUsesWith(SI, SI->getOperand(2)); - return &I; - } - - // Likewise for: div X, (Cond ? Y : 0) -> div X, Y - if (Constant *ST = dyn_cast(SI->getOperand(2))) - if (ST->isNullValue()) { - Instruction *CondI = dyn_cast(SI->getOperand(0)); - if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::getTrue()); - else if (I.getParent() != SI->getParent() || SI->hasOneUse()) - I.setOperand(1, SI->getOperand(1)); - else - UpdateValueUsesWith(SI, SI->getOperand(1)); - return &I; - } - } - - return 0; + return commonDivTransforms(I); } /// GetFactor - If we can prove that the specified value is at least a multiple @@ -3887,16 +3866,6 @@ return Changed ? &I : 0; } -/// MulWithOverflow - Compute Result = In1*In2, returning true if the result -/// overflowed for this type. -static bool MulWithOverflow(ConstantInt *&Result, ConstantInt *In1, - ConstantInt *In2) { - Result = cast(ConstantExpr::getMul(In1, In2)); - return !In2->isNullValue() && (In2->getType()->isSigned() ? - ConstantExpr::getSDiv(Result, In2) : - ConstantExpr::getUDiv(Result, In2)) != In1; -} - static bool isPositive(ConstantInt *C) { return C->getSExtValue() >= 0; } @@ -4298,7 +4267,9 @@ } } - + // Since the RHS is a constantInt (CI), if the left hand side is an + // instruction, see if that instruction also has constants so that the + // instruction can be folded into the setcc if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { case Instruction::And: @@ -4553,26 +4524,57 @@ case Instruction::SDiv: case Instruction::UDiv: - // Fold: (div X, C1) op C2 -> range check + // Fold: setcc ([us]div X, C1), C2 -> range test + // Fold this div into the comparison, producing a range check. + // Determine, based on the divide type, what the range is being + // checked. If there is an overflow on the low or high side, remember + // it, otherwise compute the range [low, hi) bounding the new value. + // See: InsertRangeTest above for the kinds of replacements possible. if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { - // Fold this div into the comparison, producing a range check. - // Determine, based on the divide type, what the range is being - // checked. If there is an overflow on the low or high side, remember - // it, otherwise compute the range [low, hi) bounding the new value. - bool LoOverflow = false, HiOverflow = 0; + // FIXME: If the operand types don't match the type of the divide + // then don't attempt this transform. The code below doesn't have the + // logic to deal with a signed divide and an unsigned compare (and + // vice versa). This is because (x /s C1) getType(); + unsigned DivOpCode = LHSI->getOpcode(); + if ((DivOpCode == Instruction::SDiv && DivRHSTy->isUnsigned()) || + (DivOpCode == Instruction::UDiv && DivRHSTy->isSigned())) + break; + + // Initialize the variables that will indicate the nature of the + // range check. + bool LoOverflow = false, HiOverflow = false; ConstantInt *LoBound = 0, *HiBound = 0; - ConstantInt *Prod; - bool ProdOV = MulWithOverflow(Prod, CI, DivRHS); + // Compute Prod = CI * DivRHS. We are essentially solving an equation + // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and + // C2 (CI). By solving for X we can turn this into a range check + // instead of computing a divide. + ConstantInt *Prod = + cast(ConstantExpr::getMul(CI, DivRHS)); + + // Determine if the product overflows by seeing if the product is + // not equal to the divide. Make sure we do the same kind of divide + // as in the LHS instruction that we're folding. + bool ProdOV = !DivRHS->isNullValue() && + (DivOpCode == Instruction::SDiv ? + ConstantExpr::getSDiv(Prod, DivRHS) : + ConstantExpr::getUDiv(Prod, DivRHS)) != CI; + // Get the SetCC opcode Instruction::BinaryOps Opcode = I.getOpcode(); - if (DivRHS->isNullValue()) { // Don't hack on divide by zeros. - } else if (LHSI->getType()->isUnsigned()) { // udiv + if (DivRHS->isNullValue()) { + // Don't hack on divide by zeros! + } else if (DivOpCode == Instruction::UDiv) { // udiv LoBound = Prod; LoOverflow = ProdOV; HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, DivRHS); - } else if (isPositive(DivRHS)) { // Divisor is > 0. + } else if (isPositive(DivRHS)) { // Divisor is > 0. if (CI->isNullValue()) { // (X / pos) op 0 // Can't overflow. LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); @@ -4588,12 +4590,12 @@ HiBound = Prod; HiOverflow = ProdOV; } - } else { // Divisor is < 0. + } else { // Divisor is < 0. if (CI->isNullValue()) { // (X / neg) op 0 LoBound = AddOne(DivRHS); HiBound = cast(ConstantExpr::getNeg(DivRHS)); if (HiBound == DivRHS) - LoBound = 0; // - INTMIN = INTMIN + LoBound = 0; // - INTMIN = INTMIN } else if (isPositive(CI)) { // (X / neg) op pos HiOverflow = LoOverflow = ProdOV; if (!LoOverflow) @@ -5790,7 +5792,8 @@ unsigned SrcBitSize = Src->getType()->getPrimitiveSizeInBits(); unsigned DestBitSize = CI.getType()->getPrimitiveSizeInBits(); assert(SrcBitSize < DestBitSize && "Not a zext?"); - Constant *C = ConstantInt::get(Type::ULongTy, (1 << SrcBitSize)-1); + Constant *C = + ConstantInt::get(Type::ULongTy, (1ULL << SrcBitSize)-1); C = ConstantExpr::getCast(C, CI.getType()); return BinaryOperator::createAnd(Res, C); } @@ -5838,6 +5841,23 @@ ConstantInt::get(CI.getType(), 1)); } break; + case Instruction::SDiv: + case Instruction::UDiv: + // If we are just changing the sign, rewrite. + if (DestBitSize == SrcBitSize) { + // Don't insert two casts if they cannot be eliminated. We allow two + // casts to be inserted if the sizes are the same. This could only be + // converting signedness, which is a noop. + if (!ValueRequiresCast(Op1, DestTy,TD) || + !ValueRequiresCast(Op0, DestTy, TD)) { + Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); + Value *Op1c = InsertOperandCastBefore(Op1, DestTy, SrcI); + return BinaryOperator::create( + cast(SrcI)->getOpcode(), Op0c, Op1c); + } + } + break; + case Instruction::Shl: // Allow changing the sign of the source operand. Do not allow changing // the size of the shift, UNLESS the shift amount is a constant. We From reid at x10sys.com Wed Oct 25 20:58:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:37 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instructions.cpp Message-ID: <200610260158.k9Q1wbAC024544@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.93.2.8 -> 1.93.2.9 Constants.cpp updated: 1.163.2.9 -> 1.163.2.10 Instructions.cpp updated: 1.42.2.6 -> 1.42.2.7 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+73 -22) ConstantFolding.cpp | 28 ++++++++++++---------------- Constants.cpp | 34 ++++++++++++++++++++++++++++++---- Instructions.cpp | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 22 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.8 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.9 --- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.8 Mon Oct 23 13:13:27 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Wed Oct 25 20:58:05 2006 @@ -531,30 +531,27 @@ if (V2->isAllOnesValue() && // MIN_INT / -1 (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) return 0; - BuiltinType R = - (BuiltinType)V1->getZExtValue() / (BuiltinType)V2->getZExtValue(); + BuiltinType R = BuiltinType(V1->getZExtValue() / V2->getZExtValue()); return ConstantInt::get(*Ty, R); } - static Constant *URem(const ConstantInt *V1, - const ConstantInt *V2) { - if (V2->isNullValue()) return 0; // X / 0 + static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) { + if (V2->isNullValue()) + return 0; if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) + (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) return 0; - BuiltinType R = - (BuiltinType)V1->getZExtValue() % (BuiltinType)V2->getZExtValue(); + BuiltinType R = BuiltinType(V1->getSExtValue() / V2->getSExtValue()); return ConstantInt::get(*Ty, R); } - static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) { - if (V2->isNullValue()) - return 0; + static Constant *URem(const ConstantInt *V1, + const ConstantInt *V2) { + if (V2->isNullValue()) return 0; // X / 0 if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) + (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) return 0; - BuiltinType R = - (BuiltinType)V1->getSExtValue() / (BuiltinType)V2->getSExtValue(); + BuiltinType R = BuiltinType(V1->getZExtValue() % V2->getZExtValue()); return ConstantInt::get(*Ty, R); } @@ -564,8 +561,7 @@ if (V2->isAllOnesValue() && // MIN_INT / -1 (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) return 0; - BuiltinType R = - (BuiltinType)V1->getSExtValue() % (BuiltinType)V2->getSExtValue(); + BuiltinType R = BuiltinType(V1->getSExtValue() % V2->getSExtValue()); return ConstantInt::get(*Ty, R); } Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.163.2.9 llvm/lib/VMCore/Constants.cpp:1.163.2.10 --- llvm/lib/VMCore/Constants.cpp:1.163.2.9 Mon Oct 23 13:13:27 2006 +++ llvm/lib/VMCore/Constants.cpp Wed Oct 25 20:58:05 2006 @@ -1421,15 +1421,41 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) { #ifndef NDEBUG switch (Opcode) { - case Instruction::Add: case Instruction::Sub: - case Instruction::URem: case Instruction::SRem: case Instruction::FRem: - case Instruction::Mul: case Instruction::UDiv: - case Instruction::SDiv: case Instruction::FDiv: + case Instruction::Add: + case Instruction::Sub: + case Instruction::Mul: assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() || isa(C1->getType())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; + case Instruction::UDiv: + case Instruction::SDiv: + assert(C1->getType() == C2->getType() && "Op types should be identical!"); + assert((C1->getType()->isInteger() || (isa(C1->getType()) && + cast(C1->getType())->getElementType()->isInteger())) && + "Tried to create an arithmetic operation on a non-arithmetic type!"); + break; + case Instruction::FDiv: + assert(C1->getType() == C2->getType() && "Op types should be identical!"); + assert((C1->getType()->isFloatingPoint() || (isa(C1->getType()) + && cast(C1->getType())->getElementType()->isFloatingPoint())) + && "Tried to create an arithmetic operation on a non-arithmetic type!"); + break; + case Instruction::URem: + case Instruction::SRem: + assert(C1->getType() == C2->getType() && "Op types should be identical!"); + assert((C1->getType()->isInteger() || (isa(C1->getType()) && + cast(C1->getType())->getElementType()->isInteger())) && + "Tried to create an arithmetic operation on a non-arithmetic type!"); + break; + case Instruction::FRem: + assert(C1->getType() == C2->getType() && "Op types should be identical!"); + assert((C1->getType()->isFloatingPoint() || (isa(C1->getType()) + && cast(C1->getType())->getElementType()->isFloatingPoint())) + && "Tried to create an arithmetic operation on a non-arithmetic type!"); + break; + case Instruction::And: case Instruction::Or: case Instruction::Xor: Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.42.2.6 llvm/lib/VMCore/Instructions.cpp:1.42.2.7 --- llvm/lib/VMCore/Instructions.cpp:1.42.2.6 Mon Oct 23 13:13:27 2006 +++ llvm/lib/VMCore/Instructions.cpp Wed Oct 25 20:58:05 2006 @@ -1022,14 +1022,43 @@ #ifndef NDEBUG switch (iType) { case Add: case Sub: - case URem: case SRem: case FRem: - case Mul: case UDiv: case SDiv: case FDiv: + case Mul: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); assert((getType()->isInteger() || getType()->isFloatingPoint() || isa(getType())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; + case UDiv: + case SDiv: + assert(getType() == LHS->getType() && + "Arithmetic operation should return same type as operands!"); + assert((getType()->isInteger() || (isa(getType()) && + cast(getType())->getElementType()->isInteger())) && + "Incorrect operand type (not integer) for S/UDIV"); + break; + case FDiv: + assert(getType() == LHS->getType() && + "Arithmetic operation should return same type as operands!"); + assert((getType()->isFloatingPoint() || (isa(getType()) && + cast(getType())->getElementType()->isFloatingPoint())) + && "Incorrect operand type (not floating point) for FDIV"); + break; + case URem: + case SRem: + assert(getType() == LHS->getType() && + "Arithmetic operation should return same type as operands!"); + assert((getType()->isInteger() || (isa(getType()) && + cast(getType())->getElementType()->isInteger())) && + "Incorrect operand type (not integer) for S/UREM"); + break; + case FRem: + assert(getType() == LHS->getType() && + "Arithmetic operation should return same type as operands!"); + assert((getType()->isFloatingPoint() || (isa(getType()) && + cast(getType())->getElementType()->isFloatingPoint())) + && "Incorrect operand type (not floating point) for FREM"); + break; case And: case Or: case Xor: assert(getType() == LHS->getType() && From reid at x10sys.com Wed Oct 25 20:58:35 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:35 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/docs/LangRef.html Message-ID: <200610260158.k9Q1wZAm024505@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.158.2.1 -> 1.158.2.2 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+19 -17) LangRef.html | 36 +++++++++++++++++++----------------- 1 files changed, 19 insertions(+), 17 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.158.2.1 llvm/docs/LangRef.html:1.158.2.2 --- llvm/docs/LangRef.html:1.158.2.1 Mon Oct 23 01:58:29 2006 +++ llvm/docs/LangRef.html Wed Oct 25 20:58:05 2006 @@ -1642,13 +1642,14 @@

    The 'udiv' instruction returns the quotient of its two operands.

    Arguments:
    -

    The two arguments to the 'div' instruction must be -integer values. The arguments are considered to be -unsigned integer quantities. This instruction can also take -packed versions of the values. Both arguments must -have identical types.

    -
    Semantics:
    -

    The value produced is the unsigned integer quotient of the two operands.

    +

    The two arguments to the 'udiv' instruction must be +integer values. Both arguments must have identical +types. This instruction can also take packed versions +of the values in which case the elements must be integers.

    +
    Semantics:
    +

    The value produced is the unsigned integer quotient of the two operands. This +instruction always performs an unsigned division operation, regardless of +whether the arguments are unsigned or not.

    Example:
      <result> = udiv uint 4, %var          ; yields {uint}:result = 4 / %var
     
    @@ -1665,12 +1666,13 @@ operands.

    Arguments:

    The two arguments to the 'sdiv' instruction must be -integer values. The arguments are considered to be -signed integer quantities. This instruction can also take -packed versions of the values. Both arguments must -have identical types.

    -
    Semantics:
    -

    The value produced is the signed integer quotient of the two operands.

    +integer values. Both arguments must have identical +types. This instruction can also take packed versions +of the values in which case the elements must be integers.

    +
    Semantics:
    +

    The value produced is the signed integer quotient of the two operands. This +instruction always performs a signed division operation, regardless of whether +the arguments are signed or not.

    Example:
      <result> = sdiv int 4, %var          ; yields {int}:result = 4 / %var
     
    @@ -1687,9 +1689,9 @@ operands.

    Arguments:

    The two arguments to the 'div' instruction must be -floating point values. This instruction can also -take packed versions of the values. -Both arguments must have identical types.

    +floating point values. Both arguments must have +identical types. This instruction can also take packed +versions of the values in which case the elements must be floating point.

    Semantics:

    The value produced is the floating point quotient of the two operands.

    Example:
    @@ -3954,7 +3956,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/23 06:58:29 $ + Last modified: $Date: 2006/10/26 01:58:05 $ From reid at x10sys.com Wed Oct 25 20:58:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:36 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200610260158.k9Q1wacA024517@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.266.2.8 -> 1.266.2.9 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+47 -45) llvmAsmParser.y | 92 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 47 insertions(+), 45 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.8 llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.9 --- llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.8 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Oct 25 20:58:05 2006 @@ -813,50 +813,48 @@ return Ty; } -// This template function is used to obtain the correct opcode for an -// instruction when an obsolete opcode is encountered. The OpcodeInfo template -// keeps track of the opcode and the "obsolete" flag. These are generated by -// the lexer and obsolete will be true when the lexer encounters the token for +// This function is used to obtain the correct opcode for an instruction when +// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +// an opcode and an "obsolete" flag. These are generated by the lexer and +// the "obsolete" member will be true when the lexer encounters the token for // an obsolete opcode. For example, "div" was replaced by [usf]div but we need // to maintain backwards compatibility for asm files that still have the "div" // instruction. This function handles converting div -> [usf]div appropriately. -template -static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { - if (OI.obsolete) { - switch (OI.opcode) { - default: - GenerateError("Invalid Obsolete OpCode"); - break; - case Instruction::UDiv: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isSigned()) - OI.opcode = Instruction::SDiv; - break; - case Instruction::SDiv: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isUnsigned()) - OI.opcode = Instruction::UDiv; - break; - case Instruction::URem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isSigned()) - OI.opcode = Instruction::SRem; - break; - case Instruction::SRem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isUnsigned()) - OI.opcode = Instruction::URem; - break; - } - OI.obsolete = false; +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; } - - + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1045,13 +1043,13 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - BinaryOpInfo BinaryOpVal; - TermOpInfo TermOpVal; - MemOpInfo MemOpVal; - OtherOpInfo OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } %type Module FunctionList @@ -1685,8 +1683,11 @@ | ArithmeticOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. sanitizeOpCode($1,$3->getType()); CHECK_FOR_ERROR; + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the @@ -2473,6 +2474,7 @@ if (isa((*$2).get()) && ($1.opcode == Instruction::URem || $1.opcode == Instruction::SRem)) GEN_ERROR("URem and SRem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. sanitizeOpCode($1,*$2); CHECK_FOR_ERROR; Value* val1 = getVal(*$2, $3); From reid at x10sys.com Wed Oct 25 20:58:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:36 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200610260158.k9Q1waSP024525@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.53.2.4 -> 1.53.2.5 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+2 -3) ScalarEvolution.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.4 llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.5 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.4 Mon Oct 23 13:13:26 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Wed Oct 25 20:58:05 2006 @@ -1385,9 +1385,8 @@ return SCEVMulExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); case Instruction::SDiv: - if (V->getType()->isInteger()) - return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), - getSCEV(I->getOperand(1))); + return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), + getSCEV(I->getOperand(1))); break; case Instruction::Sub: From reid at x10sys.com Wed Oct 25 20:58:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:36 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200610260158.k9Q1wamh024513@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.139.6.4 -> 1.139.6.5 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+48 -12) Execution.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 48 insertions(+), 12 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.4 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.5 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.4 Mon Oct 23 13:13:26 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Oct 25 20:58:05 2006 @@ -42,8 +42,12 @@ const Type *Ty); static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, const Type *Ty); -static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); +static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeFDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2, const Type *Ty); static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2, @@ -90,11 +94,17 @@ getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); case Instruction::SDiv: + return executeSDivInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::UDiv: + return executeUDivInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::FDiv: - return executeDivInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); + return executeFDivInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::URem: case Instruction::SRem: return executeRemInst(getOperandValue(CE->getOperand(0), SF), @@ -245,18 +255,44 @@ return Dest; } -static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2, +static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; + if (Ty->isSigned()) + Ty = Ty->getUnsignedVersion(); switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(/, UByte); - IMPLEMENT_BINARY_OPERATOR(/, SByte); IMPLEMENT_BINARY_OPERATOR(/, UShort); - IMPLEMENT_BINARY_OPERATOR(/, Short); IMPLEMENT_BINARY_OPERATOR(/, UInt); - IMPLEMENT_BINARY_OPERATOR(/, Int); IMPLEMENT_BINARY_OPERATOR(/, ULong); + default: + std::cout << "Unhandled type for UDiv instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + if (Ty->isUnsigned()) + Ty = Ty->getSignedVersion(); + switch (Ty->getTypeID()) { + IMPLEMENT_BINARY_OPERATOR(/, SByte); + IMPLEMENT_BINARY_OPERATOR(/, Short); + IMPLEMENT_BINARY_OPERATOR(/, Int); IMPLEMENT_BINARY_OPERATOR(/, Long); + default: + std::cout << "Unhandled type for SDiv instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeFDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(/, Float); IMPLEMENT_BINARY_OPERATOR(/, Double); default: @@ -510,9 +546,9 @@ case Instruction::URem: case Instruction::SRem: case Instruction::FRem: R = executeRemInst (Src1, Src2, Ty); break; - case Instruction::SDiv: - case Instruction::UDiv: - case Instruction::FDiv: R = executeDivInst (Src1, Src2, Ty); break; + case Instruction::UDiv: R = executeUDivInst (Src1, Src2, Ty); break; + case Instruction::SDiv: R = executeSDivInst (Src1, Src2, Ty); break; + case Instruction::FDiv: R = executeFDivInst (Src1, Src2, Ty); break; case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break; case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break; case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); break; From reid at x10sys.com Wed Oct 25 20:58:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 25 Oct 2006 20:58:37 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200610260158.k9Q1wbqx024535@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.154.2.1 -> 1.154.2.2 --- Log message: Round 2 of DIV updates. --- Diffs of the changes: (+1 -1) Local.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.154.2.1 llvm/lib/Analysis/DataStructure/Local.cpp:1.154.2.2 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.154.2.1 Wed Oct 18 22:57:55 2006 +++ llvm/lib/Analysis/DataStructure/Local.cpp Wed Oct 25 20:58:05 2006 @@ -419,7 +419,7 @@ #if 0 if (const SequentialType *STy = cast(*I)) { CurTy = STy->getElementType(); - if (ConstantSInt *CS = dyn_cast(GEP.getOperand(i))) { + if (ConstantInt *CS = dyn_cast(GEP.getOperand(i))) { Offset += CS->getValue()*TD.getTypeSize(CurTy); } else { // Variable index into a node. We must merge all of the elements of the From nicholas at mxc.ca Wed Oct 25 21:34:05 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Oct 2006 21:34:05 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll Message-ID: <200610260234.k9Q2Y5Gp025079@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: 2006-10-25-AddSetCC.ll added (r1.1) --- Log message: Handling of setlt/le/gt/ge is broken at the moment; predsimplify removes the call the pass2. --- Diffs of the changes: (+27 -0) 2006-10-25-AddSetCC.ll | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll:1.1 *** /dev/null Wed Oct 25 21:34:01 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-25-AddSetCC.ll Wed Oct 25 21:33:51 2006 *************** *** 0 **** --- 1,27 ---- + ; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg -disable-output && + ; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep -c pass | grep 2 + + int %test(int %x, int %y) { + entry: + %tmp2 = setlt int %x, %y + %tmp = setne bool %tmp2, true + br bool %tmp, label %cond_true, label %return + + cond_true: ; preds = %entry + %tmp4 = seteq int %x, %y ; [#uses=1] + br bool %tmp4, label %cond_true5, label %cond_false + + cond_true5: ; preds = %cond_true + %tmp6 = call int %pass1( ) ; [#uses=1] + ret int %tmp6 + + cond_false: + %tmp8 = call int %pass2( ) ; [#uses=1] + ret int %tmp8 + + return: ; preds = %cond_next7 + ret int 0 + } + + declare int %pass1() + declare int %pass2() From nicholas at mxc.ca Wed Oct 25 21:35:32 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 25 Oct 2006 21:35:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Message-ID: <200610260235.k9Q2ZW5I025115@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.28 -> 1.29 --- Log message: Fix 2006-10-25-AddSetCC. A relational operator (like setlt) can never produce an EQ property. --- Diffs of the changes: (+46 -27) PredicateSimplifier.cpp | 73 ++++++++++++++++++++++++++++++------------------ 1 files changed, 46 insertions(+), 27 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.28 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.29 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.28 Wed Oct 25 18:48:24 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Oct 25 21:35:18 2006 @@ -316,21 +316,6 @@ Iter I1, I2; }; - void add(Ops Opcode, Value *V1, Value *V2, bool invert) { - switch (Opcode) { - case EQ: - if (invert) addNotEqual(V1, V2); - else addEqual(V1, V2); - break; - case NE: - if (invert) addEqual(V1, V2); - else addNotEqual(V1, V2); - break; - default: - assert(0 && "Unknown property opcode."); - } - } - void addToResolve(Value *V, std::list &WorkList) { if (!isa(V) && !isa(V)) { for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); @@ -398,31 +383,65 @@ if (!WorkList.empty()) resolve(WorkList); } - // Finds the properties implied by an equivalence and adds them too. - // Example: ("seteq %a, %b", true, EQ) --> (%a, %b, EQ) - // ("seteq %a, %b", false, EQ) --> (%a, %b, NE) + void add(Ops Opcode, Value *V1, Value *V2, bool invert) { + switch (Opcode) { + case EQ: + if (invert) addNotEqual(V1, V2); + else addEqual(V1, V2); + break; + case NE: + if (invert) addEqual(V1, V2); + else addNotEqual(V1, V2); + break; + default: + assert(0 && "Unknown property opcode."); + } + } + + /// Finds the properties implied by an equivalence and adds them too. + /// Example: ("seteq %a, %b", true, EQ) --> (%a, %b, EQ) + /// ("seteq %a, %b", false, EQ) --> (%a, %b, NE) void addImpliedProperties(Ops Opcode, Value *V1, Value *V2) { order(V1, V2); if (BinaryOperator *BO = dyn_cast(V2)) { switch (BO->getOpcode()) { case Instruction::SetEQ: + // "seteq int %a, %b" EQ true then %a EQ %b + // "seteq int %a, %b" EQ false then %a NE %b + // "seteq int %a, %b" NE true then %a NE %b + // "seteq int %a, %b" NE false then %a EQ %b if (ConstantBool *V1CB = dyn_cast(V1)) add(Opcode, BO->getOperand(0), BO->getOperand(1),!V1CB->getValue()); break; case Instruction::SetNE: + // "setne int %a, %b" EQ true then %a NE %b + // "setne int %a, %b" EQ false then %a EQ %b + // "setne int %a, %b" NE true then %a EQ %b + // "setne int %a, %b" NE false then %a NE %b if (ConstantBool *V1CB = dyn_cast(V1)) add(Opcode, BO->getOperand(0), BO->getOperand(1), V1CB->getValue()); break; case Instruction::SetLT: case Instruction::SetGT: - if (V1 == ConstantBool::getTrue()) - add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + // "setlt/gt int %a, %b" EQ true then %a NE %b + // "setlt/gt int %a, %b" NE false then %a NE %b + + // "setlt int %a, %b" NE true then %a EQ %b + + if (ConstantBool *CB = dyn_cast(V1)) { + if (CB->getValue() ^ Opcode==NE) + addNotEqual(BO->getOperand(0), BO->getOperand(1)); + } break; case Instruction::SetLE: case Instruction::SetGE: - if (V1 == ConstantBool::getFalse()) - add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + // "setle/ge int %a, %b" EQ false then %a NE %b + // "setle/ge int %a, %b" NE true then %a NE %b + if (ConstantBool *CB = dyn_cast(V1)) { + if (CB->getValue() ^ Opcode==EQ) + addNotEqual(BO->getOperand(0), BO->getOperand(1)); + } break; case Instruction::And: { // "and int %a, %b" EQ 0xff then %a EQ 0xff and %b EQ 0xff @@ -461,15 +480,15 @@ // "EQ true" and "NE true" in place of "EQ false". // "xor int %c, %a" EQ %c then %a = 0 // "xor int %c, %a" NE %c then %a != 0 - // 2. Repeat all of the above, with the operands swapped. + // 2. Repeat all of the above, with order of operands reversed. Value *LHS = BO->getOperand(0), *RHS = BO->getOperand(1); if (!isa(LHS)) std::swap(LHS, RHS); if (ConstantBool *CB = dyn_cast(V1)) { if (ConstantBool *A = dyn_cast(LHS)) { - addEqual(RHS, ConstantBool::get(A->getValue() ^ CB->getValue() - ^ Opcode==NE)); + addEqual(RHS, ConstantBool::get(A->getValue() ^ CB->getValue() + ^ Opcode==NE)); } } else if (ConstantIntegral *CI = dyn_cast(V1)) { @@ -486,9 +505,9 @@ ConstantBool *True = ConstantBool::get(Opcode==EQ), *False = ConstantBool::get(Opcode!=EQ); - if (V1 == SI->getTrueValue()) + if (V1 == canonicalize(SI->getTrueValue())) addEqual(SI->getCondition(), True); - else if (V1 == SI->getFalseValue()) + else if (V1 == canonicalize(SI->getFalseValue())) addEqual(SI->getCondition(), False); } From clattner at apple.com Wed Oct 25 22:37:04 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 25 Oct 2006 20:37:04 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: <1161803750.32005.17.camel@bashful.x10sys.com> References: <1161803750.32005.17.camel@bashful.x10sys.com> Message-ID: On Oct 25, 2006, at 12:15 PM, Reid Spencer wrote: > Attached are two patch files to replace the DIV instruction with 3 > instructions: SDiv, UDiv, FDiv. The first file patches llvm. The > second > file patches llvm-gcc4. > > This is the 2nd attempt to provide the patch. All comments are > welcome. llvm-gcc part first: Instead of adding a switch stmt to EmitBinOp, please change it to something like this: +++ gcc/llvm-convert.cpp (working copy) @@ -544,9 +544,15 @@ case PLUS_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Add);break; case MINUS_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Sub);break; case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Mul);break; - case TRUNC_DIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Div);break; - case EXACT_DIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Div);break; - case RDIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Div);break; + case TRUNC_DIV_EXPR: + if (TREE_UNSIGNED(TREE_TYPE(exp))) + Result = EmitBinOp(exp, DestLoc, Instruction::UDiv); + else + Result = EmitBinOp(exp, DestLoc, Instruction::SDiv); + break; EXACT_DIV_EXPR should always be UDiv, RDIV_EXPR is fine. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061025/d507821c/attachment.html From clattner at apple.com Wed Oct 25 23:03:22 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 25 Oct 2006 21:03:22 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: <1161803750.32005.17.camel@bashful.x10sys.com> References: <1161803750.32005.17.camel@bashful.x10sys.com> Message-ID: On Oct 25, 2006, at 12:15 PM, Reid Spencer wrote: > Attached are two patch files to replace the DIV instruction with 3 > instructions: SDiv, UDiv, FDiv. The first file patches llvm. The > second > file patches llvm-gcc4. > > This is the 2nd attempt to provide the patch. All comments are > welcome. This patch is *far* improved over the last one. Nit picky stuff below. Please make these changes, but there is no need to repost these diffs for review. llvm part, without instcombine: +// This function is used to obtain the correct opcode for an instruction when +// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +// an opcode and an "obsolete" flag. These are generated by the lexer and +// the "obsolete" member will be true when the lexer encounters the token for +// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +// to maintain backwards compatibility for asm files that still have the "div" +// instruction. This function handles converting div -> [usf]div appropriately. +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ Please convert this to a doxygen comment. Please change the second argument to "const Type *Ty". Bytecode/Reader.cpp: + // If this is a bytecode format that did not include the unreachable + // instruction, bump up the opcode number to adjust it. + if (hasNoUnreachableInst) { + if (Opcode >= Instruction::Unreachable && + Opcode < 62) { // 62 + ++Opcode; + } + } What is the "// 62" comment? + case 11: // Rem + // As with "Div", make the signed/unsigned Rem instruction choice based + // on the type of the instruction. + if (ArgVec[0]->getType()->isFloatingPoint()) + Opcode = Instruction::Rem; + else if (ArgVec[0]->getType()->isSigned()) + Opcode = Instruction::Rem; + else + Opcode = Instruction::Rem; Heh, so forward looking :), no need to change it. + // In version 5 and prior, the integer types were distinguished by sign. + // That is we have UIntTy and IntTy as well as ConstantSInt and + // ConstantUInt. In version 6, the integer types became signless so we + // need to note that we have signed integer types in prior versions. + bool hasSignedIntegers; This is set but never checked, please remove it. diff -t -d -u -p -5 -r1.94 ConstantFolding.cpp --- lib/VMCore/ConstantFolding.cpp 20 Oct 2006 07:07:24 -0000 1.94 +++ lib/VMCore/ConstantFolding.cpp 25 Oct 2006 18:51:19 -0000 @@ -38,11 +38,13 @@ namespace { ... + static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) { + if (V2->isNullValue()) + return 0; if (V2->isAllOnesValue() && // MIN_INT / -1 (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1- >getZExtValue()) return 0; + BuiltinType R = (BuiltinType)(V1->getZExtValue() / V2- >getZExtValue()); + return ConstantInt::get(*Ty, R); + } This check: if (V2->isAllOnesValue() && // MIN_INT / -1 (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1- >getZExtValue()) return 0; Is not needed in the udiv case, it is over-conservative (yes, the original code was over-conservative in the same way). -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061025/7e1a4b99/attachment.html From clattner at apple.com Wed Oct 25 23:19:34 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 25 Oct 2006 21:19:34 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: <1161803750.32005.17.camel@bashful.x10sys.com> References: <1161803750.32005.17.camel@bashful.x10sys.com> Message-ID: On Oct 25, 2006, at 12:15 PM, Reid Spencer wrote: > Attached are two patch files to replace the DIV instruction with 3 > instructions: SDiv, UDiv, FDiv. The first file patches llvm. The > second > file patches llvm-gcc4. > > This is the 2nd attempt to provide the patch. All comments are > welcome. > > Reid. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits Overall, this patch looks very nice. Please fix the one bug below (adding the regtest) and you are approved to check the whole mess in. Final part (instcombine): +Instruction *InstCombiner::visitFDiv(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + return commonDivTransforms(I); +} You can delete Op0/Op1. + // FIXME: If the operand types don't match the type of the divide + // then don't attempt this transform. The code below doesn't have the + // logic to deal with a signed divide and an unsigned compare (and + // vice versa). This is because (x /s C1) getType(); + unsigned DivOpCode = LHSI->getOpcode(); + if ((DivOpCode == Instruction::SDiv && DivRHSTy->isUnsigned ()) || + (DivOpCode == Instruction::UDiv && DivRHSTy->isSigned())) + break; This is good but slightly over conservative. Please allow the xform to happen if the comparison is an ==/!= comparison (i.e. SetCondInst::isEquality() returns true). Instruction* InstCombiner::commonDivTransforms(BinaryOperator &I) { Please add comments above each new function. The visit* methods don't need comments above them. // (X / C1) / C2 -> X / (C1*C2) if (Instruction *LHS = dyn_cast(Op0)) if (Instruction::BinaryOps(LHS->getOpcode()) == I.getOpcode()) This code is a bit simpler as: // (X / C1) / C2 -> X / (C1*C2) if (BinaryOperator *LHS = dyn_cast(Op0)) if (LHS->getOpcode() == I.getOpcode()) // udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) // where C1&C2 are powers of two. ... X = InsertNewInstBefore( new CastInst(X, X->getType()->getUnsignedVersion ()), I); This (and similar cases) is easier/cleaner with InsertCastBefore. // Finally, construct the select instruction and return it. return new SelectInst(SI->getOperand(0), TSI, FSI); In the same xform, this needs to cast the result back to the right type if the operation was signed. Please write a short regtest for this and check it in with your patch to verify that you get this right (add it to the end of div.ll or something). Something like this: int %test(int %X, int %Y, bool %C) { %A = select bool %C, int 1024, int 32 %B = udiv int %Y, %A ret int %B } -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061025/9803b95d/attachment.html From rspencer at reidspencer.com Wed Oct 25 23:26:15 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 25 Oct 2006 21:26:15 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: References: <1161803750.32005.17.camel@bashful.x10sys.com> Message-ID: <1161836775.32005.65.camel@bashful.x10sys.com> Done. On Wed, 2006-10-25 at 20:37 -0700, Chris Lattner wrote: > > On Oct 25, 2006, at 12:15 PM, Reid Spencer wrote: > > > Attached are two patch files to replace the DIV instruction with 3 > > instructions: SDiv, UDiv, FDiv. The first file patches llvm. The > > second > > file patches llvm-gcc4. > > > > > > This is the 2nd attempt to provide the patch. All comments are > > welcome. > > llvm-gcc part first: > > > Instead of adding a switch stmt to EmitBinOp, please change it to > something like this: > > > +++ gcc/llvm-convert.cpp (working copy) > @@ -544,9 +544,15 @@ > case PLUS_EXPR: Result = EmitBinOp(exp, DestLoc, > Instruction::Add);break; > case MINUS_EXPR: Result = EmitBinOp(exp, DestLoc, > Instruction::Sub);break; > case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, > Instruction::Mul);break; > - case TRUNC_DIV_EXPR: Result = EmitBinOp(exp, DestLoc, > Instruction::Div);break; > - case EXACT_DIV_EXPR: Result = EmitBinOp(exp, DestLoc, > Instruction::Div);break; > - case RDIV_EXPR: Result = EmitBinOp(exp, DestLoc, > Instruction::Div);break; > + case TRUNC_DIV_EXPR: > + if (TREE_UNSIGNED(TREE_TYPE(exp))) > + Result = EmitBinOp(exp, DestLoc, Instruction::UDiv); > + else > + Result = EmitBinOp(exp, DestLoc, Instruction::SDiv); > + break; > > > EXACT_DIV_EXPR should always be UDiv, RDIV_EXPR is fine. > > > -Chris > > > > From rspencer at reidspencer.com Wed Oct 25 23:26:25 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 25 Oct 2006 21:26:25 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: References: <1161803750.32005.17.camel@bashful.x10sys.com> Message-ID: <1161836785.32005.67.camel@bashful.x10sys.com> All Done. On Wed, 2006-10-25 at 21:03 -0700, Chris Lattner wrote: > > On Oct 25, 2006, at 12:15 PM, Reid Spencer wrote: > > > Attached are two patch files to replace the DIV instruction with 3 > > instructions: SDiv, UDiv, FDiv. The first file patches llvm. The > > second > > file patches llvm-gcc4. > > > > > > This is the 2nd attempt to provide the patch. All comments are > > welcome. > > > This patch is *far* improved over the last one. Nit picky stuff > below. Please make these changes, but there is no need to repost > these diffs for review. > > > > llvm part, without instcombine: > > > +// This function is used to obtain the correct opcode for an > instruction when > +// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) > has both > +// an opcode and an "obsolete" flag. These are generated by the lexer > and > +// the "obsolete" member will be true when the lexer encounters the > token for > +// an obsolete opcode. For example, "div" was replaced by [usf]div > but we need > +// to maintain backwards compatibility for asm files that still have > the "div" > +// instruction. This function handles converting div -> [usf]div > appropriately. > +static void > +sanitizeOpCode(OpcodeInfo &OI, const > PATypeHolder& PATy) > +{ > > > Please convert this to a doxygen comment. Please change the second > argument to "const Type *Ty". > > > > > > > Bytecode/Reader.cpp: > > > + // If this is a bytecode format that did not include the > unreachable > + // instruction, bump up the opcode number to adjust it. > + if (hasNoUnreachableInst) { > + if (Opcode >= Instruction::Unreachable && > + Opcode < 62) { // 62 > + ++Opcode; > + } > + } > > > What is the "// 62" comment? > > > > > > > + case 11: // Rem > + // As with "Div", make the signed/unsigned Rem instruction > choice based > + // on the type of the instruction. > + if (ArgVec[0]->getType()->isFloatingPoint()) > + Opcode = Instruction::Rem; > + else if (ArgVec[0]->getType()->isSigned()) > + Opcode = Instruction::Rem; > + else > + Opcode = Instruction::Rem; > > > Heh, so forward looking :), no need to change it. > > > > > + // In version 5 and prior, the integer types were distinguished by > sign. > + // That is we have UIntTy and IntTy as well as ConstantSInt and > + // ConstantUInt. In version 6, the integer types became signless so > we > + // need to note that we have signed integer types in prior > versions. > + bool hasSignedIntegers; > > > This is set but never checked, please remove it. > > > > > diff -t -d -u -p -5 -r1.94 ConstantFolding.cpp > --- lib/VMCore/ConstantFolding.cpp 20 Oct 2006 07:07:24 -0000 1.94 > +++ lib/VMCore/ConstantFolding.cpp 25 Oct 2006 18:51:19 -0000 > @@ -38,11 +38,13 @@ namespace { > > > ... > > > + static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) > { > + if (V2->isNullValue()) > + return 0; > if (V2->isAllOnesValue() && // MIN_INT / -1 > (BuiltinType)V1->getZExtValue() == > -(BuiltinType)V1->getZExtValue()) > return 0; > + BuiltinType R = (BuiltinType)(V1->getZExtValue() / > V2->getZExtValue()); > + return ConstantInt::get(*Ty, R); > + } > > > > > This check: > if (V2->isAllOnesValue() && // MIN_INT / -1 > (BuiltinType)V1->getZExtValue() == > -(BuiltinType)V1->getZExtValue()) > return 0; > > > Is not needed in the udiv case, it is over-conservative (yes, the > original code was over-conservative in the same way). > > > > > -Chris > > From rspencer at reidspencer.com Wed Oct 25 23:57:46 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 25 Oct 2006 21:57:46 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: References: <1161803750.32005.17.camel@bashful.x10sys.com> Message-ID: <1161838666.32005.76.camel@bashful.x10sys.com> Chris, A couple side notes on this one ... On Wed, 2006-10-25 at 21:19 -0700, Chris Lattner wrote: > > Overall, this patch looks very nice. Please fix the one bug below > (adding the regtest) and you are approved to check the whole mess in. Thank you. > // (X / C1) / C2 -> X / (C1*C2) > if (Instruction *LHS = dyn_cast(Op0)) > if (Instruction::BinaryOps(LHS->getOpcode()) == I.getOpcode()) > > > This code is a bit simpler as: > > > // (X / C1) / C2 -> X / (C1*C2) > if (BinaryOperator *LHS = dyn_cast(Op0)) > if (LHS->getOpcode() == I.getOpcode()) > Didn't apply this because it causes a compiler warning about signed/unsigned comparison. > // udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr > X, C2) > // where C1&C2 are powers of two. > ... > X = InsertNewInstBefore( > new CastInst(X, X->getType()->getUnsignedVersion()), > I); > > > This (and similar cases) is easier/cleaner with InsertCastBefore. Yes, I agree. I changed the ones in my code but there are actually dozens (hundreds) of instances in the file (not related to my changes). I'm going to commit the DIV patch first, then I'll come back and clean up the others in a separate patch (tested, of course). Thanks for your excellent reviews, Chris. I know it takes a lot of your time and I appreciate that you so willingly give it. I'll apply what I learned from DIV to the REM patch which I'm reviewing for Sheng soon. Hopefully REM will fare better than DIV did. Reid. From reid at x10sys.com Thu Oct 26 00:59:39 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 00:59:39 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/divides.c Message-ID: <200610260559.k9Q5xdpF028630@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/Vector: divides.c added (r1.1) --- Log message: Add a new test case for testing vector divides, both signed and unsigned. --- Diffs of the changes: (+33 -0) divides.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+) Index: llvm-test/SingleSource/UnitTests/Vector/divides.c diff -c /dev/null llvm-test/SingleSource/UnitTests/Vector/divides.c:1.1 *** /dev/null Thu Oct 26 00:59:35 2006 --- llvm-test/SingleSource/UnitTests/Vector/divides.c Thu Oct 26 00:59:25 2006 *************** *** 0 **** --- 1,33 ---- + #include + typedef unsigned uvec __attribute__ ((__vector_size__ (16))); + typedef int svec __attribute__ ((__vector_size__ (16))); + void testuvec(uvec *A, uvec *B, uvec *R) { *R = *A / *B; } + void testsvec(svec *A, svec *B, svec *R) { *R = *A / *B; } + + typedef union { + svec V; + int A[4]; + } SV; + + typedef union { + uvec V; + unsigned A[4]; + } UV; + + int main(int argc, char**argv) { + SV S1, S2, S3; + UV U1, U2, U3; + S1.A[0] = S2.A[0] = 2; + S1.A[1] = S2.A[1] = -3; + S1.A[2] = S2.A[2] = 5; + S1.A[3] = S2.A[3] = -8; + U1.A[0] = U2.A[0] = 2; + U1.A[1] = U2.A[1] = 3; + U1.A[2] = U2.A[2] = 5; + U1.A[3] = U2.A[3] = 8; + testuvec(&U1.V, &U2.V, &U3.V); + testsvec(&S1.V, &S2.V, &S3.V); + + printf("U3.V = <%u %u %u %u>\n", U3.A[0], U3.A[1], U3.A[2], U3.A[3]); + printf("S3.V = <%u %u %u %u>\n", S3.A[0], S3.A[1], S3.A[2], S3.A[3]); + } From rspencer at reidspencer.com Thu Oct 26 01:09:10 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 25 Oct 2006 23:09:10 -0700 Subject: [llvm-commits] [llvm-gcc] FINAL DIV->[SUF]Div Changes Message-ID: <1161842950.32005.87.camel@bashful.x10sys.com> All, Attached is the final patch for llvm-gcc4 to make it work with the DIV instruction changes that I just committed to LLVM. You'll need to apply this patch to your llvm-gcc4 if you update LLVM before the patch is applied to the subversion repository. It should be done in 24 hours. Thanks, Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: DIV-llvmgcc.patch Type: text/x-patch Size: 3279 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061025/aa2dd32f/attachment.bin From reid at x10sys.com Thu Oct 26 01:16:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200610260616.k9Q6GOeE029086@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.43 -> 1.44 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+13 -0) README.txt | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.43 llvm/lib/Target/README.txt:1.44 --- llvm/lib/Target/README.txt:1.43 Tue Oct 24 11:12:47 2006 +++ llvm/lib/Target/README.txt Thu Oct 26 01:15:43 2006 @@ -319,3 +319,16 @@ } //===---------------------------------------------------------------------===// + +-instcombine should handle this transform: + setcc (sdiv X / C1 ), C2 +when X, C1, and C2 are unsigned. Similarly for udiv and signed operands. + +Currently InstCombine avoids this transform but will do it when the signs of +the operands and the sign of the divide match. See the FIXME in +InstructionCombining.cpp in the visitSetCondInst method after the switch case +for Instruction::UDiv (around line 4447) for more details. + +The SingleSource/Benchmarks/Shootout-C++/hash and hash2 tests have examples of +this construct. +//===---------------------------------------------------------------------===// From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200610260616.k9Q6GSQb029139@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.54 -> 1.55 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+14 -15) ScalarEvolution.cpp | 29 ++++++++++++++--------------- 1 files changed, 14 insertions(+), 15 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.54 llvm/lib/Analysis/ScalarEvolution.cpp:1.55 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.54 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Oct 26 01:15:43 2006 @@ -989,9 +989,9 @@ SCEVHandle SCEVSDivExpr::get(const SCEVHandle &LHS, const SCEVHandle &RHS) { if (SCEVConstant *RHSC = dyn_cast(RHS)) { if (RHSC->getValue()->equalsInt(1)) - return LHS; // X /s 1 --> x + return LHS; // X sdiv 1 --> x if (RHSC->getValue()->isAllOnesValue()) - return SCEV::getNegativeSCEV(LHS); // X /s -1 --> -x + return SCEV::getNegativeSCEV(LHS); // X sdiv -1 --> -x if (SCEVConstant *LHSC = dyn_cast(LHS)) { Constant *LHSCV = LHSC->getValue(); @@ -1001,7 +1001,7 @@ LHSCV->getType()->getSignedVersion()); if (RHSCV->getType()->isUnsigned()) RHSCV = ConstantExpr::getCast(RHSCV, LHSCV->getType()); - return SCEVUnknown::get(ConstantExpr::getDiv(LHSCV, RHSCV)); + return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV)); } } @@ -1384,10 +1384,9 @@ case Instruction::Mul: return SCEVMulExpr::get(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); - case Instruction::Div: - if (V->getType()->isInteger() && V->getType()->isSigned()) - return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), - getSCEV(I->getOperand(1))); + case Instruction::SDiv: + return SCEVSDivExpr::get(getSCEV(I->getOperand(0)), + getSCEV(I->getOperand(1))); break; case Instruction::Sub: @@ -2058,16 +2057,16 @@ return std::make_pair(CNC, CNC); } - Constant *Two = ConstantInt::get(L->getValue()->getType(), 2); + Constant *C = L->getValue(); + Constant *Two = ConstantInt::get(C->getType(), 2); // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C - Constant *C = L->getValue(); // The B coefficient is M-N/2 Constant *B = ConstantExpr::getSub(M->getValue(), - ConstantExpr::getDiv(N->getValue(), + ConstantExpr::getSDiv(N->getValue(), Two)); // The A coefficient is N/2 - Constant *A = ConstantExpr::getDiv(N->getValue(), Two); + Constant *A = ConstantExpr::getSDiv(N->getValue(), Two); // Compute the B^2-4ac term. Constant *SqrtTerm = @@ -2102,9 +2101,9 @@ SqrtTerm = ConstantExpr::getCast(SqrtTerm, SignedTy); Constant *Solution1 = - ConstantExpr::getDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); + ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); Constant *Solution2 = - ConstantExpr::getDiv(ConstantExpr::getSub(NegB, SqrtTerm), TwoA); + ConstantExpr::getSDiv(ConstantExpr::getSub(NegB, SqrtTerm), TwoA); return std::make_pair(SCEVUnknown::get(Solution1), SCEVUnknown::get(Solution2)); } @@ -2150,7 +2149,7 @@ Constant *StartNegC = ConstantExpr::getNeg(StartCC); Constant *Rem = ConstantExpr::getRem(StartNegC, StepC->getValue()); if (Rem->isNullValue()) { - Constant *Result =ConstantExpr::getDiv(StartNegC,StepC->getValue()); + Constant *Result =ConstantExpr::getSDiv(StartNegC,StepC->getValue()); return SCEVUnknown::get(Result); } } @@ -2352,7 +2351,7 @@ Constant *ExitValue = Upper; if (A != One) { ExitValue = ConstantExpr::getSub(ConstantExpr::getAdd(Upper, A), One); - ExitValue = ConstantExpr::getDiv(ExitValue, A); + ExitValue = ConstantExpr::getSDiv(ExitValue, A); } assert(isa(ExitValue) && "Constant folding of integers not implemented?"); From reid at x10sys.com Thu Oct 26 01:16:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:27 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Message-ID: <200610260616.k9Q6GRZi029116@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.90 -> 1.91 Instruction.def updated: 1.19 -> 1.20 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+31 -31) Constants.h | 4 ++- Instruction.def | 58 +++++++++++++++++++++++++++----------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.90 llvm/include/llvm/Constants.h:1.91 --- llvm/include/llvm/Constants.h:1.90 Fri Oct 20 02:24:55 2006 +++ llvm/include/llvm/Constants.h Thu Oct 26 01:15:43 2006 @@ -543,7 +543,9 @@ static Constant *getAdd(Constant *C1, Constant *C2); static Constant *getSub(Constant *C1, Constant *C2); static Constant *getMul(Constant *C1, Constant *C2); - static Constant *getDiv(Constant *C1, Constant *C2); + static Constant *getUDiv(Constant *C1, Constant *C2); + static Constant *getSDiv(Constant *C1, Constant *C2); + static Constant *getFDiv(Constant *C1, Constant *C2); static Constant *getRem(Constant *C1, Constant *C2); static Constant *getAnd(Constant *C1, Constant *C2); static Constant *getOr(Constant *C1, Constant *C2); Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.19 llvm/include/llvm/Instruction.def:1.20 --- llvm/include/llvm/Instruction.def:1.19 Fri Apr 7 20:15:18 2006 +++ llvm/include/llvm/Instruction.def Thu Oct 26 01:15:43 2006 @@ -93,45 +93,43 @@ HANDLE_BINARY_INST( 7, Add , BinaryOperator) HANDLE_BINARY_INST( 8, Sub , BinaryOperator) HANDLE_BINARY_INST( 9, Mul , BinaryOperator) -HANDLE_BINARY_INST(10, Div , BinaryOperator) -HANDLE_BINARY_INST(11, Rem , BinaryOperator) +HANDLE_BINARY_INST(10, UDiv , BinaryOperator) +HANDLE_BINARY_INST(11, SDiv , BinaryOperator) +HANDLE_BINARY_INST(12, FDiv , BinaryOperator) +HANDLE_BINARY_INST(13, Rem , BinaryOperator) // Logical operators... -HANDLE_BINARY_INST(12, And , BinaryOperator) -HANDLE_BINARY_INST(13, Or , BinaryOperator) -HANDLE_BINARY_INST(14, Xor , BinaryOperator) +HANDLE_BINARY_INST(14, And , BinaryOperator) +HANDLE_BINARY_INST(15, Or , BinaryOperator) +HANDLE_BINARY_INST(16, Xor , BinaryOperator) // Binary comparison operators... -HANDLE_BINARY_INST(15, SetEQ , SetCondInst) -HANDLE_BINARY_INST(16, SetNE , SetCondInst) -HANDLE_BINARY_INST(17, SetLE , SetCondInst) -HANDLE_BINARY_INST(18, SetGE , SetCondInst) -HANDLE_BINARY_INST(19, SetLT , SetCondInst) -HANDLE_BINARY_INST(20, SetGT , SetCondInst) - LAST_BINARY_INST(20) +HANDLE_BINARY_INST(17, SetEQ , SetCondInst) +HANDLE_BINARY_INST(18, SetNE , SetCondInst) +HANDLE_BINARY_INST(19, SetLE , SetCondInst) +HANDLE_BINARY_INST(20, SetGE , SetCondInst) +HANDLE_BINARY_INST(21, SetLT , SetCondInst) +HANDLE_BINARY_INST(22, SetGT , SetCondInst) + LAST_BINARY_INST(22) // Memory operators... - FIRST_MEMORY_INST(21) -HANDLE_MEMORY_INST(21, Malloc, MallocInst) // Heap management instructions -HANDLE_MEMORY_INST(22, Free , FreeInst ) -HANDLE_MEMORY_INST(23, Alloca, AllocaInst) // Stack management -HANDLE_MEMORY_INST(24, Load , LoadInst ) // Memory manipulation instrs -HANDLE_MEMORY_INST(25, Store , StoreInst ) -HANDLE_MEMORY_INST(26, GetElementPtr, GetElementPtrInst) - LAST_MEMORY_INST(26) + FIRST_MEMORY_INST(23) +HANDLE_MEMORY_INST(23, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(24, Free , FreeInst ) +HANDLE_MEMORY_INST(25, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(26, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(27, Store , StoreInst ) +HANDLE_MEMORY_INST(28, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(28) // Other operators... - FIRST_OTHER_INST(27) -HANDLE_OTHER_INST(27, PHI , PHINode ) // PHI node instruction -HANDLE_OTHER_INST(28, Cast , CastInst ) // Type cast -HANDLE_OTHER_INST(29, Call , CallInst ) // Call a function - -HANDLE_OTHER_INST(30, Shl , ShiftInst ) // Shift operations -HANDLE_OTHER_INST(31, Shr , ShiftInst ) -// 32 -> Empty slot used to be used for vanext in llvm 1.5 and before. -// 33 -> Empty slot used to be used for vaarg in llvm 1.5 and before. + FIRST_OTHER_INST(29) +HANDLE_OTHER_INST(29, PHI , PHINode ) // PHI node instruction +HANDLE_OTHER_INST(30, Cast , CastInst ) // Type cast +HANDLE_OTHER_INST(31, Call , CallInst ) // Call a function +HANDLE_OTHER_INST(32, Shl , ShiftInst ) // Shift operations +HANDLE_OTHER_INST(33, Shr , ShiftInst ) HANDLE_OTHER_INST(34, Select , SelectInst ) // select instruction - HANDLE_OTHER_INST(35, UserOp1, Instruction) // May be used internally in a pass HANDLE_OTHER_INST(36, UserOp2, Instruction) HANDLE_OTHER_INST(37, VAArg , VAArgInst ) // vaarg instruction From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200610260616.k9Q6GSFC029166@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.140 -> 1.141 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+51 -11) Execution.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 51 insertions(+), 11 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.140 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.141 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.140 Fri Oct 20 02:07:24 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Thu Oct 26 01:15:43 2006 @@ -42,8 +42,12 @@ const Type *Ty); static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, const Type *Ty); -static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); +static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeFDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2, const Type *Ty); static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2, @@ -89,10 +93,18 @@ return executeMulInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); - case Instruction::Div: - return executeDivInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); + case Instruction::SDiv: + return executeSDivInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); + case Instruction::UDiv: + return executeUDivInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); + case Instruction::FDiv: + return executeFDivInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::Rem: return executeRemInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), @@ -242,18 +254,44 @@ return Dest; } -static GenericValue executeDivInst(GenericValue Src1, GenericValue Src2, +static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; + if (Ty->isSigned()) + Ty = Ty->getUnsignedVersion(); switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(/, UByte); - IMPLEMENT_BINARY_OPERATOR(/, SByte); IMPLEMENT_BINARY_OPERATOR(/, UShort); - IMPLEMENT_BINARY_OPERATOR(/, Short); IMPLEMENT_BINARY_OPERATOR(/, UInt); - IMPLEMENT_BINARY_OPERATOR(/, Int); IMPLEMENT_BINARY_OPERATOR(/, ULong); + default: + std::cout << "Unhandled type for UDiv instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + if (Ty->isUnsigned()) + Ty = Ty->getSignedVersion(); + switch (Ty->getTypeID()) { + IMPLEMENT_BINARY_OPERATOR(/, SByte); + IMPLEMENT_BINARY_OPERATOR(/, Short); + IMPLEMENT_BINARY_OPERATOR(/, Int); IMPLEMENT_BINARY_OPERATOR(/, Long); + default: + std::cout << "Unhandled type for SDiv instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeFDivInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(/, Float); IMPLEMENT_BINARY_OPERATOR(/, Double); default: @@ -504,7 +542,9 @@ case Instruction::Add: R = executeAddInst (Src1, Src2, Ty); break; case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty); break; case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty); break; - case Instruction::Div: R = executeDivInst (Src1, Src2, Ty); break; + case Instruction::UDiv: R = executeUDivInst (Src1, Src2, Ty); break; + case Instruction::SDiv: R = executeSDivInst (Src1, Src2, Ty); break; + case Instruction::FDiv: R = executeFDivInst (Src1, Src2, Ty); break; case Instruction::Rem: R = executeRemInst (Src1, Src2, Ty); break; case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break; case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break; From reid at x10sys.com Thu Oct 26 01:16:23 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200610260616.k9Q6GNK0029071@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.125 -> 1.126 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+1 -1) Writer.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.125 llvm/lib/Bytecode/Writer/Writer.cpp:1.126 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.125 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Bytecode/Writer/Writer.cpp Thu Oct 26 01:15:43 2006 @@ -40,7 +40,7 @@ /// so that the reader can distinguish which format of the bytecode file has /// been written. /// @brief The bytecode version number -const unsigned BCVersionNum = 5; +const unsigned BCVersionNum = 6; static RegisterPass X("emitbytecode", "Bytecode Writer"); From reid at x10sys.com Thu Oct 26 01:16:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:27 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200610260616.k9Q6GR2k029102@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.9 -> 1.10 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+14 -2) PatternMatch.h | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.9 llvm/include/llvm/Support/PatternMatch.h:1.10 --- llvm/include/llvm/Support/PatternMatch.h:1.9 Mon Sep 18 00:17:11 2006 +++ llvm/include/llvm/Support/PatternMatch.h Thu Oct 26 01:15:43 2006 @@ -112,9 +112,21 @@ } template -inline BinaryOp_match m_Div(const LHS &L, +inline BinaryOp_match m_UDiv(const LHS &L, const RHS &R) { - return BinaryOp_match(L, R); + return BinaryOp_match(L, R); +} + +template +inline BinaryOp_match m_SDiv(const LHS &L, + const RHS &R) { + return BinaryOp_match(L, R); +} + +template +inline BinaryOp_match m_FDiv(const LHS &L, + const RHS &R) { + return BinaryOp_match(L, R); } template From reid at x10sys.com Thu Oct 26 01:16:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:27 -0500 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200610260616.k9Q6GR4v029094@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.19 -> 1.20 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+2 -2) StackerCompiler.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.19 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.20 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.19 Fri Oct 20 02:07:24 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Thu Oct 26 01:15:43 2006 @@ -1041,7 +1041,7 @@ LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); BinaryOperator* divop = - BinaryOperator::create( Instruction::Div, op1, op2); + BinaryOperator::create( Instruction::SDiv, op1, op2); bb->getInstList().push_back( divop ); push_value( bb, divop ); break; @@ -1072,7 +1072,7 @@ // Divide by the third operand BinaryOperator* divop = - BinaryOperator::create( Instruction::Div, multop, op3); + BinaryOperator::create( Instruction::SDiv, multop, op3); bb->getInstList().push_back( divop ); // Push the result From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200610260616.k9Q6GS8d029170@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.17 -> 1.18 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+9 -3) CppWriter.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.17 llvm/tools/llvm2cpp/CppWriter.cpp:1.18 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.17 Fri Oct 20 02:07:24 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Thu Oct 26 01:15:43 2006 @@ -773,7 +773,9 @@ case Instruction::Add: Out << "getAdd"; break; case Instruction::Sub: Out << "getSub"; break; case Instruction::Mul: Out << "getMul"; break; - case Instruction::Div: Out << "getDiv"; break; + case Instruction::UDiv: Out << "getUDiv"; break; + case Instruction::SDiv: Out << "getSDiv"; break; + case Instruction::FDiv: Out << "getFDiv"; break; case Instruction::Rem: Out << "getRem"; break; case Instruction::And: Out << "getAnd"; break; case Instruction::Or: Out << "getOr"; break; @@ -1021,7 +1023,9 @@ case Instruction::Add: case Instruction::Sub: case Instruction::Mul: - case Instruction::Div: + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: case Instruction::Rem: case Instruction::And: case Instruction::Or: @@ -1033,7 +1037,9 @@ case Instruction::Add: Out << "Instruction::Add"; break; case Instruction::Sub: Out << "Instruction::Sub"; break; case Instruction::Mul: Out << "Instruction::Mul"; break; - case Instruction::Div: Out << "Instruction::Div"; break; + case Instruction::UDiv:Out << "Instruction::UDiv"; break; + case Instruction::SDiv:Out << "Instruction::SDiv"; break; + case Instruction::FDiv:Out << "Instruction::FDiv"; break; case Instruction::Rem: Out << "Instruction::Rem"; break; case Instruction::And: Out << "Instruction::And"; break; case Instruction::Or: Out << "Instruction::Or"; break; From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200610260616.k9Q6GSEt029150@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.274 -> 1.275 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+161 -7) Writer.cpp | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 161 insertions(+), 7 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.274 llvm/lib/Target/CBackend/Writer.cpp:1.275 --- llvm/lib/Target/CBackend/Writer.cpp:1.274 Sun Oct 22 04:58:21 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Thu Oct 26 01:15:43 2006 @@ -121,6 +121,8 @@ void writeOperand(Value *Operand); void writeOperandInternal(Value *Operand); + void writeOperandWithCast(Value* Operand, unsigned Opcode); + bool writeInstructionCast(const Instruction &I); private : void lowerIntrinsics(Function &F); @@ -136,6 +138,8 @@ void printLoop(Loop *L); void printConstant(Constant *CPV); + void printConstantWithCast(Constant *CPV, unsigned Opcode); + bool printConstExprCast(const ConstantExpr *CE); void printConstantArray(ConstantArray *CPA); void printConstantPacked(ConstantPacked *CP); @@ -586,7 +590,9 @@ case Instruction::Add: case Instruction::Sub: case Instruction::Mul: - case Instruction::Div: + case Instruction::SDiv: + case Instruction::UDiv: + case Instruction::FDiv: case Instruction::Rem: case Instruction::And: case Instruction::Or: @@ -600,12 +606,15 @@ case Instruction::Shl: case Instruction::Shr: Out << '('; - printConstant(CE->getOperand(0)); + bool NeedsClosingParens = printConstExprCast(CE); + printConstantWithCast(CE->getOperand(0), CE->getOpcode()); switch (CE->getOpcode()) { case Instruction::Add: Out << " + "; break; case Instruction::Sub: Out << " - "; break; case Instruction::Mul: Out << " * "; break; - case Instruction::Div: Out << " / "; break; + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: Out << " / "; break; case Instruction::Rem: Out << " % "; break; case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; @@ -620,7 +629,9 @@ case Instruction::Shr: Out << " >> "; break; default: assert(0 && "Illegal opcode here!"); } - printConstant(CE->getOperand(1)); + printConstantWithCast(CE->getOperand(1), CE->getOpcode()); + if (NeedsClosingParens) + Out << "))"; Out << ')'; return; @@ -805,6 +816,71 @@ } } +// Some constant expressions need to be casted back to the original types +// because their operands were casted to the expected type. This function takes +// care of detecting that case and printing the cast for the ConstantExpr. +bool CWriter::printConstExprCast(const ConstantExpr* CE) { + bool Result = false; + const Type* Ty = CE->getOperand(0)->getType(); + switch (CE->getOpcode()) { + case Instruction::UDiv: Result = Ty->isSigned(); break; + case Instruction::SDiv: Result = Ty->isUnsigned(); break; + default: break; + } + if (Result) { + Out << "(("; + printType(Out, Ty); + Out << ")("; + } + return Result; +} + +// Print a constant assuming that it is the operand for a given Opcode. The +// opcodes that care about sign need to cast their operands to the expected +// type before the operation proceeds. This function does the casting. +void CWriter::printConstantWithCast(Constant* CPV, unsigned Opcode) { + + // Extract the operand's type, we'll need it. + const Type* OpTy = CPV->getType(); + + // Indicate whether to do the cast or not. + bool shouldCast = false; + + // Based on the Opcode for which this Constant is being written, determine + // the new type to which the operand should be casted by setting the value + // of OpTy. If we change OpTy, also set shouldCast to true. + switch (Opcode) { + default: + // for most instructions, it doesn't matter + break; + case Instruction::UDiv: + // For UDiv to have unsigned operands + if (OpTy->isSigned()) { + OpTy = OpTy->getUnsignedVersion(); + shouldCast = true; + } + break; + case Instruction::SDiv: + if (OpTy->isUnsigned()) { + OpTy = OpTy->getSignedVersion(); + shouldCast = true; + } + break; + } + + // Write out the casted constnat if we should, otherwise just write the + // operand. + if (shouldCast) { + Out << "(("; + printType(Out, OpTy); + Out << ")"; + printConstant(CPV); + Out << ")"; + } else + writeOperand(CPV); + +} + void CWriter::writeOperandInternal(Value *Operand) { if (Instruction *I = dyn_cast(Operand)) if (isInlinableInst(*I) && !isDirectAlloca(I)) { @@ -833,6 +909,72 @@ Out << ')'; } +// Some instructions need to have their result value casted back to the +// original types because their operands were casted to the expected type. +// This function takes care of detecting that case and printing the cast +// for the Instruction. +bool CWriter::writeInstructionCast(const Instruction &I) { + bool Result = false; + const Type* Ty = I.getOperand(0)->getType(); + switch (I.getOpcode()) { + case Instruction::UDiv: Result = Ty->isSigned(); break; + case Instruction::SDiv: Result = Ty->isUnsigned(); break; + default: break; + } + if (Result) { + Out << "(("; + printType(Out, Ty); + Out << ")("; + } + return Result; +} + +// Write the operand with a cast to another type based on the Opcode being used. +// This will be used in cases where an instruction has specific type +// requirements (usually signedness) for its operands. +void CWriter::writeOperandWithCast(Value* Operand, unsigned Opcode) { + + // Extract the operand's type, we'll need it. + const Type* OpTy = Operand->getType(); + + // Indicate whether to do the cast or not. + bool shouldCast = false; + + // Based on the Opcode for which this Operand is being written, determine + // the new type to which the operand should be casted by setting the value + // of OpTy. If we change OpTy, also set shouldCast to true. + switch (Opcode) { + default: + // for most instructions, it doesn't matter + break; + case Instruction::UDiv: + // For UDiv to have unsigned operands + if (OpTy->isSigned()) { + OpTy = OpTy->getUnsignedVersion(); + shouldCast = true; + } + break; + case Instruction::SDiv: + if (OpTy->isUnsigned()) { + OpTy = OpTy->getSignedVersion(); + shouldCast = true; + } + break; + } + + // Write out the casted operand if we should, otherwise just write the + // operand. + if (shouldCast) { + Out << "(("; + printType(Out, OpTy); + Out << ")"; + writeOperand(Operand); + Out << ")"; + } else + writeOperand(Operand); + +} + // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // @@ -1642,13 +1784,23 @@ writeOperand(I.getOperand(1)); Out << ")"; } else { - writeOperand(I.getOperand(0)); + + // Write out the cast of the instruction's value back to the proper type + // if necessary. + bool NeedsClosingParens = writeInstructionCast(I); + + // Certain instructions require the operand to be forced to a specific type + // so we use writeOperandWithCast here instead of writeOperand. Similarly + // below for operand 1 + writeOperandWithCast(I.getOperand(0), I.getOpcode()); switch (I.getOpcode()) { case Instruction::Add: Out << " + "; break; case Instruction::Sub: Out << " - "; break; case Instruction::Mul: Out << '*'; break; - case Instruction::Div: Out << '/'; break; + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: Out << '/'; break; case Instruction::Rem: Out << '%'; break; case Instruction::And: Out << " & "; break; case Instruction::Or: Out << " | "; break; @@ -1664,7 +1816,9 @@ default: std::cerr << "Invalid operator type!" << I; abort(); } - writeOperand(I.getOperand(1)); + writeOperandWithCast(I.getOperand(1), I.getOpcode()); + if (NeedsClosingParens) + Out << "))"; } if (needsCast) { From reid at x10sys.com Thu Oct 26 01:16:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp Message-ID: <200610260616.k9Q6GRai029114@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.94 -> 1.95 Constants.cpp updated: 1.165 -> 1.166 Instruction.cpp updated: 1.53 -> 1.54 Instructions.cpp updated: 1.43 -> 1.44 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+105 -33) ConstantFolding.cpp | 82 +++++++++++++++++++++++++++++++++++----------------- Constants.cpp | 30 ++++++++++++++++--- Instruction.cpp | 8 +++-- Instructions.cpp | 18 ++++++++++- 4 files changed, 105 insertions(+), 33 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.94 llvm/lib/VMCore/ConstantFolding.cpp:1.95 --- llvm/lib/VMCore/ConstantFolding.cpp:1.94 Fri Oct 20 02:07:24 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Oct 26 01:15:43 2006 @@ -40,7 +40,9 @@ virtual Constant *add(const Constant *V1, const Constant *V2) const = 0; virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0; virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *div(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *fdiv(const Constant *V1, const Constant *V2) const = 0; virtual Constant *rem(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; @@ -106,8 +108,14 @@ virtual Constant *mul(const Constant *V1, const Constant *V2) const { return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *div(const Constant *V1, const Constant *V2) const { - return SubClassName::Div((const ArgType *)V1, (const ArgType *)V2); + virtual Constant *udiv(const Constant *V1, const Constant *V2) const { + return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2); + } + virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { + return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); + } + virtual Constant *fdiv(const Constant *V1, const Constant *V2) const { + return SubClassName::FDiv((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *rem(const Constant *V1, const Constant *V2) const { return SubClassName::Rem((const ArgType *)V1, (const ArgType *)V2); @@ -178,16 +186,18 @@ // Default "noop" implementations //===--------------------------------------------------------------------===// - static Constant *Add(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Sub(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Div(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Rem(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shl(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shr(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *FDiv(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Rem (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -373,8 +383,14 @@ static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getMul); } - static Constant *Div(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getDiv); + static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getUDiv); + } + static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getSDiv); + } + static Constant *FDiv(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getFDiv); } static Constant *Rem(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getRem); @@ -493,18 +509,25 @@ DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST - static Constant *Div(const ConstantInt *V1, const ConstantInt *V2) { - if (V2->isNullValue()) return 0; + static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) { + if (V2->isNullValue()) + return 0; + BuiltinType R = (BuiltinType)(V1->getZExtValue() / V2->getZExtValue()); + return ConstantInt::get(*Ty, R); + } + + static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) { + if (V2->isNullValue()) + return 0; if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) + (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue()) return 0; BuiltinType R = - (BuiltinType)V1->getZExtValue() / (BuiltinType)V2->getZExtValue(); + (BuiltinType)(V1->getSExtValue() / V2->getSExtValue()); return ConstantInt::get(*Ty, R); } - static Constant *Rem(const ConstantInt *V1, - const ConstantInt *V2) { + static Constant *Rem(const ConstantInt *V1, const ConstantInt *V2) { if (V2->isNullValue()) return 0; // X / 0 if (V2->isAllOnesValue() && // MIN_INT / -1 (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) @@ -615,7 +638,7 @@ (BuiltinType)V2->getValue()); return ConstantFP::get(*Ty, Result); } - static Constant *Div(const ConstantFP *V1, const ConstantFP *V2) { + static Constant *FDiv(const ConstantFP *V1, const ConstantFP *V2) { BuiltinType inf = std::numeric_limits::infinity(); if (V2->isExactlyValue(0.0)) return ConstantFP::get(*Ty, inf); if (V2->isExactlyValue(-0.0)) return ConstantFP::get(*Ty, -inf); @@ -1224,7 +1247,9 @@ case Instruction::Add: C = ConstRules::get(V1, V2).add(V1, V2); break; case Instruction::Sub: C = ConstRules::get(V1, V2).sub(V1, V2); break; case Instruction::Mul: C = ConstRules::get(V1, V2).mul(V1, V2); break; - case Instruction::Div: C = ConstRules::get(V1, V2).div(V1, V2); break; + case Instruction::UDiv: C = ConstRules::get(V1, V2).udiv(V1, V2); break; + case Instruction::SDiv: C = ConstRules::get(V1, V2).sdiv(V1, V2); break; + case Instruction::FDiv: C = ConstRules::get(V1, V2).fdiv(V1, V2); break; case Instruction::Rem: C = ConstRules::get(V1, V2).rem(V1, V2); break; case Instruction::And: C = ConstRules::get(V1, V2).op_and(V1, V2); break; case Instruction::Or: C = ConstRules::get(V1, V2).op_or (V1, V2); break; @@ -1307,7 +1332,9 @@ case Instruction::Mul: case Instruction::And: return Constant::getNullValue(V1->getType()); - case Instruction::Div: + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: case Instruction::Rem: if (!isa(V2)) // undef/X -> 0 return Constant::getNullValue(V1->getType()); @@ -1358,7 +1385,8 @@ if (CI->getZExtValue() == 1) return const_cast(V1); // X * 1 == X break; - case Instruction::Div: + case Instruction::UDiv: + case Instruction::SDiv: if (const ConstantInt *CI = dyn_cast(V2)) if (CI->getZExtValue() == 1) return const_cast(V1); // X / 1 == X @@ -1419,7 +1447,9 @@ case Instruction::Shl: case Instruction::Shr: case Instruction::Sub: - case Instruction::Div: + case Instruction::SDiv: + case Instruction::UDiv: + case Instruction::FDiv: case Instruction::Rem: default: // These instructions cannot be flopped around. break; Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.165 llvm/lib/VMCore/Constants.cpp:1.166 --- llvm/lib/VMCore/Constants.cpp:1.165 Fri Oct 20 02:07:24 2006 +++ llvm/lib/VMCore/Constants.cpp Thu Oct 26 01:15:43 2006 @@ -75,7 +75,9 @@ switch (CE->getOpcode()) { default: return false; - case Instruction::Div: + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: case Instruction::Rem: // Div and rem can trap if the RHS is not known to be non-zero. if (!isa(getOperand(1)) || getOperand(1)->isNullValue()) @@ -446,8 +448,14 @@ Constant *ConstantExpr::getMul(Constant *C1, Constant *C2) { return get(Instruction::Mul, C1, C2); } -Constant *ConstantExpr::getDiv(Constant *C1, Constant *C2) { - return get(Instruction::Div, C1, C2); +Constant *ConstantExpr::getUDiv(Constant *C1, Constant *C2) { + return get(Instruction::UDiv, C1, C2); +} +Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) { + return get(Instruction::SDiv, C1, C2); +} +Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { + return get(Instruction::FDiv, C1, C2); } Constant *ConstantExpr::getRem(Constant *C1, Constant *C2) { return get(Instruction::Rem, C1, C2); @@ -1437,13 +1445,27 @@ #ifndef NDEBUG switch (Opcode) { case Instruction::Add: case Instruction::Sub: - case Instruction::Mul: case Instruction::Div: + case Instruction::Mul: case Instruction::Rem: assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() || isa(C1->getType())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; + + case Instruction::UDiv: + case Instruction::SDiv: + assert(C1->getType() == C2->getType() && "Op types should be identical!"); + assert((C1->getType()->isInteger() || (isa(C1->getType()) && + cast(C1->getType())->getElementType()->isInteger())) && + "Tried to create an arithmetic operation on a non-arithmetic type!"); + break; + case Instruction::FDiv: + assert(C1->getType() == C2->getType() && "Op types should be identical!"); + assert((C1->getType()->isFloatingPoint() || (isa(C1->getType()) + && cast(C1->getType())->getElementType()->isFloatingPoint())) + && "Tried to create an arithmetic operation on a non-arithmetic type!"); + break; case Instruction::And: case Instruction::Or: case Instruction::Xor: Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.53 llvm/lib/VMCore/Instruction.cpp:1.54 --- llvm/lib/VMCore/Instruction.cpp:1.53 Sun Sep 17 14:14:47 2006 +++ llvm/lib/VMCore/Instruction.cpp Thu Oct 26 01:15:43 2006 @@ -94,7 +94,9 @@ case Add: return "add"; case Sub: return "sub"; case Mul: return "mul"; - case Div: return "div"; + case UDiv: return "udiv"; + case SDiv: return "sdiv"; + case FDiv: return "fdiv"; case Rem: return "rem"; // Logical operators... @@ -221,7 +223,9 @@ /// bool Instruction::isTrapping(unsigned op) { switch(op) { - case Div: + case UDiv: + case SDiv: + case FDiv: case Rem: case Load: case Store: Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.43 llvm/lib/VMCore/Instructions.cpp:1.44 --- llvm/lib/VMCore/Instructions.cpp:1.43 Fri Oct 20 02:07:24 2006 +++ llvm/lib/VMCore/Instructions.cpp Thu Oct 26 01:15:43 2006 @@ -1022,7 +1022,7 @@ #ifndef NDEBUG switch (iType) { case Add: case Sub: - case Mul: case Div: + case Mul: case Rem: assert(getType() == LHS->getType() && "Arithmetic operation should return same type as operands!"); @@ -1030,6 +1030,22 @@ isa(getType())) && "Tried to create an arithmetic operation on a non-arithmetic type!"); break; + case UDiv: + case SDiv: + assert(getType() == LHS->getType() && + "Arithmetic operation should return same type as operands!"); + assert((getType()->isInteger() || (isa(getType()) && + cast(getType())->getElementType()->isInteger())) && + "Incorrect operand type (not integer) for S/UDIV"); + break; + case FDiv: + assert(getType() == LHS->getType() && + "Arithmetic operation should return same type as operands!"); + assert((getType()->isFloatingPoint() || (isa(getType()) && + cast(getType())->getElementType()->isFloatingPoint())) + && "Incorrect operand type (not floating point) for FDIV"); + break; + case And: case Or: case Xor: assert(getType() == LHS->getType() && From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/div.ll Message-ID: <200610260616.k9Q6GS2M029181@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: div.ll updated: 1.12 -> 1.13 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+5 -6) div.ll | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) Index: llvm/test/Regression/Transforms/InstCombine/div.ll diff -u llvm/test/Regression/Transforms/InstCombine/div.ll:1.12 llvm/test/Regression/Transforms/InstCombine/div.ll:1.13 --- llvm/test/Regression/Transforms/InstCombine/div.ll:1.12 Sun Feb 5 01:52:47 2006 +++ llvm/test/Regression/Transforms/InstCombine/div.ll Thu Oct 26 01:15:43 2006 @@ -57,13 +57,12 @@ uint %test10(uint %X, bool %C) { %V = select bool %C, uint 64, uint 8 - %R = div uint %X, %V + %R = udiv uint %X, %V ret uint %R } -uint %test10(uint %X, ubyte %B) { - %Amt = shl uint 32, ubyte %B - %V = div uint %X, %Amt - ret uint %V +int %test11(int %X, bool %C) { + %A = select bool %C, int 1024, int 32 + %B = udiv int %X, %A + ret int %B } - From reid at x10sys.com Thu Oct 26 01:16:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Reader.h Message-ID: <200610260616.k9Q6GRfr029106@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.199 -> 1.200 Reader.h updated: 1.34 -> 1.35 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+713 -370) Reader.cpp | 1064 +++++++++++++++++++++++++++++++++++++++---------------------- Reader.h | 19 + 2 files changed, 713 insertions(+), 370 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.199 llvm/lib/Bytecode/Reader/Reader.cpp:1.200 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.199 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 26 01:15:43 2006 @@ -562,6 +562,244 @@ insertValue(AI, getTypeSlot(AI->getType()), FunctionValues); } +// Convert previous opcode values into the current value and/or construct +// the instruction. This function handles all *abnormal* cases for instruction +// generation based on obsolete opcode values. The normal cases are handled +// in ParseInstruction below. Generally this function just produces a new +// Opcode value (first argument). In a few cases (VAArg, VANext) the upgrade +// path requies that the instruction (sequence) be generated differently from +// the normal case in order to preserve the original semantics. In these +// cases the result of the function will be a non-zero Instruction pointer. In +// all other cases, zero will be returned indicating that the *normal* +// instruction generation should be used, but with the new Opcode value. +// +Instruction* +BytecodeReader::handleObsoleteOpcodes( + unsigned &Opcode, ///< The old opcode, possibly updated by this function + std::vector &Oprnds, ///< The operands to the instruction + unsigned &iType, ///< The type code from the bytecode file + const Type* InstTy, ///< The type of the instruction + BasicBlock* BB ///< The basic block to insert into, if we need to +) { + + // First, short circuit this if no conversion is required. When signless + // instructions were implemented the entire opcode sequence was revised so + // we key on this first which means that the opcode value read is the one + // we should use. + if (!hasSignlessInstructions) + return 0; // The opcode is fine the way it is. + + // Declare the resulting instruction we might build. In general we just + // change the Opcode argument but in a few cases we need to generate the + // Instruction here because the upgrade case is significantly different from + // the normal case. + Instruction *Result = 0; + + // If this is a bytecode format that did not include the unreachable + // instruction, bump up the opcode number to adjust it. + if (hasNoUnreachableInst) + if (Opcode >= Instruction::Unreachable && Opcode < 62) + ++Opcode; + + // We're dealing with an upgrade situation. For each of the opcode values, + // perform the necessary conversion. + switch (Opcode) { + default: // Error + // This switch statement provides cases for all known opcodes prior to + // version 6 bytecode format. We know we're in an upgrade situation so + // if there isn't a match in this switch, then something is horribly + // wrong. + error("Unknown obsolete opcode encountered."); + break; + case 1: // Ret + Opcode = Instruction::Ret; + break; + case 2: // Br + Opcode = Instruction::Br; + break; + case 3: // Switch + Opcode = Instruction::Switch; + break; + case 4: // Invoke + Opcode = Instruction::Invoke; + break; + case 5: // Unwind + Opcode = Instruction::Unwind; + break; + case 6: // Unreachable + Opcode = Instruction::Unreachable; + break; + case 7: // Add + Opcode = Instruction::Add; + break; + case 8: // Sub + Opcode = Instruction::Sub; + break; + case 9: // Mul + Opcode = Instruction::Mul; + break; + case 10: // Div + // The type of the instruction is based on the operands. We need to select + // fdiv, udiv or sdiv based on that type. The iType values are hardcoded + // to the values used in bytecode version 5 (and prior) because it is + // likely these codes will change in future versions of LLVM. + if (iType == 10 || iType == 11 ) + Opcode = Instruction::FDiv; + else if (iType >= 2 && iType <= 9 && iType % 2 != 0) + Opcode = Instruction::SDiv; + else + Opcode = Instruction::UDiv; + break; + + case 11: // Rem + Opcode = Instruction::Rem; + break; + case 12: // And + Opcode = Instruction::And; + break; + case 13: // Or + Opcode = Instruction::Or; + break; + case 14: // Xor + Opcode = Instruction::Xor; + break; + case 15: // SetEQ + Opcode = Instruction::SetEQ; + break; + case 16: // SetNE + Opcode = Instruction::SetNE; + break; + case 17: // SetLE + Opcode = Instruction::SetLE; + break; + case 18: // SetGE + Opcode = Instruction::SetGE; + break; + case 19: // SetLT + Opcode = Instruction::SetLT; + break; + case 20: // SetGT + Opcode = Instruction::SetGT; + break; + case 21: // Malloc + Opcode = Instruction::Malloc; + break; + case 22: // Free + Opcode = Instruction::Free; + break; + case 23: // Alloca + Opcode = Instruction::Alloca; + break; + case 24: // Load + Opcode = Instruction::Load; + break; + case 25: // Store + Opcode = Instruction::Store; + break; + case 26: // GetElementPtr + Opcode = Instruction::GetElementPtr; + break; + case 27: // PHI + Opcode = Instruction::PHI; + break; + case 28: // Cast + Opcode = Instruction::Cast; + break; + case 29: // Call + Opcode = Instruction::Call; + break; + case 30: // Shl + Opcode = Instruction::Shl; + break; + case 31: // Shr + Opcode = Instruction::Shr; + break; + case 32: { //VANext_old ( <= llvm 1.5 ) + const Type* ArgTy = getValue(iType, Oprnds[0])->getType(); + Function* NF = TheModule->getOrInsertFunction( + "llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + // In llvm 1.6 the VANext instruction was dropped because it was only + // necessary to have a VAArg instruction. The code below transforms an + // old vanext instruction into the equivalent code given only the + // availability of the new vaarg instruction. Essentially, the transform + // is as follows: + // b = vanext a, t -> + // foo = alloca 1 of t + // bar = vacopy a + // store bar -> foo + // tmp = vaarg foo, t + // b = load foo + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); + BB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, getValue(iType, Oprnds[0])); + BB->getInstList().push_back(bar); + BB->getInstList().push_back(new StoreInst(bar, foo)); + Instruction* tmp = new VAArgInst(foo, getSanitizedType(Oprnds[1])); + BB->getInstList().push_back(tmp); + Result = new LoadInst(foo); + break; + } + case 33: { //VAArg_old + const Type* ArgTy = getValue(iType, Oprnds[0])->getType(); + Function* NF = TheModule->getOrInsertFunction( + "llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + // In llvm 1.6 the VAArg's instruction semantics were changed. The code + // below transforms an old vaarg instruction into the equivalent code + // given only the availability of the new vaarg instruction. Essentially, + // the transform is as follows: + // b = vaarg a, t -> + // foo = alloca 1 of t + // bar = vacopy a + // store bar -> foo + // b = vaarg foo, t + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); + BB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, getValue(iType, Oprnds[0])); + BB->getInstList().push_back(bar); + BB->getInstList().push_back(new StoreInst(bar, foo)); + Result = new VAArgInst(foo, getSanitizedType(Oprnds[1])); + break; + } + case 34: // Select + Opcode = Instruction::Select; + break; + case 35: // UserOp1 + Opcode = Instruction::UserOp1; + break; + case 36: // UserOp2 + Opcode = Instruction::UserOp2; + break; + case 37: // VAArg + Opcode = Instruction::VAArg; + break; + case 38: // ExtractElement + Opcode = Instruction::ExtractElement; + break; + case 39: // InsertElement + Opcode = Instruction::InsertElement; + break; + case 40: // ShuffleVector + Opcode = Instruction::ShuffleVector; + break; + case 56: // Invoke with encoded CC + case 57: // Invoke Fast CC + case 58: // Call with extra operand for calling conv + case 59: // tail call, Fast CC + case 60: // normal call, Fast CC + case 61: // tail call, C Calling Conv + case 62: // volatile load + case 63: // volatile store + // In all these cases, we pass the opcode through. The new version uses + // the same code (for now, this might change in 2.0). These are listed + // here to document the opcodes in use in vers 5 bytecode and to make it + // easier to migrate these opcodes in the future. + break; + } + return Result; +} + //===----------------------------------------------------------------------===// // Bytecode Parsing Methods //===----------------------------------------------------------------------===// @@ -643,411 +881,376 @@ const Type *InstTy = getSanitizedType(iType); + // Make the necessary adjustments for dealing with backwards compatibility + // of opcodes. + Instruction* Result = + handleObsoleteOpcodes(Opcode, Oprnds, iType, InstTy, BB); + // We have enough info to inform the handler now. - if (Handler) Handler->handleInstruction(Opcode, InstTy, Oprnds, At-SaveAt); + if (Handler) + Handler->handleInstruction(Opcode, InstTy, Oprnds, At-SaveAt); - // Declare the resulting instruction we'll build. - Instruction *Result = 0; + // If the backwards compatibility code didn't produce an instruction then + // we do the *normal* thing .. + if (!Result) { + // First, handle the easy binary operators case + if (Opcode >= Instruction::BinaryOpsBegin && + Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2) + Result = BinaryOperator::create(Instruction::BinaryOps(Opcode), + getValue(iType, Oprnds[0]), + getValue(iType, Oprnds[1])); + + // Indicate that we don't think this is a call instruction (yet). + // Process based on the Opcode read + switch (Opcode) { + default: // There was an error, this shouldn't happen. + if (Result == 0) + error("Illegal instruction read!"); + break; + case Instruction::VAArg: + if (Oprnds.size() != 2) + error("Invalid VAArg instruction!"); + Result = new VAArgInst(getValue(iType, Oprnds[0]), + getSanitizedType(Oprnds[1])); + break; + case Instruction::ExtractElement: { + if (Oprnds.size() != 2) + error("Invalid extractelement instruction!"); + Value *V1 = getValue(iType, Oprnds[0]); + Value *V2 = getValue(Type::UIntTyID, Oprnds[1]); + + if (!ExtractElementInst::isValidOperands(V1, V2)) + error("Invalid extractelement instruction!"); - // If this is a bytecode format that did not include the unreachable - // instruction, bump up all opcodes numbers to make space. - if (hasNoUnreachableInst) { - if (Opcode >= Instruction::Unreachable && - Opcode < 62) { - ++Opcode; + Result = new ExtractElementInst(V1, V2); + break; } - } - - // Handle binary operators - if (Opcode >= Instruction::BinaryOpsBegin && - Opcode < Instruction::BinaryOpsEnd && Oprnds.size() == 2) - Result = BinaryOperator::create((Instruction::BinaryOps)Opcode, - getValue(iType, Oprnds[0]), - getValue(iType, Oprnds[1])); - - bool isCall = false; - switch (Opcode) { - default: - if (Result == 0) - error("Illegal instruction read!"); - break; - case Instruction::VAArg: - Result = new VAArgInst(getValue(iType, Oprnds[0]), - getSanitizedType(Oprnds[1])); - break; - case 32: { //VANext_old - const Type* ArgTy = getValue(iType, Oprnds[0])->getType(); - Function* NF = TheModule->getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, - (Type *)0); - - //b = vanext a, t -> - //foo = alloca 1 of t - //bar = vacopy a - //store bar -> foo - //tmp = vaarg foo, t - //b = load foo - AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); - BB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, getValue(iType, Oprnds[0])); - BB->getInstList().push_back(bar); - BB->getInstList().push_back(new StoreInst(bar, foo)); - Instruction* tmp = new VAArgInst(foo, getSanitizedType(Oprnds[1])); - BB->getInstList().push_back(tmp); - Result = new LoadInst(foo); - break; - } - case 33: { //VAArg_old - const Type* ArgTy = getValue(iType, Oprnds[0])->getType(); - Function* NF = TheModule->getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, - (Type *)0); - - //b = vaarg a, t -> - //foo = alloca 1 of t - //bar = vacopy a - //store bar -> foo - //b = vaarg foo, t - AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); - BB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, getValue(iType, Oprnds[0])); - BB->getInstList().push_back(bar); - BB->getInstList().push_back(new StoreInst(bar, foo)); - Result = new VAArgInst(foo, getSanitizedType(Oprnds[1])); - break; - } - case Instruction::ExtractElement: { - if (Oprnds.size() != 2) - error("Invalid extractelement instruction!"); - Value *V1 = getValue(iType, Oprnds[0]); - Value *V2 = getValue(Type::UIntTyID, Oprnds[1]); - - if (!ExtractElementInst::isValidOperands(V1, V2)) - error("Invalid extractelement instruction!"); - - Result = new ExtractElementInst(V1, V2); - break; - } - case Instruction::InsertElement: { - const PackedType *PackedTy = dyn_cast(InstTy); - if (!PackedTy || Oprnds.size() != 3) - error("Invalid insertelement instruction!"); - - Value *V1 = getValue(iType, Oprnds[0]); - Value *V2 = getValue(getTypeSlot(PackedTy->getElementType()), Oprnds[1]); - Value *V3 = getValue(Type::UIntTyID, Oprnds[2]); + case Instruction::InsertElement: { + const PackedType *PackedTy = dyn_cast(InstTy); + if (!PackedTy || Oprnds.size() != 3) + error("Invalid insertelement instruction!"); - if (!InsertElementInst::isValidOperands(V1, V2, V3)) - error("Invalid insertelement instruction!"); - Result = new InsertElementInst(V1, V2, V3); - break; - } - case Instruction::ShuffleVector: { - const PackedType *PackedTy = dyn_cast(InstTy); - if (!PackedTy || Oprnds.size() != 3) - error("Invalid shufflevector instruction!"); - Value *V1 = getValue(iType, Oprnds[0]); - Value *V2 = getValue(iType, Oprnds[1]); - const PackedType *EltTy = - PackedType::get(Type::UIntTy, PackedTy->getNumElements()); - Value *V3 = getValue(getTypeSlot(EltTy), Oprnds[2]); - if (!ShuffleVectorInst::isValidOperands(V1, V2, V3)) - error("Invalid shufflevector instruction!"); - Result = new ShuffleVectorInst(V1, V2, V3); - break; - } - case Instruction::Cast: - Result = new CastInst(getValue(iType, Oprnds[0]), - getSanitizedType(Oprnds[1])); - break; - case Instruction::Select: - Result = new SelectInst(getValue(Type::BoolTyID, Oprnds[0]), - getValue(iType, Oprnds[1]), - getValue(iType, Oprnds[2])); - break; - case Instruction::PHI: { - if (Oprnds.size() == 0 || (Oprnds.size() & 1)) - error("Invalid phi node encountered!"); - - PHINode *PN = new PHINode(InstTy); - PN->reserveOperandSpace(Oprnds.size()); - for (unsigned i = 0, e = Oprnds.size(); i != e; i += 2) - PN->addIncoming(getValue(iType, Oprnds[i]), getBasicBlock(Oprnds[i+1])); - Result = PN; - break; - } - - case Instruction::Shl: - case Instruction::Shr: - Result = new ShiftInst((Instruction::OtherOps)Opcode, - getValue(iType, Oprnds[0]), - getValue(Type::UByteTyID, Oprnds[1])); - break; - case Instruction::Ret: - if (Oprnds.size() == 0) - Result = new ReturnInst(); - else if (Oprnds.size() == 1) - Result = new ReturnInst(getValue(iType, Oprnds[0])); - else - error("Unrecognized instruction!"); - break; - - case Instruction::Br: - if (Oprnds.size() == 1) - Result = new BranchInst(getBasicBlock(Oprnds[0])); - else if (Oprnds.size() == 3) - Result = new BranchInst(getBasicBlock(Oprnds[0]), - getBasicBlock(Oprnds[1]), getValue(Type::BoolTyID , Oprnds[2])); - else - error("Invalid number of operands for a 'br' instruction!"); - break; - case Instruction::Switch: { - if (Oprnds.size() & 1) - error("Switch statement with odd number of arguments!"); - - SwitchInst *I = new SwitchInst(getValue(iType, Oprnds[0]), - getBasicBlock(Oprnds[1]), - Oprnds.size()/2-1); - for (unsigned i = 2, e = Oprnds.size(); i != e; i += 2) - I->addCase(cast(getValue(iType, Oprnds[i])), - getBasicBlock(Oprnds[i+1])); - Result = I; - break; - } - - case 58: // Call with extra operand for calling conv - case 59: // tail call, Fast CC - case 60: // normal call, Fast CC - case 61: // tail call, C Calling Conv - case Instruction::Call: { // Normal Call, C Calling Convention - if (Oprnds.size() == 0) - error("Invalid call instruction encountered!"); - - Value *F = getValue(iType, Oprnds[0]); + Value *V1 = getValue(iType, Oprnds[0]); + Value *V2 = getValue(getTypeSlot(PackedTy->getElementType()),Oprnds[1]); + Value *V3 = getValue(Type::UIntTyID, Oprnds[2]); + + if (!InsertElementInst::isValidOperands(V1, V2, V3)) + error("Invalid insertelement instruction!"); + Result = new InsertElementInst(V1, V2, V3); + break; + } + case Instruction::ShuffleVector: { + const PackedType *PackedTy = dyn_cast(InstTy); + if (!PackedTy || Oprnds.size() != 3) + error("Invalid shufflevector instruction!"); + Value *V1 = getValue(iType, Oprnds[0]); + Value *V2 = getValue(iType, Oprnds[1]); + const PackedType *EltTy = + PackedType::get(Type::UIntTy, PackedTy->getNumElements()); + Value *V3 = getValue(getTypeSlot(EltTy), Oprnds[2]); + if (!ShuffleVectorInst::isValidOperands(V1, V2, V3)) + error("Invalid shufflevector instruction!"); + Result = new ShuffleVectorInst(V1, V2, V3); + break; + } + case Instruction::Cast: + if (Oprnds.size() != 2) + error("Invalid Cast instruction!"); + Result = new CastInst(getValue(iType, Oprnds[0]), + getSanitizedType(Oprnds[1])); + break; + case Instruction::Select: + if (Oprnds.size() != 3) + error("Invalid Select instruction!"); + Result = new SelectInst(getValue(Type::BoolTyID, Oprnds[0]), + getValue(iType, Oprnds[1]), + getValue(iType, Oprnds[2])); + break; + case Instruction::PHI: { + if (Oprnds.size() == 0 || (Oprnds.size() & 1)) + error("Invalid phi node encountered!"); + + PHINode *PN = new PHINode(InstTy); + PN->reserveOperandSpace(Oprnds.size()); + for (unsigned i = 0, e = Oprnds.size(); i != e; i += 2) + PN->addIncoming( + getValue(iType, Oprnds[i]), getBasicBlock(Oprnds[i+1])); + Result = PN; + break; + } - unsigned CallingConv = CallingConv::C; - bool isTailCall = false; + case Instruction::Shl: + case Instruction::Shr: + Result = new ShiftInst(Instruction::OtherOps(Opcode), + getValue(iType, Oprnds[0]), + getValue(Type::UByteTyID, Oprnds[1])); + break; + case Instruction::Ret: + if (Oprnds.size() == 0) + Result = new ReturnInst(); + else if (Oprnds.size() == 1) + Result = new ReturnInst(getValue(iType, Oprnds[0])); + else + error("Unrecognized instruction!"); + break; - if (Opcode == 61 || Opcode == 59) - isTailCall = true; - - if (Opcode == 58) { - isTailCall = Oprnds.back() & 1; - CallingConv = Oprnds.back() >> 1; - Oprnds.pop_back(); - } else if (Opcode == 59 || Opcode == 60) { - CallingConv = CallingConv::Fast; + case Instruction::Br: + if (Oprnds.size() == 1) + Result = new BranchInst(getBasicBlock(Oprnds[0])); + else if (Oprnds.size() == 3) + Result = new BranchInst(getBasicBlock(Oprnds[0]), + getBasicBlock(Oprnds[1]), getValue(Type::BoolTyID , Oprnds[2])); + else + error("Invalid number of operands for a 'br' instruction!"); + break; + case Instruction::Switch: { + if (Oprnds.size() & 1) + error("Switch statement with odd number of arguments!"); + + SwitchInst *I = new SwitchInst(getValue(iType, Oprnds[0]), + getBasicBlock(Oprnds[1]), + Oprnds.size()/2-1); + for (unsigned i = 2, e = Oprnds.size(); i != e; i += 2) + I->addCase(cast(getValue(iType, Oprnds[i])), + getBasicBlock(Oprnds[i+1])); + Result = I; + break; } - - // Check to make sure we have a pointer to function type - const PointerType *PTy = dyn_cast(F->getType()); - if (PTy == 0) error("Call to non function pointer value!"); - const FunctionType *FTy = dyn_cast(PTy->getElementType()); - if (FTy == 0) error("Call to non function pointer value!"); - - std::vector Params; - if (!FTy->isVarArg()) { - FunctionType::param_iterator It = FTy->param_begin(); + case 58: // Call with extra operand for calling conv + case 59: // tail call, Fast CC + case 60: // normal call, Fast CC + case 61: // tail call, C Calling Conv + case Instruction::Call: { // Normal Call, C Calling Convention + if (Oprnds.size() == 0) + error("Invalid call instruction encountered!"); - for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { - if (It == FTy->param_end()) - error("Invalid call instruction!"); - Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); - } - if (It != FTy->param_end()) - error("Invalid call instruction!"); - } else { - Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); + Value *F = getValue(iType, Oprnds[0]); - unsigned FirstVariableOperand; - if (Oprnds.size() < FTy->getNumParams()) - error("Call instruction missing operands!"); + unsigned CallingConv = CallingConv::C; + bool isTailCall = false; - // Read all of the fixed arguments - for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) - Params.push_back(getValue(getTypeSlot(FTy->getParamType(i)),Oprnds[i])); - - FirstVariableOperand = FTy->getNumParams(); + if (Opcode == 61 || Opcode == 59) + isTailCall = true; + + if (Opcode == 58) { + isTailCall = Oprnds.back() & 1; + CallingConv = Oprnds.back() >> 1; + Oprnds.pop_back(); + } else if (Opcode == 59 || Opcode == 60) { + CallingConv = CallingConv::Fast; + } + + // Check to make sure we have a pointer to function type + const PointerType *PTy = dyn_cast(F->getType()); + if (PTy == 0) error("Call to non function pointer value!"); + const FunctionType *FTy = dyn_cast(PTy->getElementType()); + if (FTy == 0) error("Call to non function pointer value!"); + + std::vector Params; + if (!FTy->isVarArg()) { + FunctionType::param_iterator It = FTy->param_begin(); + + for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { + if (It == FTy->param_end()) + error("Invalid call instruction!"); + Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); + } + if (It != FTy->param_end()) + error("Invalid call instruction!"); + } else { + Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); - if ((Oprnds.size()-FirstVariableOperand) & 1) - error("Invalid call instruction!"); // Must be pairs of type/value + unsigned FirstVariableOperand; + if (Oprnds.size() < FTy->getNumParams()) + error("Call instruction missing operands!"); - for (unsigned i = FirstVariableOperand, e = Oprnds.size(); - i != e; i += 2) - Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); - } + // Read all of the fixed arguments + for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) + Params.push_back( + getValue(getTypeSlot(FTy->getParamType(i)),Oprnds[i])); - Result = new CallInst(F, Params); - if (isTailCall) cast(Result)->setTailCall(); - if (CallingConv) cast(Result)->setCallingConv(CallingConv); - break; - } - case 56: // Invoke with encoded CC - case 57: // Invoke Fast CC - case Instruction::Invoke: { // Invoke C CC - if (Oprnds.size() < 3) - error("Invalid invoke instruction!"); - Value *F = getValue(iType, Oprnds[0]); + FirstVariableOperand = FTy->getNumParams(); - // Check to make sure we have a pointer to function type - const PointerType *PTy = dyn_cast(F->getType()); - if (PTy == 0) - error("Invoke to non function pointer value!"); - const FunctionType *FTy = dyn_cast(PTy->getElementType()); - if (FTy == 0) - error("Invoke to non function pointer value!"); + if ((Oprnds.size()-FirstVariableOperand) & 1) + error("Invalid call instruction!"); // Must be pairs of type/value - std::vector Params; - BasicBlock *Normal, *Except; - unsigned CallingConv = CallingConv::C; + for (unsigned i = FirstVariableOperand, e = Oprnds.size(); + i != e; i += 2) + Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); + } - if (Opcode == 57) - CallingConv = CallingConv::Fast; - else if (Opcode == 56) { - CallingConv = Oprnds.back(); - Oprnds.pop_back(); + Result = new CallInst(F, Params); + if (isTailCall) cast(Result)->setTailCall(); + if (CallingConv) cast(Result)->setCallingConv(CallingConv); + break; } - - if (!FTy->isVarArg()) { - Normal = getBasicBlock(Oprnds[1]); - Except = getBasicBlock(Oprnds[2]); - - FunctionType::param_iterator It = FTy->param_begin(); - for (unsigned i = 3, e = Oprnds.size(); i != e; ++i) { - if (It == FTy->param_end()) - error("Invalid invoke instruction!"); - Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); - } - if (It != FTy->param_end()) + case 56: // Invoke with encoded CC + case 57: // Invoke Fast CC + case Instruction::Invoke: { // Invoke C CC + if (Oprnds.size() < 3) error("Invalid invoke instruction!"); - } else { - Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); - - Normal = getBasicBlock(Oprnds[0]); - Except = getBasicBlock(Oprnds[1]); + Value *F = getValue(iType, Oprnds[0]); - unsigned FirstVariableArgument = FTy->getNumParams()+2; - for (unsigned i = 2; i != FirstVariableArgument; ++i) - Params.push_back(getValue(getTypeSlot(FTy->getParamType(i-2)), - Oprnds[i])); + // Check to make sure we have a pointer to function type + const PointerType *PTy = dyn_cast(F->getType()); + if (PTy == 0) + error("Invoke to non function pointer value!"); + const FunctionType *FTy = dyn_cast(PTy->getElementType()); + if (FTy == 0) + error("Invoke to non function pointer value!"); + + std::vector Params; + BasicBlock *Normal, *Except; + unsigned CallingConv = CallingConv::C; + + if (Opcode == 57) + CallingConv = CallingConv::Fast; + else if (Opcode == 56) { + CallingConv = Oprnds.back(); + Oprnds.pop_back(); + } - if (Oprnds.size()-FirstVariableArgument & 1) // Must be type/value pairs - error("Invalid invoke instruction!"); + if (!FTy->isVarArg()) { + Normal = getBasicBlock(Oprnds[1]); + Except = getBasicBlock(Oprnds[2]); + + FunctionType::param_iterator It = FTy->param_begin(); + for (unsigned i = 3, e = Oprnds.size(); i != e; ++i) { + if (It == FTy->param_end()) + error("Invalid invoke instruction!"); + Params.push_back(getValue(getTypeSlot(*It++), Oprnds[i])); + } + if (It != FTy->param_end()) + error("Invalid invoke instruction!"); + } else { + Oprnds.erase(Oprnds.begin(), Oprnds.begin()+1); - for (unsigned i = FirstVariableArgument; i < Oprnds.size(); i += 2) - Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); - } + Normal = getBasicBlock(Oprnds[0]); + Except = getBasicBlock(Oprnds[1]); - Result = new InvokeInst(F, Normal, Except, Params); - if (CallingConv) cast(Result)->setCallingConv(CallingConv); - break; - } - case Instruction::Malloc: { - unsigned Align = 0; - if (Oprnds.size() == 2) - Align = (1 << Oprnds[1]) >> 1; - else if (Oprnds.size() > 2) - error("Invalid malloc instruction!"); - if (!isa(InstTy)) - error("Invalid malloc instruction!"); + unsigned FirstVariableArgument = FTy->getNumParams()+2; + for (unsigned i = 2; i != FirstVariableArgument; ++i) + Params.push_back(getValue(getTypeSlot(FTy->getParamType(i-2)), + Oprnds[i])); - Result = new MallocInst(cast(InstTy)->getElementType(), - getValue(Type::UIntTyID, Oprnds[0]), Align); - break; - } + // Must be type/value pairs. If not, error out. + if (Oprnds.size()-FirstVariableArgument & 1) + error("Invalid invoke instruction!"); - case Instruction::Alloca: { - unsigned Align = 0; - if (Oprnds.size() == 2) - Align = (1 << Oprnds[1]) >> 1; - else if (Oprnds.size() > 2) - error("Invalid alloca instruction!"); - if (!isa(InstTy)) - error("Invalid alloca instruction!"); + for (unsigned i = FirstVariableArgument; i < Oprnds.size(); i += 2) + Params.push_back(getValue(Oprnds[i], Oprnds[i+1])); + } - Result = new AllocaInst(cast(InstTy)->getElementType(), - getValue(Type::UIntTyID, Oprnds[0]), Align); - break; - } - case Instruction::Free: - if (!isa(InstTy)) - error("Invalid free instruction!"); - Result = new FreeInst(getValue(iType, Oprnds[0])); - break; - case Instruction::GetElementPtr: { - if (Oprnds.size() == 0 || !isa(InstTy)) - error("Invalid getelementptr instruction!"); + Result = new InvokeInst(F, Normal, Except, Params); + if (CallingConv) cast(Result)->setCallingConv(CallingConv); + break; + } + case Instruction::Malloc: { + unsigned Align = 0; + if (Oprnds.size() == 2) + Align = (1 << Oprnds[1]) >> 1; + else if (Oprnds.size() > 2) + error("Invalid malloc instruction!"); + if (!isa(InstTy)) + error("Invalid malloc instruction!"); - std::vector Idx; + Result = new MallocInst(cast(InstTy)->getElementType(), + getValue(Type::UIntTyID, Oprnds[0]), Align); + break; + } + case Instruction::Alloca: { + unsigned Align = 0; + if (Oprnds.size() == 2) + Align = (1 << Oprnds[1]) >> 1; + else if (Oprnds.size() > 2) + error("Invalid alloca instruction!"); + if (!isa(InstTy)) + error("Invalid alloca instruction!"); - const Type *NextTy = InstTy; - for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { - const CompositeType *TopTy = dyn_cast_or_null(NextTy); - if (!TopTy) + Result = new AllocaInst(cast(InstTy)->getElementType(), + getValue(Type::UIntTyID, Oprnds[0]), Align); + break; + } + case Instruction::Free: + if (!isa(InstTy)) + error("Invalid free instruction!"); + Result = new FreeInst(getValue(iType, Oprnds[0])); + break; + case Instruction::GetElementPtr: { + if (Oprnds.size() == 0 || !isa(InstTy)) error("Invalid getelementptr instruction!"); - unsigned ValIdx = Oprnds[i]; - unsigned IdxTy = 0; - if (!hasRestrictedGEPTypes) { - // Struct indices are always uints, sequential type indices can be any - // of the 32 or 64-bit integer types. The actual choice of type is - // encoded in the low two bits of the slot number. - if (isa(TopTy)) - IdxTy = Type::UIntTyID; - else { - switch (ValIdx & 3) { - default: - case 0: IdxTy = Type::UIntTyID; break; - case 1: IdxTy = Type::IntTyID; break; - case 2: IdxTy = Type::ULongTyID; break; - case 3: IdxTy = Type::LongTyID; break; + std::vector Idx; + + const Type *NextTy = InstTy; + for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { + const CompositeType *TopTy = dyn_cast_or_null(NextTy); + if (!TopTy) + error("Invalid getelementptr instruction!"); + + unsigned ValIdx = Oprnds[i]; + unsigned IdxTy = 0; + if (!hasRestrictedGEPTypes) { + // Struct indices are always uints, sequential type indices can be + // any of the 32 or 64-bit integer types. The actual choice of + // type is encoded in the low two bits of the slot number. + if (isa(TopTy)) + IdxTy = Type::UIntTyID; + else { + switch (ValIdx & 3) { + default: + case 0: IdxTy = Type::UIntTyID; break; + case 1: IdxTy = Type::IntTyID; break; + case 2: IdxTy = Type::ULongTyID; break; + case 3: IdxTy = Type::LongTyID; break; + } + ValIdx >>= 2; } - ValIdx >>= 2; + } else { + IdxTy = isa(TopTy) ? Type::UByteTyID : Type::LongTyID; } - } else { - IdxTy = isa(TopTy) ? Type::UByteTyID : Type::LongTyID; - } - - Idx.push_back(getValue(IdxTy, ValIdx)); - - // Convert ubyte struct indices into uint struct indices. - if (isa(TopTy) && hasRestrictedGEPTypes) - if (ConstantInt *C = dyn_cast(Idx.back())) - if (C->getType() == Type::UByteTy) - Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy); - NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); - } + Idx.push_back(getValue(IdxTy, ValIdx)); - Result = new GetElementPtrInst(getValue(iType, Oprnds[0]), Idx); - break; - } + // Convert ubyte struct indices into uint struct indices. + if (isa(TopTy) && hasRestrictedGEPTypes) + if (ConstantInt *C = dyn_cast(Idx.back())) + if (C->getType() == Type::UByteTy) + Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy); - case 62: // volatile load - case Instruction::Load: - if (Oprnds.size() != 1 || !isa(InstTy)) - error("Invalid load instruction!"); - Result = new LoadInst(getValue(iType, Oprnds[0]), "", Opcode == 62); - break; - - case 63: // volatile store - case Instruction::Store: { - if (!isa(InstTy) || Oprnds.size() != 2) - error("Invalid store instruction!"); + NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); + } - Value *Ptr = getValue(iType, Oprnds[1]); - const Type *ValTy = cast(Ptr->getType())->getElementType(); - Result = new StoreInst(getValue(getTypeSlot(ValTy), Oprnds[0]), Ptr, - Opcode == 63); - break; - } - case Instruction::Unwind: - if (Oprnds.size() != 0) error("Invalid unwind instruction!"); - Result = new UnwindInst(); - break; - case Instruction::Unreachable: - if (Oprnds.size() != 0) error("Invalid unreachable instruction!"); - Result = new UnreachableInst(); - break; - } // end switch(Opcode) + Result = new GetElementPtrInst(getValue(iType, Oprnds[0]), Idx); + break; + } + case 62: // volatile load + case Instruction::Load: + if (Oprnds.size() != 1 || !isa(InstTy)) + error("Invalid load instruction!"); + Result = new LoadInst(getValue(iType, Oprnds[0]), "", Opcode == 62); + break; + case 63: // volatile store + case Instruction::Store: { + if (!isa(InstTy) || Oprnds.size() != 2) + error("Invalid store instruction!"); + + Value *Ptr = getValue(iType, Oprnds[1]); + const Type *ValTy = cast(Ptr->getType())->getElementType(); + Result = new StoreInst(getValue(getTypeSlot(ValTy), Oprnds[0]), Ptr, + Opcode == 63); + break; + } + case Instruction::Unwind: + if (Oprnds.size() != 0) error("Invalid unwind instruction!"); + Result = new UnwindInst(); + break; + case Instruction::Unreachable: + if (Oprnds.size() != 0) error("Invalid unreachable instruction!"); + Result = new UnreachableInst(); + break; + } // end switch(Opcode) + } // end if *normal* BB->getInstList().push_back(Result); @@ -1414,6 +1617,110 @@ } } +// Upgrade obsolete constant expression opcodes (ver. 5 and prior) to the new +// values used after ver 6. bytecode format. The operands are provided to the +// function so that decisions based on the operand type can be made when +// auto-upgrading obsolete opcodes to the new ones. +// NOTE: This code needs to be kept synchronized with handleObsoleteOpcodes. +// We can't use that function because of that functions argument requirements. +// This function only deals with the subset of opcodes that are applicable to +// constant expressions and is therefore simpler than handleObsoleteOpcodes. +inline unsigned fixCEOpcodes( + unsigned Opcode, const std::vector &ArgVec +) { + switch (Opcode) { + default: // Pass Through + // If we don't match any of the cases here then the opcode is fine the + // way it is. + break; + case 7: // Add + Opcode = Instruction::Add; + break; + case 8: // Sub + Opcode = Instruction::Sub; + break; + case 9: // Mul + Opcode = Instruction::Mul; + break; + case 10: // Div + // The type of the instruction is based on the operands. We need to select + // either udiv or sdiv based on that type. This expression selects the + // cases where the type is floating point or signed in which case we + // generated an sdiv instruction. + if (ArgVec[0]->getType()->isFloatingPoint()) + Opcode = Instruction::FDiv; + else if (ArgVec[0]->getType()->isSigned()) + Opcode = Instruction::SDiv; + else + Opcode = Instruction::UDiv; + break; + + case 11: // Rem + // As with "Div", make the signed/unsigned Rem instruction choice based + // on the type of the instruction. + if (ArgVec[0]->getType()->isFloatingPoint()) + Opcode = Instruction::Rem; + else if (ArgVec[0]->getType()->isSigned()) + Opcode = Instruction::Rem; + else + Opcode = Instruction::Rem; + break; + + case 12: // And + Opcode = Instruction::And; + break; + case 13: // Or + Opcode = Instruction::Or; + break; + case 14: // Xor + Opcode = Instruction::Xor; + break; + case 15: // SetEQ + Opcode = Instruction::SetEQ; + break; + case 16: // SetNE + Opcode = Instruction::SetNE; + break; + case 17: // SetLE + Opcode = Instruction::SetLE; + break; + case 18: // SetGE + Opcode = Instruction::SetGE; + break; + case 19: // SetLT + Opcode = Instruction::SetLT; + break; + case 20: // SetGT + Opcode = Instruction::SetGT; + break; + case 26: // GetElementPtr + Opcode = Instruction::GetElementPtr; + break; + case 28: // Cast + Opcode = Instruction::Cast; + break; + case 30: // Shl + Opcode = Instruction::Shl; + break; + case 31: // Shr + Opcode = Instruction::Shr; + break; + case 34: // Select + Opcode = Instruction::Select; + break; + case 38: // ExtractElement + Opcode = Instruction::ExtractElement; + break; + case 39: // InsertElement + Opcode = Instruction::InsertElement; + break; + case 40: // ShuffleVector + Opcode = Instruction::ShuffleVector; + break; + } + return Opcode; +} + /// Parse a single constant value Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) { // We must check for a ConstantExpr before switching by type because @@ -1468,6 +1775,10 @@ ArgVec.push_back(getConstantValue(ArgTypeSlot, ArgValSlot)); } + // Handle backwards compatibility for the opcode numbers + if (hasSignlessInstructions) + Opcode = fixCEOpcodes(Opcode, ArgVec); + // Construct a ConstantExpr of the appropriate kind if (isExprNumArgs == 1) { // All one-operand expressions if (Opcode != Instruction::Cast) @@ -2240,7 +2551,10 @@ hasNoUndefValue = false; hasNoFlagsForFunctions = false; hasNoUnreachableInst = false; + hasSignlessInstructions = false; + // Determine which backwards compatibility flags to set based on the + // bytecode file's version number switch (RevisionNum) { case 0: // LLVM 1.0, 1.1 (Released) // Base LLVM 1.0 bytecode format. @@ -2311,11 +2625,21 @@ // In version 4 and above, we did not include the 'unreachable' instruction // in the opcode numbering in the bytecode file. hasNoUnreachableInst = true; - break; // FALL THROUGH case 5: // 1.4 (Released) + // In version 5 and prior, instructions were signless while integer types + // were signed. In version 6, instructions became signed and types became + // signless. For example in version 5 we have the DIV instruction but in + // version 6 we have FDIV, SDIV and UDIV to replace it. This caused a + // renumbering of the instruction codes in version 6 that must be dealt with + // when reading old bytecode files. + hasSignlessInstructions = true; + + // FALL THROUGH + + case 6: // SignlessTypes Implementation (1.9 release) break; default: Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.34 llvm/lib/Bytecode/Reader/Reader.h:1.35 --- llvm/lib/Bytecode/Reader/Reader.h:1.34 Thu Oct 12 13:32:30 2006 +++ llvm/lib/Bytecode/Reader/Reader.h Thu Oct 26 01:15:43 2006 @@ -226,6 +226,18 @@ Function* F ///< The function into which BBs will be inserted ); + /// Convert previous opcode values into the current value and/or construct + /// the instruction. This function handles all *abnormal* cases for + /// instruction generation based on obsolete opcode values. The normal cases + /// are handled by the ParseInstruction function. + Instruction* handleObsoleteOpcodes( + unsigned &opcode, ///< The old opcode, possibly updated by this function + std::vector &Oprnds, ///< The operands to the instruction + unsigned &iType, ///< The type code from the bytecode file + const Type* InstTy, ///< The type of the instruction + BasicBlock* BB ///< The basic block to insert into, if we need to + ); + /// @brief Parse a single instruction. void ParseInstruction( std::vector& Args, ///< The arguments to be filled in @@ -336,6 +348,13 @@ // unreachable instruction. bool hasNoUnreachableInst; + // In version 5 and prior, instructions were signless. In version 6, + // instructions became signed. For example in version 5 we have the DIV + // instruction but in version 6 we have FDIV, SDIV and UDIV to replace it. + // This causes a renumbering of the instruction codes in version 6 that must + // be dealt with when reading old bytecode files. + bool hasSignlessInstructions; + /// In release 1.7 we changed intrinsic functions to not be overloaded. There /// is no bytecode change for this, but to optimize the auto-upgrade of calls /// to intrinsic functions, we save a mapping of old function definitions to From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200610260616.k9Q6GSSq029140@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.158 -> 1.159 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+59 -13) LangRef.html | 72 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 59 insertions(+), 13 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.158 llvm/docs/LangRef.html:1.159 --- llvm/docs/LangRef.html:1.158 Sun Oct 15 15:05:59 2006 +++ llvm/docs/LangRef.html Thu Oct 26 01:15:43 2006 @@ -77,7 +77,9 @@
  • 'add' Instruction
  • 'sub' Instruction
  • 'mul' Instruction
  • -
  • 'div' Instruction
  • +
  • 'udiv' Instruction
  • +
  • 'sdiv' Instruction
  • +
  • 'fdiv' Instruction
  • 'rem' Instruction
  • 'setcc' Instructions
  • @@ -1630,26 +1632,70 @@
    -
    'div' + +
    +
    Syntax:
    +
      <result> = udiv <ty> <var1>, <var2>   ; yields {ty}:result
    +
    +
    Overview:
    +

    The 'udiv' instruction returns the quotient of its two +operands.

    +
    Arguments:
    +

    The two arguments to the 'udiv' instruction must be +integer values. Both arguments must have identical +types. This instruction can also take packed versions +of the values in which case the elements must be integers.

    +
    Semantics:
    +

    The value produced is the unsigned integer quotient of the two operands. This +instruction always performs an unsigned division operation, regardless of +whether the arguments are unsigned or not.

    +
    Example:
    +
      <result> = udiv uint 4, %var          ; yields {uint}:result = 4 / %var
    +
    +
    + + +
    +
    Syntax:
    +
      <result> = sdiv <ty> <var1>, <var2>   ; yields {ty}:result
    +
    +
    Overview:
    +

    The 'sdiv' instruction returns the quotient of its two +operands.

    +
    Arguments:
    +

    The two arguments to the 'sdiv' instruction must be +integer values. Both arguments must have identical +types. This instruction can also take packed versions +of the values in which case the elements must be integers.

    +
    Semantics:
    +

    The value produced is the signed integer quotient of the two operands. This +instruction always performs a signed division operation, regardless of whether +the arguments are signed or not.

    +
    Example:
    +
      <result> = sdiv int 4, %var          ; yields {int}:result = 4 / %var
    +
    +
    + +
    Syntax:
    -
      <result> = div <ty> <var1>, <var2>   ; yields {ty}:result
    +
      <result> = fdiv <ty> <var1>, <var2>   ; yields {ty}:result
     
    Overview:
    -

    The 'div' instruction returns the quotient of its two +

    The 'fdiv' instruction returns the quotient of its two operands.

    Arguments:
    -

    The two arguments to the 'div' instruction must be either integer or floating point -values. -This instruction can also take packed versions of the values. -Both arguments must have identical types.

    +

    The two arguments to the 'div' instruction must be +floating point values. Both arguments must have +identical types. This instruction can also take packed +versions of the values in which case the elements must be floating point.

    Semantics:
    -

    The value produced is the integer or floating point quotient of the -two operands.

    +

    The value produced is the floating point quotient of the two operands.

    Example:
    -
      <result> = div int 4, %var          ; yields {int}:result = 4 / %var
    +
      <result> = fdiv float 4.0, %var          ; yields {float}:result = 4.0 / %var
     
    @@ -3910,7 +3956,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/15 20:05:59 $ + Last modified: $Date: 2006/10/26 06:15:43 $ From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp PredicateSimplifier.cpp Reassociate.cpp Message-ID: <200610260616.k9Q6GS7W029159@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.527 -> 1.528 PredicateSimplifier.cpp updated: 1.29 -> 1.30 Reassociate.cpp updated: 1.63 -> 1.64 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+254 -133) InstructionCombining.cpp | 379 ++++++++++++++++++++++++++++++----------------- PredicateSimplifier.cpp | 4 Reassociate.cpp | 4 3 files changed, 254 insertions(+), 133 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.527 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.528 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.527 Fri Oct 20 13:20:21 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 26 01:15:43 2006 @@ -131,7 +131,11 @@ Instruction *visitAdd(BinaryOperator &I); Instruction *visitSub(BinaryOperator &I); Instruction *visitMul(BinaryOperator &I); - Instruction *visitDiv(BinaryOperator &I); + Instruction *commonDivTransforms(BinaryOperator &I); + Instruction *commonIDivTransforms(BinaryOperator &I); + Instruction *visitUDiv(BinaryOperator &I); + Instruction *visitSDiv(BinaryOperator &I); + Instruction *visitFDiv(BinaryOperator &I); Instruction *visitRem(BinaryOperator &I); Instruction *visitAnd(BinaryOperator &I); Instruction *visitOr (BinaryOperator &I); @@ -1822,7 +1826,9 @@ return R; } - // add (cast *A to intptrtype) B -> cast (GEP (cast *A to sbyte*) B) -> intptrtype + // add (cast *A to intptrtype) B -> + // cast (GEP (cast *A to sbyte*) B) -> + // intptrtype { CastInst* CI = dyn_cast(LHS); Value* Other = RHS; @@ -1975,11 +1981,11 @@ } // 0 - (X sdiv C) -> (X sdiv -C) - if (Op1I->getOpcode() == Instruction::Div) + if (Op1I->getOpcode() == Instruction::SDiv) if (ConstantInt *CSI = dyn_cast(Op0)) - if (CSI->getType()->isSigned() && CSI->isNullValue()) + if (CSI->isNullValue()) if (Constant *DivRHS = dyn_cast(Op1I->getOperand(1))) - return BinaryOperator::createDiv(Op1I->getOperand(0), + return BinaryOperator::createSDiv(Op1I->getOperand(0), ConstantExpr::getNeg(DivRHS)); // X - X*C --> X * (1-C) @@ -2156,64 +2162,28 @@ return Changed ? &I : 0; } -Instruction *InstCombiner::visitDiv(BinaryOperator &I) { +/// This function implements the transforms on div instructions that work +/// regardless of the kind of div instruction it is (udiv, sdiv, or fdiv). It is +/// used by the visitors to those instructions. +/// @brief Transforms common to all three div instructions +Instruction* InstCombiner::commonDivTransforms(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - if (isa(Op0)) // undef / X -> 0 + // undef / X -> 0 + if (isa(Op0)) return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); - if (isa(Op1)) - return ReplaceInstUsesWith(I, Op1); // X / undef -> undef - - if (ConstantInt *RHS = dyn_cast(Op1)) { - // div X, 1 == X - if (RHS->equalsInt(1)) - return ReplaceInstUsesWith(I, Op0); - - // div X, -1 == -X - if (RHS->isAllOnesValue()) - return BinaryOperator::createNeg(Op0); - - if (Instruction *LHS = dyn_cast(Op0)) - if (LHS->getOpcode() == Instruction::Div) - if (ConstantInt *LHSRHS = dyn_cast(LHS->getOperand(1))) { - // (X / C1) / C2 -> X / (C1*C2) - return BinaryOperator::createDiv(LHS->getOperand(0), - ConstantExpr::getMul(RHS, LHSRHS)); - } - - // Check to see if this is an unsigned division with an exact power of 2, - // if so, convert to a right shift. - if (ConstantInt *C = dyn_cast(RHS)) - if (C->getType()->isUnsigned()) - if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 - if (isPowerOf2_64(Val)) { - uint64_t C = Log2_64(Val); - return new ShiftInst(Instruction::Shr, Op0, - ConstantInt::get(Type::UByteTy, C)); - } - // -X/C -> X/-C - if (RHS->getType()->isSigned()) - if (Value *LHSNeg = dyn_castNegVal(Op0)) - return BinaryOperator::createDiv(LHSNeg, ConstantExpr::getNeg(RHS)); - - if (!RHS->isNullValue()) { - if (SelectInst *SI = dyn_cast(Op0)) - if (Instruction *R = FoldOpIntoSelect(I, SI, this)) - return R; - if (isa(Op0)) - if (Instruction *NV = FoldOpIntoPhi(I)) - return NV; - } - } + // X / undef -> undef + if (isa(Op1)) + return ReplaceInstUsesWith(I, Op1); - // Handle div X, Cond?Y:Z + // Handle cases involving: div X, (select Cond, Y, Z) if (SelectInst *SI = dyn_cast(Op1)) { // div X, (Cond ? 0 : Y) -> div X, Y. If the div and the select are in the - // same basic block, then we replace the select with Y, and the condition of - // the select with false (if the cond value is in the same BB). If the + // same basic block, then we replace the select with Y, and the condition + // of the select with false (if the cond value is in the same BB). If the // select has uses other than the div, this allows them to be simplified - // also. + // also. Note that div X, Y is just as good as div X, 0 (undef) if (Constant *ST = dyn_cast(SI->getOperand(1))) if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); @@ -2225,6 +2195,7 @@ UpdateValueUsesWith(SI, SI->getOperand(2)); return &I; } + // Likewise for: div X, (Cond ? Y : 0) -> div X, Y if (Constant *ST = dyn_cast(SI->getOperand(2))) if (ST->isNullValue()) { @@ -2237,77 +2208,180 @@ UpdateValueUsesWith(SI, SI->getOperand(1)); return &I; } + } + + return 0; +} + +/// This function implements the transforms common to both integer division +/// instructions (udiv and sdiv). It is called by the visitors to those integer +/// division instructions. +/// @brief Common integer divide transforms +Instruction* InstCombiner::commonIDivTransforms(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + if (Instruction *Common = commonDivTransforms(I)) + return Common; + + if (ConstantInt *RHS = dyn_cast(Op1)) { + // div X, 1 == X + if (RHS->equalsInt(1)) + return ReplaceInstUsesWith(I, Op0); + + // (X / C1) / C2 -> X / (C1*C2) + if (Instruction *LHS = dyn_cast(Op0)) + if (Instruction::BinaryOps(LHS->getOpcode()) == I.getOpcode()) + if (ConstantInt *LHSRHS = dyn_cast(LHS->getOperand(1))) { + return BinaryOperator::create(I.getOpcode(), LHS->getOperand(0), + ConstantExpr::getMul(RHS, LHSRHS)); + } + + if (!RHS->isNullValue()) { // avoid X udiv 0 + if (SelectInst *SI = dyn_cast(Op0)) + if (Instruction *R = FoldOpIntoSelect(I, SI, this)) + return R; + if (isa(Op0)) + if (Instruction *NV = FoldOpIntoPhi(I)) + return NV; + } + } + + // 0 / X == 0, we don't need to preserve faults! + if (ConstantInt *LHS = dyn_cast(Op0)) + if (LHS->equalsInt(0)) + return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); + + return 0; +} + +Instruction *InstCombiner::visitUDiv(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + // Handle the integer div common cases + if (Instruction *Common = commonIDivTransforms(I)) + return Common; + + // X udiv C^2 -> X >> C + // Check to see if this is an unsigned division with an exact power of 2, + // if so, convert to a right shift. + if (ConstantInt *C = dyn_cast(Op1)) { + if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 + if (isPowerOf2_64(Val)) { + uint64_t ShiftAmt = Log2_64(Val); + Value* X = Op0; + const Type* XTy = X->getType(); + bool isSigned = XTy->isSigned(); + if (isSigned) + X = InsertCastBefore(X, XTy->getUnsignedVersion(), I); + Instruction* Result = + new ShiftInst(Instruction::Shr, X, + ConstantInt::get(Type::UByteTy, ShiftAmt)); + if (!isSigned) + return Result; + InsertNewInstBefore(Result, I); + return new CastInst(Result, XTy->getSignedVersion(), I.getName()); + } + } - // If this is 'udiv X, (Cond ? C1, C2)' where C1&C2 are powers of two, - // transform this into: '(Cond ? (udiv X, C1) : (udiv X, C2))'. + // X udiv (C1 << N), where C1 is "1< X >> (N+C2) + if (ShiftInst *RHSI = dyn_cast(I.getOperand(1))) { + if (RHSI->getOpcode() == Instruction::Shl && + isa(RHSI->getOperand(0))) { + uint64_t C1 = cast(RHSI->getOperand(0))->getZExtValue(); + if (isPowerOf2_64(C1)) { + Value *N = RHSI->getOperand(1); + const Type* NTy = N->getType(); + bool isSigned = NTy->isSigned(); + if (uint64_t C2 = Log2_64(C1)) { + if (isSigned) { + NTy = NTy->getUnsignedVersion(); + N = InsertCastBefore(N, NTy, I); + } + Constant *C2V = ConstantInt::get(NTy, C2); + N = InsertNewInstBefore(BinaryOperator::createAdd(N, C2V, "tmp"), I); + } + Instruction* Result = new ShiftInst(Instruction::Shr, Op0, N); + if (!isSigned) + return Result; + InsertNewInstBefore(Result, I); + return new CastInst(Result, NTy->getSignedVersion(), I.getName()); + } + } + } + + // udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) + // where C1&C2 are powers of two. + if (SelectInst *SI = dyn_cast(Op1)) { if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) - if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { - // STO == 0 and SFO == 0 handled above. + if (!STO->isNullValue() && !STO->isNullValue()) { uint64_t TVA = STO->getZExtValue(), FVA = SFO->getZExtValue(); if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { + // Compute the shift amounts unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); + // Make sure we get the unsigned version of X + Value* X = Op0; + const Type* origXTy = X->getType(); + bool isSigned = origXTy->isSigned(); + if (isSigned) + X = InsertCastBefore(X, X->getType()->getUnsignedVersion(), I); + // Construct the "on true" case of the select Constant *TC = ConstantInt::get(Type::UByteTy, TSA); - Instruction *TSI = new ShiftInst(Instruction::Shr, Op0, - TC, SI->getName()+".t"); + Instruction *TSI = + new ShiftInst(Instruction::Shr, X, TC, SI->getName()+".t"); TSI = InsertNewInstBefore(TSI, I); - - Constant *FC = ConstantInt::get(Type::UByteTy, FSA); - Instruction *FSI = new ShiftInst(Instruction::Shr, Op0, - FC, SI->getName()+".f"); + + // Construct the "on false" case of the select + Constant *FC = ConstantInt::get(Type::UByteTy, FSA); + Instruction *FSI = + new ShiftInst(Instruction::Shr, X, FC, SI->getName()+".f"); FSI = InsertNewInstBefore(FSI, I); - return new SelectInst(SI->getOperand(0), TSI, FSI); + + // construct the select instruction and return it. + SelectInst* NewSI = + new SelectInst(SI->getOperand(0), TSI, FSI, SI->getName()); + if (!isSigned) + return NewSI; + InsertNewInstBefore(NewSI, I); + return new CastInst(NewSI, origXTy, NewSI->getName()); } } } + return 0; +} - // 0 / X == 0, we don't need to preserve faults! - if (ConstantInt *LHS = dyn_cast(Op0)) - if (LHS->equalsInt(0)) - return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); +Instruction *InstCombiner::visitSDiv(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - if (I.getType()->isSigned()) { - // If the sign bits of both operands are zero (i.e. we can prove they are - // unsigned inputs), turn this into a udiv. + // Handle the integer div common cases + if (Instruction *Common = commonIDivTransforms(I)) + return Common; + + if (ConstantInt *RHS = dyn_cast(Op1)) { + // sdiv X, -1 == -X + if (RHS->isAllOnesValue()) + return BinaryOperator::createNeg(Op0); + + // -X/C -> X/-C + if (Value *LHSNeg = dyn_castNegVal(Op0)) + return BinaryOperator::createSDiv(LHSNeg, ConstantExpr::getNeg(RHS)); + } + + // If the sign bits of both operands are zero (i.e. we can prove they are + // unsigned inputs), turn this into a udiv. + if (I.getType()->isInteger()) { uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { - const Type *NTy = Op0->getType()->getUnsignedVersion(); - Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); - InsertNewInstBefore(LHS, I); - Value *RHS; - if (Constant *R = dyn_cast(Op1)) - RHS = ConstantExpr::getCast(R, NTy); - else - RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); - Instruction *Div = BinaryOperator::createDiv(LHS, RHS, I.getName()); - InsertNewInstBefore(Div, I); - return new CastInst(Div, I.getType()); - } - } else { - // Known to be an unsigned division. - if (Instruction *RHSI = dyn_cast(I.getOperand(1))) { - // Turn A / (C1 << N), where C1 is "1<> (N+C2) [udiv only]. - if (RHSI->getOpcode() == Instruction::Shl && - isa(RHSI->getOperand(0)) && - RHSI->getOperand(0)->getType()->isUnsigned()) { - uint64_t C1 = cast(RHSI->getOperand(0))->getZExtValue(); - if (isPowerOf2_64(C1)) { - uint64_t C2 = Log2_64(C1); - Value *Add = RHSI->getOperand(1); - if (C2) { - Constant *C2V = ConstantInt::get(Add->getType(), C2); - Add = InsertNewInstBefore(BinaryOperator::createAdd(Add, C2V, - "tmp"), I); - } - return new ShiftInst(Instruction::Shr, Op0, Add); - } - } + return BinaryOperator::createUDiv(Op0, Op1, I.getName()); } - } + } return 0; } +Instruction *InstCombiner::visitFDiv(BinaryOperator &I) { + return commonDivTransforms(I); +} /// GetFactor - If we can prove that the specified value is at least a multiple /// of some factor, return that factor. @@ -2376,13 +2450,12 @@ uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { const Type *NTy = Op0->getType()->getUnsignedVersion(); - Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); - InsertNewInstBefore(LHS, I); + Value *LHS = InsertCastBefore(Op0, NTy, I); Value *RHS; if (Constant *R = dyn_cast(Op1)) RHS = ConstantExpr::getCast(R, NTy); else - RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); + RHS = InsertCastBefore(Op1, NTy, I); Instruction *Rem = BinaryOperator::createRem(LHS, RHS, I.getName()); InsertNewInstBefore(Rem, I); return new CastInst(Rem, I.getType()); @@ -3717,14 +3790,6 @@ return Changed ? &I : 0; } -/// MulWithOverflow - Compute Result = In1*In2, returning true if the result -/// overflowed for this type. -static bool MulWithOverflow(ConstantInt *&Result, ConstantInt *In1, - ConstantInt *In2) { - Result = cast(ConstantExpr::getMul(In1, In2)); - return !In2->isNullValue() && ConstantExpr::getDiv(Result, In2) != In1; -} - static bool isPositive(ConstantInt *C) { return C->getSExtValue() >= 0; } @@ -4126,7 +4191,9 @@ } } - + // Since the RHS is a constantInt (CI), if the left hand side is an + // instruction, see if that instruction also has constants so that the + // instruction can be folded into the setcc if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { case Instruction::And: @@ -4379,27 +4446,60 @@ } break; - case Instruction::Div: - // Fold: (div X, C1) op C2 -> range check + case Instruction::SDiv: + case Instruction::UDiv: + // Fold: setcc ([us]div X, C1), C2 -> range test + // Fold this div into the comparison, producing a range check. + // Determine, based on the divide type, what the range is being + // checked. If there is an overflow on the low or high side, remember + // it, otherwise compute the range [low, hi) bounding the new value. + // See: InsertRangeTest above for the kinds of replacements possible. if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { - // Fold this div into the comparison, producing a range check. - // Determine, based on the divide type, what the range is being - // checked. If there is an overflow on the low or high side, remember - // it, otherwise compute the range [low, hi) bounding the new value. - bool LoOverflow = false, HiOverflow = 0; + // FIXME: If the operand types don't match the type of the divide + // then don't attempt this transform. The code below doesn't have the + // logic to deal with a signed divide and an unsigned compare (and + // vice versa). This is because (x /s C1) getType(); + unsigned DivOpCode = LHSI->getOpcode(); + if (I.isEquality() && + ((DivOpCode == Instruction::SDiv && DivRHSTy->isUnsigned()) || + (DivOpCode == Instruction::UDiv && DivRHSTy->isSigned()))) + break; + + // Initialize the variables that will indicate the nature of the + // range check. + bool LoOverflow = false, HiOverflow = false; ConstantInt *LoBound = 0, *HiBound = 0; - ConstantInt *Prod; - bool ProdOV = MulWithOverflow(Prod, CI, DivRHS); + // Compute Prod = CI * DivRHS. We are essentially solving an equation + // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and + // C2 (CI). By solving for X we can turn this into a range check + // instead of computing a divide. + ConstantInt *Prod = + cast(ConstantExpr::getMul(CI, DivRHS)); + + // Determine if the product overflows by seeing if the product is + // not equal to the divide. Make sure we do the same kind of divide + // as in the LHS instruction that we're folding. + bool ProdOV = !DivRHS->isNullValue() && + (DivOpCode == Instruction::SDiv ? + ConstantExpr::getSDiv(Prod, DivRHS) : + ConstantExpr::getUDiv(Prod, DivRHS)) != CI; + // Get the SetCC opcode Instruction::BinaryOps Opcode = I.getOpcode(); - if (DivRHS->isNullValue()) { // Don't hack on divide by zeros. - } else if (LHSI->getType()->isUnsigned()) { // udiv + if (DivRHS->isNullValue()) { + // Don't hack on divide by zeros! + } else if (DivOpCode == Instruction::UDiv) { // udiv LoBound = Prod; LoOverflow = ProdOV; HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, DivRHS); - } else if (isPositive(DivRHS)) { // Divisor is > 0. + } else if (isPositive(DivRHS)) { // Divisor is > 0. if (CI->isNullValue()) { // (X / pos) op 0 // Can't overflow. LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); @@ -4415,12 +4515,12 @@ HiBound = Prod; HiOverflow = ProdOV; } - } else { // Divisor is < 0. + } else { // Divisor is < 0. if (CI->isNullValue()) { // (X / neg) op 0 LoBound = AddOne(DivRHS); HiBound = cast(ConstantExpr::getNeg(DivRHS)); if (HiBound == DivRHS) - LoBound = 0; // - INTMIN = INTMIN + LoBound = 0; // - INTMIN = INTMIN } else if (isPositive(CI)) { // (X / neg) op pos HiOverflow = LoOverflow = ProdOV; if (!LoOverflow) @@ -5679,6 +5779,23 @@ ConstantInt::get(CI.getType(), 1)); } break; + case Instruction::SDiv: + case Instruction::UDiv: + // If we are just changing the sign, rewrite. + if (DestBitSize == SrcBitSize) { + // Don't insert two casts if they cannot be eliminated. We allow two + // casts to be inserted if the sizes are the same. This could only be + // converting signedness, which is a noop. + if (!ValueRequiresCast(Op1, DestTy,TD) || + !ValueRequiresCast(Op0, DestTy, TD)) { + Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); + Value *Op1c = InsertOperandCastBefore(Op1, DestTy, SrcI); + return BinaryOperator::create( + cast(SrcI)->getOpcode(), Op0c, Op1c); + } + } + break; + case Instruction::Shl: // Allow changing the sign of the source operand. Do not allow changing // the size of the shift, UNLESS the shift amount is a constant. We Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.29 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.30 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.29 Wed Oct 25 21:35:18 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Thu Oct 26 01:15:43 2006 @@ -788,7 +788,9 @@ Instruction::BinaryOps ops = BO.getOpcode(); switch (ops) { - case Instruction::Div: + case Instruction::UDiv: + case Instruction::SDiv: + case Instruction::FDiv: case Instruction::Rem: { Value *Divisor = BO.getOperand(1); KP.addNotEqual(Constant::getNullValue(Divisor->getType()), Divisor); Index: llvm/lib/Transforms/Scalar/Reassociate.cpp diff -u llvm/lib/Transforms/Scalar/Reassociate.cpp:1.63 llvm/lib/Transforms/Scalar/Reassociate.cpp:1.64 --- llvm/lib/Transforms/Scalar/Reassociate.cpp:1.63 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/Scalar/Reassociate.cpp Thu Oct 26 01:15:43 2006 @@ -113,7 +113,9 @@ I->getOpcode() == Instruction::Malloc || I->getOpcode() == Instruction::Invoke || I->getOpcode() == Instruction::Call || - I->getOpcode() == Instruction::Div || + I->getOpcode() == Instruction::UDiv || + I->getOpcode() == Instruction::SDiv || + I->getOpcode() == Instruction::FDiv || I->getOpcode() == Instruction::Rem) return true; return false; From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h ScalarEvolutionExpressions.h Message-ID: <200610260616.k9Q6GSKi029165@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpander.h updated: 1.5 -> 1.6 ScalarEvolutionExpressions.h updated: 1.7 -> 1.8 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+2 -2) ScalarEvolutionExpander.h | 2 +- ScalarEvolutionExpressions.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.5 llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.6 --- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.5 Fri Mar 31 22:48:52 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Thu Oct 26 01:15:43 2006 @@ -140,7 +140,7 @@ const Type *Ty = S->getType(); Value *LHS = expandInTy(S->getLHS(), Ty); Value *RHS = expandInTy(S->getRHS(), Ty); - return BinaryOperator::createDiv(LHS, RHS, "tmp.", InsertPt); + return BinaryOperator::createSDiv(LHS, RHS, "tmp.", InsertPt); } Value *visitAddRecExpr(SCEVAddRecExpr *S); Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.7 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.8 --- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.7 Fri Mar 31 22:48:52 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Thu Oct 26 01:15:43 2006 @@ -293,7 +293,7 @@ //===--------------------------------------------------------------------===// - /// SCEVSDivExpr - This class represents a binary unsigned division operation. + /// SCEVSDivExpr - This class represents a binary signed division operation. /// class SCEVSDivExpr : public SCEV { SCEVHandle LHS, RHS; From reid at x10sys.com Thu Oct 26 01:16:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l ParserInternals.h llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200610260616.k9Q6GORo029084@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.79 -> 1.80 ParserInternals.h updated: 1.45 -> 1.46 llvmAsmParser.cpp.cvs updated: 1.21 -> 1.22 llvmAsmParser.h.cvs updated: 1.16 -> 1.17 llvmAsmParser.y updated: 1.270 -> 1.271 llvmAsmParser.y.cvs updated: 1.22 -> 1.23 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+1359 -1196) Lexer.l | 17 ParserInternals.h | 16 llvmAsmParser.cpp.cvs | 2224 +++++++++++++++++++++++++------------------------- llvmAsmParser.h.cvs | 132 +- llvmAsmParser.y | 83 + llvmAsmParser.y.cvs | 83 + 6 files changed, 1359 insertions(+), 1196 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.79 llvm/lib/AsmParser/Lexer.l:1.80 --- llvm/lib/AsmParser/Lexer.l:1.79 Sun Oct 22 01:07:41 2006 +++ llvm/lib/AsmParser/Lexer.l Thu Oct 26 01:15:43 2006 @@ -39,8 +39,18 @@ yy_scan_string (str); } +// Construct a token value for a non-obsolete token #define RET_TOK(type, Enum, sym) \ - llvmAsmlval.type = Instruction::Enum; return sym + llvmAsmlval.type.opcode = Instruction::Enum; \ + llvmAsmlval.type.obsolete = false; \ + return sym + +// Construct a token value for an obsolete token +#define RET_TOK_OBSOLETE(type, Enum, sym) \ + llvmAsmlval.type.opcode = Instruction::Enum; \ + llvmAsmlval.type.obsolete = true; \ + return sym + namespace llvm { @@ -247,7 +257,10 @@ add { RET_TOK(BinaryOpVal, Add, ADD); } sub { RET_TOK(BinaryOpVal, Sub, SUB); } mul { RET_TOK(BinaryOpVal, Mul, MUL); } -div { RET_TOK(BinaryOpVal, Div, DIV); } +div { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); } +udiv { RET_TOK(BinaryOpVal, UDiv, UDIV); } +sdiv { RET_TOK(BinaryOpVal, SDiv, SDIV); } +fdiv { RET_TOK(BinaryOpVal, FDiv, FDIV); } rem { RET_TOK(BinaryOpVal, Rem, REM); } and { RET_TOK(BinaryOpVal, And, AND); } or { RET_TOK(BinaryOpVal, Or , OR ); } Index: llvm/lib/AsmParser/ParserInternals.h diff -u llvm/lib/AsmParser/ParserInternals.h:1.45 llvm/lib/AsmParser/ParserInternals.h:1.46 --- llvm/lib/AsmParser/ParserInternals.h:1.45 Thu Sep 28 18:35:21 2006 +++ llvm/lib/AsmParser/ParserInternals.h Thu Oct 26 01:15:43 2006 @@ -201,4 +201,20 @@ } // End llvm namespace +// This structure is used to keep track of obsolete opcodes. The lexer will +// retain the ability to parse obsolete opcode mnemonics. In this case it will +// set "obsolete" to true and the opcode will be the replacement opcode. For +// example if "rem" is encountered then opcode will be set to "urem" and the +// "obsolete" flag will be true. If the opcode is not obsolete then "obsolete" +// will be false. +template +struct OpcodeInfo { + Enum opcode; + bool obsolete; +}; +typedef OpcodeInfo BinaryOpInfo; +typedef OpcodeInfo TermOpInfo; +typedef OpcodeInfo MemOpInfo; +typedef OpcodeInfo OtherOpInfo; + #endif Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.21 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.22 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.21 Sun Oct 22 02:03:43 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Thu Oct 26 01:15:43 2006 @@ -142,34 +142,36 @@ ADD = 333, SUB = 334, MUL = 335, - DIV = 336, - REM = 337, - AND = 338, - OR = 339, - XOR = 340, - SETLE = 341, - SETGE = 342, - SETLT = 343, - SETGT = 344, - SETEQ = 345, - SETNE = 346, - MALLOC = 347, - ALLOCA = 348, - FREE = 349, - LOAD = 350, - STORE = 351, - GETELEMENTPTR = 352, - PHI_TOK = 353, - CAST = 354, - SELECT = 355, - SHL = 356, - SHR = 357, - VAARG = 358, - EXTRACTELEMENT = 359, - INSERTELEMENT = 360, - SHUFFLEVECTOR = 361, - VAARG_old = 362, - VANEXT_old = 363 + UDIV = 336, + SDIV = 337, + FDIV = 338, + REM = 339, + AND = 340, + OR = 341, + XOR = 342, + SETLE = 343, + SETGE = 344, + SETLT = 345, + SETGT = 346, + SETEQ = 347, + SETNE = 348, + MALLOC = 349, + ALLOCA = 350, + FREE = 351, + LOAD = 352, + STORE = 353, + GETELEMENTPTR = 354, + PHI_TOK = 355, + CAST = 356, + SELECT = 357, + SHL = 358, + SHR = 359, + VAARG = 360, + EXTRACTELEMENT = 361, + INSERTELEMENT = 362, + SHUFFLEVECTOR = 363, + VAARG_old = 364, + VANEXT_old = 365 }; #endif /* Tokens. */ @@ -251,40 +253,42 @@ #define ADD 333 #define SUB 334 #define MUL 335 -#define DIV 336 -#define REM 337 -#define AND 338 -#define OR 339 -#define XOR 340 -#define SETLE 341 -#define SETGE 342 -#define SETLT 343 -#define SETGT 344 -#define SETEQ 345 -#define SETNE 346 -#define MALLOC 347 -#define ALLOCA 348 -#define FREE 349 -#define LOAD 350 -#define STORE 351 -#define GETELEMENTPTR 352 -#define PHI_TOK 353 -#define CAST 354 -#define SELECT 355 -#define SHL 356 -#define SHR 357 -#define VAARG 358 -#define EXTRACTELEMENT 359 -#define INSERTELEMENT 360 -#define SHUFFLEVECTOR 361 -#define VAARG_old 362 -#define VANEXT_old 363 +#define UDIV 336 +#define SDIV 337 +#define FDIV 338 +#define REM 339 +#define AND 340 +#define OR 341 +#define XOR 342 +#define SETLE 343 +#define SETGE 344 +#define SETLT 345 +#define SETGT 346 +#define SETEQ 347 +#define SETNE 348 +#define MALLOC 349 +#define ALLOCA 350 +#define FREE 351 +#define LOAD 352 +#define STORE 353 +#define GETELEMENTPTR 354 +#define PHI_TOK 355 +#define CAST 356 +#define SELECT 357 +#define SHL 358 +#define SHR 359 +#define VAARG 360 +#define EXTRACTELEMENT 361 +#define INSERTELEMENT 362 +#define SHUFFLEVECTOR 363 +#define VAARG_old 364 +#define VANEXT_old 365 /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" +#line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1087,6 +1091,43 @@ return Ty; } +/// This function is used to obtain the correct opcode for an instruction when +/// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +/// an opcode and an "obsolete" flag. These are generated by the lexer and +/// the "obsolete" member will be true when the lexer encounters the token for +/// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +/// to maintain backwards compatibility for asm files that still have the "div" +/// instruction. This function handles converting div -> [usf]div appropriately. +/// @brief Convert obsolete opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1264,7 +1305,7 @@ #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 974 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" +#line 1011 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1296,16 +1337,16 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - llvm::Instruction::BinaryOps BinaryOpVal; - llvm::Instruction::TermOps TermOpVal; - llvm::Instruction::MemoryOps MemOpVal; - llvm::Instruction::OtherOps OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1309 "llvmAsmParser.tab.c" +#line 1350 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1317,7 +1358,7 @@ /* Line 219 of yacc.c. */ -#line 1321 "llvmAsmParser.tab.c" +#line 1362 "llvmAsmParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1468,20 +1509,20 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1339 +#define YYLAST 1288 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 123 +#define YYNTOKENS 125 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 75 /* YYNRULES -- Number of rules. */ -#define YYNRULES 252 +#define YYNRULES 254 /* YYNRULES -- Number of states. */ -#define YYNSTATES 517 +#define YYNSTATES 519 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 363 +#define YYMAXUTOK 365 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -1493,15 +1534,15 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 112, 113, 121, 2, 110, 2, 2, 2, 2, 2, + 114, 115, 123, 2, 112, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 117, 109, 118, 2, 2, 2, 2, 2, 2, 2, + 119, 111, 120, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 114, 111, 116, 2, 2, 2, 2, 2, 122, + 2, 116, 113, 118, 2, 2, 2, 2, 2, 124, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 115, 2, 2, 119, 2, 120, 2, 2, 2, 2, + 117, 2, 2, 121, 2, 122, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1525,7 +1566,7 @@ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108 + 105, 106, 107, 108, 109, 110 }; #if YYDEBUG @@ -1536,147 +1577,148 @@ 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, - 59, 61, 63, 65, 67, 70, 71, 73, 75, 77, - 79, 81, 83, 85, 86, 87, 89, 91, 93, 95, - 97, 99, 102, 103, 106, 107, 111, 114, 115, 117, - 118, 122, 124, 127, 129, 131, 133, 135, 137, 139, + 59, 61, 63, 65, 67, 69, 71, 74, 75, 77, + 79, 81, 83, 85, 87, 89, 90, 91, 93, 95, + 97, 99, 101, 103, 106, 107, 110, 111, 115, 118, + 119, 121, 122, 126, 128, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 165, 167, 169, 172, 177, 183, 189, 193, - 196, 199, 201, 205, 207, 211, 213, 214, 219, 223, - 227, 232, 237, 241, 244, 247, 250, 253, 256, 259, - 262, 265, 268, 271, 278, 284, 293, 300, 307, 314, - 321, 328, 337, 346, 350, 352, 354, 356, 358, 361, - 364, 369, 372, 374, 379, 382, 387, 388, 396, 397, - 405, 406, 414, 415, 423, 427, 432, 433, 435, 437, - 439, 443, 447, 451, 455, 459, 463, 465, 466, 468, - 470, 472, 473, 476, 480, 482, 484, 488, 490, 491, - 500, 502, 504, 508, 510, 512, 515, 516, 518, 520, - 521, 526, 527, 529, 531, 533, 535, 537, 539, 541, - 543, 545, 549, 551, 557, 559, 561, 563, 565, 568, - 571, 574, 578, 581, 582, 584, 587, 590, 594, 604, - 614, 623, 637, 639, 641, 648, 654, 657, 664, 672, - 674, 678, 680, 681, 684, 686, 692, 698, 704, 707, - 712, 717, 724, 729, 734, 739, 744, 751, 758, 761, - 769, 771, 774, 775, 777, 778, 782, 789, 793, 800, - 803, 808, 815 + 161, 163, 165, 167, 169, 171, 173, 176, 181, 187, + 193, 197, 200, 203, 205, 209, 211, 215, 217, 218, + 223, 227, 231, 236, 241, 245, 248, 251, 254, 257, + 260, 263, 266, 269, 272, 275, 282, 288, 297, 304, + 311, 318, 325, 332, 341, 350, 354, 356, 358, 360, + 362, 365, 368, 373, 376, 378, 383, 386, 391, 392, + 400, 401, 409, 410, 418, 419, 427, 431, 436, 437, + 439, 441, 443, 447, 451, 455, 459, 463, 467, 469, + 470, 472, 474, 476, 477, 480, 484, 486, 488, 492, + 494, 495, 504, 506, 508, 512, 514, 516, 519, 520, + 522, 524, 525, 530, 531, 533, 535, 537, 539, 541, + 543, 545, 547, 549, 553, 555, 561, 563, 565, 567, + 569, 572, 575, 578, 582, 585, 586, 588, 591, 594, + 598, 608, 618, 627, 641, 643, 645, 652, 658, 661, + 668, 676, 678, 682, 684, 685, 688, 690, 696, 702, + 708, 711, 716, 721, 728, 733, 738, 743, 748, 755, + 762, 765, 773, 775, 778, 779, 781, 782, 786, 793, + 797, 804, 807, 812, 819 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const short int yyrhs[] = { - 154, 0, -1, 5, -1, 6, -1, 3, -1, 4, + 156, 0, -1, 5, -1, 6, -1, 3, -1, 4, -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, - -1, 88, -1, 89, -1, 90, -1, 91, -1, 101, - -1, 102, -1, 16, -1, 14, -1, 12, -1, 10, - -1, 17, -1, 15, -1, 13, -1, 11, -1, 130, - -1, 131, -1, 18, -1, 19, -1, 166, 109, -1, - -1, 41, -1, 42, -1, 43, -1, 44, -1, 45, - -1, 46, -1, 47, -1, -1, -1, 65, -1, 66, - -1, 67, -1, 68, -1, 69, -1, 70, -1, 64, - 4, -1, -1, 57, 4, -1, -1, 110, 57, 4, - -1, 34, 24, -1, -1, 139, -1, -1, 110, 142, - 141, -1, 139, -1, 57, 4, -1, 145, -1, 8, - -1, 147, -1, 8, -1, 147, -1, 9, -1, 10, - -1, 11, -1, 12, -1, 13, -1, 14, -1, 15, - -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, - -1, 21, -1, 48, -1, 146, -1, 181, -1, 111, - 4, -1, 144, 112, 149, 113, -1, 114, 4, 115, - 147, 116, -1, 117, 4, 115, 147, 118, -1, 119, - 148, 120, -1, 119, 120, -1, 147, 121, -1, 147, - -1, 148, 110, 147, -1, 148, -1, 148, 110, 37, - -1, 37, -1, -1, 145, 114, 152, 116, -1, 145, - 114, 116, -1, 145, 122, 24, -1, 145, 117, 152, - 118, -1, 145, 119, 152, 120, -1, 145, 119, 120, - -1, 145, 38, -1, 145, 39, -1, 145, 181, -1, - 145, 151, -1, 145, 26, -1, 130, 125, -1, 131, - 4, -1, 9, 27, -1, 9, 28, -1, 133, 7, - -1, 99, 112, 150, 36, 145, 113, -1, 97, 112, - 150, 195, 113, -1, 100, 112, 150, 110, 150, 110, - 150, 113, -1, 126, 112, 150, 110, 150, 113, -1, - 127, 112, 150, 110, 150, 113, -1, 128, 112, 150, - 110, 150, 113, -1, 129, 112, 150, 110, 150, 113, - -1, 104, 112, 150, 110, 150, 113, -1, 105, 112, - 150, 110, 150, 110, 150, 113, -1, 106, 112, 150, - 110, 150, 110, 150, 113, -1, 152, 110, 150, -1, - 150, -1, 32, -1, 33, -1, 155, -1, 155, 175, - -1, 155, 177, -1, 155, 62, 61, 161, -1, 155, - 25, -1, 156, -1, 156, 134, 20, 143, -1, 156, - 177, -1, 156, 62, 61, 161, -1, -1, 156, 134, - 135, 153, 150, 157, 141, -1, -1, 156, 134, 50, - 153, 145, 158, 141, -1, -1, 156, 134, 45, 153, - 145, 159, 141, -1, -1, 156, 134, 47, 153, 145, - 160, 141, -1, 156, 51, 163, -1, 156, 58, 109, - 164, -1, -1, 24, -1, 56, -1, 55, -1, 53, - 109, 162, -1, 54, 109, 4, -1, 52, 109, 24, - -1, 71, 109, 24, -1, 114, 165, 116, -1, 165, - 110, 24, -1, 24, -1, -1, 22, -1, 24, -1, - 166, -1, -1, 145, 167, -1, 169, 110, 168, -1, - 168, -1, 169, -1, 169, 110, 37, -1, 37, -1, - -1, 136, 143, 166, 112, 170, 113, 140, 137, -1, - 29, -1, 119, -1, 135, 171, 172, -1, 30, -1, - 120, -1, 184, 174, -1, -1, 45, -1, 47, -1, - -1, 31, 178, 176, 171, -1, -1, 63, -1, 3, - -1, 4, -1, 7, -1, 27, -1, 28, -1, 38, - -1, 39, -1, 26, -1, 117, 152, 118, -1, 151, - -1, 61, 179, 24, 110, 24, -1, 124, -1, 166, - -1, 181, -1, 180, -1, 145, 182, -1, 184, 185, - -1, 173, 185, -1, 186, 134, 187, -1, 186, 189, - -1, -1, 23, -1, 72, 183, -1, 72, 8, -1, - 73, 21, 182, -1, 73, 9, 182, 110, 21, 182, - 110, 21, 182, -1, 74, 132, 182, 110, 21, 182, - 114, 188, 116, -1, 74, 132, 182, 110, 21, 182, - 114, 116, -1, 75, 136, 143, 182, 112, 192, 113, - 36, 21, 182, 76, 21, 182, -1, 76, -1, 77, - -1, 188, 132, 180, 110, 21, 182, -1, 132, 180, - 110, 21, 182, -1, 134, 194, -1, 145, 114, 182, - 110, 182, 116, -1, 190, 110, 114, 182, 110, 182, - 116, -1, 183, -1, 191, 110, 183, -1, 191, -1, - -1, 60, 59, -1, 59, -1, 126, 145, 182, 110, - 182, -1, 127, 145, 182, 110, 182, -1, 128, 145, - 182, 110, 182, -1, 49, 183, -1, 129, 183, 110, - 183, -1, 99, 183, 36, 145, -1, 100, 183, 110, - 183, 110, 183, -1, 103, 183, 110, 145, -1, 107, - 183, 110, 145, -1, 108, 183, 110, 145, -1, 104, - 183, 110, 183, -1, 105, 183, 110, 183, 110, 183, - -1, 106, 183, 110, 183, 110, 183, -1, 98, 190, - -1, 193, 136, 143, 182, 112, 192, 113, -1, 197, - -1, 110, 191, -1, -1, 35, -1, -1, 92, 145, - 138, -1, 92, 145, 110, 15, 182, 138, -1, 93, - 145, 138, -1, 93, 145, 110, 15, 182, 138, -1, - 94, 183, -1, 196, 95, 145, 182, -1, 196, 96, - 183, 110, 145, 182, -1, 97, 145, 182, 195, -1 + -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, + -1, 93, -1, 103, -1, 104, -1, 16, -1, 14, + -1, 12, -1, 10, -1, 17, -1, 15, -1, 13, + -1, 11, -1, 132, -1, 133, -1, 18, -1, 19, + -1, 168, 111, -1, -1, 41, -1, 42, -1, 43, + -1, 44, -1, 45, -1, 46, -1, 47, -1, -1, + -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, + -1, 70, -1, 64, 4, -1, -1, 57, 4, -1, + -1, 112, 57, 4, -1, 34, 24, -1, -1, 141, + -1, -1, 112, 144, 143, -1, 141, -1, 57, 4, + -1, 147, -1, 8, -1, 149, -1, 8, -1, 149, + -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, + -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, + -1, 19, -1, 20, -1, 21, -1, 48, -1, 148, + -1, 183, -1, 113, 4, -1, 146, 114, 151, 115, + -1, 116, 4, 117, 149, 118, -1, 119, 4, 117, + 149, 120, -1, 121, 150, 122, -1, 121, 122, -1, + 149, 123, -1, 149, -1, 150, 112, 149, -1, 150, + -1, 150, 112, 37, -1, 37, -1, -1, 147, 116, + 154, 118, -1, 147, 116, 118, -1, 147, 124, 24, + -1, 147, 119, 154, 120, -1, 147, 121, 154, 122, + -1, 147, 121, 122, -1, 147, 38, -1, 147, 39, + -1, 147, 183, -1, 147, 153, -1, 147, 26, -1, + 132, 127, -1, 133, 4, -1, 9, 27, -1, 9, + 28, -1, 135, 7, -1, 101, 114, 152, 36, 147, + 115, -1, 99, 114, 152, 197, 115, -1, 102, 114, + 152, 112, 152, 112, 152, 115, -1, 128, 114, 152, + 112, 152, 115, -1, 129, 114, 152, 112, 152, 115, + -1, 130, 114, 152, 112, 152, 115, -1, 131, 114, + 152, 112, 152, 115, -1, 106, 114, 152, 112, 152, + 115, -1, 107, 114, 152, 112, 152, 112, 152, 115, + -1, 108, 114, 152, 112, 152, 112, 152, 115, -1, + 154, 112, 152, -1, 152, -1, 32, -1, 33, -1, + 157, -1, 157, 177, -1, 157, 179, -1, 157, 62, + 61, 163, -1, 157, 25, -1, 158, -1, 158, 136, + 20, 145, -1, 158, 179, -1, 158, 62, 61, 163, + -1, -1, 158, 136, 137, 155, 152, 159, 143, -1, + -1, 158, 136, 50, 155, 147, 160, 143, -1, -1, + 158, 136, 45, 155, 147, 161, 143, -1, -1, 158, + 136, 47, 155, 147, 162, 143, -1, 158, 51, 165, + -1, 158, 58, 111, 166, -1, -1, 24, -1, 56, + -1, 55, -1, 53, 111, 164, -1, 54, 111, 4, + -1, 52, 111, 24, -1, 71, 111, 24, -1, 116, + 167, 118, -1, 167, 112, 24, -1, 24, -1, -1, + 22, -1, 24, -1, 168, -1, -1, 147, 169, -1, + 171, 112, 170, -1, 170, -1, 171, -1, 171, 112, + 37, -1, 37, -1, -1, 138, 145, 168, 114, 172, + 115, 142, 139, -1, 29, -1, 121, -1, 137, 173, + 174, -1, 30, -1, 122, -1, 186, 176, -1, -1, + 45, -1, 47, -1, -1, 31, 180, 178, 173, -1, + -1, 63, -1, 3, -1, 4, -1, 7, -1, 27, + -1, 28, -1, 38, -1, 39, -1, 26, -1, 119, + 154, 120, -1, 153, -1, 61, 181, 24, 112, 24, + -1, 126, -1, 168, -1, 183, -1, 182, -1, 147, + 184, -1, 186, 187, -1, 175, 187, -1, 188, 136, + 189, -1, 188, 191, -1, -1, 23, -1, 72, 185, + -1, 72, 8, -1, 73, 21, 184, -1, 73, 9, + 184, 112, 21, 184, 112, 21, 184, -1, 74, 134, + 184, 112, 21, 184, 116, 190, 118, -1, 74, 134, + 184, 112, 21, 184, 116, 118, -1, 75, 138, 145, + 184, 114, 194, 115, 36, 21, 184, 76, 21, 184, + -1, 76, -1, 77, -1, 190, 134, 182, 112, 21, + 184, -1, 134, 182, 112, 21, 184, -1, 136, 196, + -1, 147, 116, 184, 112, 184, 118, -1, 192, 112, + 116, 184, 112, 184, 118, -1, 185, -1, 193, 112, + 185, -1, 193, -1, -1, 60, 59, -1, 59, -1, + 128, 147, 184, 112, 184, -1, 129, 147, 184, 112, + 184, -1, 130, 147, 184, 112, 184, -1, 49, 185, + -1, 131, 185, 112, 185, -1, 101, 185, 36, 147, + -1, 102, 185, 112, 185, 112, 185, -1, 105, 185, + 112, 147, -1, 109, 185, 112, 147, -1, 110, 185, + 112, 147, -1, 106, 185, 112, 185, -1, 107, 185, + 112, 185, 112, 185, -1, 108, 185, 112, 185, 112, + 185, -1, 100, 192, -1, 195, 138, 145, 184, 114, + 194, 115, -1, 199, -1, 112, 193, -1, -1, 35, + -1, -1, 94, 147, 140, -1, 94, 147, 112, 15, + 184, 140, -1, 95, 147, 140, -1, 95, 147, 112, + 15, 184, 140, -1, 96, 185, -1, 198, 97, 147, + 184, -1, 198, 98, 185, 112, 147, 184, -1, 99, + 147, 184, 197, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1097, 1097, 1098, 1106, 1107, 1117, 1117, 1117, 1117, - 1117, 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, - 1121, 1121, 1125, 1125, 1125, 1125, 1126, 1126, 1126, 1126, - 1127, 1127, 1128, 1128, 1131, 1135, 1140, 1141, 1142, 1143, - 1144, 1145, 1146, 1147, 1149, 1150, 1151, 1152, 1153, 1154, - 1155, 1156, 1165, 1166, 1172, 1173, 1181, 1189, 1190, 1195, - 1196, 1197, 1202, 1216, 1216, 1217, 1217, 1219, 1229, 1229, - 1229, 1229, 1229, 1229, 1229, 1230, 1230, 1230, 1230, 1230, - 1230, 1231, 1235, 1239, 1247, 1255, 1268, 1273, 1285, 1295, - 1299, 1310, 1315, 1321, 1322, 1326, 1330, 1341, 1367, 1381, - 1411, 1437, 1458, 1471, 1481, 1486, 1547, 1554, 1563, 1569, - 1575, 1579, 1583, 1591, 1602, 1634, 1642, 1664, 1675, 1681, - 1689, 1695, 1701, 1710, 1714, 1722, 1722, 1732, 1740, 1745, - 1749, 1753, 1757, 1772, 1794, 1797, 1800, 1800, 1808, 1808, - 1816, 1816, 1824, 1824, 1833, 1836, 1839, 1843, 1856, 1857, - 1859, 1863, 1872, 1876, 1881, 1883, 1888, 1893, 1902, 1902, - 1903, 1903, 1905, 1912, 1918, 1925, 1929, 1935, 1940, 1945, - 2040, 2040, 2042, 2050, 2050, 2052, 2057, 2058, 2059, 2061, - 2061, 2071, 2075, 2080, 2084, 2088, 2092, 2096, 2100, 2104, - 2108, 2112, 2137, 2141, 2155, 2159, 2165, 2165, 2171, 2176, - 2180, 2189, 2200, 2205, 2217, 2230, 2234, 2238, 2243, 2252, - 2271, 2280, 2336, 2340, 2347, 2358, 2371, 2380, 2389, 2399, - 2403, 2410, 2410, 2412, 2416, 2421, 2437, 2452, 2466, 2479, - 2487, 2495, 2503, 2509, 2529, 2552, 2558, 2564, 2570, 2585, - 2644, 2651, 2654, 2659, 2663, 2670, 2675, 2681, 2686, 2692, - 2700, 2712, 2727 + 0, 1134, 1134, 1135, 1143, 1144, 1154, 1154, 1154, 1154, + 1154, 1154, 1154, 1155, 1155, 1155, 1156, 1156, 1156, 1156, + 1156, 1156, 1158, 1158, 1162, 1162, 1162, 1162, 1163, 1163, + 1163, 1163, 1164, 1164, 1165, 1165, 1168, 1172, 1177, 1178, + 1179, 1180, 1181, 1182, 1183, 1184, 1186, 1187, 1188, 1189, + 1190, 1191, 1192, 1193, 1202, 1203, 1209, 1210, 1218, 1226, + 1227, 1232, 1233, 1234, 1239, 1253, 1253, 1254, 1254, 1256, + 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1267, 1267, 1267, + 1267, 1267, 1267, 1268, 1272, 1276, 1284, 1292, 1305, 1310, + 1322, 1332, 1336, 1347, 1352, 1358, 1359, 1363, 1367, 1378, + 1404, 1418, 1448, 1474, 1495, 1508, 1518, 1523, 1584, 1591, + 1600, 1606, 1612, 1616, 1620, 1628, 1639, 1671, 1679, 1706, + 1717, 1723, 1731, 1737, 1743, 1752, 1756, 1764, 1764, 1774, + 1782, 1787, 1791, 1795, 1799, 1814, 1836, 1839, 1842, 1842, + 1850, 1850, 1858, 1858, 1866, 1866, 1875, 1878, 1881, 1885, + 1898, 1899, 1901, 1905, 1914, 1918, 1923, 1925, 1930, 1935, + 1944, 1944, 1945, 1945, 1947, 1954, 1960, 1967, 1971, 1977, + 1982, 1987, 2082, 2082, 2084, 2092, 2092, 2094, 2099, 2100, + 2101, 2103, 2103, 2113, 2117, 2122, 2126, 2130, 2134, 2138, + 2142, 2146, 2150, 2154, 2179, 2183, 2197, 2201, 2207, 2207, + 2213, 2218, 2222, 2231, 2242, 2247, 2259, 2272, 2276, 2280, + 2285, 2294, 2313, 2322, 2378, 2382, 2389, 2400, 2413, 2422, + 2431, 2441, 2445, 2452, 2452, 2454, 2458, 2463, 2482, 2497, + 2511, 2524, 2532, 2540, 2548, 2554, 2574, 2597, 2603, 2609, + 2615, 2630, 2689, 2696, 2699, 2704, 2708, 2715, 2720, 2726, + 2731, 2737, 2745, 2757, 2772 }; #endif @@ -1698,27 +1740,27 @@ "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", - "MUL", "DIV", "REM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", - "SETGT", "SETEQ", "SETNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", - "GETELEMENTPTR", "PHI_TOK", "CAST", "SELECT", "SHL", "SHR", "VAARG", - "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", - "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", - "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", "INTVAL", - "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", "ShiftOps", - "SIntType", "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", - "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection", - "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", - "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", - "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", - "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle", - "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", - "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", - "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", - "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", - "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", - "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", - "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", - "MemoryInst", 0 + "MUL", "UDIV", "SDIV", "FDIV", "REM", "AND", "OR", "XOR", "SETLE", + "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC", "ALLOCA", "FREE", + "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", "CAST", "SELECT", "SHL", + "SHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", + "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['", + "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", + "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", + "ShiftOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign", + "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", + "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", + "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI", + "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", + "Module", "FunctionList", "ConstPool", "@1", "@2", "@3", "@4", + "AsmBlock", "BigOrLittle", "TargetDefinition", "LibrariesDefinition", + "LibList", "Name", "OptName", "ArgVal", "ArgListH", "ArgList", + "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function", + "FnDeclareLinkage", "FunctionProto", "@5", "OptSideEffect", + "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", + "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", + "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE", + "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0 }; #endif @@ -1737,41 +1779,41 @@ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 61, - 44, 92, 40, 41, 91, 120, 93, 60, 62, 123, - 125, 42, 99 + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 61, 44, 92, 40, 41, 91, 120, 93, 60, + 62, 123, 125, 42, 99 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { - 0, 123, 124, 124, 125, 125, 126, 126, 126, 126, - 126, 127, 127, 127, 128, 128, 128, 128, 128, 128, - 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, - 132, 132, 133, 133, 134, 134, 135, 135, 135, 135, - 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, - 136, 136, 137, 137, 138, 138, 139, 140, 140, 141, - 141, 142, 142, 143, 143, 144, 144, 145, 146, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 148, 148, 149, 149, 149, 149, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 152, 152, 153, 153, 154, 155, 155, - 155, 155, 155, 156, 156, 156, 157, 156, 158, 156, - 159, 156, 160, 156, 156, 156, 156, 161, 162, 162, - 163, 163, 163, 163, 164, 165, 165, 165, 166, 166, - 167, 167, 168, 169, 169, 170, 170, 170, 170, 171, - 172, 172, 173, 174, 174, 175, 176, 176, 176, 178, - 177, 179, 179, 180, 180, 180, 180, 180, 180, 180, - 180, 180, 180, 180, 181, 181, 182, 182, 183, 184, - 184, 185, 186, 186, 186, 187, 187, 187, 187, 187, - 187, 187, 187, 187, 188, 188, 189, 190, 190, 191, - 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 195, 195, 196, 196, 197, 197, 197, 197, 197, - 197, 197, 197 + 0, 125, 126, 126, 127, 127, 128, 128, 128, 128, + 128, 128, 128, 129, 129, 129, 130, 130, 130, 130, + 130, 130, 131, 131, 132, 132, 132, 132, 133, 133, + 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, + 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, + 138, 138, 138, 138, 139, 139, 140, 140, 141, 142, + 142, 143, 143, 144, 144, 145, 145, 146, 146, 147, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 150, 150, 151, 151, 151, 151, 152, + 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 154, 154, 155, 155, 156, + 157, 157, 157, 157, 157, 158, 158, 158, 159, 158, + 160, 158, 161, 158, 162, 158, 158, 158, 158, 163, + 164, 164, 165, 165, 165, 165, 166, 167, 167, 167, + 168, 168, 169, 169, 170, 171, 171, 172, 172, 172, + 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, + 178, 180, 179, 181, 181, 182, 182, 182, 182, 182, + 182, 182, 182, 182, 182, 182, 183, 183, 184, 184, + 185, 186, 186, 187, 188, 188, 188, 189, 189, 189, + 189, 189, 189, 189, 189, 189, 190, 190, 191, 192, + 192, 193, 193, 194, 194, 195, 195, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 197, 197, 198, 198, 199, 199, 199, + 199, 199, 199, 199, 199 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1780,29 +1822,29 @@ 0, 2, 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, 1, 1, 1, - 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, - 1, 2, 0, 2, 0, 3, 2, 0, 1, 0, - 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, + 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, + 1, 1, 1, 2, 0, 2, 0, 3, 2, 0, + 1, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 4, 5, 5, 3, 2, - 2, 1, 3, 1, 3, 1, 0, 4, 3, 3, - 4, 4, 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 6, 5, 8, 6, 6, 6, 6, - 6, 8, 8, 3, 1, 1, 1, 1, 2, 2, - 4, 2, 1, 4, 2, 4, 0, 7, 0, 7, - 0, 7, 0, 7, 3, 4, 0, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 1, 0, 1, 1, - 1, 0, 2, 3, 1, 1, 3, 1, 0, 8, - 1, 1, 3, 1, 1, 2, 0, 1, 1, 0, - 4, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 5, 1, 1, 1, 1, 2, 2, - 2, 3, 2, 0, 1, 2, 2, 3, 9, 9, - 8, 13, 1, 1, 6, 5, 2, 6, 7, 1, - 3, 1, 0, 2, 1, 5, 5, 5, 2, 4, - 4, 6, 4, 4, 4, 4, 6, 6, 2, 7, - 1, 2, 0, 1, 0, 3, 6, 3, 6, 2, - 4, 6, 4 + 1, 1, 1, 1, 1, 1, 2, 4, 5, 5, + 3, 2, 2, 1, 3, 1, 3, 1, 0, 4, + 3, 3, 4, 4, 3, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 6, 5, 8, 6, 6, + 6, 6, 6, 8, 8, 3, 1, 1, 1, 1, + 2, 2, 4, 2, 1, 4, 2, 4, 0, 7, + 0, 7, 0, 7, 0, 7, 3, 4, 0, 1, + 1, 1, 3, 3, 3, 3, 3, 3, 1, 0, + 1, 1, 1, 0, 2, 3, 1, 1, 3, 1, + 0, 8, 1, 1, 3, 1, 1, 2, 0, 1, + 1, 0, 4, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, + 2, 2, 2, 3, 2, 0, 1, 2, 2, 3, + 9, 9, 8, 13, 1, 1, 6, 5, 2, 6, + 7, 1, 3, 1, 0, 2, 1, 5, 5, 5, + 2, 4, 4, 6, 4, 4, 4, 4, 6, 6, + 2, 7, 1, 2, 0, 1, 0, 3, 6, 3, + 6, 2, 4, 6, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1810,482 +1852,472 @@ means the default is an error. */ static const unsigned char yydefact[] = { - 146, 0, 43, 132, 1, 131, 179, 36, 37, 38, - 39, 40, 41, 42, 0, 44, 203, 128, 129, 203, - 158, 159, 0, 0, 0, 43, 0, 134, 176, 0, - 0, 45, 46, 47, 48, 49, 50, 0, 0, 204, - 200, 35, 173, 174, 175, 199, 0, 0, 0, 0, - 144, 0, 0, 0, 0, 0, 0, 0, 34, 177, - 178, 44, 147, 130, 51, 2, 3, 64, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 0, 0, 0, 0, 194, 0, 0, 63, - 82, 67, 195, 83, 170, 171, 172, 244, 202, 0, - 0, 0, 0, 157, 145, 135, 133, 125, 126, 0, - 0, 0, 0, 180, 84, 0, 0, 66, 89, 91, - 0, 0, 96, 90, 243, 0, 224, 0, 0, 0, - 0, 44, 212, 213, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, - 0, 0, 0, 0, 0, 20, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 201, 44, 216, - 0, 240, 152, 149, 148, 150, 151, 153, 156, 0, - 140, 142, 138, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 0, 0, 0, 0, 136, 0, - 0, 0, 88, 168, 95, 93, 0, 0, 228, 223, - 206, 205, 0, 0, 25, 29, 24, 28, 23, 27, - 22, 26, 30, 31, 0, 0, 54, 54, 249, 0, - 0, 238, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 154, 59, - 59, 59, 110, 111, 4, 5, 108, 109, 112, 107, - 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 106, 105, 59, 65, - 65, 92, 167, 161, 164, 165, 0, 0, 85, 183, - 184, 185, 190, 186, 187, 188, 189, 181, 0, 192, - 197, 196, 198, 0, 207, 0, 0, 0, 245, 0, - 247, 242, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, - 0, 141, 143, 139, 0, 0, 0, 0, 0, 0, - 98, 124, 0, 0, 102, 0, 99, 0, 0, 0, - 0, 137, 86, 87, 160, 162, 0, 57, 94, 182, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, - 0, 0, 230, 0, 232, 235, 0, 0, 233, 234, - 0, 0, 0, 229, 0, 250, 0, 0, 0, 61, - 59, 242, 0, 0, 0, 0, 0, 0, 97, 100, - 101, 0, 0, 0, 0, 166, 163, 58, 52, 0, - 191, 0, 0, 222, 54, 55, 54, 219, 241, 0, - 0, 0, 0, 0, 225, 226, 227, 222, 0, 56, - 62, 60, 0, 0, 0, 0, 0, 0, 123, 0, - 0, 0, 0, 0, 169, 0, 0, 0, 221, 0, - 0, 246, 248, 0, 0, 0, 231, 236, 237, 0, - 251, 114, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 193, 0, 0, 0, 220, 217, 0, 239, - 113, 0, 120, 0, 0, 116, 117, 118, 119, 0, - 210, 0, 0, 0, 218, 0, 0, 0, 208, 0, - 209, 0, 0, 115, 121, 122, 0, 0, 0, 0, - 0, 0, 215, 0, 0, 214, 211 + 148, 0, 45, 134, 1, 133, 181, 38, 39, 40, + 41, 42, 43, 44, 0, 46, 205, 130, 131, 205, + 160, 161, 0, 0, 0, 45, 0, 136, 178, 0, + 0, 47, 48, 49, 50, 51, 52, 0, 0, 206, + 202, 37, 175, 176, 177, 201, 0, 0, 0, 0, + 146, 0, 0, 0, 0, 0, 0, 0, 36, 179, + 180, 46, 149, 132, 53, 2, 3, 66, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 0, 0, 0, 0, 196, 0, 0, 65, + 84, 69, 197, 85, 172, 173, 174, 246, 204, 0, + 0, 0, 0, 159, 147, 137, 135, 127, 128, 0, + 0, 0, 0, 182, 86, 0, 0, 68, 91, 93, + 0, 0, 98, 92, 245, 0, 226, 0, 0, 0, + 0, 46, 214, 215, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 0, 0, 0, 0, 0, 0, 0, 22, 23, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, + 46, 218, 0, 242, 154, 151, 150, 152, 153, 155, + 158, 0, 142, 144, 140, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, + 138, 0, 0, 0, 90, 170, 97, 95, 0, 0, + 230, 225, 208, 207, 0, 0, 27, 31, 26, 30, + 25, 29, 24, 28, 32, 33, 0, 0, 56, 56, + 251, 0, 0, 240, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 156, 61, 61, 61, 112, 113, 4, 5, 110, 111, + 114, 109, 105, 106, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 108, 107, + 61, 67, 67, 94, 169, 163, 166, 167, 0, 0, + 87, 185, 186, 187, 192, 188, 189, 190, 191, 183, + 0, 194, 199, 198, 200, 0, 209, 0, 0, 0, + 247, 0, 249, 244, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 157, 0, 143, 145, 141, 0, 0, 0, 0, + 0, 0, 100, 126, 0, 0, 104, 0, 101, 0, + 0, 0, 0, 139, 88, 89, 162, 164, 0, 59, + 96, 184, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 254, 0, 0, 232, 0, 234, 237, 0, 0, + 235, 236, 0, 0, 0, 231, 0, 252, 0, 0, + 0, 63, 61, 244, 0, 0, 0, 0, 0, 0, + 99, 102, 103, 0, 0, 0, 0, 168, 165, 60, + 54, 0, 193, 0, 0, 224, 56, 57, 56, 221, + 243, 0, 0, 0, 0, 0, 227, 228, 229, 224, + 0, 58, 64, 62, 0, 0, 0, 0, 0, 0, + 125, 0, 0, 0, 0, 0, 171, 0, 0, 0, + 223, 0, 0, 248, 250, 0, 0, 0, 233, 238, + 239, 0, 253, 116, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 55, 195, 0, 0, 0, 222, 219, + 0, 241, 115, 0, 122, 0, 0, 118, 119, 120, + 121, 0, 212, 0, 0, 0, 220, 0, 0, 0, + 210, 0, 211, 0, 0, 117, 123, 124, 0, 0, + 0, 0, 0, 0, 217, 0, 0, 216, 213 }; /* YYDEFGOTO[NTERM-NUM]. */ static const short int yydefgoto[] = { - -1, 86, 256, 272, 273, 274, 275, 194, 195, 224, - 196, 25, 15, 37, 444, 308, 389, 408, 331, 390, - 87, 88, 197, 90, 91, 120, 206, 341, 299, 342, - 109, 1, 2, 3, 278, 251, 249, 250, 63, 175, - 50, 104, 179, 92, 355, 284, 285, 286, 38, 96, - 16, 44, 17, 61, 18, 28, 360, 300, 93, 302, - 417, 19, 40, 41, 167, 492, 98, 231, 448, 449, - 168, 169, 369, 170, 171 + -1, 86, 258, 274, 275, 276, 277, 196, 197, 226, + 198, 25, 15, 37, 446, 310, 391, 410, 333, 392, + 87, 88, 199, 90, 91, 120, 208, 343, 301, 344, + 109, 1, 2, 3, 280, 253, 251, 252, 63, 177, + 50, 104, 181, 92, 357, 286, 287, 288, 38, 96, + 16, 44, 17, 61, 18, 28, 362, 302, 93, 304, + 419, 19, 40, 41, 169, 494, 98, 233, 450, 451, + 170, 171, 371, 172, 173 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -410 +#define YYPACT_NINF -463 static const short int yypact[] = { - -410, 17, 118, 605, -410, -410, -410, -410, -410, -410, - -410, -410, -410, -410, 24, 160, 67, -410, -410, -15, - -410, -410, 27, -5, 46, -6, 10, -410, 86, 147, - 138, -410, -410, -410, -410, -410, -410, 1060, -20, -410, - -410, 110, -410, -410, -410, -410, 69, 70, 72, 73, - -410, 63, 147, 1060, 68, 68, 68, 68, -410, -410, - -410, 160, -410, -410, -410, -410, -410, 64, -410, -410, - -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, - -410, -410, 182, 183, 186, 572, -410, 110, 77, -410, - -410, -28, -410, -410, -410, -410, -410, 1231, -410, 168, - 83, 199, 180, 181, -410, -410, -410, -410, -410, 1101, - 1101, 1101, 1142, -410, -410, 91, 96, -410, -410, -28, - -98, 103, 852, -410, -410, 1101, -410, 157, 1183, 50, - 185, 160, -410, -410, -410, -410, -410, -410, -410, -410, - -410, -410, -410, -410, -410, -410, -410, -410, 1101, 1101, - 1101, 1101, 1101, 1101, 1101, -410, -410, 1101, 1101, 1101, - 1101, 1101, 1101, 1101, 1101, 1101, 1101, -410, 160, -410, - 49, -410, -410, -410, -410, -410, -410, -410, -410, -14, - -410, -410, -410, 120, 148, 213, 150, 214, 154, 215, - 166, 217, 224, 231, 170, 218, 232, 425, -410, 1101, - 1101, 1101, -410, 893, -410, 130, 128, 638, -410, -410, - 64, -410, 638, 638, -410, -410, -410, -410, -410, -410, - -410, -410, -410, -410, 638, 1060, 132, 133, -410, 638, - 136, 134, 216, 141, 143, 144, 146, 149, 151, 152, - 638, 638, 638, 153, 1060, 1101, 1101, 233, -410, 155, - 155, 155, -410, -410, -410, -410, -410, -410, -410, -410, - -410, -410, 156, 159, 161, 164, 175, 177, 934, 1142, - 592, 234, 178, 184, 187, 188, -410, -410, 155, -70, - -35, -28, -410, 110, -410, 162, 179, 978, -410, -410, - -410, -410, -410, -410, -410, -410, -410, 197, 1142, -410, - -410, -410, -410, 191, -410, 195, 638, 3, -410, 18, - -410, 196, 638, 193, 1101, 1101, 1101, 1101, 1101, 1101, - 1101, 1101, 201, 202, 203, 1101, 638, 638, 205, -410, - 13, -410, -410, -410, 1142, 1142, 1142, 1142, 1142, 1142, - -410, -410, -13, -99, -410, -78, -410, 1142, 1142, 1142, - 1142, -410, -410, -410, -410, -410, 1019, 230, -410, -410, - 242, -23, 246, 272, 208, 638, 290, 638, 1101, -410, - 211, 638, -410, 212, -410, -410, 219, 220, -410, -410, - 638, 638, 638, -410, 229, -410, 1101, 273, 294, -410, - 155, 196, 291, 226, 237, 240, 241, 1142, -410, -410, - -410, 243, 247, 248, 249, -410, -410, -410, 252, 250, - -410, 638, 638, 1101, 251, -410, 251, -410, 255, 638, - 256, 1101, 1101, 1101, -410, -410, -410, 1101, 638, -410, - -410, -410, 239, 1101, 1142, 1142, 1142, 1142, -410, 1142, - 1142, 1142, 1142, 322, -410, 304, 257, 228, 255, 259, - 286, -410, -410, 1101, 253, 638, -410, -410, -410, 260, - -410, -410, 262, 267, 265, 270, 277, 278, 279, 280, - 281, -410, -410, 323, 14, 320, -410, -410, 254, -410, - -410, 1142, -410, 1142, 1142, -410, -410, -410, -410, 638, - -410, 742, 52, 362, -410, 282, 284, 287, -410, 289, - -410, 742, 638, -410, -410, -410, 380, 292, 327, 638, - 383, 384, -410, 638, 638, -410, -410 + -463, 42, 182, 621, -463, -463, -463, -463, -463, -463, + -463, -463, -463, -463, -15, 347, 64, -463, -463, -12, + -463, -463, 15, 1, 33, 360, 10, -463, 89, 114, + 140, -463, -463, -463, -463, -463, -463, 1005, -1, -463, + -463, 115, -463, -463, -463, -463, 40, 56, 67, 68, + -463, 59, 114, 1005, 51, 51, 51, 51, -463, -463, + -463, 347, -463, -463, -463, -463, -463, 66, -463, -463, + -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, + -463, -463, 172, 177, 180, 489, -463, 115, 74, -463, + -463, -97, -463, -463, -463, -463, -463, 1178, -463, 165, + -17, 188, 170, 171, -463, -463, -463, -463, -463, 1046, + 1046, 1046, 1087, -463, -463, 80, 81, -463, -463, -97, + -91, 85, 838, -463, -463, 1046, -463, 142, 1128, 6, + 248, 347, -463, -463, -463, -463, -463, -463, -463, -463, + -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, + 1046, 1046, 1046, 1046, 1046, 1046, 1046, -463, -463, 1046, + 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, -463, + 347, -463, 35, -463, -463, -463, -463, -463, -463, -463, + -463, -48, -463, -463, -463, 113, 146, 198, 150, 200, + 152, 213, 167, 214, 212, 223, 169, 216, 224, 443, + -463, 1046, 1046, 1046, -463, 879, -463, 109, 117, 620, + -463, -463, 66, -463, 620, 620, -463, -463, -463, -463, + -463, -463, -463, -463, -463, -463, 620, 1005, 128, 129, + -463, 620, 126, 131, 209, 134, 141, 143, 144, 154, + 156, 157, 620, 620, 620, 158, 1005, 1046, 1046, 228, + -463, 161, 161, 161, -463, -463, -463, -463, -463, -463, + -463, -463, -463, -463, 160, 164, 175, 178, 181, 184, + 87, 1087, 574, 230, 185, 186, 187, 189, -463, -463, + 161, -33, -101, -97, -463, 115, -463, 163, 176, 923, + -463, -463, -463, -463, -463, -463, -463, -463, -463, 231, + 1087, -463, -463, -463, -463, 190, -463, 195, 620, -9, + -463, -8, -463, 196, 620, 193, 1046, 1046, 1046, 1046, + 1046, 1046, 1046, 1046, 199, 201, 202, 1046, 620, 620, + 203, -463, -22, -463, -463, -463, 1087, 1087, 1087, 1087, + 1087, 1087, -463, -463, -47, -79, -463, -82, -463, 1087, + 1087, 1087, 1087, -463, -463, -463, -463, -463, 964, 262, + -463, -463, 293, -75, 301, 302, 210, 620, 324, 620, + 1046, -463, 217, 620, -463, 218, -463, -463, 219, 220, + -463, -463, 620, 620, 620, -463, 229, -463, 1046, 314, + 340, -463, 161, 196, 309, 234, 237, 240, 241, 1087, + -463, -463, -463, 242, 243, 246, 247, -463, -463, -463, + 303, 249, -463, 620, 620, 1046, 250, -463, 250, -463, + 251, 620, 255, 1046, 1046, 1046, -463, -463, -463, 1046, + 620, -463, -463, -463, 253, 1046, 1087, 1087, 1087, 1087, + -463, 1087, 1087, 1087, 1087, 365, -463, 348, 259, 258, + 251, 260, 320, -463, -463, 1046, 261, 620, -463, -463, + -463, 267, -463, -463, 270, 277, 278, 282, 283, 281, + 284, 294, 304, -463, -463, 376, 65, 372, -463, -463, + 305, -463, -463, 1087, -463, 1087, 1087, -463, -463, -463, + -463, 620, -463, 726, 149, 399, -463, 306, 307, 310, + -463, 312, -463, 726, 620, -463, -463, -463, 405, 315, + 352, 620, 409, 411, -463, 620, 620, -463, -463 }; /* YYPGOTO[NTERM-NUM]. */ static const short int yypgoto[] = { - -410, -410, -410, 309, 310, 311, 312, -129, -128, -398, - -410, 369, 386, -118, -410, -223, 55, -410, -244, -410, - -50, -410, -37, -410, -64, 293, -410, -102, 221, -192, - 53, -410, -410, -410, -410, -410, -410, -410, 361, -410, - -410, -410, -410, 2, -410, 58, -410, -410, 356, -410, - -410, -410, -410, -410, 416, -410, -410, -409, -57, 62, - -105, -410, 401, -410, -410, -410, -410, -410, 54, -4, - -410, -410, 30, -410, -410 + -463, -463, -463, 336, 339, 341, 342, -129, -128, -462, + -463, 396, 415, -118, -463, -225, 82, -463, -244, -463, + -50, -463, -37, -463, -56, 321, -463, -102, 252, -247, + 5, -463, -463, -463, -463, -463, -463, -463, 390, -463, + -463, -463, -463, 2, -463, 92, -463, -463, 391, -463, + -463, -463, -463, -463, 450, -463, -463, -459, -57, 62, + -105, -463, 436, -463, -463, -463, -463, -463, 86, 28, + -463, -463, 69, -463, -463 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -128 +#define YYTABLE_NINF -130 static const short int yytable[] = { - 89, 222, 223, 106, 310, 26, 332, 333, 39, 94, - 198, 397, 201, 225, 53, 42, 89, 4, 365, 399, - 208, 119, 202, 211, 214, 215, 216, 217, 218, 219, - 220, 221, 397, 367, 351, 7, 8, 9, 10, 54, - 12, 55, 400, 26, 56, 228, 352, 387, 232, 233, - 244, 123, 234, 235, 236, 237, 238, 239, 119, 212, - 366, 243, 214, 215, 216, 217, 218, 219, 220, 221, - 388, 213, 180, 181, 182, 366, 491, 343, 345, 46, - 47, 48, 499, 353, -65, 29, 123, 397, 207, 121, - 39, 207, 507, 123, 501, 410, 247, 397, 49, 95, - 107, 108, 248, 398, 51, 43, 361, 52, 110, 111, - 112, 226, 227, 207, 229, 230, 207, 207, -127, 58, - 207, 207, 207, 207, 207, 207, 240, 241, 242, 207, - 490, 59, 20, 60, 21, 279, 280, 281, 173, 174, - 277, 328, 64, 5, 245, 246, 431, 252, 253, 6, - 301, -25, -25, -24, -24, 301, 301, -23, -23, 7, - 8, 9, 10, 11, 12, 13, 283, 301, 500, -22, - -22, 62, 301, 254, 255, 306, -66, 103, 99, 100, - 14, 101, 102, 301, 301, 301, 114, 115, 89, 122, - 116, 451, 172, 452, 326, 214, 215, 216, 217, 218, - 219, 220, 221, 176, 177, 178, 199, 89, 327, 207, - 373, 200, 375, 376, 377, 203, 209, -29, -28, -27, - 383, -26, 257, 281, 30, 31, 32, 33, 34, 35, - 36, -32, 391, 392, 393, 394, 395, 396, -33, 258, - 287, 288, 307, 309, 313, 401, 402, 403, 404, 301, - 312, 315, 314, 316, 317, 301, 318, 329, 346, 319, - 359, 320, 321, 325, 387, 330, 409, 411, 334, 301, - 301, 335, 356, 336, 303, 304, 337, 372, 207, 374, - 207, 207, 207, 378, 379, 354, 305, 338, 207, 339, - 347, 311, 357, 412, 415, 438, 348, 429, 430, 349, - 350, 362, 322, 323, 324, 363, 368, 371, 301, 443, - 301, 380, 381, 382, 301, 386, 456, 457, 458, 283, - 413, 419, 421, 301, 301, 301, 471, 433, 472, 422, - 423, 207, 463, 464, 465, 466, 434, 467, 468, 469, - 470, 427, 474, 366, 489, 222, 223, 435, 476, 428, - 436, 437, 461, 439, 301, 301, 493, 440, 441, 442, - 445, 450, 301, 222, 223, 453, 455, 473, 364, 477, - 494, 301, 475, 479, 370, 480, 207, 481, 482, 495, - 483, 496, 497, 502, 207, 207, 207, 484, 384, 385, - 207, 485, 486, 487, 488, 503, 462, 504, 301, 506, - 505, 509, 510, 511, 513, 514, 163, 164, 165, 166, - 97, 57, 407, 105, 406, 205, 207, 113, 276, 27, - 45, 432, 418, 459, 0, 0, 0, 414, 0, 416, - 65, 66, 301, 420, 0, 0, 0, 0, 0, 0, - 0, 0, 424, 425, 426, 301, 0, 20, 0, 21, - 0, 259, 301, 0, 0, 0, 301, 301, 0, 0, - 0, 0, 0, 260, 261, 0, 0, 0, 0, 0, - 0, 0, 0, 446, 447, 0, 0, 0, 0, 0, - 0, 454, 0, 0, 0, 0, 0, 0, 0, 0, - 460, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 478, 0, 0, - 0, 0, 262, 0, 263, 264, 155, 156, 0, 265, - 266, 267, 0, 0, 0, 0, 0, 0, 0, 268, - 0, 0, 269, 0, 270, 0, 0, 271, 0, 0, - 0, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 508, 0, 0, 0, 0, 0, - 0, 512, 0, 0, 0, 515, 516, 65, 66, 0, - 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 20, 0, 21, 65, 66, 0, - 117, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 79, 80, 20, 0, 21, 0, 0, 0, - 81, 0, 0, 0, 0, -35, 0, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 6, -35, -35, 0, - 81, 289, 290, 65, 66, 291, -35, -35, -35, -35, - -35, -35, -35, 0, 0, -35, 22, 0, 0, 0, - 20, 0, 21, 23, 292, 293, 294, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 295, 296, 0, 0, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 118, 0, 0, 0, 0, 0, 0, 297, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 344, 0, 0, 0, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 0, 0, 0, 0, 0, 262, 0, 263, 264, 155, - 156, 0, 265, 266, 267, 289, 290, 0, 0, 291, - 0, 0, 0, 0, 0, 298, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, - 294, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 295, 296, 0, 0, 0, 0, 0, 0, 0, 0, + 89, 224, 225, 106, 312, 26, 367, 369, 334, 335, + 200, 39, 389, 227, 493, 214, 89, -67, 42, 355, + 210, 203, 123, 213, 345, 347, 123, 215, 94, 119, + 399, 204, 503, 399, 501, 390, 353, 399, 175, 176, + 402, 401, 4, 26, 509, 412, 29, 230, 368, 368, + 234, 235, 246, 363, 236, 237, 238, 239, 240, 241, + 110, 111, 112, 245, 249, 399, 119, 46, 47, 48, + 250, 400, 182, 183, 184, 216, 217, 218, 219, 220, + 221, 222, 223, 107, 108, 354, 49, 39, 209, 121, + 123, 209, 65, 66, 52, 117, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 79, 80, 20, + 43, 21, 51, 228, 229, 209, 231, 232, 209, 209, + 95, 58, 209, 209, 209, 209, 209, 209, 242, 243, + 244, 209, 247, 248, 59, 81, 60, 20, 62, 21, + 254, 255, 279, 330, 64, 281, 282, 283, 433, -27, + -27, 99, 303, -26, -26, -25, -25, 303, 303, 216, + 217, 218, 219, 220, 221, 222, 223, 100, 285, 303, + -24, -24, 256, 257, 303, 103, 114, 308, 101, 102, + -68, 115, -129, 492, 116, 303, 303, 303, 122, 174, + 89, 453, 178, 454, 179, 180, 328, 201, 202, 205, + 82, 211, -31, 83, -30, 342, 84, 5, 85, 89, + 329, 209, 375, 6, 377, 378, 379, -29, -28, -34, + 259, 289, 385, 7, 8, 9, 10, 11, 12, 13, + -35, 260, 290, 283, 393, 394, 395, 396, 397, 398, + 309, 311, 314, 315, 14, 316, 317, 403, 404, 405, + 406, 303, 331, 318, 348, 319, 320, 303, 216, 217, + 218, 219, 220, 221, 222, 223, 321, 502, 322, 323, + 327, 303, 303, 332, 336, 358, 305, 306, 337, 374, + 209, 376, 209, 209, 209, 380, 381, 356, 307, 338, + 209, 359, 339, 313, 361, 340, 389, 440, 341, 349, + 350, 351, 364, 352, 324, 325, 326, 365, 370, 373, + 303, 382, 303, 383, 384, 388, 303, 411, 458, 459, + 460, 285, 413, 414, 415, 303, 303, 303, 417, 421, + 423, 424, 425, 209, 465, 466, 467, 468, 431, 469, + 470, 471, 472, 429, 432, 435, 436, 224, 225, 437, + 478, 430, 438, 439, 441, 442, 303, 303, 443, 444, + 445, 447, 452, 455, 303, 224, 225, 457, 463, 473, + 366, 475, 474, 303, 476, 477, 372, 368, 209, 479, + 53, 497, 481, 498, 499, 482, 209, 209, 209, 483, + 386, 387, 209, 484, 485, 486, 487, 491, 464, 488, + 303, 7, 8, 9, 10, 54, 12, 55, 495, 489, + 56, 30, 31, 32, 33, 34, 35, 36, 209, 490, + 504, 505, 506, 496, 508, 507, 511, 512, 513, 416, + 515, 418, 516, 165, 303, 422, 166, 97, 167, 168, + 57, 409, 105, 207, 426, 427, 428, 303, 65, 66, + 408, 278, 113, 27, 303, 45, 420, 461, 303, 303, + 0, 0, 434, 0, 0, 20, 0, 21, 0, 261, + 0, 0, 0, 0, 0, 448, 449, 0, 0, 0, + 0, 262, 263, 456, 0, 0, 0, 0, 0, 0, + 0, 0, 462, 0, 65, 66, 0, 117, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 20, 0, 21, 0, 0, 0, 0, 0, 480, + 0, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 81, 0, 0, + 0, 0, 264, 0, 265, 266, 157, 158, 0, 267, + 268, 269, 0, 500, 0, 0, 0, 0, 0, 270, + 0, 0, 271, 0, 272, 0, 510, 273, 0, 0, + 0, 0, 0, 514, 0, 0, 0, 517, 518, 65, + 66, 0, 117, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 79, 80, 20, 0, 21, 0, + 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, + 85, 118, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 81, 291, 292, 65, 66, 293, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 297, 0, 0, 0, 0, 0, 0, + 0, -37, 20, 20, 21, 21, 294, 295, 296, 0, + 0, 0, 6, -37, -37, 0, 0, 0, 297, 298, + 0, 0, -37, -37, -37, -37, -37, -37, -37, 0, + 0, -37, 22, 0, 0, 0, 0, 0, 0, 23, + 0, 299, 0, 24, 0, 0, 0, 82, 0, 0, + 83, 0, 0, 84, 0, 85, 346, 0, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 0, 0, 0, 0, 0, 264, + 0, 265, 266, 157, 158, 0, 267, 268, 269, 291, + 292, 0, 0, 293, 0, 0, 0, 0, 0, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 0, 0, 0, 0, 0, 262, - 0, 263, 264, 155, 156, 0, 265, 266, 267, 0, - 0, 0, 0, 0, 0, 0, 0, 65, 66, 298, - 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, - 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, - 81, 117, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, + 0, 0, 294, 295, 296, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 297, 298, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 282, 0, 0, 0, 0, 0, 0, 0, 0, 65, - 66, 81, 117, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 79, 80, 20, 0, 21, 0, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 81, 65, 66, 0, 117, 68, 69, 70, + 0, 0, 0, 0, 0, 0, 0, 299, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 0, 0, 0, 0, 0, 264, 0, 265, 266, 157, + 158, 0, 267, 268, 269, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 300, 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 20, 0, 21, 0, 82, 0, 0, 83, 0, 0, - 84, 0, 85, 0, 0, 358, 0, 0, 0, 0, + 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 20, 0, 21, 0, 82, 0, 0, 83, 0, - 340, 84, 0, 85, 0, 0, 405, 0, 0, 0, - 0, 0, 0, 0, 0, 65, 66, 81, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 20, 0, 21, 0, 0, 0, 0, 82, - 0, 0, 83, 0, 0, 84, 0, 85, 0, 0, - 0, 0, 0, 0, 0, 0, 65, 66, 81, 117, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, - 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, - 0, 0, 0, 0, 0, 0, 0, 65, 66, 81, - 117, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 79, 80, 20, 0, 21, 0, 0, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, - 81, 210, 68, 69, 70, 71, 72, 73, 74, 75, + 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 284, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 81, 65, 66, + 0, 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, + 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, + 360, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 66, 81, 117, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, - 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, + 85, 407, 0, 0, 0, 0, 0, 0, 0, 0, + 65, 66, 81, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, + 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, + 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, + 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, + 21, 0, 0, 0, 0, 0, 0, 82, 0, 0, + 83, 0, 0, 84, 0, 85, 0, 0, 0, 0, + 0, 0, 65, 66, 81, 117, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 79, 80, 20, + 0, 21, 0, 0, 0, 0, 0, 0, 82, 0, + 0, 83, 0, 0, 84, 0, 85, 0, 0, 0, + 0, 0, 0, 65, 66, 81, 212, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 20, 0, 21, 0, 0, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 0, 85, 0, 0, + 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 126, 127, 0, 0, 82, 0, 0, 83, 0, 0, - 84, 0, 85, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 0, 0, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162 + 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, + 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 126, 127, 0, + 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164 }; static const short int yycheck[] = { - 37, 130, 130, 53, 227, 3, 250, 251, 23, 29, - 112, 110, 110, 131, 20, 30, 53, 0, 15, 118, - 125, 85, 120, 128, 10, 11, 12, 13, 14, 15, - 16, 17, 110, 15, 278, 41, 42, 43, 44, 45, - 46, 47, 120, 41, 50, 150, 116, 34, 153, 154, - 168, 121, 157, 158, 159, 160, 161, 162, 122, 9, - 57, 166, 10, 11, 12, 13, 14, 15, 16, 17, - 57, 21, 109, 110, 111, 57, 474, 269, 270, 52, - 53, 54, 491, 118, 112, 61, 121, 110, 125, 87, - 23, 128, 501, 121, 492, 118, 110, 110, 71, 119, - 32, 33, 116, 116, 109, 120, 298, 61, 55, 56, - 57, 148, 149, 150, 151, 152, 153, 154, 0, 109, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 116, 45, 22, 47, 24, 199, 200, 201, 55, 56, - 197, 246, 4, 25, 95, 96, 390, 27, 28, 31, - 207, 3, 4, 3, 4, 212, 213, 3, 4, 41, - 42, 43, 44, 45, 46, 47, 203, 224, 116, 3, - 4, 24, 229, 3, 4, 225, 112, 114, 109, 109, - 62, 109, 109, 240, 241, 242, 4, 4, 225, 112, - 4, 414, 24, 416, 244, 10, 11, 12, 13, 14, - 15, 16, 17, 4, 24, 24, 115, 244, 245, 246, - 315, 115, 317, 318, 319, 112, 59, 4, 4, 4, - 325, 4, 4, 287, 64, 65, 66, 67, 68, 69, - 70, 7, 334, 335, 336, 337, 338, 339, 7, 7, - 110, 113, 110, 110, 110, 347, 348, 349, 350, 306, - 114, 110, 36, 110, 110, 312, 110, 24, 24, 110, - 63, 110, 110, 110, 34, 110, 24, 21, 112, 326, - 327, 112, 110, 112, 212, 213, 112, 314, 315, 316, - 317, 318, 319, 320, 321, 283, 224, 112, 325, 112, - 112, 229, 113, 21, 4, 397, 112, 24, 4, 112, - 112, 110, 240, 241, 242, 110, 110, 114, 365, 57, - 367, 110, 110, 110, 371, 110, 421, 422, 423, 356, - 112, 110, 110, 380, 381, 382, 4, 36, 24, 110, - 110, 368, 434, 435, 436, 437, 110, 439, 440, 441, - 442, 112, 114, 57, 21, 474, 474, 110, 453, 386, - 110, 110, 113, 110, 411, 412, 36, 110, 110, 110, - 110, 110, 419, 492, 492, 110, 110, 110, 306, 116, - 116, 428, 113, 113, 312, 113, 413, 110, 113, 481, - 110, 483, 484, 21, 421, 422, 423, 110, 326, 327, - 427, 113, 113, 113, 113, 113, 433, 113, 455, 110, - 113, 21, 110, 76, 21, 21, 97, 97, 97, 97, - 41, 25, 357, 52, 356, 122, 453, 61, 197, 3, - 19, 391, 368, 427, -1, -1, -1, 365, -1, 367, - 5, 6, 489, 371, -1, -1, -1, -1, -1, -1, - -1, -1, 380, 381, 382, 502, -1, 22, -1, 24, - -1, 26, 509, -1, -1, -1, 513, 514, -1, -1, - -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, - -1, -1, -1, 411, 412, -1, -1, -1, -1, -1, - -1, 419, -1, -1, -1, -1, -1, -1, -1, -1, - 428, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 455, -1, -1, - -1, -1, 97, -1, 99, 100, 101, 102, -1, 104, - 105, 106, -1, -1, -1, -1, -1, -1, -1, 114, - -1, -1, 117, -1, 119, -1, -1, 122, -1, -1, - -1, 489, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 502, -1, -1, -1, -1, -1, - -1, 509, -1, -1, -1, 513, 514, 5, 6, -1, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, 5, 6, -1, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, - 48, -1, -1, -1, -1, 20, -1, 22, -1, 24, - -1, -1, -1, -1, -1, -1, 31, 32, 33, -1, - 48, 3, 4, 5, 6, 7, 41, 42, 43, 44, - 45, 46, 47, -1, -1, 50, 51, -1, -1, -1, - 22, -1, 24, 58, 26, 27, 28, 62, -1, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, -1, - -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, - -1, 119, 120, -1, -1, -1, -1, -1, -1, 61, - -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, - -1, 119, 120, -1, -1, -1, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - -1, -1, -1, -1, -1, 97, -1, 99, 100, 101, - 102, -1, 104, 105, 106, 3, 4, -1, -1, 7, - -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, - 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, -1, -1, -1, -1, -1, -1, -1, + 37, 130, 130, 53, 229, 3, 15, 15, 252, 253, + 112, 23, 34, 131, 476, 9, 53, 114, 30, 120, + 125, 112, 123, 128, 271, 272, 123, 21, 29, 85, + 112, 122, 494, 112, 493, 57, 280, 112, 55, 56, + 122, 120, 0, 41, 503, 120, 61, 152, 57, 57, + 155, 156, 170, 300, 159, 160, 161, 162, 163, 164, + 55, 56, 57, 168, 112, 112, 122, 52, 53, 54, + 118, 118, 109, 110, 111, 10, 11, 12, 13, 14, + 15, 16, 17, 32, 33, 118, 71, 23, 125, 87, + 123, 128, 5, 6, 61, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 122, 24, 111, 150, 151, 152, 153, 154, 155, 156, + 121, 111, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 97, 98, 45, 48, 47, 22, 24, 24, + 27, 28, 199, 248, 4, 201, 202, 203, 392, 3, + 4, 111, 209, 3, 4, 3, 4, 214, 215, 10, + 11, 12, 13, 14, 15, 16, 17, 111, 205, 226, + 3, 4, 3, 4, 231, 116, 4, 227, 111, 111, + 114, 4, 0, 118, 4, 242, 243, 244, 114, 24, + 227, 416, 4, 418, 24, 24, 246, 117, 117, 114, + 113, 59, 4, 116, 4, 118, 119, 25, 121, 246, + 247, 248, 317, 31, 319, 320, 321, 4, 4, 7, + 4, 112, 327, 41, 42, 43, 44, 45, 46, 47, + 7, 7, 115, 289, 336, 337, 338, 339, 340, 341, + 112, 112, 116, 112, 62, 36, 112, 349, 350, 351, + 352, 308, 24, 112, 24, 112, 112, 314, 10, 11, + 12, 13, 14, 15, 16, 17, 112, 118, 112, 112, + 112, 328, 329, 112, 114, 112, 214, 215, 114, 316, + 317, 318, 319, 320, 321, 322, 323, 285, 226, 114, + 327, 115, 114, 231, 63, 114, 34, 399, 114, 114, + 114, 114, 112, 114, 242, 243, 244, 112, 112, 116, + 367, 112, 369, 112, 112, 112, 373, 24, 423, 424, + 425, 358, 21, 21, 114, 382, 383, 384, 4, 112, + 112, 112, 112, 370, 436, 437, 438, 439, 24, 441, + 442, 443, 444, 114, 4, 36, 112, 476, 476, 112, + 455, 388, 112, 112, 112, 112, 413, 414, 112, 112, + 57, 112, 112, 112, 421, 494, 494, 112, 115, 4, + 308, 112, 24, 430, 116, 115, 314, 57, 415, 118, + 20, 483, 115, 485, 486, 115, 423, 424, 425, 112, + 328, 329, 429, 115, 112, 112, 115, 21, 435, 115, + 457, 41, 42, 43, 44, 45, 46, 47, 36, 115, + 50, 64, 65, 66, 67, 68, 69, 70, 455, 115, + 21, 115, 115, 118, 112, 115, 21, 112, 76, 367, + 21, 369, 21, 97, 491, 373, 97, 41, 97, 97, + 25, 359, 52, 122, 382, 383, 384, 504, 5, 6, + 358, 199, 61, 3, 511, 19, 370, 429, 515, 516, + -1, -1, 393, -1, -1, 22, -1, 24, -1, 26, + -1, -1, -1, -1, -1, 413, 414, -1, -1, -1, + -1, 38, 39, 421, -1, -1, -1, -1, -1, -1, + -1, -1, 430, -1, 5, 6, -1, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, -1, -1, -1, 457, + -1, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 48, -1, -1, + -1, -1, 99, -1, 101, 102, 103, 104, -1, 106, + 107, 108, -1, 491, -1, -1, -1, -1, -1, 116, + -1, -1, 119, -1, 121, -1, 504, 124, -1, -1, + -1, -1, -1, 511, -1, -1, -1, 515, 516, 5, + 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, + -1, -1, 113, -1, -1, 116, -1, -1, 119, -1, + 121, 122, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 48, 3, 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + -1, 20, 22, 22, 24, 24, 26, 27, 28, -1, + -1, -1, 31, 32, 33, -1, -1, -1, 38, 39, + -1, -1, 41, 42, 43, 44, 45, 46, 47, -1, + -1, 50, 51, -1, -1, -1, -1, -1, -1, 58, + -1, 61, -1, 62, -1, -1, -1, 113, -1, -1, + 116, -1, -1, 119, -1, 121, 122, -1, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, -1, -1, -1, -1, -1, 99, + -1, 101, 102, 103, 104, -1, 106, 107, 108, 3, + 4, -1, -1, 7, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, -1, -1, -1, -1, -1, 97, - -1, 99, 100, 101, 102, -1, 104, 105, 106, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 117, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, - -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, - 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + -1, -1, 26, 27, 28, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, - 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, - -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, - -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 48, 5, 6, -1, 8, 9, 10, 11, + -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + -1, -1, -1, -1, -1, 99, -1, 101, 102, 103, + 104, -1, 106, 107, 108, -1, -1, -1, -1, -1, + -1, -1, -1, 5, 6, 119, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, -1, 24, -1, 111, -1, -1, 114, -1, -1, - 117, -1, 119, -1, -1, 37, -1, -1, -1, -1, + 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, -1, 111, -1, -1, 114, -1, - 116, 117, -1, 119, -1, -1, 37, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, -1, 24, -1, -1, -1, -1, 111, - -1, -1, 114, -1, -1, 117, -1, 119, -1, -1, - -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, - 111, -1, -1, 114, -1, -1, 117, -1, 119, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, - -1, 111, -1, -1, 114, -1, -1, 117, -1, 119, - -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, - 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 5, 6, + -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, - -1, -1, 111, -1, -1, 114, -1, -1, 117, -1, - 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 113, -1, -1, 116, -1, -1, 119, -1, 121, + 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, + -1, -1, 113, -1, -1, 116, -1, -1, 119, -1, + 121, 37, -1, -1, -1, -1, -1, -1, -1, -1, + 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, + -1, -1, -1, -1, -1, -1, 113, -1, -1, 116, + -1, -1, 119, -1, 121, -1, -1, -1, -1, -1, + -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, + 24, -1, -1, -1, -1, -1, -1, 113, -1, -1, + 116, -1, -1, 119, -1, 121, -1, -1, -1, -1, + -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + -1, 24, -1, -1, -1, -1, -1, -1, 113, -1, + -1, 116, -1, -1, 119, -1, 121, -1, -1, -1, + -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, -1, -1, -1, -1, -1, -1, 113, + -1, -1, 116, -1, -1, 119, -1, 121, -1, -1, + -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, - -1, 119, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 59, 60, -1, -1, 111, -1, -1, 114, -1, -1, - 117, -1, 119, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, -1, -1, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108 + 113, -1, -1, 116, -1, -1, 119, -1, 121, -1, + -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 59, 60, -1, + -1, 113, -1, -1, 116, -1, -1, 119, -1, 121, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, -1, -1, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 154, 155, 156, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 135, 173, 175, 177, 184, - 22, 24, 51, 58, 62, 134, 166, 177, 178, 61, - 64, 65, 66, 67, 68, 69, 70, 136, 171, 23, - 185, 186, 30, 120, 174, 185, 52, 53, 54, 71, - 163, 109, 61, 20, 45, 47, 50, 135, 109, 45, - 47, 176, 24, 161, 4, 5, 6, 8, 9, 10, + 0, 156, 157, 158, 0, 25, 31, 41, 42, 43, + 44, 45, 46, 47, 62, 137, 175, 177, 179, 186, + 22, 24, 51, 58, 62, 136, 168, 179, 180, 61, + 64, 65, 66, 67, 68, 69, 70, 138, 173, 23, + 187, 188, 30, 122, 176, 187, 52, 53, 54, 71, + 165, 111, 61, 20, 45, 47, 50, 137, 111, 45, + 47, 178, 24, 163, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 48, 111, 114, 117, 119, 124, 143, 144, 145, - 146, 147, 166, 181, 29, 119, 172, 134, 189, 109, - 109, 109, 109, 114, 164, 161, 143, 32, 33, 153, - 153, 153, 153, 171, 4, 4, 4, 8, 120, 147, - 148, 166, 112, 121, 35, 49, 59, 60, 72, 73, + 21, 48, 113, 116, 119, 121, 126, 145, 146, 147, + 148, 149, 168, 183, 29, 121, 174, 136, 191, 111, + 111, 111, 111, 116, 166, 163, 145, 32, 33, 155, + 155, 155, 155, 173, 4, 4, 4, 8, 122, 149, + 150, 168, 114, 123, 35, 49, 59, 60, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 126, 127, 128, 129, 187, 193, 194, - 196, 197, 24, 55, 56, 162, 4, 24, 24, 165, - 145, 145, 145, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 130, 131, 133, 145, 150, 115, - 115, 110, 120, 112, 37, 148, 149, 145, 183, 59, - 8, 183, 9, 21, 10, 11, 12, 13, 14, 15, - 16, 17, 130, 131, 132, 136, 145, 145, 183, 145, - 145, 190, 183, 183, 183, 183, 183, 183, 183, 183, - 145, 145, 145, 183, 136, 95, 96, 110, 116, 159, - 160, 158, 27, 28, 3, 4, 125, 4, 7, 26, - 38, 39, 97, 99, 100, 104, 105, 106, 114, 117, - 119, 122, 126, 127, 128, 129, 151, 181, 157, 147, - 147, 147, 37, 145, 168, 169, 170, 110, 113, 3, - 4, 7, 26, 27, 28, 38, 39, 61, 117, 151, - 180, 181, 182, 182, 182, 182, 143, 110, 138, 110, - 138, 182, 114, 110, 36, 110, 110, 110, 110, 110, - 110, 110, 182, 182, 182, 110, 143, 145, 183, 24, - 110, 141, 141, 141, 112, 112, 112, 112, 112, 112, - 116, 150, 152, 152, 120, 152, 24, 112, 112, 112, - 112, 141, 116, 118, 166, 167, 110, 113, 37, 63, - 179, 152, 110, 110, 182, 15, 57, 15, 110, 195, - 182, 114, 145, 183, 145, 183, 183, 183, 145, 145, - 110, 110, 110, 183, 182, 182, 110, 34, 57, 139, - 142, 150, 150, 150, 150, 150, 150, 110, 116, 118, - 120, 150, 150, 150, 150, 37, 168, 139, 140, 24, - 118, 21, 21, 112, 182, 4, 182, 183, 191, 110, - 182, 110, 110, 110, 182, 182, 182, 112, 145, 24, - 4, 141, 195, 36, 110, 110, 110, 110, 150, 110, - 110, 110, 110, 57, 137, 110, 182, 182, 191, 192, - 110, 138, 138, 110, 182, 110, 183, 183, 183, 192, - 182, 113, 145, 150, 150, 150, 150, 150, 150, 150, - 150, 4, 24, 110, 114, 113, 183, 116, 182, 113, - 113, 110, 113, 110, 110, 113, 113, 113, 113, 21, - 116, 132, 188, 36, 116, 150, 150, 150, 182, 180, - 116, 132, 21, 113, 113, 113, 110, 180, 182, 21, - 110, 76, 182, 21, 21, 182, 182 + 94, 95, 96, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 128, 129, 130, 131, 189, + 195, 196, 198, 199, 24, 55, 56, 164, 4, 24, + 24, 167, 147, 147, 147, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 132, 133, 135, 147, + 152, 117, 117, 112, 122, 114, 37, 150, 151, 147, + 185, 59, 8, 185, 9, 21, 10, 11, 12, 13, + 14, 15, 16, 17, 132, 133, 134, 138, 147, 147, + 185, 147, 147, 192, 185, 185, 185, 185, 185, 185, + 185, 185, 147, 147, 147, 185, 138, 97, 98, 112, + 118, 161, 162, 160, 27, 28, 3, 4, 127, 4, + 7, 26, 38, 39, 99, 101, 102, 106, 107, 108, + 116, 119, 121, 124, 128, 129, 130, 131, 153, 183, + 159, 149, 149, 149, 37, 147, 170, 171, 172, 112, + 115, 3, 4, 7, 26, 27, 28, 38, 39, 61, + 119, 153, 182, 183, 184, 184, 184, 184, 145, 112, + 140, 112, 140, 184, 116, 112, 36, 112, 112, 112, + 112, 112, 112, 112, 184, 184, 184, 112, 145, 147, + 185, 24, 112, 143, 143, 143, 114, 114, 114, 114, + 114, 114, 118, 152, 154, 154, 122, 154, 24, 114, + 114, 114, 114, 143, 118, 120, 168, 169, 112, 115, + 37, 63, 181, 154, 112, 112, 184, 15, 57, 15, + 112, 197, 184, 116, 147, 185, 147, 185, 185, 185, + 147, 147, 112, 112, 112, 185, 184, 184, 112, 34, + 57, 141, 144, 152, 152, 152, 152, 152, 152, 112, + 118, 120, 122, 152, 152, 152, 152, 37, 170, 141, + 142, 24, 120, 21, 21, 114, 184, 4, 184, 185, + 193, 112, 184, 112, 112, 112, 184, 184, 184, 114, + 147, 24, 4, 143, 197, 36, 112, 112, 112, 112, + 152, 112, 112, 112, 112, 57, 139, 112, 184, 184, + 193, 194, 112, 140, 140, 112, 184, 112, 185, 185, + 185, 194, 184, 115, 147, 152, 152, 152, 152, 152, + 152, 152, 152, 4, 24, 112, 116, 115, 185, 118, + 184, 115, 115, 112, 115, 112, 112, 115, 115, 115, + 115, 21, 118, 134, 190, 36, 118, 152, 152, 152, + 184, 182, 118, 134, 21, 115, 115, 115, 112, 182, + 184, 21, 112, 76, 184, 21, 21, 184, 184 }; #define yyerrok (yyerrstatus = 0) @@ -2955,7 +2987,7 @@ switch (yyn) { case 3: -#line 1098 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -2965,7 +2997,7 @@ break; case 5: -#line 1107 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -2974,99 +3006,99 @@ ;} break; - case 34: -#line 1131 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 36: +#line 1168 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR ;} break; - case 35: -#line 1135 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 37: +#line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR ;} break; - case 36: -#line 1140 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 38: +#line 1177 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; - case 37: -#line 1141 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 39: +#line 1178 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; - case 38: -#line 1142 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 40: +#line 1179 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; - case 39: -#line 1143 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 41: +#line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; - case 40: -#line 1144 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 42: +#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; - case 41: -#line 1145 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 43: +#line 1182 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; - case 42: -#line 1146 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 44: +#line 1183 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; - case 43: -#line 1147 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 45: +#line 1184 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; - case 44: -#line 1149 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 46: +#line 1186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; - case 45: -#line 1150 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 47: +#line 1187 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; - case 46: -#line 1151 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 48: +#line 1188 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::CSRet; ;} break; - case 47: -#line 1152 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 49: +#line 1189 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; - case 48: -#line 1153 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 50: +#line 1190 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; - case 49: -#line 1154 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 51: +#line 1191 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; - case 50: -#line 1155 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 52: +#line 1192 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; - case 51: -#line 1156 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 53: +#line 1193 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large!"); @@ -3075,13 +3107,13 @@ ;} break; - case 52: -#line 1165 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 54: +#line 1202 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 53: -#line 1166 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 55: +#line 1203 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3090,13 +3122,13 @@ ;} break; - case 54: -#line 1172 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 56: +#line 1209 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; - case 55: -#line 1173 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 57: +#line 1210 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3105,8 +3137,8 @@ ;} break; - case 56: -#line 1181 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 58: +#line 1218 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') @@ -3116,28 +3148,28 @@ ;} break; - case 57: -#line 1189 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 59: +#line 1226 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 58: -#line 1190 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 60: +#line 1227 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; - case 59: -#line 1195 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 61: +#line 1232 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 60: -#line 1196 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 62: +#line 1233 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; - case 61: -#line 1197 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 63: +#line 1234 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -3145,8 +3177,8 @@ ;} break; - case 62: -#line 1202 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 64: +#line 1239 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); @@ -3155,18 +3187,18 @@ ;} break; - case 64: -#line 1216 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 66: +#line 1253 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; - case 66: -#line 1217 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 68: +#line 1254 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; - case 67: -#line 1219 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 69: +#line 1256 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -3175,24 +3207,24 @@ ;} break; - case 81: -#line 1231 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 83: +#line 1268 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ;} break; - case 82: -#line 1235 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 84: +#line 1272 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR ;} break; - case 83: -#line 1239 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 85: +#line 1276 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -3200,8 +3232,8 @@ ;} break; - case 84: -#line 1247 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 86: +#line 1284 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3212,8 +3244,8 @@ ;} break; - case 85: -#line 1255 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 87: +#line 1292 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3229,8 +3261,8 @@ ;} break; - case 86: -#line 1268 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 88: +#line 1305 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); delete (yyvsp[-1].TypeVal); @@ -3238,8 +3270,8 @@ ;} break; - case 87: -#line 1273 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 89: +#line 1310 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Packed array type? const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) @@ -3254,8 +3286,8 @@ ;} break; - case 88: -#line 1285 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 90: +#line 1322 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3268,16 +3300,16 @@ ;} break; - case 89: -#line 1295 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 91: +#line 1332 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ;} break; - case 90: -#line 1299 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 92: +#line 1336 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -3287,8 +3319,8 @@ ;} break; - case 91: -#line 1310 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 93: +#line 1347 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); @@ -3296,40 +3328,40 @@ ;} break; - case 92: -#line 1315 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 94: +#line 1352 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; - case 94: -#line 1322 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 96: +#line 1359 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; - case 95: -#line 1326 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 97: +#line 1363 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; - case 96: -#line 1330 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 98: +#line 1367 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR ;} break; - case 97: -#line 1341 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 99: +#line 1378 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) @@ -3358,8 +3390,8 @@ ;} break; - case 98: -#line 1367 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 100: +#line 1404 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3376,8 +3408,8 @@ ;} break; - case 99: -#line 1381 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 101: +#line 1418 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3410,8 +3442,8 @@ ;} break; - case 100: -#line 1411 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 102: +#line 1448 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) @@ -3440,8 +3472,8 @@ ;} break; - case 101: -#line 1437 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 103: +#line 1474 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) @@ -3465,8 +3497,8 @@ ;} break; - case 102: -#line 1458 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 104: +#line 1495 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) @@ -3482,8 +3514,8 @@ ;} break; - case 103: -#line 1471 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 105: +#line 1508 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) @@ -3496,8 +3528,8 @@ ;} break; - case 104: -#line 1481 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 106: +#line 1518 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); delete (yyvsp[-1].TypeVal); @@ -3505,8 +3537,8 @@ ;} break; - case 105: -#line 1486 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 107: +#line 1523 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) @@ -3570,8 +3602,8 @@ ;} break; - case 106: -#line 1547 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 108: +#line 1584 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); @@ -3581,8 +3613,8 @@ ;} break; - case 107: -#line 1554 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 109: +#line 1591 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) @@ -3593,8 +3625,8 @@ ;} break; - case 108: -#line 1563 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 110: +#line 1600 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3603,8 +3635,8 @@ ;} break; - case 109: -#line 1569 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 111: +#line 1606 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3613,24 +3645,24 @@ ;} break; - case 110: -#line 1575 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 112: +#line 1612 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getTrue(); CHECK_FOR_ERROR ;} break; - case 111: -#line 1579 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 113: +#line 1616 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getFalse(); CHECK_FOR_ERROR ;} break; - case 112: -#line 1583 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 114: +#line 1620 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); @@ -3639,8 +3671,8 @@ ;} break; - case 113: -#line 1591 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 115: +#line 1628 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + @@ -3654,8 +3686,8 @@ ;} break; - case 114: -#line 1602 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 116: +#line 1639 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); @@ -3690,8 +3722,8 @@ ;} break; - case 115: -#line 1634 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 117: +#line 1671 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); @@ -3702,17 +3734,22 @@ ;} break; - case 116: -#line 1642 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 118: +#line 1679 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. + sanitizeOpCode((yyvsp[-5].BinaryOpVal),(yyvsp[-3].ConstVal)->getType()); + CHECK_FOR_ERROR; + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the // broken case. See PR424 for more information. if (!isa((yyvsp[-3].ConstVal)->getType())) { - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -3720,7 +3757,7 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy), + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy), ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy)); (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType()); } @@ -3728,8 +3765,8 @@ ;} break; - case 117: -#line 1664 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 119: +#line 1706 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); @@ -3738,35 +3775,35 @@ !cast((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 118: -#line 1675 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 120: +#line 1717 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 119: -#line 1681 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 121: +#line 1723 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; - case 120: -#line 1689 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 122: +#line 1731 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -3775,8 +3812,8 @@ ;} break; - case 121: -#line 1695 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 123: +#line 1737 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -3785,8 +3822,8 @@ ;} break; - case 122: -#line 1701 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 124: +#line 1743 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -3795,16 +3832,16 @@ ;} break; - case 123: -#line 1710 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 125: +#line 1752 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 124: -#line 1714 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 126: +#line 1756 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); @@ -3812,18 +3849,18 @@ ;} break; - case 125: -#line 1722 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 127: +#line 1764 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; - case 126: -#line 1722 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 128: +#line 1764 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; - case 127: -#line 1732 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 129: +#line 1774 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); @@ -3831,8 +3868,8 @@ ;} break; - case 128: -#line 1740 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 130: +#line 1782 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); @@ -3840,32 +3877,32 @@ ;} break; - case 129: -#line 1745 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 131: +#line 1787 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; - case 130: -#line 1749 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 132: +#line 1791 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR ;} break; - case 131: -#line 1753 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 133: +#line 1795 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; - case 132: -#line 1757 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 134: +#line 1799 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -3881,8 +3918,8 @@ ;} break; - case 133: -#line 1772 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 135: +#line 1814 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -3907,22 +3944,22 @@ ;} break; - case 134: -#line 1794 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 136: +#line 1836 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; - case 135: -#line 1797 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 137: +#line 1839 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; - case 136: -#line 1800 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 138: +#line 1842 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); @@ -3931,15 +3968,15 @@ ;} break; - case 137: -#line 1805 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 139: +#line 1847 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; - case 138: -#line 1808 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 140: +#line 1850 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -3947,16 +3984,16 @@ ;} break; - case 139: -#line 1812 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 141: +#line 1854 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 140: -#line 1816 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 142: +#line 1858 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -3964,16 +4001,16 @@ ;} break; - case 141: -#line 1820 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 143: +#line 1862 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 142: -#line 1824 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 144: +#line 1866 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); @@ -3982,36 +4019,36 @@ ;} break; - case 143: -#line 1829 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 145: +#line 1871 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ;} break; - case 144: -#line 1833 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 146: +#line 1875 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 145: -#line 1836 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 147: +#line 1878 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 146: -#line 1839 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 148: +#line 1881 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ;} break; - case 147: -#line 1843 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 149: +#line 1885 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); @@ -4026,26 +4063,26 @@ ;} break; - case 148: -#line 1856 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 150: +#line 1898 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; - case 149: -#line 1857 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 151: +#line 1899 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; - case 150: -#line 1859 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 152: +#line 1901 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR ;} break; - case 151: -#line 1863 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 153: +#line 1905 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); @@ -4057,24 +4094,24 @@ ;} break; - case 152: -#line 1872 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 154: +#line 1914 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); ;} break; - case 153: -#line 1876 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 155: +#line 1918 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); ;} break; - case 155: -#line 1883 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 157: +#line 1925 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4082,8 +4119,8 @@ ;} break; - case 156: -#line 1888 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 158: +#line 1930 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4091,20 +4128,20 @@ ;} break; - case 157: -#line 1893 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 159: +#line 1935 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; - case 161: -#line 1903 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 163: +#line 1945 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; - case 162: -#line 1905 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 164: +#line 1947 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); @@ -4113,8 +4150,8 @@ ;} break; - case 163: -#line 1912 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 165: +#line 1954 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4123,8 +4160,8 @@ ;} break; - case 164: -#line 1918 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 166: +#line 1960 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4133,16 +4170,16 @@ ;} break; - case 165: -#line 1925 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 167: +#line 1967 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR ;} break; - case 166: -#line 1929 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 168: +#line 1971 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyval.ArgList)->push_back(std::pair >(); (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); @@ -4160,16 +4197,16 @@ ;} break; - case 168: -#line 1940 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 170: +#line 1982 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR ;} break; - case 169: -#line 1946 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 171: +#line 1988 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { UnEscapeLexed((yyvsp[-5].StrVal)); std::string FunctionName((yyvsp[-5].StrVal)); @@ -4265,8 +4302,8 @@ ;} break; - case 172: -#line 2042 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 174: +#line 2084 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -4276,31 +4313,31 @@ ;} break; - case 175: -#line 2052 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 177: +#line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 177: -#line 2058 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 179: +#line 2100 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; - case 178: -#line 2059 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 180: +#line 2101 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; - case 179: -#line 2061 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 181: +#line 2103 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; - case 180: -#line 2061 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 182: +#line 2103 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -4308,88 +4345,88 @@ ;} break; - case 181: -#line 2071 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 183: +#line 2113 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 182: -#line 2075 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 184: +#line 2117 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 183: -#line 2080 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 185: +#line 2122 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR ;} break; - case 184: -#line 2084 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 186: +#line 2126 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; - case 185: -#line 2088 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 187: +#line 2130 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR ;} break; - case 186: -#line 2092 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 188: +#line 2134 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR ;} break; - case 187: -#line 2096 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 189: +#line 2138 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR ;} break; - case 188: -#line 2100 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 190: +#line 2142 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR ;} break; - case 189: -#line 2104 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 191: +#line 2146 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR ;} break; - case 190: -#line 2108 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 192: +#line 2150 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR ;} break; - case 191: -#line 2112 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 193: +#line 2154 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); int NumElements = (yyvsp[-1].ConstVector)->size(); @@ -4417,16 +4454,16 @@ ;} break; - case 192: -#line 2137 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 194: +#line 2179 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; - case 193: -#line 2141 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 195: +#line 2183 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); std::string AsmStr = std::string((yyvsp[-2].StrVal), End); @@ -4439,48 +4476,48 @@ ;} break; - case 194: -#line 2155 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 196: +#line 2197 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR ;} break; - case 195: -#line 2159 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 197: +#line 2201 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; - case 198: -#line 2171 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 200: +#line 2213 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; - case 199: -#line 2176 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 201: +#line 2218 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 200: -#line 2180 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 202: +#line 2222 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; - case 201: -#line 2189 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 203: +#line 2231 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR @@ -4493,8 +4530,8 @@ ;} break; - case 202: -#line 2200 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 204: +#line 2242 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); @@ -4502,8 +4539,8 @@ ;} break; - case 203: -#line 2205 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 205: +#line 2247 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR @@ -4518,8 +4555,8 @@ ;} break; - case 204: -#line 2217 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 206: +#line 2259 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); CHECK_FOR_ERROR @@ -4534,24 +4571,24 @@ ;} break; - case 205: -#line 2230 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 207: +#line 2272 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 206: -#line 2234 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 208: +#line 2276 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR ;} break; - case 207: -#line 2238 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 209: +#line 2280 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -4559,8 +4596,8 @@ ;} break; - case 208: -#line 2243 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 210: +#line 2285 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR @@ -4572,8 +4609,8 @@ ;} break; - case 209: -#line 2252 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 211: +#line 2294 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR @@ -4595,8 +4632,8 @@ ;} break; - case 210: -#line 2271 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 212: +#line 2313 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR @@ -4608,8 +4645,8 @@ ;} break; - case 211: -#line 2281 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 213: +#line 2323 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -4667,24 +4704,24 @@ ;} break; - case 212: -#line 2336 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 214: +#line 2378 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR ;} break; - case 213: -#line 2340 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 215: +#line 2382 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR ;} break; - case 214: -#line 2347 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 216: +#line 2389 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[-5].JumpTable); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4698,8 +4735,8 @@ ;} break; - case 215: -#line 2358 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 217: +#line 2400 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4714,8 +4751,8 @@ ;} break; - case 216: -#line 2371 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 218: +#line 2413 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); @@ -4726,8 +4763,8 @@ ;} break; - case 217: -#line 2380 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 219: +#line 2422 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes (yyval.PHIList) = new std::list >(); Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); @@ -4739,8 +4776,8 @@ ;} break; - case 218: -#line 2389 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 220: +#line 2431 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[-6].PHIList); Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); @@ -4751,16 +4788,16 @@ ;} break; - case 219: -#line 2399 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 221: +#line 2441 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); ;} break; - case 220: -#line 2403 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 222: +#line 2445 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[-2].ValueList); (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); @@ -4768,49 +4805,52 @@ ;} break; - case 222: -#line 2410 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 224: +#line 2452 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = 0; ;} break; - case 223: -#line 2412 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 225: +#line 2454 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 224: -#line 2416 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 226: +#line 2458 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 225: -#line 2421 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 227: +#line 2463 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && !isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem) + if (isa((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal).opcode == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. + sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal)); + CHECK_FOR_ERROR; Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, val1, val2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); delete (yyvsp[-3].TypeVal); ;} break; - case 226: -#line 2437 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 228: +#line 2482 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { if (!isa((yyvsp[-3].TypeVal)->get()) || @@ -4821,15 +4861,15 @@ CHECK_FOR_ERROR Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); delete (yyvsp[-3].TypeVal); ;} break; - case 227: -#line 2452 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 229: +#line 2497 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if(isa((*(yyvsp[-3].TypeVal)).get())) { GEN_ERROR( @@ -4839,15 +4879,15 @@ CHECK_FOR_ERROR Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); delete (yyvsp[-3].TypeVal); ;} break; - case 228: -#line 2466 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 230: +#line 2511 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; @@ -4863,20 +4903,20 @@ ;} break; - case 229: -#line 2479 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 231: +#line 2524 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal).opcode, (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; - case 230: -#line 2487 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 232: +#line 2532 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast instruction to a non-primitive type: '" + @@ -4887,8 +4927,8 @@ ;} break; - case 231: -#line 2495 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 233: +#line 2540 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); @@ -4899,8 +4939,8 @@ ;} break; - case 232: -#line 2503 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 234: +#line 2548 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { NewVarArgs = true; (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); @@ -4909,8 +4949,8 @@ ;} break; - case 233: -#line 2509 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 235: +#line 2554 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -4933,8 +4973,8 @@ ;} break; - case 234: -#line 2529 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 236: +#line 2574 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -4960,8 +5000,8 @@ ;} break; - case 235: -#line 2552 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 237: +#line 2597 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -4970,8 +5010,8 @@ ;} break; - case 236: -#line 2558 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 238: +#line 2603 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -4980,8 +5020,8 @@ ;} break; - case 237: -#line 2564 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 239: +#line 2609 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -4990,8 +5030,8 @@ ;} break; - case 238: -#line 2570 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 240: +#line 2615 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -5009,8 +5049,8 @@ ;} break; - case 239: -#line 2585 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 241: +#line 2630 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -5072,48 +5112,48 @@ ;} break; - case 240: -#line 2644 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 242: +#line 2689 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR ;} break; - case 241: -#line 2651 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 243: +#line 2696 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR ;} break; - case 242: -#line 2654 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 244: +#line 2699 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR ;} break; - case 243: -#line 2659 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 245: +#line 2704 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR ;} break; - case 244: -#line 2663 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 246: +#line 2708 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR ;} break; - case 245: -#line 2670 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 247: +#line 2715 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5121,8 +5161,8 @@ ;} break; - case 246: -#line 2675 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 248: +#line 2720 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5131,8 +5171,8 @@ ;} break; - case 247: -#line 2681 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 249: +#line 2726 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5140,8 +5180,8 @@ ;} break; - case 248: -#line 2686 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 250: +#line 2731 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5150,8 +5190,8 @@ ;} break; - case 249: -#line 2692 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 251: +#line 2737 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5161,8 +5201,8 @@ ;} break; - case 250: -#line 2700 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 252: +#line 2745 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + @@ -5177,8 +5217,8 @@ ;} break; - case 251: -#line 2712 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 253: +#line 2757 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) @@ -5196,8 +5236,8 @@ ;} break; - case 252: -#line 2727 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" + case 254: +#line 2772 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); @@ -5229,7 +5269,7 @@ } /* Line 1126 of yacc.c. */ -#line 5233 "llvmAsmParser.tab.c" +#line 5273 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -5497,7 +5537,7 @@ } -#line 2753 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" +#line 2798 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.16 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.17 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.16 Sun Oct 22 02:03:43 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Thu Oct 26 01:15:43 2006 @@ -107,34 +107,36 @@ ADD = 333, SUB = 334, MUL = 335, - DIV = 336, - REM = 337, - AND = 338, - OR = 339, - XOR = 340, - SETLE = 341, - SETGE = 342, - SETLT = 343, - SETGT = 344, - SETEQ = 345, - SETNE = 346, - MALLOC = 347, - ALLOCA = 348, - FREE = 349, - LOAD = 350, - STORE = 351, - GETELEMENTPTR = 352, - PHI_TOK = 353, - CAST = 354, - SELECT = 355, - SHL = 356, - SHR = 357, - VAARG = 358, - EXTRACTELEMENT = 359, - INSERTELEMENT = 360, - SHUFFLEVECTOR = 361, - VAARG_old = 362, - VANEXT_old = 363 + UDIV = 336, + SDIV = 337, + FDIV = 338, + REM = 339, + AND = 340, + OR = 341, + XOR = 342, + SETLE = 343, + SETGE = 344, + SETLT = 345, + SETGT = 346, + SETEQ = 347, + SETNE = 348, + MALLOC = 349, + ALLOCA = 350, + FREE = 351, + LOAD = 352, + STORE = 353, + GETELEMENTPTR = 354, + PHI_TOK = 355, + CAST = 356, + SELECT = 357, + SHL = 358, + SHR = 359, + VAARG = 360, + EXTRACTELEMENT = 361, + INSERTELEMENT = 362, + SHUFFLEVECTOR = 363, + VAARG_old = 364, + VANEXT_old = 365 }; #endif /* Tokens. */ @@ -216,40 +218,42 @@ #define ADD 333 #define SUB 334 #define MUL 335 -#define DIV 336 -#define REM 337 -#define AND 338 -#define OR 339 -#define XOR 340 -#define SETLE 341 -#define SETGE 342 -#define SETLT 343 -#define SETGT 344 -#define SETEQ 345 -#define SETNE 346 -#define MALLOC 347 -#define ALLOCA 348 -#define FREE 349 -#define LOAD 350 -#define STORE 351 -#define GETELEMENTPTR 352 -#define PHI_TOK 353 -#define CAST 354 -#define SELECT 355 -#define SHL 356 -#define SHR 357 -#define VAARG 358 -#define EXTRACTELEMENT 359 -#define INSERTELEMENT 360 -#define SHUFFLEVECTOR 361 -#define VAARG_old 362 -#define VANEXT_old 363 +#define UDIV 336 +#define SDIV 337 +#define FDIV 338 +#define REM 339 +#define AND 340 +#define OR 341 +#define XOR 342 +#define SETLE 343 +#define SETGE 344 +#define SETLT 345 +#define SETGT 346 +#define SETEQ 347 +#define SETNE 348 +#define MALLOC 349 +#define ALLOCA 350 +#define FREE 351 +#define LOAD 352 +#define STORE 353 +#define GETELEMENTPTR 354 +#define PHI_TOK 355 +#define CAST 356 +#define SELECT 357 +#define SHL 358 +#define SHR 359 +#define VAARG 360 +#define EXTRACTELEMENT 361 +#define INSERTELEMENT 362 +#define SHUFFLEVECTOR 363 +#define VAARG_old 364 +#define VANEXT_old 365 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 974 "/proj/llvm/llvm_nc/lib/AsmParser/llvmAsmParser.y" +#line 1011 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -281,16 +285,16 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - llvm::Instruction::BinaryOps BinaryOpVal; - llvm::Instruction::TermOps TermOpVal; - llvm::Instruction::MemoryOps MemOpVal; - llvm::Instruction::OtherOps OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 1447 of yacc.c. */ -#line 294 "llvmAsmParser.tab.h" +#line 298 "llvmAsmParser.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.270 llvm/lib/AsmParser/llvmAsmParser.y:1.271 --- llvm/lib/AsmParser/llvmAsmParser.y:1.270 Tue Oct 24 14:09:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Oct 26 01:15:43 2006 @@ -813,6 +813,43 @@ return Ty; } +/// This function is used to obtain the correct opcode for an instruction when +/// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +/// an opcode and an "obsolete" flag. These are generated by the lexer and +/// the "obsolete" member will be true when the lexer encounters the token for +/// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +/// to maintain backwards compatibility for asm files that still have the "div" +/// instruction. This function handles converting div -> [usf]div appropriately. +/// @brief Convert obsolete opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1002,13 +1039,13 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - llvm::Instruction::BinaryOps BinaryOpVal; - llvm::Instruction::TermOps TermOpVal; - llvm::Instruction::MemoryOps MemOpVal; - llvm::Instruction::OtherOps OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } %type Module FunctionList @@ -1076,8 +1113,8 @@ // Binary Operators %type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token ADD SUB MUL DIV REM AND OR XOR -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators +%token ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR +%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions %token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR @@ -1114,7 +1151,7 @@ // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | DIV | REM; +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ; LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; @@ -1642,12 +1679,17 @@ | ArithmeticOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. + sanitizeOpCode($1,$3->getType()); + CHECK_FOR_ERROR; + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the // broken case. See PR424 for more information. if (!isa($3->getType())) { - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -1655,7 +1697,7 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - $$ = ConstantExpr::get($1, ConstantExpr::getCast($3, IntPtrTy), + $$ = ConstantExpr::get($1.opcode, ConstantExpr::getCast($3, IntPtrTy), ConstantExpr::getCast($5, IntPtrTy)); $$ = ConstantExpr::getCast($$, $3->getType()); } @@ -1669,13 +1711,13 @@ !cast($3->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } | SetCondOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("setcc operand types must match!"); - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } | ShiftOps '(' ConstVal ',' ConstVal ')' { @@ -1683,7 +1725,7 @@ GEN_ERROR("Shift count for shift constant must be unsigned byte!"); if (!$3->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } | EXTRACTELEMENT '(' ConstVal ',' ConstVal ')' { @@ -2423,13 +2465,16 @@ !isa((*$2).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*$2).get()) && $1 == Instruction::Rem) + if (isa((*$2).get()) && $1.opcode == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. + sanitizeOpCode($1,*$2); + CHECK_FOR_ERROR; Value* val1 = getVal(*$2, $3); CHECK_FOR_ERROR Value* val2 = getVal(*$2, $5); CHECK_FOR_ERROR - $$ = BinaryOperator::create($1, val1, val2); + $$ = BinaryOperator::create($1.opcode, val1, val2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; @@ -2444,7 +2489,7 @@ CHECK_FOR_ERROR Value* tmpVal2 = getVal(*$2, $5); CHECK_FOR_ERROR - $$ = BinaryOperator::create($1, tmpVal1, tmpVal2); + $$ = BinaryOperator::create($1.opcode, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; @@ -2458,7 +2503,7 @@ CHECK_FOR_ERROR Value* tmpVal2 = getVal(*$2, $5); CHECK_FOR_ERROR - $$ = new SetCondInst($1, tmpVal1, tmpVal2); + $$ = new SetCondInst($1.opcode, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; @@ -2481,7 +2526,7 @@ GEN_ERROR("Shift amount must be ubyte!"); if (!$2->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - $$ = new ShiftInst($1, $2, $4); + $$ = new ShiftInst($1.opcode, $2, $4); CHECK_FOR_ERROR } | CAST ResolvedVal TO Types { Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.22 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.23 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.22 Tue Oct 24 14:09:48 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Thu Oct 26 01:15:43 2006 @@ -813,6 +813,43 @@ return Ty; } +/// This function is used to obtain the correct opcode for an instruction when +/// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +/// an opcode and an "obsolete" flag. These are generated by the lexer and +/// the "obsolete" member will be true when the lexer encounters the token for +/// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +/// to maintain backwards compatibility for asm files that still have the "div" +/// instruction. This function handles converting div -> [usf]div appropriately. +/// @brief Convert obsolete opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1002,13 +1039,13 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - llvm::Instruction::BinaryOps BinaryOpVal; - llvm::Instruction::TermOps TermOpVal; - llvm::Instruction::MemoryOps MemOpVal; - llvm::Instruction::OtherOps OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } %type Module FunctionList @@ -1076,8 +1113,8 @@ // Binary Operators %type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token ADD SUB MUL DIV REM AND OR XOR -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators +%token ADD SUB MUL UDIV SDIV FDIV REM AND OR XOR +%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions %token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR @@ -1114,7 +1151,7 @@ // Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | DIV | REM; +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | REM ; LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; @@ -1642,12 +1679,17 @@ | ArithmeticOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. + sanitizeOpCode($1,$3->getType()); + CHECK_FOR_ERROR; + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the // broken case. See PR424 for more information. if (!isa($3->getType())) { - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -1655,7 +1697,7 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - $$ = ConstantExpr::get($1, ConstantExpr::getCast($3, IntPtrTy), + $$ = ConstantExpr::get($1.opcode, ConstantExpr::getCast($3, IntPtrTy), ConstantExpr::getCast($5, IntPtrTy)); $$ = ConstantExpr::getCast($$, $3->getType()); } @@ -1669,13 +1711,13 @@ !cast($3->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } | SetCondOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("setcc operand types must match!"); - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } | ShiftOps '(' ConstVal ',' ConstVal ')' { @@ -1683,7 +1725,7 @@ GEN_ERROR("Shift count for shift constant must be unsigned byte!"); if (!$3->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - $$ = ConstantExpr::get($1, $3, $5); + $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } | EXTRACTELEMENT '(' ConstVal ',' ConstVal ')' { @@ -2423,13 +2465,16 @@ !isa((*$2).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*$2).get()) && $1 == Instruction::Rem) + if (isa((*$2).get()) && $1.opcode == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. + sanitizeOpCode($1,*$2); + CHECK_FOR_ERROR; Value* val1 = getVal(*$2, $3); CHECK_FOR_ERROR Value* val2 = getVal(*$2, $5); CHECK_FOR_ERROR - $$ = BinaryOperator::create($1, val1, val2); + $$ = BinaryOperator::create($1.opcode, val1, val2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; @@ -2444,7 +2489,7 @@ CHECK_FOR_ERROR Value* tmpVal2 = getVal(*$2, $5); CHECK_FOR_ERROR - $$ = BinaryOperator::create($1, tmpVal1, tmpVal2); + $$ = BinaryOperator::create($1.opcode, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; @@ -2458,7 +2503,7 @@ CHECK_FOR_ERROR Value* tmpVal2 = getVal(*$2, $5); CHECK_FOR_ERROR - $$ = new SetCondInst($1, tmpVal1, tmpVal2); + $$ = new SetCondInst($1.opcode, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; @@ -2481,7 +2526,7 @@ GEN_ERROR("Shift amount must be ubyte!"); if (!$2->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - $$ = new ShiftInst($1, $2, $4); + $$ = new ShiftInst($1.opcode, $2, $4); CHECK_FOR_ERROR } | CAST ResolvedVal TO Types { From reid at x10sys.com Thu Oct 26 01:16:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610260616.k9Q6GRmT029122@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.298 -> 1.299 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+44 -24) SelectionDAGISel.cpp | 68 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 44 insertions(+), 24 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.298 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.299 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.298 Tue Oct 24 13:07:37 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Oct 26 01:15:43 2006 @@ -499,28 +499,35 @@ void visitInvoke(InvokeInst &I) { assert(0 && "TODO"); } void visitUnwind(UnwindInst &I) { assert(0 && "TODO"); } - void visitBinary(User &I, unsigned IntOp, unsigned FPOp, unsigned VecOp); + void visitIntBinary(User &I, unsigned IntOp, unsigned VecOp); + void visitFPBinary(User &I, unsigned FPOp, unsigned VecOp); void visitShift(User &I, unsigned Opcode); void visitAdd(User &I) { - visitBinary(I, ISD::ADD, ISD::FADD, ISD::VADD); + if (I.getType()->isFloatingPoint()) + visitFPBinary(I, ISD::FADD, ISD::VADD); + else + visitIntBinary(I, ISD::ADD, ISD::VADD); } void visitSub(User &I); - void visitMul(User &I) { - visitBinary(I, ISD::MUL, ISD::FMUL, ISD::VMUL); - } - void visitDiv(User &I) { - const Type *Ty = I.getType(); - visitBinary(I, - Ty->isSigned() ? ISD::SDIV : ISD::UDIV, ISD::FDIV, - Ty->isSigned() ? ISD::VSDIV : ISD::VUDIV); + void visitMul(User &I) { + if (I.getType()->isFloatingPoint()) + visitFPBinary(I, ISD::FMUL, ISD::VMUL); + else + visitIntBinary(I, ISD::MUL, ISD::VMUL); } + void visitUDiv(User &I) { visitIntBinary(I, ISD::UDIV, ISD::VUDIV); } + void visitSDiv(User &I) { visitIntBinary(I, ISD::SDIV, ISD::VSDIV); } + void visitFDiv(User &I) { visitFPBinary(I, ISD::FDIV, ISD::VSDIV); } void visitRem(User &I) { const Type *Ty = I.getType(); - visitBinary(I, Ty->isSigned() ? ISD::SREM : ISD::UREM, ISD::FREM, 0); - } - void visitAnd(User &I) { visitBinary(I, ISD::AND, 0, ISD::VAND); } - void visitOr (User &I) { visitBinary(I, ISD::OR, 0, ISD::VOR); } - void visitXor(User &I) { visitBinary(I, ISD::XOR, 0, ISD::VXOR); } + if (Ty->isFloatingPoint()) + visitFPBinary(I, ISD::FREM, 0); + else + visitIntBinary(I, Ty->isSigned() ? ISD::SREM : ISD::UREM, 0); + } + void visitAnd(User &I) { visitIntBinary(I, ISD::AND, ISD::VAND); } + void visitOr (User &I) { visitIntBinary(I, ISD::OR, ISD::VOR); } + void visitXor(User &I) { visitIntBinary(I, ISD::XOR, ISD::VXOR); } void visitShl(User &I) { visitShift(I, ISD::SHL); } void visitShr(User &I) { visitShift(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA); @@ -1142,25 +1149,38 @@ setValue(&I, DAG.getNode(ISD::FNEG, Op2.getValueType(), Op2)); return; } - } - visitBinary(I, ISD::SUB, ISD::FSUB, ISD::VSUB); + visitFPBinary(I, ISD::FSUB, ISD::VSUB); + } else + visitIntBinary(I, ISD::SUB, ISD::VSUB); } -void SelectionDAGLowering::visitBinary(User &I, unsigned IntOp, unsigned FPOp, - unsigned VecOp) { +void +SelectionDAGLowering::visitIntBinary(User &I, unsigned IntOp, unsigned VecOp) { const Type *Ty = I.getType(); SDOperand Op1 = getValue(I.getOperand(0)); SDOperand Op2 = getValue(I.getOperand(1)); - if (Ty->isIntegral()) { - setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); - } else if (Ty->isFloatingPoint()) { - setValue(&I, DAG.getNode(FPOp, Op1.getValueType(), Op1, Op2)); + if (const PackedType *PTy = dyn_cast(Ty)) { + SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); + SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy->getElementType())); + setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, Typ)); } else { - const PackedType *PTy = cast(Ty); + setValue(&I, DAG.getNode(IntOp, Op1.getValueType(), Op1, Op2)); + } +} + +void +SelectionDAGLowering::visitFPBinary(User &I, unsigned FPOp, unsigned VecOp) { + const Type *Ty = I.getType(); + SDOperand Op1 = getValue(I.getOperand(0)); + SDOperand Op2 = getValue(I.getOperand(1)); + + if (const PackedType *PTy = dyn_cast(Ty)) { SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy->getElementType())); setValue(&I, DAG.getNode(VecOp, MVT::Vector, Op1, Op2, Num, Typ)); + } else { + setValue(&I, DAG.getNode(FPOp, Op1.getValueType(), Op1, Op2)); } } From reid at x10sys.com Thu Oct 26 01:16:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:16:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Message-ID: <200610260616.k9Q6GSem029134@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.70 -> 1.71 --- Log message: For PR950: http://llvm.org/PR950 : Make necessary changes to support DIV -> [SUF]Div. This changes llvm to have three division instructions: signed, unsigned, floating point. The bytecode and assembler are bacwards compatible, however. --- Diffs of the changes: (+1 -1) SimplifyLibCalls.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.70 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.71 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.70 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Thu Oct 26 01:15:43 2006 @@ -1275,7 +1275,7 @@ return true; } else if (Op2V == -1.0) { // pow(x,-1.0) -> 1.0/x - BinaryOperator* div_inst= BinaryOperator::createDiv( + BinaryOperator* div_inst= BinaryOperator::createFDiv( ConstantFP::get(Ty,1.0), base, ci->getName()+".pow", ci); ci->replaceAllUsesWith(div_inst); ci->eraseFromParent(); From reid at x10sys.com Thu Oct 26 01:17:54 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 01:17:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200610260617.k9Q6Hs5p029214@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.275 -> 1.276 --- Log message: Enclose a case in { and } so that the pickier compilers don't complain. --- Diffs of the changes: (+2 -0) Writer.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.275 llvm/lib/Target/CBackend/Writer.cpp:1.276 --- llvm/lib/Target/CBackend/Writer.cpp:1.275 Thu Oct 26 01:15:43 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Thu Oct 26 01:17:40 2006 @@ -605,6 +605,7 @@ case Instruction::SetGE: case Instruction::Shl: case Instruction::Shr: + { Out << '('; bool NeedsClosingParens = printConstExprCast(CE); printConstantWithCast(CE->getOperand(0), CE->getOpcode()); @@ -634,6 +635,7 @@ Out << "))"; Out << ')'; return; + } default: std::cerr << "CWriter Error: Unhandled constant expression: " From rafael.espindola at gmail.com Thu Oct 26 08:31:40 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 26 Oct 2006 08:31:40 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/alloca.ll Message-ID: <200610261331.k9QDVe34012675@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: alloca.ll added (r1.1) --- Log message: initial support for frame pointers --- Diffs of the changes: (+5 -0) alloca.ll | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/alloca.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/alloca.ll:1.1 *** /dev/null Thu Oct 26 08:31:36 2006 --- llvm/test/Regression/CodeGen/ARM/alloca.ll Thu Oct 26 08:31:26 2006 *************** *** 0 **** --- 1,5 ---- + void %f(uint %a) { + entry: + %tmp1032 = alloca ubyte, uint %a + ret void + } From rafael.espindola at gmail.com Thu Oct 26 08:31:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 26 Oct 2006 08:31:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMRegisterInfo.cpp ARMRegisterInfo.td Message-ID: <200610261331.k9QDVfXI012684@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.79 -> 1.80 ARMRegisterInfo.cpp updated: 1.22 -> 1.23 ARMRegisterInfo.td updated: 1.5 -> 1.6 --- Log message: initial support for frame pointers --- Diffs of the changes: (+44 -5) ARMISelDAGToDAG.cpp | 3 +++ ARMRegisterInfo.cpp | 41 +++++++++++++++++++++++++++++++++++++---- ARMRegisterInfo.td | 5 ++++- 3 files changed, 44 insertions(+), 5 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.79 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.80 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.79 Tue Oct 24 15:15:21 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Oct 26 08:31:25 2006 @@ -91,10 +91,13 @@ setOperationAction(ISD::VASTART, MVT::Other, Custom); setOperationAction(ISD::VACOPY, MVT::Other, Expand); setOperationAction(ISD::VAEND, MVT::Other, Expand); + setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Expand); setOperationAction(ISD::ConstantFP, MVT::f64, Expand); setOperationAction(ISD::ConstantFP, MVT::f32, Expand); + setStackPointerRegisterToSaveRestore(ARM::R13); + setSchedulingPreference(SchedulingForRegPressure); computeRegisterProperties(); } Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.22 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.23 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.22 Tue Oct 17 09:34:02 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Thu Oct 26 08:31:25 2006 @@ -19,10 +19,20 @@ #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineLocation.h" #include "llvm/Type.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/ADT/STLExtras.h" #include using namespace llvm; +// hasFP - Return true if the specified function should have a dedicated frame +// pointer register. This is true if the function has variable sized allocas or +// if frame pointer elimination is disabled. +// +static bool hasFP(const MachineFunction &MF) { + const MachineFrameInfo *MFI = MF.getFrameInfo(); + return NoFramePointerElim || MFI->hasVarSizedObjects(); +} + ARMRegisterInfo::ARMRegisterInfo() : ARMGenRegisterInfo(ARM::ADJCALLSTACKDOWN, ARM::ADJCALLSTACKUP) { } @@ -88,6 +98,9 @@ void ARMRegisterInfo:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { + if (hasFP(MF)) { + assert(0); + } MBB.erase(I); } @@ -114,17 +127,18 @@ Offset += StackSize; assert (Offset >= 0); + unsigned BaseRegister = hasFP(MF) ? ARM::R11 : ARM::R13; if (Offset < 4096) { // Replace the FrameIndex with r13 - MI.getOperand(FrameIdx).ChangeToRegister(ARM::R13, false); + MI.getOperand(FrameIdx).ChangeToRegister(BaseRegister, false); // Replace the ldr offset with Offset MI.getOperand(OffIdx).ChangeToImmediate(Offset); } else { // Insert a set of r12 with the full address // r12 = r13 + offset MachineBasicBlock *MBB2 = MI.getParent(); - BuildMI(*MBB2, II, ARM::ADD, 4, ARM::R12).addReg(ARM::R13).addImm(Offset) - .addImm(0).addImm(ARMShift::LSL); + BuildMI(*MBB2, II, ARM::ADD, 4, ARM::R12).addReg(BaseRegister) + .addImm(Offset).addImm(0).addImm(ARMShift::LSL); // Replace the FrameIndex with r12 MI.getOperand(FrameIdx).ChangeToRegister(ARM::R12, false); @@ -140,6 +154,8 @@ MachineFrameInfo *MFI = MF.getFrameInfo(); int NumBytes = (int) MFI->getStackSize(); + bool HasFP = hasFP(MF); + if (MFI->hasCalls()) { // We reserve argument space for call sites in the function immediately on // entry to the current function. This eliminates the need for add/sub @@ -147,6 +163,10 @@ NumBytes += MFI->getMaxCallFrameSize(); } + if (HasFP) + // Add space for storing the FP + NumBytes += 4; + // Align to 8 bytes NumBytes = ((NumBytes + 7) / 8) * 8; @@ -155,6 +175,13 @@ //sub sp, sp, #NumBytes BuildMI(MBB, MBBI, ARM::SUB, 4, ARM::R13).addReg(ARM::R13).addImm(NumBytes) .addImm(0).addImm(ARMShift::LSL); + + if (HasFP) { + BuildMI(MBB, MBBI, ARM::str, 3) + .addReg(ARM::R11).addImm(0).addReg(ARM::R13); + BuildMI(MBB, MBBI, ARM::MOV, 3, ARM::R11).addReg(ARM::R13).addImm(0). + addImm(ARMShift::LSL); + } } void ARMRegisterInfo::emitEpilogue(MachineFunction &MF, @@ -166,6 +193,12 @@ MachineFrameInfo *MFI = MF.getFrameInfo(); int NumBytes = (int) MFI->getStackSize(); + if (hasFP(MF)) { + BuildMI(MBB, MBBI, ARM::MOV, 3, ARM::R13).addReg(ARM::R11).addImm(0). + addImm(ARMShift::LSL); + BuildMI(MBB, MBBI, ARM::ldr, 2, ARM::R11).addImm(0).addReg(ARM::R13); + } + //add sp, sp, #NumBytes BuildMI(MBB, MBBI, ARM::ADD, 4, ARM::R13).addReg(ARM::R13).addImm(NumBytes) .addImm(0).addImm(ARMShift::LSL); @@ -176,7 +209,7 @@ } unsigned ARMRegisterInfo::getFrameRegister(MachineFunction &MF) const { - return ARM::R13; + return hasFP(MF) ? ARM::R11 : ARM::R13; } #include "ARMGenRegisterInfo.inc" Index: llvm/lib/Target/ARM/ARMRegisterInfo.td diff -u llvm/lib/Target/ARM/ARMRegisterInfo.td:1.5 llvm/lib/Target/ARM/ARMRegisterInfo.td:1.6 --- llvm/lib/Target/ARM/ARMRegisterInfo.td:1.5 Mon Oct 2 14:30:56 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.td Thu Oct 26 08:31:25 2006 @@ -125,7 +125,10 @@ // r12 == ip (scratch) // r11 == Frame Pointer // r10 == Stack Limit - return end() - 4; + if (hasFP(MF)) + return end() - 5; + else + return end() - 4; } }]; } From clattner at apple.com Thu Oct 26 11:54:15 2006 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Oct 2006 09:54:15 -0700 Subject: [llvm-commits] Div->[USF]Div Patch, Attempt #2 In-Reply-To: <1161838666.32005.76.camel@bashful.x10sys.com> References: <1161803750.32005.17.camel@bashful.x10sys.com> <1161838666.32005.76.camel@bashful.x10sys.com> Message-ID: <0DA00536-B15F-4359-8E35-D4E7D68F85DE@apple.com> On Oct 25, 2006, at 9:57 PM, Reid Spencer wrote: >> This code is a bit simpler as: >> >> >> // (X / C1) / C2 -> X / (C1*C2) >> if (BinaryOperator *LHS = dyn_cast(Op0)) >> if (LHS->getOpcode() == I.getOpcode()) >> > > Didn't apply this because it causes a compiler warning about > signed/unsigned comparison. Ok. >> // udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr >> X, C2) >> // where C1&C2 are powers of two. >> ... >> X = InsertNewInstBefore( >> new CastInst(X, X->getType()->getUnsignedVersion >> ()), >> I); >> >> >> This (and similar cases) is easier/cleaner with InsertCastBefore. > > Yes, I agree. I changed the ones in my code but there are actually > dozens (hundreds) of instances in the file (not related to my > changes). > I'm going to commit the DIV patch first, then I'll come back and clean > up the others in a separate patch (tested, of course). Ok, sounds good. > Thanks for your excellent reviews, Chris. I know it takes a lot of > your > time and I appreciate that you so willingly give it. I'll apply what I > learned from DIV to the REM patch which I'm reviewing for Sheng soon. > Hopefully REM will fare better than DIV did. Sounds good, I'm sure it will get more smooth as it goes on. Thanks for the great improvements Reid! -Chris From sabre at nondot.org Thu Oct 26 13:23:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Oct 2006 13:23:00 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Message-ID: <200610261823.k9QIN0IW026871@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.90 -> 1.91 --- Log message: Add isFPOrFPVector() method, which indicates if a type is either FP or a vector of FP types. --- Diffs of the changes: (+4 -0) Type.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.90 llvm/include/llvm/Type.h:1.91 --- llvm/include/llvm/Type.h:1.90 Thu Sep 28 18:38:07 2006 +++ llvm/include/llvm/Type.h Thu Oct 26 13:22:45 2006 @@ -185,6 +185,10 @@ /// types bool isFloatingPoint() const { return ID == FloatTyID || ID == DoubleTyID; } + /// isFPOrFPVector - Return true if this is a FP type or a vector of FP types. + /// + bool isFPOrFPVector() const; + /// isAbstract - True if the type is either an Opaque type, or is a derived /// type that includes an opaque type somewhere in it. /// From sabre at nondot.org Thu Oct 26 13:23:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Oct 2006 13:23:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200610261823.k9QIN1LN026876@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.148 -> 1.149 --- Log message: Add isFPOrFPVector() method, which indicates if a type is either FP or a vector of FP types. --- Diffs of the changes: (+10 -0) Type.cpp | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.148 llvm/lib/VMCore/Type.cpp:1.149 --- llvm/lib/VMCore/Type.cpp:1.148 Fri Oct 20 02:07:24 2006 +++ llvm/lib/VMCore/Type.cpp Thu Oct 26 13:22:45 2006 @@ -90,6 +90,16 @@ } } +/// isFPOrFPVector - Return true if this is a FP type or a vector of FP types. +/// +bool Type::isFPOrFPVector() const { + if (ID == Type::FloatTyID || ID == Type::DoubleTyID) return true; + if (ID != Type::PackedTyID) return false; + + return cast(this)->getElementType()->isFloatingPoint(); +} + + // isLosslesslyConvertibleTo - Return true if this type can be converted to // 'Ty' without any reinterpretation of bits. For example, uint to int. // From sabre at nondot.org Thu Oct 26 13:27:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Oct 2006 13:27:08 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-10-26-VectorReassoc.ll Message-ID: <200610261827.k9QIR82O026976@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-10-26-VectorReassoc.ll added (r1.1) --- Log message: new testcase, should not reassoc fp vector --- Diffs of the changes: (+8 -0) 2006-10-26-VectorReassoc.ll | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-10-26-VectorReassoc.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-10-26-VectorReassoc.ll:1.1 *** /dev/null Thu Oct 26 13:27:03 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-10-26-VectorReassoc.ll Thu Oct 26 13:26:53 2006 *************** *** 0 **** --- 1,8 ---- + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep mul | wc -l | grep 2 + + + <4 x float> %test(<4 x float> %V) { + %Y = mul <4 x float> %V, + %Z = mul <4 x float> %Y, + ret <4 x float> %Z + } From sabre at nondot.org Thu Oct 26 13:27:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 26 Oct 2006 13:27:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instruction.cpp Message-ID: <200610261827.k9QIRfP0027034@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instruction.cpp updated: 1.54 -> 1.55 --- Log message: Fix Transforms/InstCombine/2006-10-26-VectorReassoc.ll --- Diffs of the changes: (+6 -5) Instruction.cpp | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.54 llvm/lib/VMCore/Instruction.cpp:1.55 --- llvm/lib/VMCore/Instruction.cpp:1.54 Thu Oct 26 01:15:43 2006 +++ llvm/lib/VMCore/Instruction.cpp Thu Oct 26 13:27:26 2006 @@ -172,11 +172,12 @@ /// applied to floating point types. /// bool Instruction::isAssociative(unsigned Opcode, const Type *Ty) { - if (Opcode == Add || Opcode == Mul || - Opcode == And || Opcode == Or || Opcode == Xor) { - // Floating point operations do not associate! - return !Ty->isFloatingPoint(); - } + if (Opcode == And || Opcode == Or || Opcode == Xor) + return true; + + // Add/Mul reassociate unless they are FP or FP vectors. + if (Opcode == Add || Opcode == Mul) + return !Ty->isFPOrFPVector(); return 0; } From evan.cheng at apple.com Thu Oct 26 14:13:46 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 14:13:46 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200610261913.k9QJDkeL015660@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.91 -> 1.92 --- Log message: Add isCString() - returns true if a ConstantArray is a CString. --- Diffs of the changes: (+5 -0) Constants.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.91 llvm/include/llvm/Constants.h:1.92 --- llvm/include/llvm/Constants.h:1.91 Thu Oct 26 01:15:43 2006 +++ llvm/include/llvm/Constants.h Thu Oct 26 14:13:30 2006 @@ -334,6 +334,11 @@ /// ubyte, and if the elements of the array are all ConstantInt's. bool isString() const; + /// isCString - This method returns true if the array is a string (see + /// isString) and it ends in a null byte \0 and does not contains any other + /// null bytes except its terminator. + bool isCString() const; + /// getAsString - If this array is isString(), then this method converts the /// array to an std::string and returns it. Otherwise, it asserts out. /// From evan.cheng at apple.com Thu Oct 26 14:15:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 14:15:19 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200610261915.k9QJFJlO015703@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.166 -> 1.167 --- Log message: Add isCString() - returns true if a ConstantArray is a CString. --- Diffs of the changes: (+13 -0) Constants.cpp | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.166 llvm/lib/VMCore/Constants.cpp:1.167 --- llvm/lib/VMCore/Constants.cpp:1.166 Thu Oct 26 01:15:43 2006 +++ llvm/lib/VMCore/Constants.cpp Thu Oct 26 14:15:05 2006 @@ -1073,6 +1073,19 @@ return true; } +/// isCString - This method returns true if the array is a string (see +/// isString) and it ends in a null byte \0 and does not contains any other +/// null bytes except its terminator. +bool ConstantArray::isCString() const { + if (!isString()) return false; + // This is safe because a ConstantArray cannot be a zero array. + for (unsigned i = 0, e = getNumOperands()-1; i != e; ++i) + if (cast(getOperand(i))->getZExtValue() == 0) + return false; + return true; +} + + // getAsString - If the sub-element type of this array is either sbyte or ubyte, // then this method converts the array to an std::string and returns it. // Otherwise, it asserts out. From evan.cheng at apple.com Thu Oct 26 14:16:34 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 14:16:34 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200610261916.k9QJGYwj015745@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.9 -> 1.10 --- Log message: Added CStringSection. --- Diffs of the changes: (+9 -0) TargetAsmInfo.h | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.9 llvm/include/llvm/Target/TargetAsmInfo.h:1.10 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.9 Fri Oct 13 12:50:07 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.h Thu Oct 26 14:16:20 2006 @@ -162,6 +162,12 @@ /// table. const char *JumpTableDirective; + /// CStringSection - If not null, this allows for special handling of + /// cstring constants (\0 terminated string that does not contain any + /// other null bytes) on this target. This is commonly supported as + /// ".cstring". + const char *CStringSection; // Defaults to NULL + /// StaticCtorsSection - This is the directive that is emitted to switch to /// a section to emit the static constructor list. /// Defaults to "\t.section .ctors,\"aw\", at progbits". @@ -366,6 +372,9 @@ const char *getJumpTableDataSection() const { return JumpTableDataSection; } + const char *getCStringSection() const { + return CStringSection; + } const char *getStaticCtorsSection() const { return StaticCtorsSection; } From evan.cheng at apple.com Thu Oct 26 14:18:33 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 14:18:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp X86TargetAsmInfo.cpp Message-ID: <200610261918.k9QJIX6r015805@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.205 -> 1.206 X86TargetAsmInfo.cpp updated: 1.4 -> 1.5 --- Log message: Put cstrings in .cstring section when compiling for Mac OS X. --- Diffs of the changes: (+10 -1) X86AsmPrinter.cpp | 10 +++++++++- X86TargetAsmInfo.cpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.205 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.206 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.205 Tue Oct 24 15:32:14 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Thu Oct 26 14:18:18 2006 @@ -204,9 +204,17 @@ // If external or appending, declare as a global symbol O << "\t.globl " << name << "\n"; // FALL THROUGH - case GlobalValue::InternalLinkage: + case GlobalValue::InternalLinkage: { + if (TAI->getCStringSection()) { + const ConstantArray *CVA = dyn_cast(C); + if (CVA && CVA->isCString()) { + SwitchToDataSection(TAI->getCStringSection(), I); + break; + } + } SwitchToDataSection(TAI->getDataSection(), I); break; + } default: assert(0 && "Unknown linkage type!"); } Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.4 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.5 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.4 Wed Oct 4 21:43:52 2006 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Thu Oct 26 14:18:18 2006 @@ -32,6 +32,7 @@ PrivateGlobalPrefix = "L"; // Marker for constant pool idxs ConstantPoolSection = "\t.const\n"; JumpTableDataSection = "\t.const\n"; + CStringSection = "\t.cstring"; FourByteConstantSection = "\t.literal4\n"; EightByteConstantSection = "\t.literal8\n"; if (Subtarget->is64Bit()) From reid at x10sys.com Thu Oct 26 14:19:20 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 26 Oct 2006 14:19:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200610261919.k9QJJKT0015832@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.528 -> 1.529 --- Log message: Simplify code a bit by changing instances of: InsertNewInstBefore(new CastInst(Val, ValTy, Val->GetName()), I) into: InsertCastBefore(Val, ValTy, I) --- Diffs of the changes: (+27 -47) InstructionCombining.cpp | 74 +++++++++++++++++------------------------------ 1 files changed, 27 insertions(+), 47 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.528 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.529 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.528 Thu Oct 26 01:15:43 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Oct 26 14:19:06 2006 @@ -461,9 +461,7 @@ if (Constant *C = dyn_cast(V)) return ConstantExpr::getCast(C, DestTy); - CastInst *CI = new CastInst(V, DestTy, V->getName()); - InsertNewInstBefore(CI, *InsertBefore); - return CI; + return InsertCastBefore(V, DestTy, *InsertBefore); } // SimplifyCommutative - This performs a few simplifications for commutative @@ -1087,13 +1085,11 @@ // convert this into a zero extension. if ((KnownZero & InSignBit) || (NewBits & ~DemandedMask) == NewBits) { // Convert to unsigned first. - Instruction *NewVal; - NewVal = new CastInst(I->getOperand(0), SrcTy->getUnsignedVersion(), - I->getOperand(0)->getName()); - InsertNewInstBefore(NewVal, *I); + Value *NewVal = + InsertCastBefore(I->getOperand(0), SrcTy->getUnsignedVersion(), *I); // Then cast that to the destination type. NewVal = new CastInst(NewVal, I->getType(), I->getName()); - InsertNewInstBefore(NewVal, *I); + InsertNewInstBefore(cast(NewVal), *I); return UpdateValueUsesWith(I, NewVal); } else if (KnownOne & InSignBit) { // Input sign bit known set KnownOne |= NewBits; @@ -1124,17 +1120,15 @@ // the shift amount is >= the size of the datatype, which is undefined. if (DemandedMask == 1 && I->getType()->isSigned()) { // Convert the input to unsigned. - Instruction *NewVal = new CastInst(I->getOperand(0), - I->getType()->getUnsignedVersion(), - I->getOperand(0)->getName()); - InsertNewInstBefore(NewVal, *I); + Value *NewVal = InsertCastBefore(I->getOperand(0), + I->getType()->getUnsignedVersion(), *I); // Perform the unsigned shift right. NewVal = new ShiftInst(Instruction::Shr, NewVal, I->getOperand(1), I->getName()); - InsertNewInstBefore(NewVal, *I); + InsertNewInstBefore(cast(NewVal), *I); // Then cast that to the destination type. NewVal = new CastInst(NewVal, I->getType(), I->getName()); - InsertNewInstBefore(NewVal, *I); + InsertNewInstBefore(cast(NewVal), *I); return UpdateValueUsesWith(I, NewVal); } @@ -1175,17 +1169,14 @@ // are demanded, turn this into an unsigned shift right. if ((KnownZero & SignBit) || (HighBits & ~DemandedMask) == HighBits) { // Convert the input to unsigned. - Instruction *NewVal; - NewVal = new CastInst(I->getOperand(0), - I->getType()->getUnsignedVersion(), - I->getOperand(0)->getName()); - InsertNewInstBefore(NewVal, *I); + Value *NewVal = InsertCastBefore(I->getOperand(0), + I->getType()->getUnsignedVersion(), *I); // Perform the unsigned shift right. NewVal = new ShiftInst(Instruction::Shr, NewVal, SA, I->getName()); - InsertNewInstBefore(NewVal, *I); + InsertNewInstBefore(cast(NewVal), *I); // Then cast that to the destination type. NewVal = new CastInst(NewVal, I->getType(), I->getName()); - InsertNewInstBefore(NewVal, *I); + InsertNewInstBefore(cast(NewVal), *I); return UpdateValueUsesWith(I, NewVal); } else if (KnownOne & SignBit) { // New bits are known one. KnownOne |= HighBits; @@ -1914,15 +1905,13 @@ SI->getType()->getPrimitiveSizeInBits()-1) { // Ok, the transformation is safe. Insert a cast of the incoming // value, then the new shift, then the new cast. - Instruction *FirstCast = new CastInst(SI->getOperand(0), NewTy, - SI->getOperand(0)->getName()); - Value *InV = InsertNewInstBefore(FirstCast, I); - Instruction *NewShift = new ShiftInst(Instruction::Shr, FirstCast, + Value *InV = InsertCastBefore(SI->getOperand(0), NewTy, I); + Instruction *NewShift = new ShiftInst(Instruction::Shr, InV, CU, SI->getName()); if (NewShift->getType() == I.getType()) return NewShift; else { - InV = InsertNewInstBefore(NewShift, I); + InsertNewInstBefore(NewShift, I); return new CastInst(NewShift, I.getType()); } } @@ -2139,8 +2128,7 @@ SCOpTy->getPrimitiveSizeInBits()-1); if (SCIOp0->getType()->isUnsigned()) { const Type *NewTy = SCIOp0->getType()->getSignedVersion(); - SCIOp0 = InsertNewInstBefore(new CastInst(SCIOp0, NewTy, - SCIOp0->getName()), I); + SCIOp0 = InsertCastBefore(SCIOp0, NewTy, I); } Value *V = @@ -2151,7 +2139,7 @@ // If the multiply type is not the same as the source type, sign extend // or truncate to the multiply type. if (I.getType() != V->getType()) - V = InsertNewInstBefore(new CastInst(V, I.getType(), V->getName()),I); + V = InsertCastBefore(V, I.getType(), I); Value *OtherOp = Op0 == BoolCast ? I.getOperand(1) : Op0; return BinaryOperator::createAnd(V, OtherOp); @@ -4000,11 +3988,9 @@ // signed comparison. const Type *NewTy = LHSV->getType()->getSignedVersion(); if (LHSV->getType() != NewTy) - LHSV = InsertNewInstBefore(new CastInst(LHSV, NewTy, - LHSV->getName()), I); + LHSV = InsertCastBefore(LHSV, NewTy, I); if (RHSV->getType() != NewTy) - RHSV = InsertNewInstBefore(new CastInst(RHSV, NewTy, - RHSV->getName()), I); + RHSV = InsertCastBefore(RHSV, NewTy, I); return new SetCondInst(Cond, LHSV, RHSV); } } @@ -4838,8 +4824,7 @@ Op1 = ConstantExpr::getCast(Op1C, Op0->getType()); } else { // Otherwise, cast the RHS right before the setcc - Op1 = new CastInst(Op1, Op0->getType(), Op1->getName()); - InsertNewInstBefore(cast(Op1), I); + Op1 = InsertCastBefore(Op1, Op0->getType(), I); } return BinaryOperator::create(I.getOpcode(), Op0, Op1); } @@ -5276,7 +5261,7 @@ Value *Op = ShiftOp->getOperand(0); if (isShiftOfSignedShift != isSignedShift) - Op = InsertNewInstBefore(new CastInst(Op, I.getType(),Op->getName()),I); + Op = InsertCastBefore(Op, I.getType(), I); Instruction *Mask = BinaryOperator::createAnd(Op, C, Op->getName()+".mask"); @@ -5304,9 +5289,7 @@ } } else { // (X >>s C1) << C2 where C1 > C2 === (X >>s (C1-C2)) & mask - Op = InsertNewInstBefore(new CastInst(Mask, - I.getType()->getSignedVersion(), - Mask->getName()), I); + Op = InsertCastBefore(Mask, I.getType()->getSignedVersion(), I); Instruction *Shift = new ShiftInst(ShiftOp->getOpcode(), Op, ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); @@ -5863,8 +5846,8 @@ // Perform an unsigned shr by shiftamt. Convert input to // unsigned if it is signed. if (In->getType()->isSigned()) - In = InsertNewInstBefore(new CastInst(In, - In->getType()->getUnsignedVersion(), In->getName()),CI); + In = InsertCastBefore( + In, In->getType()->getUnsignedVersion(), CI); // Insert the shift to put the result in the low bit. In = InsertNewInstBefore(new ShiftInst(Instruction::Shr, In, ConstantInt::get(Type::UByteTy, ShiftAmt), @@ -6952,10 +6935,8 @@ const Type *VTy = V->getType(); if (!VTy->isSigned() && VTy->getPrimitiveSize() < PS) // We must insert a cast to ensure we sign-extend. - V = IC->InsertNewInstBefore(new CastInst(V, VTy->getSignedVersion(), - V->getName()), *InsertPoint); - return IC->InsertNewInstBefore(new CastInst(V, DTy, V->getName()), - *InsertPoint); + V = IC->InsertCastBefore(V, VTy->getSignedVersion(), *InsertPoint); + return IC->InsertCastBefore(V, DTy, *InsertPoint); } @@ -7019,8 +7000,7 @@ TD->getIntPtrType()->getSignedVersion())); MadeChange = true; } else { - Op = InsertNewInstBefore(new CastInst(Op, TD->getIntPtrType(), - Op->getName()), GEP); + Op = InsertCastBefore(Op, TD->getIntPtrType(), GEP); GEP.setOperand(i, Op); MadeChange = true; } From dpatel at apple.com Thu Oct 26 15:46:37 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 26 Oct 2006 15:46:37 -0500 Subject: [llvm-commits] CVS: llvm/tools/lto/lto.cpp Message-ID: <200610262046.k9QKkbSD027888@zion.cs.uiuc.edu> Changes in directory llvm/tools/lto: lto.cpp updated: 1.24 -> 1.25 --- Log message: Save temp. bc files when saveTemps flag is true. Use final output file name supplied by linker to construct temp bc file names. Remove tabs. --- Diffs of the changes: (+24 -11) lto.cpp | 35 ++++++++++++++++++++++++----------- 1 files changed, 24 insertions(+), 11 deletions(-) Index: llvm/tools/lto/lto.cpp diff -u llvm/tools/lto/lto.cpp:1.24 llvm/tools/lto/lto.cpp:1.25 --- llvm/tools/lto/lto.cpp:1.24 Wed Oct 25 13:10:07 2006 +++ llvm/tools/lto/lto.cpp Thu Oct 26 15:46:22 2006 @@ -129,7 +129,7 @@ /// set corresponding target triplet string. void LTO::getTargetTriple(const std::string &InputFilename, - std::string &targetTriple) + std::string &targetTriple) { Module *m = getModule(InputFilename); if (m) @@ -142,8 +142,8 @@ /// Return LTO_READ_SUCCESS if there is no error. enum LTOStatus LTO::readLLVMObjectFile(const std::string &InputFilename, - NameToSymbolMap &symbols, - std::set &references) + NameToSymbolMap &symbols, + std::set &references) { Module *m = getModule(InputFilename); if (!m) @@ -316,7 +316,7 @@ CodeGenPasses->add(new TargetData(*Target->getTargetData())); Target->addPassesToEmitFile(*CodeGenPasses, Out, TargetMachine::AssemblyFile, - true); + true); // Run our queue of passes all at once now, efficiently. Passes.run(*M); @@ -337,8 +337,10 @@ /// Return appropriate LTOStatus. enum LTOStatus LTO::optimizeModules(const std::string &OutputFilename, - std::vector &exportList, - std::string &targetTriple) + std::vector &exportList, + std::string &targetTriple, + bool saveTemps, + const char *FinalOutputFilename) { if (modules.empty()) return LTO_NO_WORK; @@ -352,11 +354,15 @@ if (theLinker.LinkModules(bigOne, modules[i], errMsg)) return LTO_MODULE_MERGE_FAILURE; -#if 0 - // Enable this when -save-temps is used - std::ofstream Out("big.bc", io_mode); - WriteBytecodeToFile(bigOne, Out, true); -#endif + sys::Path FinalOutputPath(FinalOutputFilename); + FinalOutputPath.eraseSuffix(); + + if (saveTemps) { + std::string tempFileName(FinalOutputPath.c_str()); + tempFileName += "0.bc"; + std::ofstream Out(tempFileName.c_str(), io_mode); + WriteBytecodeToFile(bigOne, Out, true); + } // Strip leading underscore because it was added to match names // seen by linker. @@ -404,6 +410,13 @@ return status; } + if (saveTemps) { + std::string tempFileName(FinalOutputPath.c_str()); + tempFileName += "1.bc"; + std::ofstream Out(tempFileName.c_str(), io_mode); + WriteBytecodeToFile(bigOne, Out, true); + } + targetTriple = bigOne->getTargetTriple(); // Run GCC to assemble and link the program into native code. From dpatel at apple.com Thu Oct 26 15:46:38 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 26 Oct 2006 15:46:38 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkTimeOptimizer.h Message-ID: <200610262046.k9QKkcpV027893@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkTimeOptimizer.h updated: 1.11 -> 1.12 --- Log message: Save temp. bc files when saveTemps flag is true. Use final output file name supplied by linker to construct temp bc file names. Remove tabs. --- Diffs of the changes: (+7 -4) LinkTimeOptimizer.h | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/include/llvm/LinkTimeOptimizer.h diff -u llvm/include/llvm/LinkTimeOptimizer.h:1.11 llvm/include/llvm/LinkTimeOptimizer.h:1.12 --- llvm/include/llvm/LinkTimeOptimizer.h:1.11 Wed Oct 25 13:10:07 2006 +++ llvm/include/llvm/LinkTimeOptimizer.h Thu Oct 26 15:46:22 2006 @@ -91,8 +91,9 @@ NameToSymbolMap &, std::set &) = 0; virtual enum LTOStatus optimizeModules(const std::string &, - std::vector &, - std::string &) = 0; + std::vector &, + std::string &, bool, + const char *) = 0; virtual void getTargetTriple(const std::string &, std::string &) = 0; virtual void removeModule (const std::string &InputFilename) = 0; virtual ~LinkTimeOptimizer() = 0; @@ -113,8 +114,10 @@ std::set &references); enum LTOStatus optimizeModules(const std::string &OutputFilename, std::vector &exportList, - std::string &targetTriple); - void getTargetTriple(const std::string &InputFilename, std::string &targetTriple); + std::string &targetTriple, bool saveTemps, + const char *); + void getTargetTriple(const std::string &InputFilename, + std::string &targetTriple); void removeModule (const std::string &InputFilename); // Constructors and destructors From evan.cheng at apple.com Thu Oct 26 16:48:22 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 16:48:22 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200610262148.k9QLmMoL007456@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.167 -> 1.168 --- Log message: Speed up isCString() --- Diffs of the changes: (+14 -4) Constants.cpp | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.167 llvm/lib/VMCore/Constants.cpp:1.168 --- llvm/lib/VMCore/Constants.cpp:1.167 Thu Oct 26 14:15:05 2006 +++ llvm/lib/VMCore/Constants.cpp Thu Oct 26 16:48:03 2006 @@ -1077,11 +1077,21 @@ /// isString) and it ends in a null byte \0 and does not contains any other /// null bytes except its terminator. bool ConstantArray::isCString() const { - if (!isString()) return false; - // This is safe because a ConstantArray cannot be a zero array. - for (unsigned i = 0, e = getNumOperands()-1; i != e; ++i) - if (cast(getOperand(i))->getZExtValue() == 0) + // Check the element type for sbyte or ubyte... + if (getType()->getElementType() != Type::UByteTy && + getType()->getElementType() != Type::SByteTy) + return false; + Constant *Zero = Constant::getNullValue(getOperand(0)->getType()); + // Last element must be a null. + if (getOperand(getNumOperands()-1) != Zero) + return false; + // Other elements must be non-null integers. + for (unsigned i = 0, e = getNumOperands()-1; i != e; ++i) { + if (!isa(getOperand(i))) return false; + if (getOperand(i) == Zero) + return false; + } return true; } From evan.cheng at apple.com Thu Oct 26 16:52:38 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 16:52:38 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h Message-ID: <200610262152.k9QLqc4b007562@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.139 -> 1.140 SelectionDAGNodes.h updated: 1.155 -> 1.156 --- Log message: Indexed load / store changes. --- Diffs of the changes: (+18 -18) SelectionDAG.h | 3 ++- SelectionDAGNodes.h | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.139 llvm/include/llvm/CodeGen/SelectionDAG.h:1.140 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.139 Tue Oct 17 16:12:56 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Thu Oct 26 16:52:23 2006 @@ -314,7 +314,8 @@ SDOperand getExtLoad(ISD::LoadExtType ExtType, MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, const Value *SV, int SVOffset, MVT::ValueType EVT, bool isVolatile=false); - SDOperand getPreIndexedLoad(SDOperand OrigLoad, SDOperand Base); + SDOperand getIndexedLoad(SDOperand OrigLoad, SDOperand Base, + SDOperand Offset, ISD::MemOpAddrMode AM); SDOperand getVecLoad(unsigned Count, MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV); Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.155 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.155 Tue Oct 17 16:12:56 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu Oct 26 16:52:24 2006 @@ -370,9 +370,10 @@ // operations. FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, - // Other operators. LOAD and STORE have token chains as their first - // operand, then the same operands as an LLVM load/store instruction, then a - // SRCVALUE node that provides alias analysis information. + // LOAD and STORE have token chains as their first operand, then the same + // operands as an LLVM load/store instruction, then an offset node that + // is added / subtracted from the base pointer to form the address (for + // indexed memory ops). LOAD, STORE, // Abstract vector version of LOAD. VLOAD has a constant element count as @@ -529,8 +530,8 @@ /// load); an unindexed store does not produces a value. /// /// PRE_INC Similar to the unindexed mode where the effective address is - /// PRE_DEC the result of computation of the base pointer. However, it - /// considers the computation as being folded into the load / + /// PRE_DEC the value of the base pointer add / subtract the offset. + /// It considers the computation as being folded into the load / /// store operation (i.e. the load / store does the address /// computation as well as performing the memory transaction). /// The base operand is always undefined. In addition to @@ -540,12 +541,12 @@ /// of the address computation). /// /// POST_INC The effective address is the value of the base pointer. The - /// POST_DEC value of the offset operand is then added to the base after - /// memory transaction. In addition to producing a chain, - /// post-indexed load produces two values (the result of the load - /// and the result of the base + offset computation); a - /// post-indexed store produces one value (the the result of the - /// base + offset computation). + /// POST_DEC value of the offset operand is then added to / subtracted + /// from the base after memory transaction. In addition to + /// producing a chain, post-indexed load produces two values + /// (the result of the load and the result of the base +/- offset + /// computation); a post-indexed store produces one value (the + /// the result of the base +/- offset computation). /// enum MemOpAddrMode { UNINDEXED = 0, @@ -1408,9 +1409,8 @@ : SDNode(ISD::LOAD, Chain, Ptr, Off), AddrMode(AM), ExtType(ETy), LoadedVT(LVT), SrcValue(SV), SVOffset(O), Alignment(Align), IsVolatile(Vol) { - assert((Off.getOpcode() == ISD::UNDEF || - AddrMode == ISD::POST_INC || AddrMode == ISD::POST_DEC) && - "Only post-indexed load has a non-undef offset operand"); + assert((Off.getOpcode() == ISD::UNDEF || AddrMode != ISD::UNINDEXED) && + "Only indexed load has a non-undef offset operand"); } public: @@ -1462,9 +1462,8 @@ : SDNode(ISD::STORE, Chain, Value, Ptr, Off), AddrMode(AM), IsTruncStore(isTrunc), StoredVT(SVT), SrcValue(SV), SVOffset(O), Alignment(Align), IsVolatile(Vol) { - assert((Off.getOpcode() == ISD::UNDEF || - AddrMode == ISD::POST_INC || AddrMode == ISD::POST_DEC) && - "Only post-indexed store has a non-undef offset operand"); + assert((Off.getOpcode() == ISD::UNDEF || AddrMode != ISD::UNINDEXED) && + "Only indexed store has a non-undef offset operand"); } public: From evan.cheng at apple.com Thu Oct 26 16:53:54 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 16:53:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200610262153.k9QLrsTl007603@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.355 -> 1.356 --- Log message: getPreIndexedLoad -> getIndexedLoad. --- Diffs of the changes: (+7 -21) SelectionDAG.cpp | 28 +++++++--------------------- 1 files changed, 7 insertions(+), 21 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355 Tue Oct 17 16:47:13 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 26 16:53:40 2006 @@ -1447,28 +1447,14 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getPreIndexedLoad(SDOperand OrigLoad, SDOperand Base) { +SDOperand SelectionDAG::getIndexedLoad(SDOperand OrigLoad, SDOperand Base, + SDOperand Offset, ISD::MemOpAddrMode AM){ LoadSDNode *LD = cast(OrigLoad); - SDOperand Ptr = LD->getBasePtr(); - MVT::ValueType PtrVT = Ptr.getValueType(); - unsigned Opc = Ptr.getOpcode(); - SDOperand Offset = LD->getOffset(); - assert(Offset.getOpcode() == ISD::UNDEF); - assert((Opc == ISD::ADD || Opc == ISD::SUB) && - "Load address must be !"); - ISD::MemOpAddrMode AM = (Opc == ISD::ADD) ? ISD::PRE_INC : ISD::PRE_DEC; - if (Ptr.getOperand(0) == Base) { - Offset = Ptr.getOperand(1); - Ptr = Ptr.getOperand(0); - } else { - assert(Ptr.getOperand(1) == Base); - Offset = Ptr.getOperand(0); - Ptr = Ptr.getOperand(1); - } - + assert(LD->getOffset().getOpcode() == ISD::UNDEF && + "Load is already a indexed load!"); MVT::ValueType VT = OrigLoad.getValueType(); - SDVTList VTs = getVTList(VT, PtrVT, MVT::Other); - SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD->getChain(), Ptr, Offset); + SDVTList VTs = getVTList(VT, Base.getValueType(), MVT::Other); + SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD->getChain(), Base, Offset); ID.AddInteger(AM); ID.AddInteger(LD->getExtensionType()); ID.AddInteger(LD->getLoadedVT()); @@ -1479,7 +1465,7 @@ void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); - SDNode *N = new LoadSDNode(LD->getChain(), Ptr, Offset, AM, + SDNode *N = new LoadSDNode(LD->getChain(), Base, Offset, AM, LD->getExtensionType(), LD->getLoadedVT(), LD->getSrcValue(), LD->getSrcValueOffset(), LD->getAlignment(), LD->isVolatile()); From evan.cheng at apple.com Thu Oct 26 16:56:05 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 16:56:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200610262156.k9QLu59M007654@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.73 -> 1.74 --- Log message: Change load PatFrag to ignore indexed load. --- Diffs of the changes: (+62 -31) TargetSelectionDAG.td | 93 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 62 insertions(+), 31 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.73 llvm/lib/Target/TargetSelectionDAG.td:1.74 --- llvm/lib/Target/TargetSelectionDAG.td:1.73 Fri Oct 13 16:14:26 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Thu Oct 26 16:55:50 2006 @@ -399,79 +399,110 @@ def vnot_conv : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV_bc)>; def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>; +// load fragments. def load : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - return ISD::isNON_EXTLoad(N); + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::NON_EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED; + return false; }]>; // extending load fragments. def extloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i1; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i1; return false; }]>; def extloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i8; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i8; return false; }]>; def extloadi16 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i16; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i16; return false; }]>; def extloadi32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i32; return false; }]>; def extloadf32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::f32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::EXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::f32; return false; }]>; -def sextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i1; +def sextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i1; return false; }]>; -def sextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i8; +def sextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i8; return false; }]>; def sextloadi16 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i16; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i16; return false; }]>; def sextloadi32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isSEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::SEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i32; return false; }]>; -def zextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i1; +def zextloadi1 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i1; return false; }]>; -def zextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i8; +def zextloadi8 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i8; return false; }]>; def zextloadi16 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i16; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i16; return false; }]>; def zextloadi32 : PatFrag<(ops node:$ptr), (ld node:$ptr), [{ - if (ISD::isZEXTLoad(N)) - return cast(N)->getLoadedVT() == MVT::i32; + if (LoadSDNode *LD = dyn_cast(N)) + return LD->getExtensionType() == ISD::ZEXTLOAD && + LD->getAddressingMode() == ISD::UNINDEXED && + LD->getLoadedVT() == MVT::i32; return false; }]>; +// store fragments. def store : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ return ISD::isNON_TRUNCStore(N); From clattner at apple.com Thu Oct 26 17:43:54 2006 From: clattner at apple.com (Chris Lattner) Date: Thu, 26 Oct 2006 15:43:54 -0700 Subject: [llvm-commits] patch for cfstrings Message-ID: <8A58660E-2D1D-46FB-A56E-1C5D62F6110D@apple.com> This improves support for the darwin-specific -fconstant-cfstrings option: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: patch.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061026/e2ae1bc7/attachment.txt -------------- next part -------------- -Chris From evan.cheng at apple.com Thu Oct 26 16:49:11 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 26 Oct 2006 16:49:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCTargetAsmInfo.cpp Message-ID: <200610262149.k9QLnBmp007491@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.202 -> 1.203 PPCTargetAsmInfo.cpp updated: 1.7 -> 1.8 --- Log message: Place cstrings in .cstring section. --- Diffs of the changes: (+9 -0) PPCAsmPrinter.cpp | 8 ++++++++ PPCTargetAsmInfo.cpp | 1 + 2 files changed, 9 insertions(+) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.202 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.203 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.202 Tue Oct 24 15:32:14 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Thu Oct 26 16:48:57 2006 @@ -548,6 +548,14 @@ O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: + if (TAI->getCStringSection()) { + const ConstantArray *CVA = dyn_cast(C); + if (CVA && CVA->isCString()) { + SwitchToDataSection(TAI->getCStringSection(), I); + break; + } + } + SwitchToDataSection("\t.data", I); break; default: Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.7 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.8 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.7 Tue Oct 17 06:30:57 2006 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Thu Oct 26 16:48:57 2006 @@ -28,6 +28,7 @@ AlignmentIsInBytes = false; ConstantPoolSection = "\t.const\t"; JumpTableDataSection = ".const"; + CStringSection = "\t.cstring"; LCOMMDirective = "\t.lcomm\t"; StaticCtorsSection = ".mod_init_func"; StaticDtorsSection = ".mod_term_func"; From reid at x10sys.com Fri Oct 27 00:30:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 00:30:37 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/alloca.ll Message-ID: <200610270530.k9R5UbXE014858@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: alloca.ll updated: 1.1 -> 1.2 --- Log message: Add a run line to this test. --- Diffs of the changes: (+1 -0) alloca.ll | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CodeGen/ARM/alloca.ll diff -u llvm/test/Regression/CodeGen/ARM/alloca.ll:1.1 llvm/test/Regression/CodeGen/ARM/alloca.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/alloca.ll:1.1 Thu Oct 26 08:31:26 2006 +++ llvm/test/Regression/CodeGen/ARM/alloca.ll Fri Oct 27 00:30:23 2006 @@ -1,3 +1,4 @@ +; RUN: llvm-as < %s | llc -march=arm void %f(uint %a) { entry: %tmp1032 = alloca ubyte, uint %a From reid at x10sys.com Fri Oct 27 10:45:45 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 10:45:45 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile Message-ID: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: rem.c added (r1.1) Makefile updated: 1.2 -> 1.3 --- Log message: Add a test for remainder testing. Also, in the Makefile, compute a seed for the random number generator based on julian date so that rem isn't always running the same test but it runs the same on any given day. Thanks to Domagoj Babic for writing this! --- Diffs of the changes: (+160 -1) Makefile | 3 - rem.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.1 *** /dev/null Fri Oct 27 10:45:35 2006 --- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Fri Oct 27 10:45:24 2006 *************** *** 0 **** --- 1,158 ---- + #include + #include + + // Simple REM test case. Tests some basic properties of remainder + // operation. + + // All macros must evaluate to true. x,y can be signed/unsigned, m + // should be unsigned. + + // Returns true if multiplication will overflow. + #define MultOverflow(x,y) ((((x) * (y)) / (y)) != (x)) + + // x == y => (x mod m) == (y mod m) + #define CongruenceTest(x,y,m) \ + (((x) != (y)) || (((x) % (m)) == ((y) % (m)))) + + + /****************************************************************** + * These three tests can be done only for unsigned case because they + * contain add/sub. If you're eager to get this working with signed + * numbers, take care of overflows. + ******************************************************************/ + + // Return true if add/sub will cause overflow. + #define UnsignedAddOverflow(x,y) (((x) + (y)) < (x)) + #define UnsignedSubUnderflow(x,y) (((x) - (y)) > (x)) + + // ((x % m) + (y % m)) % m = (x + y) % m + #define AdditionOfCongruences(x,y,m) \ + (UnsignedAddOverflow((x)%(m),(y)%(m)) || \ + UnsignedAddOverflow((x),(y)) || \ + (((((x) % (m)) + ((y) % (m))) % m) == (((x) + (y)) % (m)))) + + // ((x % m) == ((y + z) % m)) == (((x - z) % m) == (y % m)) + #define SimpleCongruenceEquation(x,y,z,m) \ + (UnsignedAddOverflow((y),(z)) || \ + UnsignedSubUnderflow((x),(z)) || \ + ((((x) % (m)) == (((y) + (z)) % (m))) % m) == \ + ((((x) - (z)) % (m)) == ((y) % (m)))) + + // If y*m does not overflow: (x % m) == (x + y*m) % m + #define AdditionOfMultipleOfModIsNOP(x,y,m) \ + (MultOverflow(y,m) || \ + UnsignedAddOverflow((x),(y)*(m)) || \ + (((x) % (m)) == (((x) + ((y)*(m))) % (m)))) + + /******************************************************************/ + + // Greatest common divisor + long gcd(long a, long b) { + long c; + while(1) { + c = a % b; + if(c == 0) return b; + a = b; + b = c; + } + } + + // If gcd(z,m)==1: ((x == y) % m) == ((x / z == y / z) % m). This holds + // only if both sides are actually divisble by z. + #define BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x,y,z,m) \ + ((gcd((z),(m)) != 1) || ((z) == 0) || \ + (gcd((x),(z)) != (z)) || ((gcd((y),(z)) != (z))) || \ + (((x) % (m)) == ((y) % (m))) == (((((x) / (z)) % m) == (((y) / (z))) % m))) + + // If z divides x,y,m: ((x % m) == (y % m)) == (((x/z) % (m/z)) == ((y/z) % (m/z))) + #define DivideBothSidesAndModulus(x,y,z,m) \ + (((z) == 0) || (gcd((x),(z)) != (z)) || \ + (gcd((y),(z)) != (z)) || \ + (gcd((m),(z)) != (z)) || \ + (((x)%(m)) == ((y)%(m))) == \ + ((((x)/(z)) % ((m)/(z))) == (((y)/(z)) % ((m)/(z))))) + + // If z divides m, than: ((x % m) == (y % m)) == ((x % z) == (y % z)) + // z should be unsigned. + #define SubModulusTest(x,y,z,m) \ + (((z) == 0) || (gcd((m),(z)) != (z)) || \ + ((((x)%(m)) == ((y)%(m))) == (((x)%(z)) == ((y)%(z))))) + + // Runs the test c under number t. + #define test(t,c) \ + if (!c) { \ + printf("Test #%u, failed in iteration #: %u\n", t, idx); \ + printf("Failing test vector:\n"); \ + printf("m=%u, x_u=%u, y_u=%u, z_u=%u, x_s=%d, y_s=%d, z_s=%d\n", \ + m, x_u, y_u, z_u, x_s, y_s, z_s); \ + return 1; \ + } + + // The higher the number the better the testing. + #define ITERATIONS 100 + + int main(int argc, char **argv) { + // Since the test vectors are printed out anyways, I suggest leaving + // the test nondeterministic. Many people run tests on various + // machines, so REM-related code will be covered with a much better + // coverage... If you really don't like the idea of having better + // coverage, uncomment the srand line: + + if (argc > 1) { + int seed = atoi(argv[1]); + srand(seed); + } + + unsigned idx = 0; + for (; idx < ITERATIONS; ++idx) { + unsigned m = (unsigned)rand(); + + if (m == 0) { // Repeat again + idx--; continue; + } + + unsigned x_u = (unsigned)rand(); + unsigned y_u = (unsigned)rand(); + unsigned z_u = (unsigned)rand(); + + int x_s = (rand() % 2) ? rand() : -rand(); + int y_s = (rand() % 2) ? rand() : -rand(); + int z_s = (rand() % 2) ? rand() : -rand(); + + test(1, CongruenceTest(x_s, y_s, m)); + test(2, CongruenceTest(x_s, y_u, m)); + test(3, CongruenceTest(x_u, y_s, m)); + test(4, CongruenceTest(x_u, y_u, m)); + + test(5, AdditionOfCongruences(x_u, y_u, m)); + + test(6, SimpleCongruenceEquation(x_u, y_u, z_u, m)); + + test(7, AdditionOfMultipleOfModIsNOP(x_u, y_u, m)); + + test(8, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_s, z_s, m)); + test(9, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_s, z_u, m)); + test(10, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_u, z_s, m)); + test(11, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_u, z_u, m)); + test(12, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_s, z_s, m)); + test(13, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_s, z_u, m)); + test(14, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_u, z_s, m)); + test(15, BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_u, z_u, m)); + + test(16, DivideBothSidesAndModulus(x_s, y_s, z_s, m)); + test(17, DivideBothSidesAndModulus(x_s, y_s, z_u, m)); + test(18, DivideBothSidesAndModulus(x_s, y_u, z_s, m)); + test(19, DivideBothSidesAndModulus(x_s, y_u, z_u, m)); + test(20, DivideBothSidesAndModulus(x_u, y_s, z_s, m)); + test(21, DivideBothSidesAndModulus(x_u, y_s, z_u, m)); + test(22, DivideBothSidesAndModulus(x_u, y_u, z_s, m)); + test(23, DivideBothSidesAndModulus(x_u, y_u, z_u, m)); + + test(25, SubModulusTest(x_s, y_s, z_u, m)); + test(27, SubModulusTest(x_s, y_u, z_u, m)); + test(29, SubModulusTest(x_u, y_s, z_u, m)); + test(31, SubModulusTest(x_u, y_u, z_u, m)); + } + printf("\n *** REM test done! ***\n"); + return 0; + } Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 --- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 Tue Oct 24 19:59:01 2006 +++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Fri Oct 27 10:45:24 2006 @@ -1,5 +1,6 @@ # SingleSource/UnitTests/Vector/Makefile LEVEL = ../../.. -PROG=div +SEED := $(shell date +%j) +RUN_OPTIONS := $(SEED) include $(LEVEL)/Makefile.config include $(LEVEL)/SingleSource/Makefile.singlesrc From reid at x10sys.com Fri Oct 27 10:47:35 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 10:47:35 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Message-ID: <200610271547.k9RFlZcV012021@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: rem.c updated: 1.1 -> 1.2 --- Log message: Make it iterate 10,000 times instead of 100 .. tests more cases. --- Diffs of the changes: (+1 -1) rem.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.1 llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.2 --- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c:1.1 Fri Oct 27 10:45:24 2006 +++ llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Fri Oct 27 10:47:18 2006 @@ -89,7 +89,7 @@ } // The higher the number the better the testing. -#define ITERATIONS 100 +#define ITERATIONS 10000 int main(int argc, char **argv) { // Since the test vectors are printed out anyways, I suggest leaving From clattner at apple.com Fri Oct 27 11:04:49 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Oct 2006 09:04:49 -0700 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile In-Reply-To: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> References: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> Message-ID: <64203FCF-AD05-4A40-9825-D8541EC5A563@apple.com> Please change this to set the seed to a constant in main(). -Chris On Oct 27, 2006, at 8:45 AM, Reid Spencer wrote: > > > Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: > > rem.c added (r1.1) > Makefile updated: 1.2 -> 1.3 > --- > Log message: > > Add a test for remainder testing. Also, in the Makefile, compute a > seed > for the random number generator based on julian date so that rem isn't > always running the same test but it runs the same on any given day. > > Thanks to Domagoj Babic for writing this! > > > --- > Diffs of the changes: (+160 -1) > > Makefile | 3 - > rem.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++ > 2 files changed, 160 insertions(+), 1 deletion(-) > > > Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c > diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/ > rem.c:1.1 > *** /dev/null Fri Oct 27 10:45:35 2006 > --- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Fri Oct 27 > 10:45:24 2006 > *************** > *** 0 **** > --- 1,158 ---- > + #include > + #include > + > + // Simple REM test case. Tests some basic properties of remainder > + // operation. > + > + // All macros must evaluate to true. x,y can be signed/unsigned, m > + // should be unsigned. > + > + // Returns true if multiplication will overflow. > + #define MultOverflow(x,y) ((((x) * (y)) / (y)) != (x)) > + > + // x == y => (x mod m) == (y mod m) > + #define CongruenceTest(x,y,m) \ > + (((x) != (y)) || (((x) % (m)) == ((y) % (m)))) > + > + > + /****************************************************************** > + * These three tests can be done only for unsigned case because they > + * contain add/sub. If you're eager to get this working with signed > + * numbers, take care of overflows. > + ******************************************************************/ > + > + // Return true if add/sub will cause overflow. > + #define UnsignedAddOverflow(x,y) (((x) + (y)) < (x)) > + #define UnsignedSubUnderflow(x,y) (((x) - (y)) > (x)) > + > + // ((x % m) + (y % m)) % m = (x + y) % m > + #define AdditionOfCongruences(x,y,m) \ > + (UnsignedAddOverflow((x)%(m),(y)%(m)) || \ > + UnsignedAddOverflow((x),(y)) || \ > + (((((x) % (m)) + ((y) % (m))) % m) == (((x) + (y)) % (m)))) > + > + // ((x % m) == ((y + z) % m)) == (((x - z) % m) == (y % m)) > + #define SimpleCongruenceEquation(x,y,z,m) \ > + (UnsignedAddOverflow((y),(z)) || \ > + UnsignedSubUnderflow((x),(z)) || \ > + ((((x) % (m)) == (((y) + (z)) % (m))) % m) == \ > + ((((x) - (z)) % (m)) == ((y) % (m)))) > + > + // If y*m does not overflow: (x % m) == (x + y*m) % m > + #define AdditionOfMultipleOfModIsNOP(x,y,m) \ > + (MultOverflow(y,m) || \ > + UnsignedAddOverflow((x),(y)*(m)) || \ > + (((x) % (m)) == (((x) + ((y)*(m))) % (m)))) > + > + /******************************************************************/ > + > + // Greatest common divisor > + long gcd(long a, long b) { > + long c; > + while(1) { > + c = a % b; > + if(c == 0) return b; > + a = b; > + b = c; > + } > + } > + > + // If gcd(z,m)==1: ((x == y) % m) == ((x / z == y / z) % m). This > holds > + // only if both sides are actually divisble by z. > + #define BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod > (x,y,z,m) \ > + ((gcd((z),(m)) != 1) || ((z) == 0) || \ > + (gcd((x),(z)) != (z)) || ((gcd((y),(z)) != (z))) || \ > + (((x) % (m)) == ((y) % (m))) == (((((x) / (z)) % m) == > (((y) / (z))) % m))) > + > + // If z divides x,y,m: ((x % m) == (y % m)) == (((x/z) % (m/z)) > == ((y/z) % (m/z))) > + #define DivideBothSidesAndModulus(x,y,z,m) \ > + (((z) == 0) || (gcd((x),(z)) != (z)) || \ > + (gcd((y),(z)) != (z)) || \ > + (gcd((m),(z)) != (z)) || \ > + (((x)%(m)) == ((y)%(m))) == \ > + ((((x)/(z)) % ((m)/(z))) == (((y)/(z)) % ((m)/(z))))) > + > + // If z divides m, than: ((x % m) == (y % m)) == ((x % z) == (y % > z)) > + // z should be unsigned. > + #define SubModulusTest(x,y,z,m) \ > + (((z) == 0) || (gcd((m),(z)) != (z)) || \ > + ((((x)%(m)) == ((y)%(m))) == (((x)%(z)) == ((y)%(z))))) > + > + // Runs the test c under number t. > + #define test(t,c) \ > + if (!c) { \ > + printf("Test #%u, failed in iteration #: %u\n", t, idx); \ > + printf("Failing test vector:\n"); \ > + printf("m=%u, x_u=%u, y_u=%u, z_u=%u, x_s=%d, y_s=%d, z_s=%d\n", \ > + m, x_u, y_u, z_u, x_s, y_s, z_s); \ > + return 1; \ > + } > + > + // The higher the number the better the testing. > + #define ITERATIONS 100 > + > + int main(int argc, char **argv) { > + // Since the test vectors are printed out anyways, I suggest > leaving > + // the test nondeterministic. Many people run tests on various > + // machines, so REM-related code will be covered with a much > better > + // coverage... If you really don't like the idea of having > better > + // coverage, uncomment the srand line: > + > + if (argc > 1) { > + int seed = atoi(argv[1]); > + srand(seed); > + } > + > + unsigned idx = 0; > + for (; idx < ITERATIONS; ++idx) { > + unsigned m = (unsigned)rand(); > + > + if (m == 0) { // Repeat again > + idx--; continue; > + } > + > + unsigned x_u = (unsigned)rand(); > + unsigned y_u = (unsigned)rand(); > + unsigned z_u = (unsigned)rand(); > + > + int x_s = (rand() % 2) ? rand() : -rand(); > + int y_s = (rand() % 2) ? rand() : -rand(); > + int z_s = (rand() % 2) ? rand() : -rand(); > + > + test(1, CongruenceTest(x_s, y_s, m)); > + test(2, CongruenceTest(x_s, y_u, m)); > + test(3, CongruenceTest(x_u, y_s, m)); > + test(4, CongruenceTest(x_u, y_u, m)); > + > + test(5, AdditionOfCongruences(x_u, y_u, m)); > + > + test(6, SimpleCongruenceEquation(x_u, y_u, z_u, m)); > + > + test(7, AdditionOfMultipleOfModIsNOP(x_u, y_u, m)); > + > + test(8, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_s, z_s, > m)); > + test(9, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_s, z_u, > m)); > + test(10, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_u, z_s, > m)); > + test(11, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_u, z_u, > m)); > + test(12, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_s, z_s, > m)); > + test(13, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_s, z_u, > m)); > + test(14, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_u, z_s, > m)); > + test(15, > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_u, z_u, > m)); > + > + test(16, DivideBothSidesAndModulus(x_s, y_s, z_s, m)); > + test(17, DivideBothSidesAndModulus(x_s, y_s, z_u, m)); > + test(18, DivideBothSidesAndModulus(x_s, y_u, z_s, m)); > + test(19, DivideBothSidesAndModulus(x_s, y_u, z_u, m)); > + test(20, DivideBothSidesAndModulus(x_u, y_s, z_s, m)); > + test(21, DivideBothSidesAndModulus(x_u, y_s, z_u, m)); > + test(22, DivideBothSidesAndModulus(x_u, y_u, z_s, m)); > + test(23, DivideBothSidesAndModulus(x_u, y_u, z_u, m)); > + > + test(25, SubModulusTest(x_s, y_s, z_u, m)); > + test(27, SubModulusTest(x_s, y_u, z_u, m)); > + test(29, SubModulusTest(x_u, y_s, z_u, m)); > + test(31, SubModulusTest(x_u, y_u, z_u, m)); > + } > + printf("\n *** REM test done! ***\n"); > + return 0; > + } > > > Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile > diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 > llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 > --- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 Tue > Oct 24 19:59:01 2006 > +++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Fri Oct > 27 10:45:24 2006 > @@ -1,5 +1,6 @@ > # SingleSource/UnitTests/Vector/Makefile > LEVEL = ../../.. > -PROG=div > +SEED := $(shell date +%j) > +RUN_OPTIONS := $(SEED) > include $(LEVEL)/Makefile.config > include $(LEVEL)/SingleSource/Makefile.singlesrc > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From reid at x10sys.com Fri Oct 27 11:14:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 11:14:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp Message-ID: <200610271614.k9RGER6Q005407@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.7 -> 1.8 --- Log message: Initialize CStringSection member var. --- Diffs of the changes: (+1 -0) TargetAsmInfo.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.7 llvm/lib/Target/TargetAsmInfo.cpp:1.8 --- llvm/lib/Target/TargetAsmInfo.cpp:1.7 Fri Oct 13 12:50:07 2006 +++ llvm/lib/Target/TargetAsmInfo.cpp Fri Oct 27 11:14:06 2006 @@ -49,6 +49,7 @@ ConstantPoolSection("\t.section .rodata\n"), JumpTableDataSection("\t.section .rodata\n"), JumpTableDirective(0), + CStringSection(0), StaticCtorsSection("\t.section .ctors,\"aw\", at progbits"), StaticDtorsSection("\t.section .dtors,\"aw\", at progbits"), FourByteConstantSection(0), From jlaskey at apple.com Fri Oct 27 11:16:33 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 11:16:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610271616.k9RGGXKt005461@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp added (r1.1) --- Log message: Breakout folding hash set from SelectionDAGCSEMap. --- Diffs of the changes: (+282 -0) FoldingSet.cpp | 282 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 282 insertions(+) Index: llvm/lib/Support/FoldingSet.cpp diff -c /dev/null llvm/lib/Support/FoldingSet.cpp:1.1 *** /dev/null Fri Oct 27 11:16:26 2006 --- llvm/lib/Support/FoldingSet.cpp Fri Oct 27 11:16:16 2006 *************** *** 0 **** --- 1,282 ---- + //===-- Support/FoldingSet.cpp - Uniquing Hash Set --------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by James M. Laskey and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements a hash set that can be used to remove duplication of + // nodes in a graph. This code was originally created by Chris Lattner for use + // with SelectionDAGCSEMap, but was isolated to provide use across the llvm code + // set. + // + //===----------------------------------------------------------------------===// + + #include "llvm/ADT/FoldingSet.h" + + #include "llvm/ADT/MathExtras.h" + + using namespace llvm; + + //===----------------------------------------------------------------------===// + // FoldingSetImpl::NodeID Implementation + + /// Add* - Add various data types to Bit data. + /// + void FoldingSetImpl::NodeID::AddPointer(const void *Ptr) { + // Note: this adds pointers to the hash using sizes and endianness that + // depend on the host. It doesn't matter however, because hashing on + // pointer values in inherently unstable. Nothing should depend on the + // ordering of nodes in the folding set. + intptr_t PtrI = (intptr_t)Ptr; + Bits.push_back(unsigned(PtrI)); + if (sizeof(intptr_t) > sizeof(unsigned)) + Bits.push_back(unsigned(uint64_t(PtrI) >> 32)); + } + void FoldingSetImpl::NodeID::AddInteger(signed I) { + Bits.push_back(I); + } + void FoldingSetImpl::NodeID::AddInteger(unsigned I) { + Bits.push_back(I); + } + void FoldingSetImpl::NodeID::AddInteger(uint64_t I) { + Bits.push_back(unsigned(I)); + Bits.push_back(unsigned(I >> 32)); + } + void FoldingSetImpl::NodeID::AddFloat(float F) { + Bits.push_back(FloatToBits(F)); + } + void FoldingSetImpl::NodeID::AddDouble(double D) { + Bits.push_back(DoubleToBits(D)); + } + void FoldingSetImpl::NodeID::AddString(const std::string &String) { + // Note: An assumption is made here that strings are composed of one byte + // chars. + unsigned Size = String.size(); + unsigned Units = Size / sizeof(unsigned); + const unsigned *Base = (const unsigned *)String.data(); + Bits.insert(Bits.end(), Base, Base + Units); + if (Size & 3) { + unsigned V = 0; + for (unsigned i = Units * sizeof(unsigned); i < Size; ++i) + V = (V << 8) | String[i]; + Bits.push_back(V); + } + } + + /// ComputeHash - Compute a strong hash value for this NodeID, used to + /// lookup the node in the FoldingSetImpl. + unsigned FoldingSetImpl::NodeID::ComputeHash() const { + // This is adapted from SuperFastHash by Paul Hsieh. + unsigned Hash = Bits.size(); + for (const unsigned *BP = &Bits[0], *E = BP+Bits.size(); BP != E; ++BP) { + unsigned Data = *BP; + Hash += Data & 0xFFFF; + unsigned Tmp = ((Data >> 16) << 11) ^ Hash; + Hash = (Hash << 16) ^ Tmp; + Hash += Hash >> 11; + } + + // Force "avalanching" of final 127 bits. + Hash ^= Hash << 3; + Hash += Hash >> 5; + Hash ^= Hash << 4; + Hash += Hash >> 17; + Hash ^= Hash << 25; + Hash += Hash >> 6; + return Hash; + } + + /// operator== - Used to compare two nodes to each other. + /// + bool FoldingSetImpl::NodeID::operator==(const FoldingSetImpl::NodeID &RHS)const{ + if (Bits.size() != RHS.Bits.size()) return false; + return memcmp(&Bits[0], &RHS.Bits[0], Bits.size()*sizeof(Bits[0])) == 0; + } + + + //===----------------------------------------------------------------------===// + // FoldingSetImpl Implementation + + FoldingSetImpl::FoldingSetImpl() : NumNodes(0) { + NumBuckets = 64; + Buckets = new void*[NumBuckets]; + memset(Buckets, 0, NumBuckets*sizeof(void*)); + } + FoldingSetImpl::~FoldingSetImpl() { + delete [] Buckets; + } + + /// GetNextPtr - In order to save space, each bucket is a + /// singly-linked-list. In order to make deletion more efficient, we make + /// the list circular, so we can delete a node without computing its hash. + /// The problem with this is that the start of the hash buckets are not + /// Nodes. If NextInBucketPtr is a bucket pointer, this method returns null + /// : use GetBucketPtr when this happens. + FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr) { + if (NextInBucketPtr >= Buckets && NextInBucketPtr < Buckets+NumBuckets) + return 0; + return static_cast(NextInBucketPtr); + } + + /// GetNextPtr - This is just like the previous GetNextPtr implementation, + /// but allows a bucket array to be specified. + FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr, + void **Bucks, + unsigned NumBuck) { + if (NextInBucketPtr >= Bucks && NextInBucketPtr < Bucks+NumBuck) + return 0; + return static_cast(NextInBucketPtr); + } + + /// GetBucketPtr - Provides a casting of a bucket pointer for isNode + /// testing. + void **FoldingSetImpl::GetBucketPtr(void *NextInBucketPtr) { + return static_cast(NextInBucketPtr); + } + + /// GetBucketFor - Hash the specified node ID and return the hash bucket for + /// the specified ID. + void **FoldingSetImpl::GetBucketFor(const NodeID &ID) const { + // NumBuckets is always a power of 2. + unsigned BucketNum = ID.ComputeHash() & (NumBuckets-1); + return Buckets+BucketNum; + } + + /// GrowHashTable - Double the size of the hash table and rehash everything. + /// + void FoldingSetImpl::GrowHashTable() { + void **OldBuckets = Buckets; + unsigned OldNumBuckets = NumBuckets; + NumBuckets <<= 1; + + // Reset the node count to zero: we're going to reinsert everything. + NumNodes = 0; + + // Clear out new buckets. + Buckets = new void*[NumBuckets]; + memset(Buckets, 0, NumBuckets*sizeof(void*)); + + // Walk the old buckets, rehashing nodes into their new place. + for (unsigned i = 0; i != OldNumBuckets; ++i) { + void *Probe = OldBuckets[i]; + if (!Probe) continue; + while (Node *NodeInBucket = GetNextPtr(Probe, OldBuckets, OldNumBuckets)){ + // Figure out the next link, remove NodeInBucket from the old link. + Probe = NodeInBucket->getNextInBucket(); + NodeInBucket->SetNextInBucket(0); + + // Insert the node into the new bucket, after recomputing the hash. + NodeID ID; + GetNodeProfile(ID, NodeInBucket); + InsertNode(NodeInBucket, GetBucketFor(ID)); + } + } + + delete[] OldBuckets; + } + + /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, + /// return it. If not, return the insertion token that will make insertion + /// faster. + FoldingSetImpl::Node *FoldingSetImpl::FindNodeOrInsertPos(const NodeID &ID, + void *&InsertPos) { + void **Bucket = GetBucketFor(ID); + void *Probe = *Bucket; + + InsertPos = 0; + + while (Node *NodeInBucket = GetNextPtr(Probe)) { + NodeID OtherID; + GetNodeProfile(OtherID, NodeInBucket); + if (OtherID == ID) + return NodeInBucket; + + Probe = NodeInBucket->getNextInBucket(); + } + + // Didn't find the node, return null with the bucket as the InsertPos. + InsertPos = Bucket; + return 0; + } + + /// InsertNode - Insert the specified node into the folding set, knowing that it + /// is not already in the map. InsertPos must be obtained from + /// FindNodeOrInsertPos. + void FoldingSetImpl::InsertNode(Node *N, void *InsertPos) { + ++NumNodes; + // Do we need to grow the hashtable? + if (NumNodes > NumBuckets*2) { + GrowHashTable(); + NodeID ID; + GetNodeProfile(ID, N); + InsertPos = GetBucketFor(ID); + } + + /// The insert position is actually a bucket pointer. + void **Bucket = static_cast(InsertPos); + + void *Next = *Bucket; + + // If this is the first insertion into this bucket, its next pointer will be + // null. Pretend as if it pointed to itself. + if (Next == 0) + Next = Bucket; + + // Set the nodes next pointer, and make the bucket point to the node. + N->SetNextInBucket(Next); + *Bucket = N; + } + + /// RemoveNode - Remove a node from the folding set, returning true if one was + /// removed or false if the node was not in the folding set. + bool FoldingSetImpl::RemoveNode(Node *N) { + // Because each bucket is a circular list, we don't need to compute N's hash + // to remove it. Chase around the list until we find the node (or bucket) + // which points to N. + void *Ptr = N->getNextInBucket(); + if (Ptr == 0) return false; // Not in folding set. + + --NumNodes; + + void *NodeNextPtr = Ptr; + N->SetNextInBucket(0); + while (true) { + if (Node *NodeInBucket = GetNextPtr(Ptr)) { + // Advance pointer. + Ptr = NodeInBucket->getNextInBucket(); + + // We found a node that points to N, change it to point to N's next node, + // removing N from the list. + if (Ptr == N) { + NodeInBucket->SetNextInBucket(NodeNextPtr); + return true; + } + } else { + void **Bucket = GetBucketPtr(Ptr); + Ptr = *Bucket; + + // If we found that the bucket points to N, update the bucket to point to + // whatever is next. + if (Ptr == N) { + *Bucket = NodeNextPtr; + return true; + } + } + } + } + + /// GetOrInsertNode - If there is an existing simple Node exactly + /// equal to the specified node, return it. Otherwise, insert 'N' and it + /// instead. + FoldingSetImpl::Node *FoldingSetImpl::GetOrInsertNode(FoldingSetImpl::Node *N) { + NodeID ID; + GetNodeProfile(ID, N); + void *IP; + if (Node *E = FindNodeOrInsertPos(ID, IP)) + return E; + InsertNode(N, IP); + return N; + } From jlaskey at apple.com Fri Oct 27 11:16:33 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 11:16:33 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/FoldingSet.h Message-ID: <200610271616.k9RGGXLN005458@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: FoldingSet.h added (r1.1) --- Log message: Breakout folding hash set from SelectionDAGCSEMap. --- Diffs of the changes: (+281 -0) FoldingSet.h | 281 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 281 insertions(+) Index: llvm/include/llvm/ADT/FoldingSet.h diff -c /dev/null llvm/include/llvm/ADT/FoldingSet.h:1.1 *** /dev/null Fri Oct 27 11:16:26 2006 --- llvm/include/llvm/ADT/FoldingSet.h Fri Oct 27 11:16:16 2006 *************** *** 0 **** --- 1,281 ---- + //===-- llvm/ADT/FoldingSet.h - Uniquing Hash Set ---------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by James M. Laskey and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines a hash set that can be used to remove duplication of nodes + // in a graph. This code was originally created by Chris Lattner for use with + // SelectionDAGCSEMap, but was isolated to provide use across the llvm code set. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_ADT_FOLDINGSET_H + #define LLVM_ADT_FOLDINGSET_H + + #include "llvm/ADT/SmallVector.h" + + namespace llvm { + + /// This folding set used for two purposes: + /// 1. Given information about a node we want to create, look up the unique + /// instance of the node in the set. If the node already exists, return + /// it, otherwise return the bucket it should be inserted into. + /// 2. Given a node that has already been created, remove it from the set. + /// + /// This class is implemented as a single-link chained hash table, where the + /// "buckets" are actually the nodes themselves (the next pointer is in the + /// node). The last node points back to the bucket to simplified node removal. + /// + /// Any node that is to be included in the folding set must be a subclass of + /// FoldingSetNode. The node class must also define a Profile method used to + /// establish the unique bits of data for the node. The Profile method is + /// passed a FoldingSetNodeID object which is used to gather the bits. Just + /// call one of the Add* functions defined in the FoldingSetImpl::NodeID class. + /// + /// Eg. + /// class MyNode : public FoldingSetNode { + /// private: + /// std::string Name; + /// unsigned Value; + /// public: + /// MyNode(const char *N, unsigned V) : Name(N), Value(V) {} + /// ... + /// void Profile(FoldingSetNodeID &ID) { + /// ID.AddString(Name); + /// ID.AddInteger(Value); + /// } + /// ... + /// }; + /// + /// To define the folding set itself use the FoldingSet template; + /// + /// Eg. + /// FoldingSet MyFoldingSet; + /// + /// Four public methods are available to manipulate the folding set; + /// + /// 1) If you have an existing node that you want add to the set but unsure + /// that the node might already exist then call; + /// + /// MyNode *M = MyFoldingSet.GetOrInsertNode(N); + /// + /// If The result is equal to the input then the node has been inserted. + /// Otherwise, the result is the node existing in the folding set, and the + /// input can be discarded (use the result instead.) + /// + /// 2) If you are ready to construct a node but want to check if it already + /// exists, then call FindNodeOrInsertPos with a FoldingSetNodeID of the bits to + /// check; + /// + /// FoldingSetNodeID ID; + /// ID.AddString(Name); + /// ID.AddInteger(Value); + /// void *InsertPoint; + /// + /// MyNode *M = MyFoldingSet.FindNodeOrInsertPos(ID, InsertPoint); + /// + /// If found then M with be non-NULL, else InsertPoint will point to where it + /// should be inserted using InsertNode. + /// + /// 3) If you get a NULL result from FindNodeOrInsertPos then you can ass a new + /// node with FindNodeOrInsertPos; + /// + /// InsertNode(N, InsertPoint); + /// + /// 4) Finally, if you want to remove a node from the folding set call; + /// + /// bool WasRemoved = RemoveNode(N); + /// + /// The result indicates whether the node did exist in the folding set. + + + //===----------------------------------------------------------------------===// + /// FoldingSetImpl - Implements the folding set functionality. The main + /// structure is an array of buckets. Each bucket is indexed by the hash of + /// the nodes it contains. The bucket itself points to the nodes contained + /// in the bucket via a singly linked list. The last node in the list points + /// back to the bucket to facilitate node removal. + /// + class FoldingSetImpl { + private: + // Buckets - Array of bucket chains. + void **Buckets; + + // NumBuckets - Length of the Buckets array. Always a power of 2. + unsigned NumBuckets; + + // NumNodes - Number of nodes in the folding set. Growth occurs when NumNodes + // is greater than twice teh number of buckets. + unsigned NumNodes; + + public: + FoldingSetImpl(); + ~FoldingSetImpl(); + + // Forward declaration. + class Node; + + //===--------------------------------------------------------------------===// + /// NodeID - This class is used to gather all the unique data bits of a + /// node. When all the bits are gathered this class is used to produce a + /// hash value for the node. + /// + class NodeID { + /// Bits - Vector of all the data bits that make the node unique. + /// Use a SmallVector to avoid a heap allocation in the common case. + SmallVector Bits; + + public: + NodeID() {} + + /// getRawData - Return the ith entry in the Bits data. + /// + unsigned getRawData(unsigned i) const { + return Bits[i]; + } + + /// Add* - Add various data types to Bit data. + /// + void AddPointer(const void *Ptr); + void AddInteger(signed I); + void AddInteger(unsigned I); + void AddInteger(uint64_t I); + void AddFloat(float F); + void AddDouble(double D); + void AddString(const std::string &String); + + /// ComputeHash - Compute a strong hash value for this NodeID, used to + /// lookup the node in the FoldingSetImpl. + unsigned ComputeHash() const; + + /// operator== - Used to compare two nodes to each other. + /// + bool operator==(const NodeID &RHS) const; + }; + + //===--------------------------------------------------------------------===// + /// Node - This class is used to maintain the singly linked bucket list in + /// a folding set. + /// + class Node { + private: + // nextInBucket - next linek in the bucket list. + void *nextInBucket; + + public: + + Node() : nextInBucket(0) {} + + // Accessors + void *getNextInBucket() const { return nextInBucket; } + void SetNextInBucket(void *N) { nextInBucket = N; } + }; + + /// RemoveNode - Remove a node from the folding set, returning true if one + /// was removed or false if the node was not in the folding set. + bool RemoveNode(Node *N); + + /// GetOrInsertNode - If there is an existing simple Node exactly + /// equal to the specified node, return it. Otherwise, insert 'N' and return + /// it instead. + Node *GetOrInsertNode(Node *N); + + /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, + /// return it. If not, return the insertion token that will make insertion + /// faster. + Node *FindNodeOrInsertPos(const NodeID &ID, void *&InsertPos); + + /// InsertNode - Insert the specified node into the folding set, knowing that + /// it is not already in the folding set. InsertPos must be obtained from + /// FindNodeOrInsertPos. + void InsertNode(Node *N, void *InsertPos); + + private: + /// GetNextPtr - In order to save space, each bucket is a + /// singly-linked-list. In order to make deletion more efficient, we make + /// the list circular, so we can delete a node without computing its hash. + /// The problem with this is that the start of the hash buckets are not + /// Nodes. If NextInBucketPtr is a bucket pointer, this method returns null + /// : use GetBucketPtr when this happens. + Node *GetNextPtr(void *NextInBucketPtr); + + /// GetNextPtr - This is just like the previous GetNextPtr implementation, + /// but allows a bucket array to be specified. + Node *GetNextPtr(void *NextInBucketPtr, void **Buckets, unsigned NumBuck); + + /// GetBucketPtr - Provides a casting of a bucket pointer for isNode + /// testing. + void **GetBucketPtr(void *NextInBucketPtr); + + /// GetBucketFor - Hash the specified node ID and return the hash bucket for + /// the specified ID. + void **GetBucketFor(const NodeID &ID) const; + + /// GrowHashTable - Double the size of the hash table and rehash everything. + /// + void GrowHashTable(); + + protected: + + /// GetNodeProfile - Instantiations of the FoldingSet template implement + /// this function to gather data bits for teh given node. + virtual void GetNodeProfile(NodeID &ID, Node *N) = 0; + }; + + // Convenence types to hide the implementation of the folding set. + typedef FoldingSetImpl::Node FoldingSetNode; + typedef FoldingSetImpl::NodeID FoldingSetNodeID; + + //===--------------------------------------------------------------------===// + /// FoldingSet - This template class is used to instantiate a specialized + /// implementation of the folding set to the node class T. T must be a + /// subclass of FoldingSetNode and implement a Profile function. + /// + template class FoldingSet : public FoldingSetImpl { + private: + /// GetNodeProfile - Each instantiatation of the FoldingSet + virtual void GetNodeProfile(NodeID &ID, Node *N) { + T *TN = static_cast(N); + TN->Profile(ID); + } + + public: + /// RemoveNode - Remove a node from the folding set, returning true if one + /// was removed or false if the node was not in the folding set. + bool RemoveNode(T *N) { + return FoldingSetImpl::RemoveNode(static_cast(N)); + } + + /// GetOrInsertNode - If there is an existing simple Node exactly + /// equal to the specified node, return it. Otherwise, insert 'N' and + /// return it instead. + T *GetOrInsertNode(Node *N) { + return static_cast(FoldingSetImpl::GetOrInsertNode( + static_cast(N))); + } + + /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, + /// return it. If not, return the insertion token that will make insertion + /// faster. + T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) { + return static_cast(FoldingSetImpl::FindNodeOrInsertPos(ID, + InsertPos)); + } + + /// InsertNode - Insert the specified node into the folding set, knowing + /// that it is not already in the folding set. InsertPos must be obtained + /// from FindNodeOrInsertPos. + void InsertNode(T *N, void *InsertPos) { + FoldingSetImpl::InsertNode(static_cast(N), InsertPos); + } + }; + + }; // End of namespace llvm. + + + #endif + From clattner at apple.com Fri Oct 27 11:24:33 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Oct 2006 09:24:33 -0700 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile In-Reply-To: <1161965751.2415.5.camel@bashful.x10sys.com> References: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> <64203FCF-AD05-4A40-9825-D8541EC5A563@apple.com> <1161965751.2415.5.camel@bashful.x10sys.com> Message-ID: On Oct 27, 2006, at 9:15 AM, Reid Spencer wrote: > Is something wrong with one constant seed per day? Yes. Say I do one test run today. Tommorrow I do another test run. the out-nat won't be regenerated tomorrow but llc output will, the test will fail. -Chris From rspencer at reidspencer.com Fri Oct 27 11:15:51 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 27 Oct 2006 09:15:51 -0700 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile In-Reply-To: <64203FCF-AD05-4A40-9825-D8541EC5A563@apple.com> References: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> <64203FCF-AD05-4A40-9825-D8541EC5A563@apple.com> Message-ID: <1161965751.2415.5.camel@bashful.x10sys.com> Is something wrong with one constant seed per day? Reid. On Fri, 2006-10-27 at 09:04 -0700, Chris Lattner wrote: > Please change this to set the seed to a constant in main(). > > -Chris > > On Oct 27, 2006, at 8:45 AM, Reid Spencer wrote: > > > > > > > Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: > > > > rem.c added (r1.1) > > Makefile updated: 1.2 -> 1.3 > > --- > > Log message: > > > > Add a test for remainder testing. Also, in the Makefile, compute a > > seed > > for the random number generator based on julian date so that rem isn't > > always running the same test but it runs the same on any given day. > > > > Thanks to Domagoj Babic for writing this! > > > > > > --- > > Diffs of the changes: (+160 -1) > > > > Makefile | 3 - > > rem.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > ++++++++++++ > > 2 files changed, 160 insertions(+), 1 deletion(-) > > > > > > Index: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c > > diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/ > > rem.c:1.1 > > *** /dev/null Fri Oct 27 10:45:35 2006 > > --- llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Fri Oct 27 > > 10:45:24 2006 > > *************** > > *** 0 **** > > --- 1,158 ---- > > + #include > > + #include > > + > > + // Simple REM test case. Tests some basic properties of remainder > > + // operation. > > + > > + // All macros must evaluate to true. x,y can be signed/unsigned, m > > + // should be unsigned. > > + > > + // Returns true if multiplication will overflow. > > + #define MultOverflow(x,y) ((((x) * (y)) / (y)) != (x)) > > + > > + // x == y => (x mod m) == (y mod m) > > + #define CongruenceTest(x,y,m) \ > > + (((x) != (y)) || (((x) % (m)) == ((y) % (m)))) > > + > > + > > + /****************************************************************** > > + * These three tests can be done only for unsigned case because they > > + * contain add/sub. If you're eager to get this working with signed > > + * numbers, take care of overflows. > > + ******************************************************************/ > > + > > + // Return true if add/sub will cause overflow. > > + #define UnsignedAddOverflow(x,y) (((x) + (y)) < (x)) > > + #define UnsignedSubUnderflow(x,y) (((x) - (y)) > (x)) > > + > > + // ((x % m) + (y % m)) % m = (x + y) % m > > + #define AdditionOfCongruences(x,y,m) \ > > + (UnsignedAddOverflow((x)%(m),(y)%(m)) || \ > > + UnsignedAddOverflow((x),(y)) || \ > > + (((((x) % (m)) + ((y) % (m))) % m) == (((x) + (y)) % (m)))) > > + > > + // ((x % m) == ((y + z) % m)) == (((x - z) % m) == (y % m)) > > + #define SimpleCongruenceEquation(x,y,z,m) \ > > + (UnsignedAddOverflow((y),(z)) || \ > > + UnsignedSubUnderflow((x),(z)) || \ > > + ((((x) % (m)) == (((y) + (z)) % (m))) % m) == \ > > + ((((x) - (z)) % (m)) == ((y) % (m)))) > > + > > + // If y*m does not overflow: (x % m) == (x + y*m) % m > > + #define AdditionOfMultipleOfModIsNOP(x,y,m) \ > > + (MultOverflow(y,m) || \ > > + UnsignedAddOverflow((x),(y)*(m)) || \ > > + (((x) % (m)) == (((x) + ((y)*(m))) % (m)))) > > + > > + /******************************************************************/ > > + > > + // Greatest common divisor > > + long gcd(long a, long b) { > > + long c; > > + while(1) { > > + c = a % b; > > + if(c == 0) return b; > > + a = b; > > + b = c; > > + } > > + } > > + > > + // If gcd(z,m)==1: ((x == y) % m) == ((x / z == y / z) % m). This > > holds > > + // only if both sides are actually divisble by z. > > + #define BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod > > (x,y,z,m) \ > > + ((gcd((z),(m)) != 1) || ((z) == 0) || \ > > + (gcd((x),(z)) != (z)) || ((gcd((y),(z)) != (z))) || \ > > + (((x) % (m)) == ((y) % (m))) == (((((x) / (z)) % m) == > > (((y) / (z))) % m))) > > + > > + // If z divides x,y,m: ((x % m) == (y % m)) == (((x/z) % (m/z)) > > == ((y/z) % (m/z))) > > + #define DivideBothSidesAndModulus(x,y,z,m) \ > > + (((z) == 0) || (gcd((x),(z)) != (z)) || \ > > + (gcd((y),(z)) != (z)) || \ > > + (gcd((m),(z)) != (z)) || \ > > + (((x)%(m)) == ((y)%(m))) == \ > > + ((((x)/(z)) % ((m)/(z))) == (((y)/(z)) % ((m)/(z))))) > > + > > + // If z divides m, than: ((x % m) == (y % m)) == ((x % z) == (y % > > z)) > > + // z should be unsigned. > > + #define SubModulusTest(x,y,z,m) \ > > + (((z) == 0) || (gcd((m),(z)) != (z)) || \ > > + ((((x)%(m)) == ((y)%(m))) == (((x)%(z)) == ((y)%(z))))) > > + > > + // Runs the test c under number t. > > + #define test(t,c) \ > > + if (!c) { \ > > + printf("Test #%u, failed in iteration #: %u\n", t, idx); \ > > + printf("Failing test vector:\n"); \ > > + printf("m=%u, x_u=%u, y_u=%u, z_u=%u, x_s=%d, y_s=%d, z_s=%d\n", \ > > + m, x_u, y_u, z_u, x_s, y_s, z_s); \ > > + return 1; \ > > + } > > + > > + // The higher the number the better the testing. > > + #define ITERATIONS 100 > > + > > + int main(int argc, char **argv) { > > + // Since the test vectors are printed out anyways, I suggest > > leaving > > + // the test nondeterministic. Many people run tests on various > > + // machines, so REM-related code will be covered with a much > > better > > + // coverage... If you really don't like the idea of having > > better > > + // coverage, uncomment the srand line: > > + > > + if (argc > 1) { > > + int seed = atoi(argv[1]); > > + srand(seed); > > + } > > + > > + unsigned idx = 0; > > + for (; idx < ITERATIONS; ++idx) { > > + unsigned m = (unsigned)rand(); > > + > > + if (m == 0) { // Repeat again > > + idx--; continue; > > + } > > + > > + unsigned x_u = (unsigned)rand(); > > + unsigned y_u = (unsigned)rand(); > > + unsigned z_u = (unsigned)rand(); > > + > > + int x_s = (rand() % 2) ? rand() : -rand(); > > + int y_s = (rand() % 2) ? rand() : -rand(); > > + int z_s = (rand() % 2) ? rand() : -rand(); > > + > > + test(1, CongruenceTest(x_s, y_s, m)); > > + test(2, CongruenceTest(x_s, y_u, m)); > > + test(3, CongruenceTest(x_u, y_s, m)); > > + test(4, CongruenceTest(x_u, y_u, m)); > > + > > + test(5, AdditionOfCongruences(x_u, y_u, m)); > > + > > + test(6, SimpleCongruenceEquation(x_u, y_u, z_u, m)); > > + > > + test(7, AdditionOfMultipleOfModIsNOP(x_u, y_u, m)); > > + > > + test(8, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_s, z_s, > > m)); > > + test(9, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_s, z_u, > > m)); > > + test(10, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_u, z_s, > > m)); > > + test(11, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_s, y_u, z_u, > > m)); > > + test(12, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_s, z_s, > > m)); > > + test(13, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_s, z_u, > > m)); > > + test(14, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_u, z_s, > > m)); > > + test(15, > > BothSidesCanBeDividedWithDivisorMutuallyPrimeWithMod(x_u, y_u, z_u, > > m)); > > + > > + test(16, DivideBothSidesAndModulus(x_s, y_s, z_s, m)); > > + test(17, DivideBothSidesAndModulus(x_s, y_s, z_u, m)); > > + test(18, DivideBothSidesAndModulus(x_s, y_u, z_s, m)); > > + test(19, DivideBothSidesAndModulus(x_s, y_u, z_u, m)); > > + test(20, DivideBothSidesAndModulus(x_u, y_s, z_s, m)); > > + test(21, DivideBothSidesAndModulus(x_u, y_s, z_u, m)); > > + test(22, DivideBothSidesAndModulus(x_u, y_u, z_s, m)); > > + test(23, DivideBothSidesAndModulus(x_u, y_u, z_u, m)); > > + > > + test(25, SubModulusTest(x_s, y_s, z_u, m)); > > + test(27, SubModulusTest(x_s, y_u, z_u, m)); > > + test(29, SubModulusTest(x_u, y_s, z_u, m)); > > + test(31, SubModulusTest(x_u, y_u, z_u, m)); > > + } > > + printf("\n *** REM test done! ***\n"); > > + return 0; > > + } > > > > > > Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile > > diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 > > llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 > > --- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2 Tue > > Oct 24 19:59:01 2006 > > +++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Fri Oct > > 27 10:45:24 2006 > > @@ -1,5 +1,6 @@ > > # SingleSource/UnitTests/Vector/Makefile > > LEVEL = ../../.. > > -PROG=div > > +SEED := $(shell date +%j) > > +RUN_OPTIONS := $(SEED) > > include $(LEVEL)/Makefile.config > > include $(LEVEL)/SingleSource/Makefile.singlesrc > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From rspencer at reidspencer.com Fri Oct 27 11:35:07 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 27 Oct 2006 09:35:07 -0700 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile In-Reply-To: References: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> <64203FCF-AD05-4A40-9825-D8541EC5A563@apple.com> <1161965751.2415.5.camel@bashful.x10sys.com> Message-ID: <1161966907.2415.10.camel@bashful.x10sys.com> Okay. I'm going to allow the seed to still be specified in the Makefile though, just to a constant fixed value .. so you can easily try different seeds (assuming you also remember to "make clean") Reid. On Fri, 2006-10-27 at 09:24 -0700, Chris Lattner wrote: > On Oct 27, 2006, at 9:15 AM, Reid Spencer wrote: > > > Is something wrong with one constant seed per day? > > Yes. Say I do one test run today. > > Tommorrow I do another test run. > > the out-nat won't be regenerated tomorrow but llc output will, the > test will fail. > > -Chris From reid at x10sys.com Fri Oct 27 11:38:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 11:38:06 -0500 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Message-ID: <200610271638.k9RGc6r6024304@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: Makefile updated: 1.3 -> 1.4 --- Log message: 1. Add some comments about the seed values for the random number generate 2. Make the seed a constant value for reliable results. --- Diffs of the changes: (+9 -1) Makefile | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.4 --- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 Fri Oct 27 10:45:24 2006 +++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Fri Oct 27 11:37:45 2006 @@ -1,6 +1,14 @@ # SingleSource/UnitTests/Vector/Makefile LEVEL = ../../.. + +# You can use this seed value to get a different test +# each day, but don't forget to 'make clean' To use it, +# change RUN_OPTIONS (below) to be $(SEED) SEED := $(shell date +%j) -RUN_OPTIONS := $(SEED) + +# Use a consistent seed value for the tests so they produce +# the same results regardless of whether you make clean or not. +RUN_OPTIONS := 31415926 + include $(LEVEL)/Makefile.config include $(LEVEL)/SingleSource/Makefile.singlesrc From reid at x10sys.com Fri Oct 27 11:44:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 11:44:11 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore Message-ID: <200610271644.k9RGiBHb012882@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: .cvsignore added (r1.1) --- Log message: Improve cvs ignoring of test results. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore diff -c /dev/null llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore:1.1 *** /dev/null Fri Oct 27 11:43:44 2006 --- llvm/test/Regression/Transforms/PredicateSimplifier/.cvsignore Fri Oct 27 11:43:34 2006 *************** *** 0 **** --- 1 ---- + Output From reid at x10sys.com Fri Oct 27 11:44:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 11:44:11 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/.cvsignore Message-ID: <200610271644.k9RGiBLN012881@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: .cvsignore added (r1.1) --- Log message: Improve cvs ignoring of test results. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CodeGen/ARM/.cvsignore diff -c /dev/null llvm/test/Regression/CodeGen/ARM/.cvsignore:1.1 *** /dev/null Fri Oct 27 11:43:44 2006 --- llvm/test/Regression/CodeGen/ARM/.cvsignore Fri Oct 27 11:43:33 2006 *************** *** 0 **** --- 1 ---- + Output From reid at x10sys.com Fri Oct 27 11:44:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 11:44:11 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/.cvsignore Message-ID: <200610271644.k9RGiBSG012880@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/DSGraph: .cvsignore updated: 1.1 -> 1.2 --- Log message: Improve cvs ignoring of test results. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/Analysis/DSGraph/.cvsignore diff -u llvm/test/Regression/Analysis/DSGraph/.cvsignore:1.1 llvm/test/Regression/Analysis/DSGraph/.cvsignore:1.2 --- llvm/test/Regression/Analysis/DSGraph/.cvsignore:1.1 Thu Mar 23 17:41:54 2006 +++ llvm/test/Regression/Analysis/DSGraph/.cvsignore Fri Oct 27 11:43:32 2006 @@ -1,3 +1,4 @@ Output *.log *.sum +ds.* From reid at x10sys.com Fri Oct 27 11:44:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 11:44:11 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LCSSA/.cvsignore Message-ID: <200610271644.k9RGiB98012883@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LCSSA: .cvsignore added (r1.1) --- Log message: Improve cvs ignoring of test results. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/Transforms/LCSSA/.cvsignore diff -c /dev/null llvm/test/Regression/Transforms/LCSSA/.cvsignore:1.1 *** /dev/null Fri Oct 27 11:43:44 2006 --- llvm/test/Regression/Transforms/LCSSA/.cvsignore Fri Oct 27 11:43:34 2006 *************** *** 0 **** --- 1 ---- + Output From clattner at apple.com Fri Oct 27 11:53:13 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 27 Oct 2006 09:53:13 -0700 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/rem.c Makefile In-Reply-To: <1161966907.2415.10.camel@bashful.x10sys.com> References: <200610271545.k9RFjjSU011052@zion.cs.uiuc.edu> <64203FCF-AD05-4A40-9825-D8541EC5A563@apple.com> <1161965751.2415.5.camel@bashful.x10sys.com> <1161966907.2415.10.camel@bashful.x10sys.com> Message-ID: On Oct 27, 2006, at 9:35 AM, Reid Spencer wrote: > Okay. I'm going to allow the seed to still be specified in the > Makefile > though, just to a constant fixed value .. so you can easily try > different seeds (assuming you also remember to "make clean") Ok, thx! -Chris > Reid. > > On Fri, 2006-10-27 at 09:24 -0700, Chris Lattner wrote: >> On Oct 27, 2006, at 9:15 AM, Reid Spencer wrote: >> >>> Is something wrong with one constant seed per day? >> >> Yes. Say I do one test run today. >> >> Tommorrow I do another test run. >> >> the out-nat won't be regenerated tomorrow but llc output will, the >> test will fail. >> >> -Chris > From jlaskey at apple.com Fri Oct 27 13:05:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 13:05:30 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/FoldingSet.h Message-ID: <200610271805.k9RI5U7T007829@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: FoldingSet.h updated: 1.1 -> 1.2 --- Log message: Apply editorials. --- Diffs of the changes: (+58 -87) FoldingSet.h | 145 +++++++++++++++++++++++------------------------------------ 1 files changed, 58 insertions(+), 87 deletions(-) Index: llvm/include/llvm/ADT/FoldingSet.h diff -u llvm/include/llvm/ADT/FoldingSet.h:1.1 llvm/include/llvm/ADT/FoldingSet.h:1.2 --- llvm/include/llvm/ADT/FoldingSet.h:1.1 Fri Oct 27 11:16:16 2006 +++ llvm/include/llvm/ADT/FoldingSet.h Fri Oct 27 13:05:12 2006 @@ -35,6 +35,8 @@ /// establish the unique bits of data for the node. The Profile method is /// passed a FoldingSetNodeID object which is used to gather the bits. Just /// call one of the Add* functions defined in the FoldingSetImpl::NodeID class. +/// NOTE: That the folding set does not own the nodes and it is the +/// responsibility of the user to dispose of the nodes. /// /// Eg. /// class MyNode : public FoldingSetNode { @@ -81,7 +83,7 @@ /// If found then M with be non-NULL, else InsertPoint will point to where it /// should be inserted using InsertNode. /// -/// 3) If you get a NULL result from FindNodeOrInsertPos then you can ass a new +/// 3) If you get a NULL result from FindNodeOrInsertPos then you can as a new /// node with FindNodeOrInsertPos; /// /// InsertNode(N, InsertPoint); @@ -90,7 +92,7 @@ /// /// bool WasRemoved = RemoveNode(N); /// -/// The result indicates whether the node did exist in the folding set. +/// The result indicates whether the node existed in the folding set. //===----------------------------------------------------------------------===// @@ -102,14 +104,16 @@ /// class FoldingSetImpl { private: - // Buckets - Array of bucket chains. + /// Buckets - Array of bucket chains. + /// void **Buckets; - // NumBuckets - Length of the Buckets array. Always a power of 2. + /// NumBuckets - Length of the Buckets array. Always a power of 2. + /// unsigned NumBuckets; - // NumNodes - Number of nodes in the folding set. Growth occurs when NumNodes - // is greater than twice teh number of buckets. + /// NumNodes - Number of nodes in the folding set. Growth occurs when NumNodes + /// is greater than twice the number of buckets. unsigned NumNodes; public: @@ -163,16 +167,16 @@ /// class Node { private: - // nextInBucket - next linek in the bucket list. - void *nextInBucket; + // NextInFoldingSetBucket - next link in the bucket list. + void *NextInFoldingSetBucket; public: - Node() : nextInBucket(0) {} + Node() : NextInFoldingSetBucket(0) {} // Accessors - void *getNextInBucket() const { return nextInBucket; } - void SetNextInBucket(void *N) { nextInBucket = N; } + void *getNextInBucket() const { return NextInFoldingSetBucket; } + void SetNextInBucket(void *N) { NextInFoldingSetBucket = N; } }; /// RemoveNode - Remove a node from the folding set, returning true if one @@ -194,85 +198,52 @@ /// FindNodeOrInsertPos. void InsertNode(Node *N, void *InsertPos); - private: - /// GetNextPtr - In order to save space, each bucket is a - /// singly-linked-list. In order to make deletion more efficient, we make - /// the list circular, so we can delete a node without computing its hash. - /// The problem with this is that the start of the hash buckets are not - /// Nodes. If NextInBucketPtr is a bucket pointer, this method returns null - /// : use GetBucketPtr when this happens. - Node *GetNextPtr(void *NextInBucketPtr); - - /// GetNextPtr - This is just like the previous GetNextPtr implementation, - /// but allows a bucket array to be specified. - Node *GetNextPtr(void *NextInBucketPtr, void **Buckets, unsigned NumBuck); - - /// GetBucketPtr - Provides a casting of a bucket pointer for isNode - /// testing. - void **GetBucketPtr(void *NextInBucketPtr); - - /// GetBucketFor - Hash the specified node ID and return the hash bucket for - /// the specified ID. - void **GetBucketFor(const NodeID &ID) const; - - /// GrowHashTable - Double the size of the hash table and rehash everything. - /// - void GrowHashTable(); - - protected: +private: + + /// GrowHashTable - Double the size of the hash table and rehash everything. + /// + void GrowHashTable(); - /// GetNodeProfile - Instantiations of the FoldingSet template implement - /// this function to gather data bits for teh given node. - virtual void GetNodeProfile(NodeID &ID, Node *N) = 0; - }; +protected: - // Convenence types to hide the implementation of the folding set. - typedef FoldingSetImpl::Node FoldingSetNode; - typedef FoldingSetImpl::NodeID FoldingSetNodeID; + /// GetNodeProfile - Instantiations of the FoldingSet template implement + /// this function to gather data bits for the given node. + virtual void GetNodeProfile(NodeID &ID, Node *N) const = 0; +}; - //===--------------------------------------------------------------------===// - /// FoldingSet - This template class is used to instantiate a specialized - /// implementation of the folding set to the node class T. T must be a - /// subclass of FoldingSetNode and implement a Profile function. - /// - template class FoldingSet : public FoldingSetImpl { - private: - /// GetNodeProfile - Each instantiatation of the FoldingSet - virtual void GetNodeProfile(NodeID &ID, Node *N) { - T *TN = static_cast(N); - TN->Profile(ID); - } - - public: - /// RemoveNode - Remove a node from the folding set, returning true if one - /// was removed or false if the node was not in the folding set. - bool RemoveNode(T *N) { - return FoldingSetImpl::RemoveNode(static_cast(N)); - } - - /// GetOrInsertNode - If there is an existing simple Node exactly - /// equal to the specified node, return it. Otherwise, insert 'N' and - /// return it instead. - T *GetOrInsertNode(Node *N) { - return static_cast(FoldingSetImpl::GetOrInsertNode( - static_cast(N))); - } - - /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, - /// return it. If not, return the insertion token that will make insertion - /// faster. - T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) { - return static_cast(FoldingSetImpl::FindNodeOrInsertPos(ID, - InsertPos)); - } - - /// InsertNode - Insert the specified node into the folding set, knowing - /// that it is not already in the folding set. InsertPos must be obtained - /// from FindNodeOrInsertPos. - void InsertNode(T *N, void *InsertPos) { - FoldingSetImpl::InsertNode(static_cast(N), InsertPos); - } - }; +// Convenience types to hide the implementation of the folding set. +typedef FoldingSetImpl::Node FoldingSetNode; +typedef FoldingSetImpl::NodeID FoldingSetNodeID; + +//===--------------------------------------------------------------------===// +/// FoldingSet - This template class is used to instantiate a specialized +/// implementation of the folding set to the node class T. T must be a +/// subclass of FoldingSetNode and implement a Profile function. +/// +template class FoldingSet : public FoldingSetImpl { +private: + /// GetNodeProfile - Each instantiatation of the FoldingSet + virtual void GetNodeProfile(NodeID &ID, Node *N) const { + T *TN = static_cast(N); + TN->Profile(ID); + } + +public: + /// GetOrInsertNode - If there is an existing simple Node exactly + /// equal to the specified node, return it. Otherwise, insert 'N' and + /// return it instead. + T *GetOrInsertNode(Node *N) { + return static_cast(FoldingSetImpl::GetOrInsertNode(N)); + } + + /// FindNodeOrInsertPos - Look up the node specified by ID. If it exists, + /// return it. If not, return the insertion token that will make insertion + /// faster. + T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) { + return static_cast(FoldingSetImpl::FindNodeOrInsertPos(ID, + InsertPos)); + } +}; }; // End of namespace llvm. From jlaskey at apple.com Fri Oct 27 13:05:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 13:05:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610271805.k9RI5UKJ007828@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.1 -> 1.2 --- Log message: Apply editorials. --- Diffs of the changes: (+55 -43) FoldingSet.cpp | 98 +++++++++++++++++++++++++++++++-------------------------- 1 files changed, 55 insertions(+), 43 deletions(-) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.1 llvm/lib/Support/FoldingSet.cpp:1.2 --- llvm/lib/Support/FoldingSet.cpp:1.1 Fri Oct 27 11:16:16 2006 +++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 13:05:12 2006 @@ -15,9 +15,7 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/FoldingSet.h" - #include "llvm/ADT/MathExtras.h" - using namespace llvm; //===----------------------------------------------------------------------===// @@ -49,21 +47,40 @@ Bits.push_back(FloatToBits(F)); } void FoldingSetImpl::NodeID::AddDouble(double D) { - Bits.push_back(DoubleToBits(D)); + AddInteger(DoubleToBits(D)); } void FoldingSetImpl::NodeID::AddString(const std::string &String) { - // Note: An assumption is made here that strings are composed of one byte - // chars. unsigned Size = String.size(); - unsigned Units = Size / sizeof(unsigned); + unsigned Units = Size / 4; + unsigned Pos = 0; const unsigned *Base = (const unsigned *)String.data(); - Bits.insert(Bits.end(), Base, Base + Units); - if (Size & 3) { - unsigned V = 0; - for (unsigned i = Units * sizeof(unsigned); i < Size; ++i) - V = (V << 8) | String[i]; - Bits.push_back(V); + + // If the string is aligned do a bulk transfer. + if (!((intptr_t)Base & 3)) { + Bits.insert(Bits.end(), Base, Base + Units); + Pos = Units * sizeof(unsigned); + } else { + // Otherwise do it the hard way. + for ( Pos += 4; Pos < Size; Pos += 4) { + unsigned V = ((unsigned char)String[Pos - 4] << 24) | + ((unsigned char)String[Pos - 3] << 16) | + ((unsigned char)String[Pos - 2] << 8) | + (unsigned char)String[Pos - 1]; + Bits.push_back(V); + } } + + // With the leftover bits. + unsigned V = 0; + // Pos will have overshot size by 4 - #bytes left over. + switch (Pos - Size) { + case 1: V = (V << 8) | (unsigned char)String[Size - 3]; // Fall thru. + case 2: V = (V << 8) | (unsigned char)String[Size - 2]; // Fall thru. + case 3: V = (V << 8) | (unsigned char)String[Size - 1]; break; + case 0: return; // Nothing left. + } + + Bits.push_back(V); } /// ComputeHash - Compute a strong hash value for this NodeID, used to @@ -98,16 +115,7 @@ //===----------------------------------------------------------------------===// -// FoldingSetImpl Implementation - -FoldingSetImpl::FoldingSetImpl() : NumNodes(0) { - NumBuckets = 64; - Buckets = new void*[NumBuckets]; - memset(Buckets, 0, NumBuckets*sizeof(void*)); -} -FoldingSetImpl::~FoldingSetImpl() { - delete [] Buckets; -} +/// Helper functions for FoldingSetImpl. /// GetNextPtr - In order to save space, each bucket is a /// singly-linked-list. In order to make deletion more efficient, we make @@ -115,34 +123,38 @@ /// The problem with this is that the start of the hash buckets are not /// Nodes. If NextInBucketPtr is a bucket pointer, this method returns null /// : use GetBucketPtr when this happens. -FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr) { - if (NextInBucketPtr >= Buckets && NextInBucketPtr < Buckets+NumBuckets) - return 0; - return static_cast(NextInBucketPtr); -} - -/// GetNextPtr - This is just like the previous GetNextPtr implementation, -/// but allows a bucket array to be specified. -FoldingSetImpl::Node *FoldingSetImpl::GetNextPtr(void *NextInBucketPtr, - void **Bucks, - unsigned NumBuck) { - if (NextInBucketPtr >= Bucks && NextInBucketPtr < Bucks+NumBuck) +static FoldingSetImpl::Node *GetNextPtr(void *NextInBucketPtr, + void **Buckets, unsigned NumBuckets) { + if (NextInBucketPtr >= Buckets && NextInBucketPtr < Buckets + NumBuckets) return 0; - return static_cast(NextInBucketPtr); + return static_cast(NextInBucketPtr); } /// GetBucketPtr - Provides a casting of a bucket pointer for isNode /// testing. -void **FoldingSetImpl::GetBucketPtr(void *NextInBucketPtr) { +static void **GetBucketPtr(void *NextInBucketPtr) { return static_cast(NextInBucketPtr); } /// GetBucketFor - Hash the specified node ID and return the hash bucket for /// the specified ID. -void **FoldingSetImpl::GetBucketFor(const NodeID &ID) const { +static void **GetBucketFor(const FoldingSetImpl::NodeID &ID, + void **Buckets, unsigned NumBuckets) { // NumBuckets is always a power of 2. unsigned BucketNum = ID.ComputeHash() & (NumBuckets-1); - return Buckets+BucketNum; + return Buckets + BucketNum; +} + +//===----------------------------------------------------------------------===// +// FoldingSetImpl Implementation + +FoldingSetImpl::FoldingSetImpl() : NumNodes(0) { + NumBuckets = 64; + Buckets = new void*[NumBuckets]; + memset(Buckets, 0, NumBuckets*sizeof(void*)); +} +FoldingSetImpl::~FoldingSetImpl() { + delete [] Buckets; } /// GrowHashTable - Double the size of the hash table and rehash everything. @@ -171,7 +183,7 @@ // Insert the node into the new bucket, after recomputing the hash. NodeID ID; GetNodeProfile(ID, NodeInBucket); - InsertNode(NodeInBucket, GetBucketFor(ID)); + InsertNode(NodeInBucket, GetBucketFor(ID, Buckets, NumBuckets)); } } @@ -183,12 +195,12 @@ /// faster. FoldingSetImpl::Node *FoldingSetImpl::FindNodeOrInsertPos(const NodeID &ID, void *&InsertPos) { - void **Bucket = GetBucketFor(ID); + void **Bucket = GetBucketFor(ID, Buckets, NumBuckets); void *Probe = *Bucket; InsertPos = 0; - while (Node *NodeInBucket = GetNextPtr(Probe)) { + while (Node *NodeInBucket = GetNextPtr(Probe, Buckets, NumBuckets)) { NodeID OtherID; GetNodeProfile(OtherID, NodeInBucket); if (OtherID == ID) @@ -212,7 +224,7 @@ GrowHashTable(); NodeID ID; GetNodeProfile(ID, N); - InsertPos = GetBucketFor(ID); + InsertPos = GetBucketFor(ID, Buckets, NumBuckets); } /// The insert position is actually a bucket pointer. @@ -244,7 +256,7 @@ void *NodeNextPtr = Ptr; N->SetNextInBucket(0); while (true) { - if (Node *NodeInBucket = GetNextPtr(Ptr)) { + if (Node *NodeInBucket = GetNextPtr(Ptr, Buckets, NumBuckets)) { // Advance pointer. Ptr = NodeInBucket->getNextInBucket(); From isanbard at gmail.com Fri Oct 27 13:47:52 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Oct 2006 13:47:52 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610271847.k9RIlqMK020157@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.2 -> 1.3 --- Log message: MathExtras isn't in the llvm/ADT directory but in the llvm/Support directory. --- Diffs of the changes: (+1 -1) FoldingSet.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.2 llvm/lib/Support/FoldingSet.cpp:1.3 --- llvm/lib/Support/FoldingSet.cpp:1.2 Fri Oct 27 13:05:12 2006 +++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 13:47:29 2006 @@ -15,7 +15,7 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/FoldingSet.h" -#include "llvm/ADT/MathExtras.h" +#include "llvm/Support/MathExtras.h" using namespace llvm; //===----------------------------------------------------------------------===// From evan.cheng at apple.com Fri Oct 27 13:49:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Oct 2006 13:49:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200610271849.k9RInNDb020202@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.279 -> 1.280 --- Log message: Fix for PR968: http://llvm.org/PR968 : expand vector sdiv, udiv, srem, urem. --- Diffs of the changes: (+16 -9) X86ISelLowering.cpp | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.279 llvm/lib/Target/X86/X86ISelLowering.cpp:1.280 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.279 Wed Oct 25 16:49:50 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Oct 27 13:49:08 2006 @@ -287,7 +287,15 @@ VT != (unsigned)MVT::LAST_VALUETYPE; VT++) { setOperationAction(ISD::ADD , (MVT::ValueType)VT, Expand); setOperationAction(ISD::SUB , (MVT::ValueType)VT, Expand); + setOperationAction(ISD::FADD, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::FSUB, (MVT::ValueType)VT, Expand); setOperationAction(ISD::MUL , (MVT::ValueType)VT, Expand); + setOperationAction(ISD::FMUL, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::SDIV, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::UDIV, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::FDIV, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::SREM, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::UREM, (MVT::ValueType)VT, Expand); setOperationAction(ISD::LOAD, (MVT::ValueType)VT, Expand); setOperationAction(ISD::VECTOR_SHUFFLE, (MVT::ValueType)VT, Expand); setOperationAction(ISD::EXTRACT_VECTOR_ELT, (MVT::ValueType)VT, Expand); @@ -308,12 +316,10 @@ if (Subtarget->hasSSE1()) { addRegisterClass(MVT::v4f32, X86::VR128RegisterClass); - setOperationAction(ISD::AND, MVT::v4f32, Legal); - setOperationAction(ISD::OR, MVT::v4f32, Legal); - setOperationAction(ISD::XOR, MVT::v4f32, Legal); - setOperationAction(ISD::ADD, MVT::v4f32, Legal); - setOperationAction(ISD::SUB, MVT::v4f32, Legal); - setOperationAction(ISD::MUL, MVT::v4f32, Legal); + setOperationAction(ISD::FADD, MVT::v4f32, Legal); + setOperationAction(ISD::FSUB, MVT::v4f32, Legal); + setOperationAction(ISD::FMUL, MVT::v4f32, Legal); + setOperationAction(ISD::FDIV, MVT::v4f32, Legal); setOperationAction(ISD::LOAD, MVT::v4f32, Legal); setOperationAction(ISD::BUILD_VECTOR, MVT::v4f32, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v4f32, Custom); @@ -328,16 +334,17 @@ addRegisterClass(MVT::v4i32, X86::VR128RegisterClass); addRegisterClass(MVT::v2i64, X86::VR128RegisterClass); - setOperationAction(ISD::ADD, MVT::v2f64, Legal); setOperationAction(ISD::ADD, MVT::v16i8, Legal); setOperationAction(ISD::ADD, MVT::v8i16, Legal); setOperationAction(ISD::ADD, MVT::v4i32, Legal); - setOperationAction(ISD::SUB, MVT::v2f64, Legal); setOperationAction(ISD::SUB, MVT::v16i8, Legal); setOperationAction(ISD::SUB, MVT::v8i16, Legal); setOperationAction(ISD::SUB, MVT::v4i32, Legal); setOperationAction(ISD::MUL, MVT::v8i16, Legal); - setOperationAction(ISD::MUL, MVT::v2f64, Legal); + setOperationAction(ISD::FADD, MVT::v2f64, Legal); + setOperationAction(ISD::FSUB, MVT::v2f64, Legal); + setOperationAction(ISD::FMUL, MVT::v2f64, Legal); + setOperationAction(ISD::FDIV, MVT::v2f64, Legal); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v16i8, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v8i16, Custom); From reid at x10sys.com Fri Oct 27 13:59:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 13:59:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200610271859.k9RIxBdg020393@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.210 -> 1.211 --- Log message: Make the Value and Type methods print a newline so it prints nicely in gdb --- Diffs of the changes: (+2 -2) AsmWriter.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.210 llvm/lib/VMCore/AsmWriter.cpp:1.211 --- llvm/lib/VMCore/AsmWriter.cpp:1.210 Sun Oct 22 01:06:56 2006 +++ llvm/lib/VMCore/AsmWriter.cpp Fri Oct 27 13:58:54 2006 @@ -1357,11 +1357,11 @@ // Value::dump - allow easy printing of Values from the debugger. // Located here because so much of the needed functionality is here. -void Value::dump() const { print(std::cerr); } +void Value::dump() const { print(std::cerr); std::cerr << '\n'; } // Type::dump - allow easy printing of Values from the debugger. // Located here because so much of the needed functionality is here. -void Type::dump() const { print(std::cerr); } +void Type::dump() const { print(std::cerr); std::cerr << '\n'; } //===----------------------------------------------------------------------===// // CachedWriter Class Implementation From jlaskey at apple.com Fri Oct 27 14:14:32 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 14:14:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610271914.k9RJEWg3020739@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.3 -> 1.4 --- Log message: Temp patch for missing functionality. --- Diffs of the changes: (+4 -0) FoldingSet.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.3 llvm/lib/Support/FoldingSet.cpp:1.4 --- llvm/lib/Support/FoldingSet.cpp:1.3 Fri Oct 27 13:47:29 2006 +++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 14:14:16 2006 @@ -56,10 +56,14 @@ const unsigned *Base = (const unsigned *)String.data(); // If the string is aligned do a bulk transfer. +#if 0 // FIXME - Add insert to SmallVector (tested with vector) if (!((intptr_t)Base & 3)) { Bits.insert(Bits.end(), Base, Base + Units); Pos = Units * sizeof(unsigned); } else { +#else + } +#endif // Otherwise do it the hard way. for ( Pos += 4; Pos < Size; Pos += 4) { unsigned V = ((unsigned char)String[Pos - 4] << 24) | From jlaskey at apple.com Fri Oct 27 14:38:53 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 14:38:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610271938.k9RJcr1j032046@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.5 -> 1.6 --- Log message: SmallVector append not insert. --- Diffs of the changes: (+1 -5) FoldingSet.cpp | 6 +----- 1 files changed, 1 insertion(+), 5 deletions(-) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.5 llvm/lib/Support/FoldingSet.cpp:1.6 --- llvm/lib/Support/FoldingSet.cpp:1.5 Fri Oct 27 14:20:12 2006 +++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 14:38:32 2006 @@ -56,14 +56,10 @@ const unsigned *Base = (const unsigned *)String.data(); // If the string is aligned do a bulk transfer. -#if 0 // FIXME - Add insert to SmallVector (tested with vector) if (!((intptr_t)Base & 3)) { - Bits.insert(Bits.end(), Base, Base + Units); + Bits.append(Base, Base + Units); Pos = Units * sizeof(unsigned); } else { -#else - { -#endif // Otherwise do it the hard way. for ( Pos += 4; Pos < Size; Pos += 4) { unsigned V = ((unsigned char)String[Pos - 4] << 24) | From jlaskey at apple.com Fri Oct 27 14:20:31 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 14:20:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610271920.k9RJKVG1002236@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.4 -> 1.5 --- Log message: Grrr. --- Diffs of the changes: (+1 -1) FoldingSet.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.4 llvm/lib/Support/FoldingSet.cpp:1.5 --- llvm/lib/Support/FoldingSet.cpp:1.4 Fri Oct 27 14:14:16 2006 +++ llvm/lib/Support/FoldingSet.cpp Fri Oct 27 14:20:12 2006 @@ -62,7 +62,7 @@ Pos = Units * sizeof(unsigned); } else { #else - } + { #endif // Otherwise do it the hard way. for ( Pos += 4; Pos < Size; Pos += 4) { From isanbard at gmail.com Fri Oct 27 15:22:18 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Oct 2006 15:22:18 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp Message-ID: <200610272022.k9RKMIWM008261@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.51 -> 1.52 --- Log message: Forgot a } --- Diffs of the changes: (+1 -0) CrashDebugger.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.51 llvm/tools/bugpoint/CrashDebugger.cpp:1.52 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.51 Fri Oct 27 15:18:06 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Fri Oct 27 15:22:04 2006 @@ -398,6 +398,7 @@ if (GVs.size() < OldSize) BD.EmitProgressBytecode("reduced-global-variables"); } + } } } From evan.cheng at apple.com Fri Oct 27 16:05:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Oct 2006 16:05:32 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_extract.ll Message-ID: <200610272105.k9RL5Wmw008882@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_extract.ll updated: 1.3 -> 1.4 --- Log message: Add a new vextract test case. --- Diffs of the changes: (+12 -2) vec_extract.ll | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/X86/vec_extract.ll diff -u llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.3 llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.4 --- llvm/test/Regression/CodeGen/X86/vec_extract.ll:1.3 Tue May 30 19:48:09 2006 +++ llvm/test/Regression/CodeGen/X86/vec_extract.ll Fri Oct 27 16:05:18 2006 @@ -1,6 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movss | wc -l | grep 3 && ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movhlps | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd | wc -l | grep 1 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep unpckhpd | wc -l | grep 1 void %test1(<4 x float>* %F, float* %f) { %tmp = load <4 x float>* %F @@ -17,9 +18,18 @@ ret float %tmp2 } -void %test2(float* %R, <4 x float>* %P1) { +void %test3(float* %R, <4 x float>* %P1) { %X = load <4 x float>* %P1 %tmp = extractelement <4 x float> %X, uint 3 store float %tmp, float* %R ret void } + +double %test4(double %A) { + %tmp1 = call <2 x double> %foo() + %tmp2 = extractelement <2 x double> %tmp1, uint 1 + %tmp3 = add double %tmp2, %A + ret double %tmp3 +} + +declare <2 x double> %foo() From evan.cheng at apple.com Fri Oct 27 16:08:46 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 27 Oct 2006 16:08:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td Message-ID: <200610272108.k9RL8kA8008984@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.280 -> 1.281 X86ISelLowering.h updated: 1.76 -> 1.77 X86InstrSSE.td updated: 1.166 -> 1.167 --- Log message: Fixed a significant bug where unpcklpd is incorrectly used to extract element 1 from a v2f64 value. --- Diffs of the changes: (+25 -6) X86ISelLowering.cpp | 11 +++++++++++ X86ISelLowering.h | 4 ++++ X86InstrSSE.td | 16 ++++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.280 llvm/lib/Target/X86/X86ISelLowering.cpp:1.281 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.280 Fri Oct 27 13:49:08 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Oct 27 16:08:32 2006 @@ -2868,6 +2868,17 @@ return ::isSplatMask(N); } +/// isSplatLoMask - Return true if the specified VECTOR_SHUFFLE operand +/// specifies a splat of zero element. +bool X86::isSplatLoMask(SDNode *N) { + assert(N->getOpcode() == ISD::BUILD_VECTOR); + + for (unsigned i = 0, e = N->getNumOperands(); i < e; ++i) + if (!isUndefOrEqual(N->getOperand(i), 0)) + return false; + return true; +} + /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP* /// instructions. Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.76 llvm/lib/Target/X86/X86ISelLowering.h:1.77 --- llvm/lib/Target/X86/X86ISelLowering.h:1.76 Fri Oct 20 12:42:20 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Fri Oct 27 16:08:32 2006 @@ -225,6 +225,10 @@ /// specifies a splat of a single element. bool isSplatMask(SDNode *N); + /// isSplatLoMask - Return true if the specified VECTOR_SHUFFLE operand + /// specifies a splat of zero element. + bool isSplatLoMask(SDNode *N); + /// getShuffleSHUFImmediate - Return the appropriate immediate to shuffle /// the specified isShuffleMask VECTOR_SHUFFLE mask with PSHUF* and SHUFP* /// instructions. Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.166 llvm/lib/Target/X86/X86InstrSSE.td:1.167 --- llvm/lib/Target/X86/X86InstrSSE.td:1.166 Wed Oct 25 16:35:05 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Fri Oct 27 16:08:32 2006 @@ -104,8 +104,8 @@ return X86::isSplatMask(N); }], SHUFFLE_get_shuf_imm>; -def SSE_splat_v2_mask : PatLeaf<(build_vector), [{ - return X86::isSplatMask(N); +def SSE_splat_lo_mask : PatLeaf<(build_vector), [{ + return X86::isSplatLoMask(N); }]>; def MOVHLPS_shuffle_mask : PatLeaf<(build_vector), [{ @@ -812,13 +812,13 @@ "movddup {$src, $dst|$dst, $src}", [(set VR128:$dst, (v2f64 (vector_shuffle VR128:$src, (undef), - SSE_splat_v2_mask)))]>; + SSE_splat_lo_mask)))]>; def MOVDDUPrm : S3DI<0x12, MRMSrcMem, (ops VR128:$dst, f64mem:$src), "movddup {$src, $dst|$dst, $src}", [(set VR128:$dst, (v2f64 (vector_shuffle (scalar_to_vector (loadf64 addr:$src)), (undef), - SSE_splat_v2_mask)))]>; + SSE_splat_lo_mask)))]>; // SSE2 instructions without OpSize prefix def Int_CVTDQ2PSrr : I<0x5B, MRMSrcReg, (ops VR128:$dst, VR128:$src), @@ -1908,10 +1908,14 @@ // Splat v2f64 / v2i64 let AddedComplexity = 10 in { -def : Pat<(vector_shuffle (v2f64 VR128:$src), (undef), SSE_splat_v2_mask:$sm), +def : Pat<(vector_shuffle (v2f64 VR128:$src), (undef), SSE_splat_lo_mask:$sm), (UNPCKLPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; -def : Pat<(vector_shuffle (v2i64 VR128:$src), (undef), SSE_splat_v2_mask:$sm), +def : Pat<(vector_shuffle (v2f64 VR128:$src), (undef), UNPCKH_shuffle_mask:$sm), + (UNPCKHPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; +def : Pat<(vector_shuffle (v2i64 VR128:$src), (undef), SSE_splat_lo_mask:$sm), (PUNPCKLQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; +def : Pat<(vector_shuffle (v2i64 VR128:$src), (undef), UNPCKH_shuffle_mask:$sm), + (PUNPCKHQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; } // Splat v4f32 From isanbard at gmail.com Fri Oct 27 15:18:20 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 27 Oct 2006 15:18:20 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/CrashDebugger.cpp Message-ID: <200610272018.k9RKIKQp008183@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: CrashDebugger.cpp updated: 1.50 -> 1.51 --- Log message: Re-added the part where it tries to remove all global variables first. --- Diffs of the changes: (+38 -13) CrashDebugger.cpp | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 38 insertions(+), 13 deletions(-) Index: llvm/tools/bugpoint/CrashDebugger.cpp diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.50 llvm/tools/bugpoint/CrashDebugger.cpp:1.51 --- llvm/tools/bugpoint/CrashDebugger.cpp:1.50 Wed Oct 25 13:36:14 2006 +++ llvm/tools/bugpoint/CrashDebugger.cpp Fri Oct 27 15:18:06 2006 @@ -357,22 +357,47 @@ if (BD.getProgram()->global_begin() != BD.getProgram()->global_end()) { // Now try to reduce the number of global variable initializers in the // module to something small. - std::vector GVs; + Module *M = CloneModule(BD.getProgram()); + bool DeletedInit = false; - for (Module::global_iterator I = BD.getProgram()->global_begin(), - E = BD.getProgram()->global_end(); I != E; ++I) - if (I->hasInitializer()) - GVs.push_back(I); - - if (GVs.size() > 1 && !BugpointIsInterrupted) { - std::cout << "\n*** Attempting to reduce the number of global variables " - << "in the testcase\n"; + for (Module::global_iterator I = M->global_begin(), E = M->global_end(); + I != E; ++I) + if (I->hasInitializer()) { + I->setInitializer(0); + I->setLinkage(GlobalValue::ExternalLinkage); + DeletedInit = true; + } - unsigned OldSize = GVs.size(); - ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs); + if (!DeletedInit) { + delete M; // No change made... + } else { + // See if the program still causes a crash... + std::cout << "\nChecking to see if we can delete global inits: "; - if (GVs.size() < OldSize) - BD.EmitProgressBytecode("reduced-global-variables"); + if (TestFn(BD, M)) { // Still crashes? + BD.setNewProgram(M); + std::cout << "\n*** Able to remove all global initializers!\n"; + } else { // No longer crashes? + std::cout << " - Removing all global inits hides problem!\n"; + delete M; + + std::vector GVs; + + for (Module::global_iterator I = BD.getProgram()->global_begin(), + E = BD.getProgram()->global_end(); I != E; ++I) + if (I->hasInitializer()) + GVs.push_back(I); + + if (GVs.size() > 1 && !BugpointIsInterrupted) { + std::cout << "\n*** Attempting to reduce the number of global " + << "variables in the testcase\n"; + + unsigned OldSize = GVs.size(); + ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs); + + if (GVs.size() < OldSize) + BD.EmitProgressBytecode("reduced-global-variables"); + } } } From sabre at nondot.org Fri Oct 27 16:32:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 16:32:24 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/or-branch.ll Message-ID: <200610272132.k9RLWONG009399@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: or-branch.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+19 -0) or-branch.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/CodeGen/X86/or-branch.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/or-branch.ll:1.1 *** /dev/null Fri Oct 27 16:32:20 2006 --- llvm/test/Regression/CodeGen/X86/or-branch.ll Fri Oct 27 16:32:10 2006 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | llc -march=x86 | not grep set + + void %foo(int %X, int %Y, int %Z) { + entry: + %tmp = tail call int (...)* %bar( ) ; [#uses=0] + %tmp = seteq int %X, 0 ; [#uses=1] + %tmp3 = setlt int %Y, 5 ; [#uses=1] + %tmp4 = or bool %tmp3, %tmp ; [#uses=1] + br bool %tmp4, label %cond_true, label %UnifiedReturnBlock + + cond_true: ; preds = %entry + %tmp5 = tail call int (...)* %bar( ) ; [#uses=0] + ret void + + UnifiedReturnBlock: ; preds = %entry + ret void + } + + declare int %bar(...) From sabre at nondot.org Fri Oct 27 16:36:18 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 16:36:18 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200610272136.k9RLaI8C009488@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h updated: 1.29 -> 1.30 --- Log message: Turn conditions like x Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.299 -> 1.300 --- Log message: Turn conditions like xcreateVirtualRegister(TLI.getRegClassFor(VT)); } + + /// isExportedInst - Return true if the specified value is an instruction + /// exported from its block. + bool isExportedInst(const Value *V) { + return ValueMap.count(V); + } unsigned CreateRegForValue(const Value *V); @@ -203,6 +209,7 @@ BasicBlock *BB = I->getParent(); for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) if (cast(*UI)->getParent() != BB || isa(*UI) || + // FIXME: Remove switchinst special case. isa(*UI)) return true; return false; @@ -448,6 +455,8 @@ return Root; } + SDOperand CopyValueToVirtualRegister(Value *V, unsigned Reg); + void visit(Instruction &I) { visit(I.getOpcode(), I); } void visit(unsigned Opcode, User &I) { @@ -485,6 +494,11 @@ std::set &OutputRegs, std::set &InputRegs); + void FindMergedConditions(Value *Cond, MachineBasicBlock *TBB, + MachineBasicBlock *FBB, MachineBasicBlock *CurBB, + unsigned Opc); + void ExportFromCurrentBlock(Value *V); + // Terminator instructions. void visitRet(ReturnInst &I); void visitBr(BranchInst &I); @@ -770,6 +784,128 @@ &NewValues[0], NewValues.size())); } +/// ExportFromCurrentBlock - If this condition isn't known to be exported from +/// the current basic block, add it to ValueMap now so that we'll get a +/// CopyTo/FromReg. +void SelectionDAGLowering::ExportFromCurrentBlock(Value *V) { + // No need to export constants. + if (!isa(V) && !isa(V)) return; + + // Already exported? + if (FuncInfo.isExportedInst(V)) return; + + unsigned Reg = FuncInfo.InitializeRegForValue(V); + PendingLoads.push_back(CopyValueToVirtualRegister(V, Reg)); +} + +/// FindMergedConditions - If Cond is an expression like +void SelectionDAGLowering::FindMergedConditions(Value *Cond, + MachineBasicBlock *TBB, + MachineBasicBlock *FBB, + MachineBasicBlock *CurBB, + unsigned Opc) { + // FIXME: HANDLE AND. + // FIXME: HANDLE NOT + + // If this node is not part of the or/and tree, emit it as a branch. + BinaryOperator *BOp = dyn_cast(Cond); + + if (!BOp || (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() || + BOp->getParent() != CurBB->getBasicBlock()) { + const BasicBlock *BB = CurBB->getBasicBlock(); + + // If the leaf of the tree is a setcond inst, merge the condition into the + // caseblock. + if (BOp && isa(BOp) && + // The operands of the setcc have to be in this block. We don't know + // how to export them from some other block. + (!isa(BOp->getOperand(0)) || + cast(BOp->getOperand(0))->getParent() == BB || + FuncInfo.isExportedInst(BOp->getOperand(0))) && + (!isa(BOp->getOperand(1)) || + cast(BOp->getOperand(1))->getParent() == BB || + FuncInfo.isExportedInst(BOp->getOperand(1)))) { + ExportFromCurrentBlock(BOp->getOperand(0)); + ExportFromCurrentBlock(BOp->getOperand(1)); + + ISD::CondCode SignCond, UnsCond, FPCond, Condition; + switch (BOp->getOpcode()) { + default: assert(0 && "Unknown setcc opcode!"); + case Instruction::SetEQ: + SignCond = ISD::SETEQ; + UnsCond = ISD::SETEQ; + FPCond = ISD::SETOEQ; + break; + case Instruction::SetNE: + SignCond = ISD::SETNE; + UnsCond = ISD::SETNE; + FPCond = ISD::SETUNE; + break; + case Instruction::SetLE: + SignCond = ISD::SETLE; + UnsCond = ISD::SETULE; + FPCond = ISD::SETOLE; + break; + case Instruction::SetGE: + SignCond = ISD::SETGE; + UnsCond = ISD::SETUGE; + FPCond = ISD::SETOGE; + break; + case Instruction::SetLT: + SignCond = ISD::SETLT; + UnsCond = ISD::SETULT; + FPCond = ISD::SETOLT; + break; + case Instruction::SetGT: + SignCond = ISD::SETGT; + UnsCond = ISD::SETUGT; + FPCond = ISD::SETOGT; + break; + } + + const Type *OpType = BOp->getOperand(0)->getType(); + if (const PackedType *PTy = dyn_cast(OpType)) + OpType = PTy->getElementType(); + + if (!FiniteOnlyFPMath() && OpType->isFloatingPoint()) + Condition = FPCond; + else if (OpType->isUnsigned()) + Condition = UnsCond; + else + Condition = SignCond; + + SelectionDAGISel::CaseBlock CB(Condition, BOp->getOperand(0), + BOp->getOperand(1), TBB, FBB, CurBB); + SwitchCases.push_back(CB); + return; + } + + // Create a CaseBlock record representing this branch. + SelectionDAGISel::CaseBlock CB(ISD::SETEQ, Cond, ConstantBool::getTrue(), + TBB, FBB, CurBB); + SwitchCases.push_back(CB); + ExportFromCurrentBlock(Cond); + return; + } + + // Codegen X | Y as: + // jmp_if_X TBB + // TmpBB: + // jmp_if_Y TBB + // jmp FBB + // + // This requires creation of TmpBB after CurBB. + MachineFunction::iterator BBI = CurBB; + MachineBasicBlock *TmpBB = new MachineBasicBlock(CurBB->getBasicBlock()); + CurBB->getParent()->getBasicBlockList().insert(++BBI, TmpBB); + + // Emit the LHS condition. + FindMergedConditions(BOp->getOperand(0), TBB, TmpBB, CurBB, Opc); + + // Emit the RHS condition into TmpBB. + FindMergedConditions(BOp->getOperand(1), TBB, FBB, TmpBB, Opc); +} + void SelectionDAGLowering::visitBr(BranchInst &I) { // Update machine-CFG edges. MachineBasicBlock *Succ0MBB = FuncInfo.MBBMap[I.getSuccessor(0)]; @@ -796,9 +932,38 @@ // now. Value *CondVal = I.getCondition(); MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; + + // If this is a series of conditions that are or'd or and'd together, emit + // this as a sequence of branches instead of setcc's with and/or operations. + // For example, instead of something like: + // cmp A, B + // C = seteq + // cmp D, E + // F = setle + // or C, F + // jnz foo + // Emit: + // cmp A, B + // je foo + // cmp D, E + // jle foo + // + if (BinaryOperator *BOp = dyn_cast(CondVal)) { + if (BOp->hasOneUse() && + (/*BOp->getOpcode() == Instruction::And ||*/ + BOp->getOpcode() == Instruction::Or)) { + FindMergedConditions(BOp, Succ0MBB, Succ1MBB, CurMBB, BOp->getOpcode()); + //std::cerr << "FOUND: " << SwitchCases.size() << " merged conditions:\n"; + //I.getParent()->dump(); + + visitSwitchCase(SwitchCases[0]); + SwitchCases.erase(SwitchCases.begin()); + return; + } + } // Create a CaseBlock record representing this branch. - SelectionDAGISel::CaseBlock CB(ISD::SETEQ, CondVal, 0, + SelectionDAGISel::CaseBlock CB(ISD::SETEQ, CondVal, ConstantBool::getTrue(), Succ0MBB, Succ1MBB, CurMBB); // Use visitSwitchCase to actually insert the fast branch sequence for this // cond branch. @@ -811,12 +976,15 @@ SDOperand Cond; SDOperand CondLHS = getValue(CB.CmpLHS); - // If the CaseBlock has both LHS/RHS comparisons, build the setcc now, - // otherwise, just use the LHS value as a bool comparison value. - if (CB.CmpRHS) - Cond = DAG.getSetCC(MVT::i1, CondLHS, getValue(CB.CmpRHS), CB.CC); - else + // Build the setcc now, fold "(X == true)" to X and "(X == false)" to !X to + // handle common cases produced by branch lowering. + if (CB.CmpRHS == ConstantBool::getTrue() && CB.CC == ISD::SETEQ) Cond = CondLHS; + else if (CB.CmpRHS == ConstantBool::getFalse() && CB.CC == ISD::SETEQ) { + SDOperand True = DAG.getConstant(1, CondLHS.getValueType()); + Cond = DAG.getNode(ISD::XOR, CondLHS.getValueType(), CondLHS, True); + } else + Cond = DAG.getSetCC(MVT::i1, CondLHS, getValue(CB.CmpRHS), CB.CC); // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. @@ -3385,10 +3553,9 @@ return true; } - -SDOperand SelectionDAGISel:: -CopyValueToVirtualRegister(SelectionDAGLowering &SDL, Value *V, unsigned Reg) { - SDOperand Op = SDL.getValue(V); +SDOperand SelectionDAGLowering::CopyValueToVirtualRegister(Value *V, + unsigned Reg) { + SDOperand Op = getValue(V); assert((Op.getOpcode() != ISD::CopyFromReg || cast(Op.getOperand(1))->getReg() != Reg) && "Copy from a reg to the same reg!"); @@ -3397,9 +3564,8 @@ // register use. MVT::ValueType SrcVT = Op.getValueType(); MVT::ValueType DestVT = TLI.getTypeToTransformTo(SrcVT); - SelectionDAG &DAG = SDL.DAG; if (SrcVT == DestVT) { - return DAG.getCopyToReg(SDL.getRoot(), Reg, Op); + return DAG.getCopyToReg(getRoot(), Reg, Op); } else if (SrcVT == MVT::Vector) { // Handle copies from generic vectors to registers. MVT::ValueType PTyElementVT, PTyLegalElementVT; @@ -3416,7 +3582,7 @@ // VEXTRACT_VECTOR_ELT'ing them, converting them to PTyLegalElementVT, then // copying them into output registers. SmallVector OutChains; - SDOperand Root = SDL.getRoot(); + SDOperand Root = getRoot(); for (unsigned i = 0; i != NE; ++i) { SDOperand Elt = DAG.getNode(ISD::VEXTRACT_VECTOR_ELT, PTyElementVT, Op, DAG.getConstant(i, TLI.getPointerTy())); @@ -3449,14 +3615,14 @@ Op = DAG.getNode(ISD::FP_EXTEND, DestVT, Op); else Op = DAG.getNode(ISD::ANY_EXTEND, DestVT, Op); - return DAG.getCopyToReg(SDL.getRoot(), Reg, Op); + return DAG.getCopyToReg(getRoot(), Reg, Op); } else { // The src value is expanded into multiple registers. SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, DestVT, Op, DAG.getConstant(0, TLI.getPointerTy())); SDOperand Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, DestVT, Op, DAG.getConstant(1, TLI.getPointerTy())); - Op = DAG.getCopyToReg(SDL.getRoot(), Reg, Lo); + Op = DAG.getCopyToReg(getRoot(), Reg, Lo); return DAG.getCopyToReg(Op, Reg+1, Hi); } } @@ -3480,7 +3646,7 @@ // whereever we got it to the vreg that other BB's will reference it as. if (FuncInfo.ValueMap.count(AI)) { SDOperand Copy = - CopyValueToVirtualRegister(SDL, AI, FuncInfo.ValueMap[AI]); + SDL.CopyValueToVirtualRegister(AI, FuncInfo.ValueMap[AI]); UnorderedChains.push_back(Copy); } } @@ -3516,7 +3682,7 @@ std::map::iterator VMI =FuncInfo.ValueMap.find(I); if (VMI != FuncInfo.ValueMap.end()) UnorderedChains.push_back( - CopyValueToVirtualRegister(SDL, I, VMI->second)); + SDL.CopyValueToVirtualRegister(I, VMI->second)); } // Handle PHI nodes in successor blocks. Emit code into the SelectionDAG to @@ -3553,7 +3719,7 @@ if (RegOut == 0) { RegOut = FuncInfo.CreateRegForValue(C); UnorderedChains.push_back( - CopyValueToVirtualRegister(SDL, C, RegOut)); + SDL.CopyValueToVirtualRegister(C, RegOut)); } Reg = RegOut; } else { @@ -3564,7 +3730,7 @@ "Didn't codegen value into a register!??"); Reg = FuncInfo.CreateRegForValue(PHIOp); UnorderedChains.push_back( - CopyValueToVirtualRegister(SDL, PHIOp, Reg)); + SDL.CopyValueToVirtualRegister(PHIOp, Reg)); } } From sabre at nondot.org Fri Oct 27 16:52:53 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 16:52:53 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/and-branch.ll Message-ID: <200610272152.k9RLqrOg009908@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: and-branch.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+19 -0) and-branch.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/and-branch.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/and-branch.ll:1.1 *** /dev/null Fri Oct 27 16:52:49 2006 --- llvm/test/Regression/CodeGen/PowerPC/and-branch.ll Fri Oct 27 16:52:39 2006 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | llc -march=ppc32 && + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep mfcr + + void %foo(int %X, int %Y, int %Z) { + entry: + %tmp = seteq int %X, 0 ; [#uses=1] + %tmp3 = setlt int %Y, 5 ; [#uses=1] + %tmp4 = and bool %tmp3, %tmp ; [#uses=1] + br bool %tmp4, label %cond_true, label %UnifiedReturnBlock + + cond_true: ; preds = %entry + %tmp5 = tail call int (...)* %bar( ) ; [#uses=0] + ret void + + UnifiedReturnBlock: ; preds = %entry + ret void + } + + declare int %bar(...) From sabre at nondot.org Fri Oct 27 16:54:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 16:54:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610272154.k9RLsbei009983@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.300 -> 1.301 --- Log message: Codegen cond&cond with two branches. This compiles (f.e.) PowerPC/and-branch.ll to: cmpwi cr0, r4, 4 bgt cr0, LBB1_2 ;UnifiedReturnBlock LBB1_3: ;entry cmplwi cr0, r3, 0 bne cr0, LBB1_2 ;UnifiedReturnBlock instead of: cmpwi cr7, r4, 4 mfcr r2 addic r4, r3, -1 subfe r3, r4, r3 rlwinm r2, r2, 30, 31, 31 or r2, r2, r3 cmplwi cr0, r2, 0 bne cr0, LBB1_2 ;UnifiedReturnBlock LBB1_1: ;cond_true --- Diffs of the changes: (+35 -15) SelectionDAGISel.cpp | 50 +++++++++++++++++++++++++++++++++++--------------- 1 files changed, 35 insertions(+), 15 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.300 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.301 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.300 Fri Oct 27 16:36:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 27 16:54:23 2006 @@ -888,22 +888,43 @@ return; } - // Codegen X | Y as: - // jmp_if_X TBB - // TmpBB: - // jmp_if_Y TBB - // jmp FBB - // - // This requires creation of TmpBB after CurBB. + + // Create TmpBB after CurBB. MachineFunction::iterator BBI = CurBB; MachineBasicBlock *TmpBB = new MachineBasicBlock(CurBB->getBasicBlock()); CurBB->getParent()->getBasicBlockList().insert(++BBI, TmpBB); - // Emit the LHS condition. - FindMergedConditions(BOp->getOperand(0), TBB, TmpBB, CurBB, Opc); + if (Opc == Instruction::Or) { + // Codegen X | Y as: + // jmp_if_X TBB + // jmp TmpBB + // TmpBB: + // jmp_if_Y TBB + // jmp FBB + // - // Emit the RHS condition into TmpBB. - FindMergedConditions(BOp->getOperand(1), TBB, FBB, TmpBB, Opc); + // Emit the LHS condition. + FindMergedConditions(BOp->getOperand(0), TBB, TmpBB, CurBB, Opc); + + // Emit the RHS condition into TmpBB. + FindMergedConditions(BOp->getOperand(1), TBB, FBB, TmpBB, Opc); + } else { + assert(Opc == Instruction::And && "Unknown merge op!"); + // Codegen X & Y as: + // jmp_if_X TmpBB + // jmp FBB + // TmpBB: + // jmp_if_Y TBB + // jmp FBB + // + // This requires creation of TmpBB after CurBB. + + // Emit the LHS condition. + FindMergedConditions(BOp->getOperand(0), TmpBB, FBB, CurBB, Opc); + + // Emit the RHS condition into TmpBB. + FindMergedConditions(BOp->getOperand(1), TBB, FBB, TmpBB, Opc); + } } void SelectionDAGLowering::visitBr(BranchInst &I) { @@ -950,12 +971,11 @@ // if (BinaryOperator *BOp = dyn_cast(CondVal)) { if (BOp->hasOneUse() && - (/*BOp->getOpcode() == Instruction::And ||*/ + (BOp->getOpcode() == Instruction::And || BOp->getOpcode() == Instruction::Or)) { + if (BOp->getOpcode() == Instruction::And) + I.getParent()->dump(); FindMergedConditions(BOp, Succ0MBB, Succ1MBB, CurMBB, BOp->getOpcode()); - //std::cerr << "FOUND: " << SwitchCases.size() << " merged conditions:\n"; - //I.getParent()->dump(); - visitSwitchCase(SwitchCases[0]); SwitchCases.erase(SwitchCases.begin()); return; From sabre at nondot.org Fri Oct 27 16:58:18 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 16:58:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610272158.k9RLwIVa010085@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.301 -> 1.302 --- Log message: remove debug code --- Diffs of the changes: (+0 -2) SelectionDAGISel.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.301 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.302 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.301 Fri Oct 27 16:54:23 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 27 16:58:03 2006 @@ -973,8 +973,6 @@ if (BOp->hasOneUse() && (BOp->getOpcode() == Instruction::And || BOp->getOpcode() == Instruction::Or)) { - if (BOp->getOpcode() == Instruction::And) - I.getParent()->dump(); FindMergedConditions(BOp, Succ0MBB, Succ1MBB, CurMBB, BOp->getOpcode()); visitSwitchCase(SwitchCases[0]); SwitchCases.erase(SwitchCases.begin()); From sabre at nondot.org Fri Oct 27 17:01:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 17:01:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200610272201.k9RM19hA010230@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.101 -> 1.102 --- Log message: the code in question is now: cmpw cr0, r7, r3 ble cr0, LBB1_5 ;bb25 LBB1_8: ;bb17 cmpw cr0, r8, r5 bgt cr0, LBB1_2 ;bb which is just as good as crnand. --- Diffs of the changes: (+0 -30) README.txt | 30 ------------------------------ 1 files changed, 30 deletions(-) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.101 llvm/lib/Target/PowerPC/README.txt:1.102 --- llvm/lib/Target/PowerPC/README.txt:1.101 Fri Oct 13 15:20:58 2006 +++ llvm/lib/Target/PowerPC/README.txt Fri Oct 27 17:00:55 2006 @@ -150,36 +150,6 @@ ===-------------------------------------------------------------------------=== -PowerPC i1/setcc stuff (depends on subreg stuff): - -Check out the PPC code we get for 'compare' in this testcase: -http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19672 - -oof. on top of not doing the logical crnand instead of (mfcr, mfcr, -invert, invert, or), we then have to compare it against zero instead of -using the value already in a CR! - -that should be something like - cmpw cr7, r8, r5 - cmpw cr0, r7, r3 - crnand cr0, cr0, cr7 - bne cr0, LBB_compare_4 - -instead of - cmpw cr7, r8, r5 - cmpw cr0, r7, r3 - mfcr r7, 1 - mcrf cr7, cr0 - mfcr r8, 1 - rlwinm r7, r7, 30, 31, 31 - rlwinm r8, r8, 30, 31, 31 - xori r7, r7, 1 - xori r8, r8, 1 - addi r2, r2, 1 - or r7, r8, r7 - cmpwi cr0, r7, 0 - bne cr0, LBB_compare_4 ; loopexit - FreeBench/mason has a basic block that looks like this: %tmp.130 = seteq int %p.0__, 5 ; [#uses=1] From sabre at nondot.org Fri Oct 27 17:02:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 17:02:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200610272202.k9RM2Y5F010331@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.102 -> 1.103 --- Log message: this doesn't occur any more in mason --- Diffs of the changes: (+0 -19) README.txt | 19 ------------------- 1 files changed, 19 deletions(-) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.102 llvm/lib/Target/PowerPC/README.txt:1.103 --- llvm/lib/Target/PowerPC/README.txt:1.102 Fri Oct 27 17:00:55 2006 +++ llvm/lib/Target/PowerPC/README.txt Fri Oct 27 17:02:19 2006 @@ -150,25 +150,6 @@ ===-------------------------------------------------------------------------=== -FreeBench/mason has a basic block that looks like this: - - %tmp.130 = seteq int %p.0__, 5 ; [#uses=1] - %tmp.134 = seteq int %p.1__, 6 ; [#uses=1] - %tmp.139 = seteq int %p.2__, 12 ; [#uses=1] - %tmp.144 = seteq int %p.3__, 13 ; [#uses=1] - %tmp.149 = seteq int %p.4__, 14 ; [#uses=1] - %tmp.154 = seteq int %p.5__, 15 ; [#uses=1] - %bothcond = and bool %tmp.134, %tmp.130 ; [#uses=1] - %bothcond123 = and bool %bothcond, %tmp.139 ; - %bothcond124 = and bool %bothcond123, %tmp.144 ; - %bothcond125 = and bool %bothcond124, %tmp.149 ; - %bothcond126 = and bool %bothcond125, %tmp.154 ; - br bool %bothcond126, label %shortcirc_next.5, label %else.0 - -This is a particularly important case where handling CRs better will help. - -===-------------------------------------------------------------------------=== - Simple IPO for argument passing, change: void foo(int X, double Y, int Z) -> void foo(int X, int Z, double Y) From dpatel at apple.com Fri Oct 27 17:02:44 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 27 Oct 2006 17:02:44 -0500 Subject: [llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html Message-ID: <200610272202.k9RM2iWf010342@zion.cs.uiuc.edu> Changes in directory llvm/docs: LinkTimeOptimization.html updated: 1.8 -> 1.9 --- Log message: Document removeModule(). --- Diffs of the changes: (+13 -1) LinkTimeOptimization.html | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletion(-) Index: llvm/docs/LinkTimeOptimization.html diff -u llvm/docs/LinkTimeOptimization.html:1.8 llvm/docs/LinkTimeOptimization.html:1.9 --- llvm/docs/LinkTimeOptimization.html:1.8 Fri Oct 27 16:58:31 2006 +++ llvm/docs/LinkTimeOptimization.html Fri Oct 27 17:02:30 2006 @@ -30,6 +30,7 @@
  • readLLVMObjectFile()
  • optimizeModules()
  • getTargetTriple()
  • +
  • removeModule()
  • getAlignment()
  • Debugging Information
  • @@ -340,6 +341,17 @@ + +
    +

    Internally, LLVMlto maintains LLVM bytecode modules in + memory. The linker may use removeModule() method to remove desired + modules from memory.

    +
    + + + @@ -371,7 +383,7 @@ Devang Patel
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/27 21:58:31 $ + Last modified: $Date: 2006/10/27 22:02:30 $ From jlaskey at apple.com Fri Oct 27 17:52:16 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 17:52:16 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/FoldingSet.h Message-ID: <200610272252.k9RMqGcc011127@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: FoldingSet.h updated: 1.2 -> 1.3 --- Log message: Clean up --- Diffs of the changes: (+2 -2) FoldingSet.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/ADT/FoldingSet.h diff -u llvm/include/llvm/ADT/FoldingSet.h:1.2 llvm/include/llvm/ADT/FoldingSet.h:1.3 --- llvm/include/llvm/ADT/FoldingSet.h:1.2 Fri Oct 27 13:05:12 2006 +++ llvm/include/llvm/ADT/FoldingSet.h Fri Oct 27 17:52:02 2006 @@ -118,7 +118,7 @@ public: FoldingSetImpl(); - ~FoldingSetImpl(); + virtual ~FoldingSetImpl(); // Forward declaration. class Node; @@ -245,7 +245,7 @@ } }; -}; // End of namespace llvm. +} // End of namespace llvm. #endif From dpatel at apple.com Fri Oct 27 16:58:46 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 27 Oct 2006 16:58:46 -0500 Subject: [llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html Message-ID: <200610272158.k9RLwk7K010153@zion.cs.uiuc.edu> Changes in directory llvm/docs: LinkTimeOptimization.html updated: 1.7 -> 1.8 --- Log message: Document getAlignment() --- Diffs of the changes: (+12 -1) LinkTimeOptimization.html | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/docs/LinkTimeOptimization.html diff -u llvm/docs/LinkTimeOptimization.html:1.7 llvm/docs/LinkTimeOptimization.html:1.8 --- llvm/docs/LinkTimeOptimization.html:1.7 Wed Sep 6 15:22:55 2006 +++ llvm/docs/LinkTimeOptimization.html Fri Oct 27 16:58:31 2006 @@ -30,6 +30,7 @@
  • readLLVMObjectFile()
  • optimizeModules()
  • getTargetTriple()
  • +
  • getAlignment()
  • Debugging Information
  • @@ -337,6 +338,16 @@ while validating LLVM bytecode file.

    + + + +
    +

    The linker may use LLVMSymbol method + getAlignment() to query symbol alignment information.

    +
    +
    Debugging Information @@ -360,7 +371,7 @@ Devang Patel
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/09/06 20:22:55 $ + Last modified: $Date: 2006/10/27 21:58:31 $ From dpatel at apple.com Fri Oct 27 18:06:42 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 27 Oct 2006 18:06:42 -0500 Subject: [llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html Message-ID: <200610272306.k9RN6gX8011415@zion.cs.uiuc.edu> Changes in directory llvm/docs: LinkTimeOptimization.html updated: 1.9 -> 1.10 --- Log message: Use doc_code class. --- Diffs of the changes: (+3 -3) LinkTimeOptimization.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/docs/LinkTimeOptimization.html diff -u llvm/docs/LinkTimeOptimization.html:1.9 llvm/docs/LinkTimeOptimization.html:1.10 --- llvm/docs/LinkTimeOptimization.html:1.9 Fri Oct 27 17:02:30 2006 +++ llvm/docs/LinkTimeOptimization.html Fri Oct 27 18:06:27 2006 @@ -88,7 +88,7 @@
  • Input source file a.c is compiled into LLVM byte code form.
  • Input source file main.c is compiled into native object code. -
    +
     --- a.h ---
     extern int foo1(void);
     extern void foo2(void);
    @@ -132,7 +132,7 @@
     $ llvm-gcc4 --emit-llvm -c a.c -o a.o  # <-- a.o is LLVM bytecode file
     $ llvm-gcc4 -c main.c -o main.o # <-- main.o is native object file
     $ llvm-gcc4 a.o main.o -o main # <-- standard link command without any modifications
    -
    +
  • In this example, the linker recognizes that foo2() is an externally visible symbol defined in LLVM byte code file. This information is collected using readLLVMObjectFile(). @@ -383,7 +383,7 @@ Devang Patel
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/27 22:02:30 $ + Last modified: $Date: 2006/10/27 23:06:27 $ From jlaskey at apple.com Fri Oct 27 18:46:22 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 18:46:22 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h SelectionDAG.h SelectionDAGNodes.h SelectionDAGCSEMap.h Message-ID: <200610272346.k9RNkMJI012084@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineConstantPool.h updated: 1.20 -> 1.21 SelectionDAG.h updated: 1.140 -> 1.141 SelectionDAGNodes.h updated: 1.156 -> 1.157 SelectionDAGCSEMap.h (r1.8) removed --- Log message: Switch over from SelectionNodeCSEMap to FoldingSet. --- Diffs of the changes: (+13 -20) MachineConstantPool.h | 5 +++-- SelectionDAG.h | 6 ++++-- SelectionDAGNodes.h | 22 ++++++---------------- 3 files changed, 13 insertions(+), 20 deletions(-) Index: llvm/include/llvm/CodeGen/MachineConstantPool.h diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.20 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.21 --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.20 Thu Sep 14 02:32:32 2006 +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Fri Oct 27 18:46:08 2006 @@ -15,7 +15,8 @@ #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H -#include "llvm/CodeGen/SelectionDAGCSEMap.h" +#include "llvm/ADT/FoldingSet.h" +#include "llvm/CodeGen/SelectionDAGNodes.h" #include #include @@ -43,7 +44,7 @@ virtual int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) = 0; - virtual void AddSelectionDAGCSEId(SelectionDAGCSEMap::NodeID *Id) = 0; + virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID) = 0; /// print - Implement operator<<... /// Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.140 llvm/include/llvm/CodeGen/SelectionDAG.h:1.141 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.140 Thu Oct 26 16:52:23 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Fri Oct 27 18:46:08 2006 @@ -15,8 +15,9 @@ #ifndef LLVM_CODEGEN_SELECTIONDAG_H #define LLVM_CODEGEN_SELECTIONDAG_H -#include "llvm/CodeGen/SelectionDAGCSEMap.h" +#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/ilist" +#include "llvm/CodeGen/SelectionDAGNodes.h" #include #include @@ -31,6 +32,7 @@ class MachineDebugInfo; class MachineFunction; class MachineConstantPoolValue; + class SDOperand; /// SelectionDAG class - This is used to represent a portion of an LLVM function /// in a low-level Data Dependence DAG representation suitable for instruction @@ -56,7 +58,7 @@ /// CSEMap - This structure is used to memoize nodes, automatically performing /// CSE with existing nodes with a duplicate is requested. - SelectionDAGCSEMap CSEMap; + FoldingSet CSEMap; public: SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineDebugInfo *di) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.156 Thu Oct 26 16:52:24 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Oct 27 18:46:08 2006 @@ -20,6 +20,7 @@ #define LLVM_CODEGEN_SELECTIONDAGNODES_H #include "llvm/Value.h" +#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" #include "llvm/ADT/SmallVector.h" @@ -742,7 +743,7 @@ /// SDNode - Represents one node in the SelectionDAG. /// -class SDNode { +class SDNode : public FoldingSetNode { /// NodeType - The operation that this node performs. /// unsigned short NodeType; @@ -766,9 +767,6 @@ SDNode *Prev, *Next; friend struct ilist_traits; - /// NextInBucket - This is used by the SelectionDAGCSEMap. - void *NextInBucket; - /// Uses - These are all of the SDNode's that use a value produced by this /// node. SmallVector Uses; @@ -778,7 +776,6 @@ public: virtual ~SDNode() { assert(NumOperands == 0 && "Operand list not cleared before deletion"); - assert(NextInBucket == 0 && "Still in CSEMap?"); NodeType = ISD::DELETED_NODE; } @@ -863,11 +860,10 @@ static bool classof(const SDNode *) { return true; } - - /// NextInBucket accessors, these are private to SelectionDAGCSEMap. - void *getNextInBucket() const { return NextInBucket; } - void SetNextInBucket(void *N) { NextInBucket = N; } - + /// Profile - Gather unique data for the node. + /// + void Profile(FoldingSetNodeID &ID); + protected: friend class SelectionDAG; @@ -880,7 +876,6 @@ ValueList = getValueTypeList(VT); NumValues = 1; Prev = 0; Next = 0; - NextInBucket = 0; } SDNode(unsigned NT, SDOperand Op) : NodeType(NT), NodeId(-1) { @@ -891,7 +886,6 @@ ValueList = 0; NumValues = 0; Prev = 0; Next = 0; - NextInBucket = 0; } SDNode(unsigned NT, SDOperand N1, SDOperand N2) : NodeType(NT), NodeId(-1) { @@ -903,7 +897,6 @@ ValueList = 0; NumValues = 0; Prev = 0; Next = 0; - NextInBucket = 0; } SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3) : NodeType(NT), NodeId(-1) { @@ -918,7 +911,6 @@ ValueList = 0; NumValues = 0; Prev = 0; Next = 0; - NextInBucket = 0; } SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4) : NodeType(NT), NodeId(-1) { @@ -934,7 +926,6 @@ ValueList = 0; NumValues = 0; Prev = 0; Next = 0; - NextInBucket = 0; } SDNode(unsigned Opc, const SDOperand *Ops, unsigned NumOps) : NodeType(Opc), NodeId(-1) { @@ -949,7 +940,6 @@ ValueList = 0; NumValues = 0; Prev = 0; Next = 0; - NextInBucket = 0; } /// MorphNodeTo - This clears the return value and operands list, and sets the From jlaskey at apple.com Fri Oct 27 18:46:23 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 18:46:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGCSEMap.cpp Message-ID: <200610272346.k9RNkNgn012089@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.356 -> 1.357 SelectionDAGCSEMap.cpp (r1.9) removed --- Log message: Switch over from SelectionNodeCSEMap to FoldingSet. --- Diffs of the changes: (+211 -49) SelectionDAG.cpp | 260 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 211 insertions(+), 49 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356 Thu Oct 26 16:53:40 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 27 18:46:08 2006 @@ -252,6 +252,144 @@ } //===----------------------------------------------------------------------===// +// SDNode Profile Support +//===----------------------------------------------------------------------===// + +/// getNodeIDOpcode - Return the opcode that has been set for this NodeID. +/// +static unsigned getNodeIDOpcode(FoldingSetNodeID &ID) { + return ID.getRawData(0); +} +static void AddNodeIDOpcode(FoldingSetNodeID &ID, unsigned OpC) { + ID.AddInteger(OpC); +} + +/// AddNodeIDValueTypes - Value type lists are intern'd so we can represent them +/// solely with their pointer. +void AddNodeIDValueTypes(FoldingSetNodeID &ID, SDVTList VTList) { + ID.AddPointer(VTList.VTs); +} + + +static void AddNodeIDOperand(FoldingSetNodeID &ID, SDOperand Op) { + ID.AddPointer(Op.Val); + ID.AddInteger(Op.ResNo); +} + +static void AddNodeIDOperands(FoldingSetNodeID &ID) { +} +void AddNodeIDOperands(FoldingSetNodeID &ID, SDOperand Op) { + AddNodeIDOperand(ID, Op); +} +static void AddNodeIDOperands(FoldingSetNodeID &ID, + SDOperand Op1, SDOperand Op2) { + AddNodeIDOperand(ID, Op1); + AddNodeIDOperand(ID, Op2); +} +static void AddNodeIDOperands(FoldingSetNodeID &ID, + SDOperand Op1, SDOperand Op2, SDOperand Op3) { + AddNodeIDOperand(ID, Op1); + AddNodeIDOperand(ID, Op2); + AddNodeIDOperand(ID, Op3); +} +static void AddNodeIDOperands(FoldingSetNodeID &ID, + const SDOperand *Ops, unsigned NumOps) { + for (; NumOps; --NumOps, ++Ops) + AddNodeIDOperand(ID, *Ops); +} + +static void AddNodeIDNode(FoldingSetNodeID &ID, + unsigned short OpC, SDVTList VTList) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID); +} +static void AddNodeIDNode(FoldingSetNodeID &ID, + unsigned short OpC, SDVTList VTList, + SDOperand Op) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, Op); +} +static void AddNodeIDNode(FoldingSetNodeID &ID, + unsigned short OpC, SDVTList VTList, + SDOperand Op1, SDOperand Op2) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, Op1, Op2); +} +static void AddNodeIDNode(FoldingSetNodeID &ID, + unsigned short OpC, SDVTList VTList, + SDOperand Op1, SDOperand Op2, SDOperand Op3) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, Op1, Op2); +} +static void AddNodeIDNode(FoldingSetNodeID &ID, + unsigned short OpC, SDVTList VTList, + const SDOperand *OpList, unsigned N) { + AddNodeIDOpcode(ID, OpC); + AddNodeIDValueTypes(ID, VTList); + AddNodeIDOperands(ID, OpList, N); +} + +static void AddNodeIDNode(FoldingSetNodeID &ID, SDNode *N) { + AddNodeIDOpcode(ID, N->getOpcode()); + // Add the return value info. + AddNodeIDValueTypes(ID, N->getVTList()); + // Add the operand info. + AddNodeIDOperands(ID, N->op_begin(), N->getNumOperands()); + + // Handle SDNode leafs with special info. + if (N->getNumOperands() == 0) { + switch (N->getOpcode()) { + default: break; // Normal nodes don't need extra info. + case ISD::TargetConstant: + case ISD::Constant: + ID.AddInteger(cast(N)->getValue()); + break; + case ISD::TargetConstantFP: + case ISD::ConstantFP: + ID.AddDouble(cast(N)->getValue()); + break; + case ISD::TargetGlobalAddress: + case ISD::GlobalAddress: + ID.AddPointer(cast(N)->getGlobal()); + ID.AddInteger(cast(N)->getOffset()); + break; + case ISD::BasicBlock: + ID.AddPointer(cast(N)->getBasicBlock()); + break; + case ISD::Register: + ID.AddInteger(cast(N)->getReg()); + break; + case ISD::SRCVALUE: + ID.AddPointer(cast(N)->getValue()); + ID.AddInteger(cast(N)->getOffset()); + break; + case ISD::FrameIndex: + case ISD::TargetFrameIndex: + ID.AddInteger(cast(N)->getIndex()); + break; + case ISD::JumpTable: + case ISD::TargetJumpTable: + ID.AddInteger(cast(N)->getIndex()); + break; + case ISD::ConstantPool: + case ISD::TargetConstantPool: + ID.AddInteger(cast(N)->getAlignment()); + ID.AddInteger(cast(N)->getOffset()); + if (cast(N)->isMachineConstantPoolEntry()) + cast(N)->getMachineCPVal()-> + AddSelectionDAGCSEId(ID); + else + ID.AddPointer(cast(N)->getConstVal()); + break; + } + } +} + +//===----------------------------------------------------------------------===// // SelectionDAG Class //===----------------------------------------------------------------------===// @@ -439,10 +577,8 @@ if (N->getValueType(i) == MVT::Flag) return 0; // Never CSE anything that produces a flag. - SelectionDAGCSEMap::NodeID ID; - ID.SetOpcode(N->getOpcode()); - ID.SetValueTypes(N->getVTList()); - ID.SetOperands(Op); + FoldingSetNodeID ID; + AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Op); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -461,10 +597,8 @@ if (N->getValueType(i) == MVT::Flag) return 0; // Never CSE anything that produces a flag. - SelectionDAGCSEMap::NodeID ID; - ID.SetOpcode(N->getOpcode()); - ID.SetValueTypes(N->getVTList()); - ID.SetOperands(Op1, Op2); + FoldingSetNodeID ID; + AddNodeIDNode(ID, N->getOpcode(), N->getVTList(), Op1, Op2); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -484,9 +618,9 @@ if (N->getValueType(i) == MVT::Flag) return 0; // Never CSE anything that produces a flag. - SelectionDAGCSEMap::NodeID ID; - ID.SetOpcode(N->getOpcode()); - ID.SetValueTypes(N->getVTList()); + FoldingSetNodeID ID; + AddNodeIDNode(ID, N->getOpcode(), N->getVTList()); + if (const LoadSDNode *LD = dyn_cast(N)) { ID.AddInteger(LD->getAddressingMode()); ID.AddInteger(LD->getExtensionType()); @@ -504,7 +638,8 @@ ID.AddInteger(ST->getAlignment()); ID.AddInteger(ST->isVolatile()); } - ID.SetOperands(Ops, NumOps); + + AddNodeIDOperands(ID, Ops, NumOps); return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } @@ -544,7 +679,8 @@ Val &= MVT::getIntVTBitMask(VT); unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); ID.AddInteger(Val); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -566,8 +702,9 @@ // value, so that we don't have problems with 0.0 comparing equal to -0.0, and // we don't have issues with SNANs. unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); - ID.AddInteger(DoubleToBits(Val)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); + ID.AddDouble(Val); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -581,7 +718,8 @@ MVT::ValueType VT, int Offset, bool isTargetGA) { unsigned Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); ID.AddPointer(GV); ID.AddInteger(Offset); void *IP = 0; @@ -596,7 +734,8 @@ SDOperand SelectionDAG::getFrameIndex(int FI, MVT::ValueType VT, bool isTarget) { unsigned Opc = isTarget ? ISD::TargetFrameIndex : ISD::FrameIndex; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); ID.AddInteger(FI); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -609,7 +748,8 @@ SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT, bool isTarget){ unsigned Opc = isTarget ? ISD::TargetJumpTable : ISD::JumpTable; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); ID.AddInteger(JTI); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -624,7 +764,8 @@ unsigned Alignment, int Offset, bool isTarget) { unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); ID.AddInteger(Alignment); ID.AddInteger(Offset); ID.AddPointer(C); @@ -643,10 +784,11 @@ unsigned Alignment, int Offset, bool isTarget) { unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; - SelectionDAGCSEMap::NodeID ID(Opc, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opc, getVTList(VT)); ID.AddInteger(Alignment); ID.AddInteger(Offset); - C->AddSelectionDAGCSEId(&ID); + C->AddSelectionDAGCSEId(ID); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -658,7 +800,8 @@ SDOperand SelectionDAG::getBasicBlock(MachineBasicBlock *MBB) { - SelectionDAGCSEMap::NodeID ID(ISD::BasicBlock, getVTList(MVT::Other)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BasicBlock, getVTList(MVT::Other)); ID.AddPointer(MBB); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -709,7 +852,8 @@ } SDOperand SelectionDAG::getRegister(unsigned RegNo, MVT::ValueType VT) { - SelectionDAGCSEMap::NodeID ID(ISD::Register, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::Register, getVTList(VT)); ID.AddInteger(RegNo); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) @@ -724,7 +868,8 @@ assert((!V || isa(V->getType())) && "SrcValue is not a pointer?"); - SelectionDAGCSEMap::NodeID ID(ISD::SRCVALUE, getVTList(MVT::Other)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::SRCVALUE, getVTList(MVT::Other)); ID.AddPointer(V); ID.AddInteger(Offset); void *IP = 0; @@ -812,7 +957,8 @@ /// getNode - Gets or creates the specified node. /// SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT) { - SelectionDAGCSEMap::NodeID ID(Opcode, getVTList(VT)); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opcode, getVTList(VT)); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -991,7 +1137,8 @@ SDNode *N; SDVTList VTs = getVTList(VT); if (VT != MVT::Flag) { // Don't CSE flag producing nodes - SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Operand); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opcode, VTs, Operand); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -1291,7 +1438,8 @@ SDNode *N; SDVTList VTs = getVTList(VT); if (VT != MVT::Flag) { - SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opcode, VTs, N1, N2); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -1349,7 +1497,8 @@ SDNode *N; SDVTList VTs = getVTList(VT); if (VT != MVT::Flag) { - SelectionDAGCSEMap::NodeID ID(Opcode, VTs, N1, N2, N3); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opcode, VTs, N1, N2, N3); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -1386,7 +1535,8 @@ unsigned Alignment = 1; SDVTList VTs = getVTList(VT, MVT::Other); SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType()); - SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, Chain, Ptr, Undef); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::LOAD, VTs, Chain, Ptr, Undef); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ISD::NON_EXTLOAD); ID.AddInteger(VT); @@ -1428,7 +1578,8 @@ unsigned Alignment = 1; SDVTList VTs = getVTList(VT, MVT::Other); SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType()); - SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, Chain, Ptr, Undef); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::LOAD, VTs, Chain, Ptr, Undef); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ExtType); ID.AddInteger(EVT); @@ -1454,7 +1605,8 @@ "Load is already a indexed load!"); MVT::ValueType VT = OrigLoad.getValueType(); SDVTList VTs = getVTList(VT, Base.getValueType(), MVT::Other); - SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD->getChain(), Base, Offset); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::LOAD, VTs, LD->getChain(), Base, Offset); ID.AddInteger(AM); ID.AddInteger(LD->getExtensionType()); ID.AddInteger(LD->getLoadedVT()); @@ -1493,7 +1645,8 @@ SDVTList VTs = getVTList(MVT::Other); SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType()); SDOperand Ops[] = { Chain, Value, Ptr, Undef }; - SelectionDAGCSEMap::NodeID ID(ISD::STORE, VTs, Ops, 4); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(false); ID.AddInteger(VT); @@ -1528,7 +1681,8 @@ SDVTList VTs = getVTList(MVT::Other); SDOperand Undef = getNode(ISD::UNDEF, Ptr.getValueType()); SDOperand Ops[] = { Chain, Value, Ptr, Undef }; - SelectionDAGCSEMap::NodeID ID(ISD::STORE, VTs, Ops, 4); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(isTrunc); ID.AddInteger(SVT); @@ -1588,7 +1742,8 @@ SDNode *N; SDVTList VTs = getVTList(VT); if (VT != MVT::Flag) { - SelectionDAGCSEMap::NodeID ID(Opcode, VTs, Ops, NumOps); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opcode, VTs, Ops, NumOps); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -1649,10 +1804,8 @@ // Memoize the node unless it returns a flag. SDNode *N; if (VTList.VTs[VTList.NumVTs-1] != MVT::Flag) { - SelectionDAGCSEMap::NodeID ID; - ID.SetOpcode(Opcode); - ID.SetValueTypes(VTList); - ID.SetOperands(&Ops[0], NumOps); + FoldingSetNodeID ID; + AddNodeIDNode(ID, Opcode, VTList, Ops, NumOps); void *IP = 0; if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) return SDOperand(E, 0); @@ -1872,7 +2025,8 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT) { SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -1890,7 +2044,8 @@ MVT::ValueType VT, SDOperand Op1) { // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -1908,7 +2063,8 @@ SDOperand Op2) { // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -1927,8 +2083,8 @@ SDOperand Op2, SDOperand Op3) { // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, - Op1, Op2, Op3); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2, Op3); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -1947,9 +2103,8 @@ unsigned NumOps) { // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs); - for (unsigned i = 0; i != NumOps; ++i) - ID.AddOperand(Ops[i]); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -1967,7 +2122,8 @@ MVT::ValueType VT1, MVT::ValueType VT2, SDOperand Op1, SDOperand Op2) { SDVTList VTs = getVTList(VT1, VT2); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -1987,8 +2143,8 @@ SDOperand Op3) { // If an identical node already exists, use it. SDVTList VTs = getVTList(VT1, VT2); - SelectionDAGCSEMap::NodeID ID(ISD::BUILTIN_OP_END+TargetOpc, VTs, - Op1, Op2, Op3); + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Op1, Op2, Op3); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; @@ -2311,6 +2467,12 @@ void SDNode::ANCHOR() { } +/// Profile - Gather unique data for the node. +/// +void SDNode::Profile(FoldingSetNodeID &ID) { + AddNodeIDNode(ID, this); +} + /// getValueTypeList - Return a pointer to the specified value type. /// MVT::ValueType *SDNode::getValueTypeList(MVT::ValueType VT) { From sabre at nondot.org Fri Oct 27 18:47:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 18:47:48 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll Message-ID: <200610272347.k9RNlm18012170@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-10-27-CondFolding.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+21 -0) 2006-10-27-CondFolding.ll | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll:1.1 *** /dev/null Fri Oct 27 18:47:44 2006 --- llvm/test/Regression/CodeGen/Generic/2006-10-27-CondFolding.ll Fri Oct 27 18:47:34 2006 *************** *** 0 **** --- 1,21 ---- + ; RUN: llvm-as < %s | llc + + void %start_pass_huff(int %gather_statistics) { + entry: + %tmp = seteq int %gather_statistics, 0 ; [#uses=1] + br bool false, label %cond_next22, label %bb166 + + cond_next22: ; preds = %entry + %bothcond = and bool false, %tmp ; [#uses=1] + br bool %bothcond, label %bb34, label %bb46 + + bb34: ; preds = %cond_next22 + ret void + + bb46: ; preds = %cond_next22 + ret void + + bb166: ; preds = %entry + ret void + } + From sabre at nondot.org Fri Oct 27 18:50:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 18:50:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610272350.k9RNomxW012264@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.302 -> 1.303 --- Log message: Fix a bug in merged condition handling (CodeGen/Generic/2006-10-27-CondFolding.ll). Add many fewer CFG edges and PHI node entries. If there is a switch which has the same block as multiple destinations, only add that block once as a successor/phi node (in the jumptable case) --- Diffs of the changes: (+111 -68) SelectionDAGISel.cpp | 179 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 111 insertions(+), 68 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.302 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.303 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.302 Fri Oct 27 16:58:03 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Oct 27 18:50:33 2006 @@ -282,24 +282,24 @@ // Create Machine PHI nodes for LLVM PHI nodes, lowering them as // appropriate. PHINode *PN; - for (BasicBlock::iterator I = BB->begin(); - (PN = dyn_cast(I)); ++I) - if (!PN->use_empty()) { - MVT::ValueType VT = TLI.getValueType(PN->getType()); - unsigned NumElements; - if (VT != MVT::Vector) - NumElements = TLI.getNumElements(VT); - else { - MVT::ValueType VT1,VT2; - NumElements = - TLI.getPackedTypeBreakdown(cast(PN->getType()), - VT1, VT2); - } - unsigned PHIReg = ValueMap[PN]; - assert(PHIReg &&"PHI node does not have an assigned virtual register!"); - for (unsigned i = 0; i != NumElements; ++i) - BuildMI(MBB, TargetInstrInfo::PHI, PN->getNumOperands(), PHIReg+i); - } + for (BasicBlock::iterator I = BB->begin();(PN = dyn_cast(I)); ++I){ + if (PN->use_empty()) continue; + + MVT::ValueType VT = TLI.getValueType(PN->getType()); + unsigned NumElements; + if (VT != MVT::Vector) + NumElements = TLI.getNumElements(VT); + else { + MVT::ValueType VT1,VT2; + NumElements = + TLI.getPackedTypeBreakdown(cast(PN->getType()), + VT1, VT2); + } + unsigned PHIReg = ValueMap[PN]; + assert(PHIReg && "PHI node does not have an assigned virtual register!"); + for (unsigned i = 0; i != NumElements; ++i) + BuildMI(MBB, TargetInstrInfo::PHI, PN->getNumOperands(), PHIReg+i); + } } } @@ -497,6 +497,7 @@ void FindMergedConditions(Value *Cond, MachineBasicBlock *TBB, MachineBasicBlock *FBB, MachineBasicBlock *CurBB, unsigned Opc); + bool isExportableFromCurrentBlock(Value *V, const BasicBlock *FromBB); void ExportFromCurrentBlock(Value *V); // Terminator instructions. @@ -798,15 +799,39 @@ PendingLoads.push_back(CopyValueToVirtualRegister(V, Reg)); } +bool SelectionDAGLowering::isExportableFromCurrentBlock(Value *V, + const BasicBlock *FromBB) { + // The operands of the setcc have to be in this block. We don't know + // how to export them from some other block. + if (Instruction *VI = dyn_cast(V)) { + // Can export from current BB. + if (VI->getParent() == FromBB) + return true; + + // Is already exported, noop. + return FuncInfo.isExportedInst(V); + } + + // If this is an argument, we can export it if the BB is the entry block or + // if it is already exported. + if (isa(V)) { + if (FromBB == &FromBB->getParent()->getEntryBlock()) + return true; + + // Otherwise, can only export this if it is already exported. + return FuncInfo.isExportedInst(V); + } + + // Otherwise, constants can always be exported. + return true; +} + /// FindMergedConditions - If Cond is an expression like void SelectionDAGLowering::FindMergedConditions(Value *Cond, MachineBasicBlock *TBB, MachineBasicBlock *FBB, MachineBasicBlock *CurBB, unsigned Opc) { - // FIXME: HANDLE AND. - // FIXME: HANDLE NOT - // If this node is not part of the or/and tree, emit it as a branch. BinaryOperator *BOp = dyn_cast(Cond); @@ -819,12 +844,8 @@ if (BOp && isa(BOp) && // The operands of the setcc have to be in this block. We don't know // how to export them from some other block. - (!isa(BOp->getOperand(0)) || - cast(BOp->getOperand(0))->getParent() == BB || - FuncInfo.isExportedInst(BOp->getOperand(0))) && - (!isa(BOp->getOperand(1)) || - cast(BOp->getOperand(1))->getParent() == BB || - FuncInfo.isExportedInst(BOp->getOperand(1)))) { + isExportableFromCurrentBlock(BOp->getOperand(0), BB) && + isExportableFromCurrentBlock(BOp->getOperand(1), BB)) { ExportFromCurrentBlock(BOp->getOperand(0)); ExportFromCurrentBlock(BOp->getOperand(1)); @@ -1222,10 +1243,18 @@ DestBBs.push_back(Default); } - // Update successor info + // Update successor info. Add one edge to each unique successor. + // Vector bool would be better, but vector is really slow. + std::vector SuccsHandled; + SuccsHandled.resize(CurMBB->getParent()->getNumBlockIDs()); + for (std::vector::iterator I = DestBBs.begin(), - E = DestBBs.end(); I != E; ++I) - JumpTableBB->addSuccessor(*I); + E = DestBBs.end(); I != E; ++I) { + if (!SuccsHandled[(*I)->getNumber()]) { + SuccsHandled[(*I)->getNumber()] = true; + JumpTableBB->addSuccessor(*I); + } + } // Create a jump table index for this jump table, or return an existing // one. @@ -3710,63 +3739,77 @@ // BB. As such, the start of the BB might correspond to a different MBB than // the end. // + TerminatorInst *TI = LLVMBB->getTerminator(); // Emit constants only once even if used by multiple PHI nodes. std::map ConstantsOut; + // Vector bool would be better, but vector is really slow. + std::vector SuccsHandled; + if (TI->getNumSuccessors()) + SuccsHandled.resize(BB->getParent()->getNumBlockIDs()); + // Check successor nodes PHI nodes that expect a constant to be available from // this block. - TerminatorInst *TI = LLVMBB->getTerminator(); for (unsigned succ = 0, e = TI->getNumSuccessors(); succ != e; ++succ) { BasicBlock *SuccBB = TI->getSuccessor(succ); if (!isa(SuccBB->begin())) continue; + MachineBasicBlock *SuccMBB = FuncInfo.MBBMap[SuccBB]; - MachineBasicBlock::iterator MBBI = FuncInfo.MBBMap[SuccBB]->begin(); + // If this terminator has multiple identical successors (common for + // switches), only handle each succ once. + unsigned SuccMBBNo = SuccMBB->getNumber(); + if (SuccsHandled[SuccMBBNo]) continue; + SuccsHandled[SuccMBBNo] = true; + + MachineBasicBlock::iterator MBBI = SuccMBB->begin(); PHINode *PN; // At this point we know that there is a 1-1 correspondence between LLVM PHI // nodes and Machine PHI nodes, but the incoming operands have not been // emitted yet. for (BasicBlock::iterator I = SuccBB->begin(); - (PN = dyn_cast(I)); ++I) - if (!PN->use_empty()) { - unsigned Reg; - Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB); - if (Constant *C = dyn_cast(PHIOp)) { - unsigned &RegOut = ConstantsOut[C]; - if (RegOut == 0) { - RegOut = FuncInfo.CreateRegForValue(C); - UnorderedChains.push_back( - SDL.CopyValueToVirtualRegister(C, RegOut)); - } - Reg = RegOut; - } else { - Reg = FuncInfo.ValueMap[PHIOp]; - if (Reg == 0) { - assert(isa(PHIOp) && - FuncInfo.StaticAllocaMap.count(cast(PHIOp)) && - "Didn't codegen value into a register!??"); - Reg = FuncInfo.CreateRegForValue(PHIOp); - UnorderedChains.push_back( - SDL.CopyValueToVirtualRegister(PHIOp, Reg)); - } + (PN = dyn_cast(I)); ++I) { + // Ignore dead phi's. + if (PN->use_empty()) continue; + + unsigned Reg; + Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB); + if (Constant *C = dyn_cast(PHIOp)) { + unsigned &RegOut = ConstantsOut[C]; + if (RegOut == 0) { + RegOut = FuncInfo.CreateRegForValue(C); + UnorderedChains.push_back( + SDL.CopyValueToVirtualRegister(C, RegOut)); } - - // Remember that this register needs to added to the machine PHI node as - // the input for this MBB. - MVT::ValueType VT = TLI.getValueType(PN->getType()); - unsigned NumElements; - if (VT != MVT::Vector) - NumElements = TLI.getNumElements(VT); - else { - MVT::ValueType VT1,VT2; - NumElements = - TLI.getPackedTypeBreakdown(cast(PN->getType()), - VT1, VT2); + Reg = RegOut; + } else { + Reg = FuncInfo.ValueMap[PHIOp]; + if (Reg == 0) { + assert(isa(PHIOp) && + FuncInfo.StaticAllocaMap.count(cast(PHIOp)) && + "Didn't codegen value into a register!??"); + Reg = FuncInfo.CreateRegForValue(PHIOp); + UnorderedChains.push_back( + SDL.CopyValueToVirtualRegister(PHIOp, Reg)); } - for (unsigned i = 0, e = NumElements; i != e; ++i) - PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i)); } + + // Remember that this register needs to added to the machine PHI node as + // the input for this MBB. + MVT::ValueType VT = TLI.getValueType(PN->getType()); + unsigned NumElements; + if (VT != MVT::Vector) + NumElements = TLI.getNumElements(VT); + else { + MVT::ValueType VT1,VT2; + NumElements = + TLI.getPackedTypeBreakdown(cast(PN->getType()), + VT1, VT2); + } + for (unsigned i = 0, e = NumElements; i != e; ++i) + PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i)); + } } ConstantsOut.clear(); From jlaskey at apple.com Fri Oct 27 18:53:05 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 18:53:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200610272353.k9RNr5sb012335@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.357 -> 1.358 --- Log message: Clean up. --- Diffs of the changes: (+12 -2) SelectionDAG.cpp | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.357 Fri Oct 27 18:46:08 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Oct 27 18:52:51 2006 @@ -260,6 +260,9 @@ static unsigned getNodeIDOpcode(FoldingSetNodeID &ID) { return ID.getRawData(0); } + +/// AddNodeIDOpcode - Add the node opcode to the NodeID data. +/// static void AddNodeIDOpcode(FoldingSetNodeID &ID, unsigned OpC) { ID.AddInteger(OpC); } @@ -270,15 +273,18 @@ ID.AddPointer(VTList.VTs); } - +/// AddNodeIDOperand - Add an operands data to the NodeID data. +/// static void AddNodeIDOperand(FoldingSetNodeID &ID, SDOperand Op) { ID.AddPointer(Op.Val); ID.AddInteger(Op.ResNo); } +/// AddNodeIDOperands - Various routines for adding operands to the NodeID data. +/// static void AddNodeIDOperands(FoldingSetNodeID &ID) { } -void AddNodeIDOperands(FoldingSetNodeID &ID, SDOperand Op) { +static void AddNodeIDOperands(FoldingSetNodeID &ID, SDOperand Op) { AddNodeIDOperand(ID, Op); } static void AddNodeIDOperands(FoldingSetNodeID &ID, @@ -298,6 +304,8 @@ AddNodeIDOperand(ID, *Ops); } +/// AddNodeIDOperands - Various routines for adding node info to the NodeID +/// data. static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC, SDVTList VTList) { AddNodeIDOpcode(ID, OpC); @@ -333,6 +341,8 @@ AddNodeIDOperands(ID, OpList, N); } +/// AddNodeIDNode - Generic routine for adding a nodes info to the NodeID +/// data. static void AddNodeIDNode(FoldingSetNodeID &ID, SDNode *N) { AddNodeIDOpcode(ID, N->getOpcode()); // Add the return value info. From reid at x10sys.com Fri Oct 27 19:11:53 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 27 Oct 2006 19:11:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Makefile Message-ID: <200610280011.k9S0BrrE012648@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: Makefile updated: 1.29 -> 1.30 --- Log message: Make sure all the readme files get distributed. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/Makefile diff -u llvm/lib/Target/X86/Makefile:1.29 llvm/lib/Target/X86/Makefile:1.30 --- llvm/lib/Target/X86/Makefile:1.29 Fri Oct 6 04:17:41 2006 +++ llvm/lib/Target/X86/Makefile Fri Oct 27 19:11:39 2006 @@ -9,7 +9,7 @@ LEVEL = ../../.. LIBRARYNAME = LLVMX86 TARGET = X86 -EXTRA_DIST = README.txt +EXTRA_DIST = README.txt README-FPStack.txt README-SSE.txt README-X86-64.txt # Make sure that tblgen is run, first thing. BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \ X86GenRegisterInfo.inc X86GenInstrNames.inc \ From sabre at nondot.org Fri Oct 27 19:48:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 19:48:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Makefile Message-ID: <200610280048.k9S0mfdN013233@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: Makefile updated: 1.30 -> 1.31 --- Log message: don't distribute internal readme's --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/Makefile diff -u llvm/lib/Target/X86/Makefile:1.30 llvm/lib/Target/X86/Makefile:1.31 --- llvm/lib/Target/X86/Makefile:1.30 Fri Oct 27 19:11:39 2006 +++ llvm/lib/Target/X86/Makefile Fri Oct 27 19:48:27 2006 @@ -9,7 +9,7 @@ LEVEL = ../../.. LIBRARYNAME = LLVMX86 TARGET = X86 -EXTRA_DIST = README.txt README-FPStack.txt README-SSE.txt README-X86-64.txt + # Make sure that tblgen is run, first thing. BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \ X86GenRegisterInfo.inc X86GenInstrNames.inc \ From sabre at nondot.org Fri Oct 27 19:50:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 19:50:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/Makefile Message-ID: <200610280050.k9S0o9Lf013287@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: Makefile updated: 1.22 -> 1.23 --- Log message: don't dist internal readme's --- Diffs of the changes: (+0 -1) Makefile | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/PowerPC/Makefile diff -u llvm/lib/Target/PowerPC/Makefile:1.22 llvm/lib/Target/PowerPC/Makefile:1.23 --- llvm/lib/Target/PowerPC/Makefile:1.22 Thu Apr 13 01:39:24 2006 +++ llvm/lib/Target/PowerPC/Makefile Fri Oct 27 19:49:54 2006 @@ -9,7 +9,6 @@ LEVEL = ../../.. LIBRARYNAME = LLVMPowerPC TARGET = PPC -EXTRA_DIST = README.txt README_ALTIVEC.txt # Make sure that tblgen is run, first thing. BUILT_SOURCES = PPCGenInstrNames.inc PPCGenRegisterNames.inc \ From sabre at nondot.org Fri Oct 27 19:50:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 19:50:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Makefile Message-ID: <200610280050.k9S0oxkC013328@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: Makefile updated: 1.15 -> 1.16 --- Log message: don't dist internal readme --- Diffs of the changes: (+0 -1) Makefile | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/Sparc/Makefile diff -u llvm/lib/Target/Sparc/Makefile:1.15 llvm/lib/Target/Sparc/Makefile:1.16 --- llvm/lib/Target/Sparc/Makefile:1.15 Thu Apr 13 01:39:24 2006 +++ llvm/lib/Target/Sparc/Makefile Fri Oct 27 19:50:45 2006 @@ -9,7 +9,6 @@ LEVEL = ../../.. LIBRARYNAME = LLVMSparc TARGET = Sparc -EXTRA_DIST = README.txt # Make sure that tblgen is run, first thing. BUILT_SOURCES = SparcGenRegisterInfo.h.inc SparcGenRegisterNames.inc \ From sabre at nondot.org Fri Oct 27 19:51:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 19:51:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Makefile Message-ID: <200610280051.k9S0pTMu013365@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: Makefile updated: 1.27 -> 1.28 --- Log message: don't dist internal readme --- Diffs of the changes: (+0 -1) Makefile | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/Makefile diff -u llvm/lib/Target/Makefile:1.27 llvm/lib/Target/Makefile:1.28 --- llvm/lib/Target/Makefile:1.27 Thu Apr 13 01:39:24 2006 +++ llvm/lib/Target/Makefile Fri Oct 27 19:51:15 2006 @@ -10,7 +10,6 @@ LEVEL = ../.. LIBRARYNAME = LLVMTarget BUILD_ARCHIVE = 1 -EXTRA_DIST = README.txt # We include this early so we can access the value of TARGETS_TO_BUILD as the # value for PARALLEL_DIRS which must be set before Makefile.rules is included From sabre at nondot.org Fri Oct 27 19:59:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 19:59:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200610280059.k9S0xYo2013533@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.90 -> 1.91 --- Log message: prepare for a change I'm about to make --- Diffs of the changes: (+6 -0) LoopStrengthReduce.cpp | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.90 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.91 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.90 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Oct 27 19:59:20 2006 @@ -379,6 +379,9 @@ for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (PN->getIncomingValue(i) == IV) { SplitCriticalEdge(PN->getIncomingBlock(i), PN->getParent(), P); + // Splitting the critical edge can reduce the number of entries in this + // PHI. + e = PN->getNumIncomingValues(); if (--NumUses == 0) break; } @@ -589,6 +592,9 @@ BasicBlock *NewBB = PN->getIncomingBlock(i); NewBB->moveBefore(PN->getParent()); } + + // Splitting the edge can reduce the number of PHI entries we have. + e = PN->getNumIncomingValues(); } Value *&Code = InsertedCode[PN->getIncomingBlock(i)]; From sabre at nondot.org Fri Oct 27 20:24:20 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 20:24:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp Message-ID: <200610280124.k9S1OKDx013954@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: LoopInfo.cpp updated: 1.78 -> 1.79 --- Log message: add a method --- Diffs of the changes: (+20 -0) LoopInfo.cpp | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm/lib/Analysis/LoopInfo.cpp diff -u llvm/lib/Analysis/LoopInfo.cpp:1.78 llvm/lib/Analysis/LoopInfo.cpp:1.79 --- llvm/lib/Analysis/LoopInfo.cpp:1.78 Tue Aug 29 17:29:16 2006 +++ llvm/lib/Analysis/LoopInfo.cpp Fri Oct 27 20:24:05 2006 @@ -332,6 +332,26 @@ // APIs for simple analysis of the loop. // +/// getExitingBlocks - Return all blocks inside the loop that have successors +/// outside of the loop. These are the blocks _inside of the current loop_ +/// which branch out. The returned list is always unique. +/// +void Loop::getExitingBlocks(std::vector &ExitingBlocks) const { + // Sort the blocks vector so that we can use binary search to do quick + // lookups. + std::vector LoopBBs(block_begin(), block_end()); + std::sort(LoopBBs.begin(), LoopBBs.end()); + + for (std::vector::const_iterator BI = Blocks.begin(), + BE = Blocks.end(); BI != BE; ++BI) + for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I) + if (!std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I)) { + // Not in current loop? It must be an exit block. + ExitingBlocks.push_back(*BI); + break; + } +} + /// getExitBlocks - Return all of the successor blocks of this loop. These /// are the blocks _outside of the current loop_ which are branched to. /// From sabre at nondot.org Fri Oct 27 20:24:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 27 Oct 2006 20:24:21 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/LoopInfo.h Message-ID: <200610280124.k9S1OLMw013959@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: LoopInfo.h updated: 1.58 -> 1.59 --- Log message: add a method --- Diffs of the changes: (+6 -0) LoopInfo.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Analysis/LoopInfo.h diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.58 llvm/include/llvm/Analysis/LoopInfo.h:1.59 --- llvm/include/llvm/Analysis/LoopInfo.h:1.58 Tue Aug 29 17:29:16 2006 +++ llvm/include/llvm/Analysis/LoopInfo.h Fri Oct 27 20:24:05 2006 @@ -107,6 +107,12 @@ // induction variable canonicalization pass should be used to normalize loops // for easy analysis. These methods assume canonical loops. + /// getExitingBlocks - Return all blocks inside the loop that have successors + /// outside of the loop. These are the blocks _inside of the current loop_ + /// which branch out. The returned list is always unique. + /// + void getExitingBlocks(std::vector &Blocks) const; + /// getExitBlocks - Return all of the successor blocks of this loop. These /// are the blocks _outside of the current loop_ which are branched to. /// From jlaskey at apple.com Fri Oct 27 20:34:36 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 27 Oct 2006 20:34:36 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h Message-ID: <200610280134.k9S1YaX0014126@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.141 -> 1.142 SelectionDAGNodes.h updated: 1.157 -> 1.158 --- Log message: Editorial clean up. --- Diffs of the changes: (+0 -2) SelectionDAG.h | 1 - SelectionDAGNodes.h | 1 - 2 files changed, 2 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.141 llvm/include/llvm/CodeGen/SelectionDAG.h:1.142 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.141 Fri Oct 27 18:46:08 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Fri Oct 27 20:34:21 2006 @@ -32,7 +32,6 @@ class MachineDebugInfo; class MachineFunction; class MachineConstantPoolValue; - class SDOperand; /// SelectionDAG class - This is used to represent a portion of an LLVM function /// in a low-level Data Dependence DAG representation suitable for instruction Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.158 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.157 Fri Oct 27 18:46:08 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Fri Oct 27 20:34:21 2006 @@ -23,7 +23,6 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" -#include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/Support/DataTypes.h" #include From nicholas at mxc.ca Fri Oct 27 21:34:55 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 27 Oct 2006 21:34:55 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll Message-ID: <200610280234.k9S2YttF015028@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/PredicateSimplifier: 2006-10-22-IntOr.ll updated: 1.2 -> 1.3 --- Log message: Emitting raw bytecode is awfully rude. Add -disable-output. Clarify the test. --- Diffs of the changes: (+17 -7) 2006-10-22-IntOr.ll | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) Index: llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll diff -u llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.2 llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.3 --- llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll:1.2 Wed Oct 25 19:51:58 2006 +++ llvm/test/Regression/Transforms/PredicateSimplifier/2006-10-22-IntOr.ll Fri Oct 27 21:34:41 2006 @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg && -; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep -c fail | grep 1 && -; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep -c pass | grep 1 +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg -disable-output && +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | not grep fail && +; RUN: llvm-as < %s | opt -predsimplify -instcombine -simplifycfg | llvm-dis | grep -v declare | grep -c pass | grep 3 int %test1(int %x, int %y) { entry: @@ -10,12 +10,16 @@ cond_true: ; preds = %entry %tmp4 = seteq int %x, 0 ; [#uses=1] - br bool %tmp4, label %cond_true5, label %return + br bool %tmp4, label %cond_true5, label %cond_false cond_true5: ; preds = %cond_true - %tmp6 = call int %fail( ) ; [#uses=0] + %tmp6 = call int %pass( ) ; [#uses=1] ret int %tmp6 +cond_false: + %tmp8 = call int %fail ( ) ; [#uses=1] + ret int %tmp8 + return: ; preds = %cond_next7 ret int 0 } @@ -28,15 +32,21 @@ cond_true: ; preds = %entry %tmp4 = seteq int %x, 0 ; [#uses=1] - br bool %tmp4, label %cond_true5, label %return + br bool %tmp4, label %cond_true5, label %cond_false cond_true5: ; preds = %cond_true - %tmp6 = call int %pass( ) ; [#uses=0] + %tmp6 = call int %pass1( ) ; [#uses=1] ret int %tmp6 +cond_false: + %tmp8 = call int %pass2( ) ; [#uses=1] + ret int %tmp8 + return: ; preds = %cond_next7 ret int 0 } declare int %fail() declare int %pass() +declare int %pass1() +declare int %pass2() From evan.cheng at apple.com Sat Oct 28 00:56:20 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Oct 2006 00:56:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200610280556.k9S5uKHM017930@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.206 -> 1.207 --- Log message: Doh. Must check if GV is constant first. --- Diffs of the changes: (+2 -2) X86AsmPrinter.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.206 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.207 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.206 Thu Oct 26 14:18:18 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Sat Oct 28 00:56:06 2006 @@ -205,9 +205,9 @@ O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: { - if (TAI->getCStringSection()) { + if (I->isConstant()) { const ConstantArray *CVA = dyn_cast(C); - if (CVA && CVA->isCString()) { + if (TAI->getCStringSection() && CVA && CVA->isCString()) { SwitchToDataSection(TAI->getCStringSection(), I); break; } From evan.cheng at apple.com Sat Oct 28 00:57:06 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Oct 2006 00:57:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200610280557.k9S5v6J3017991@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.203 -> 1.204 --- Log message: Doh. Must check if GV is constant first before putting it in .cstring. --- Diffs of the changes: (+2 -2) PPCAsmPrinter.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.203 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.204 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.203 Thu Oct 26 16:48:57 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Sat Oct 28 00:56:51 2006 @@ -548,9 +548,9 @@ O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - if (TAI->getCStringSection()) { + if (I->isConstant()) { const ConstantArray *CVA = dyn_cast(C); - if (CVA && CVA->isCString()) { + if (TAI->getCStringSection() && CVA && CVA->isCString()) { SwitchToDataSection(TAI->getCStringSection(), I); break; } From sabre at nondot.org Sat Oct 28 01:15:40 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:15:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200610280615.k9S6Fen4018489@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.358 -> 1.359 --- Log message: Fix a serious bug that caused any x86 vector stuff to infinite loop --- Diffs of the changes: (+1 -1) SelectionDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.358 Fri Oct 27 18:52:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 01:15:26 2006 @@ -331,7 +331,7 @@ SDOperand Op1, SDOperand Op2, SDOperand Op3) { AddNodeIDOpcode(ID, OpC); AddNodeIDValueTypes(ID, VTList); - AddNodeIDOperands(ID, Op1, Op2); + AddNodeIDOperands(ID, Op1, Op2, Op3); } static void AddNodeIDNode(FoldingSetNodeID &ID, unsigned short OpC, SDVTList VTList, From sabre at nondot.org Sat Oct 28 01:38:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:38:29 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Message-ID: <200610280638.k9S6cT5n018880@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.35 -> 1.36 --- Log message: SplitCriticalEdge checks to see if an edge is critical, don't check twice --- Diffs of the changes: (+1 -2) CorrelatedExprs.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.35 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.36 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.35 Thu Sep 28 18:35:21 2006 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Sat Oct 28 01:38:14 2006 @@ -621,8 +621,7 @@ // Make sure that we don't introduce critical edges from oldsucc now! for (unsigned i = 0, e = OldSucc->getTerminator()->getNumSuccessors(); i != e; ++i) - if (isCriticalEdge(OldSucc->getTerminator(), i)) - SplitCriticalEdge(OldSucc->getTerminator(), i, this); + SplitCriticalEdge(OldSucc->getTerminator(), i, this); // Since we invalidated the CFG, recalculate the dominator set so that it is // useful for later processing! From sabre at nondot.org Sat Oct 28 01:45:11 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:45:11 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h Message-ID: <200610280645.k9S6jBiu019026@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms/Utils: BasicBlockUtils.h updated: 1.13 -> 1.14 --- Log message: Expose a smarter way to break critical edges. --- Diffs of the changes: (+11 -4) BasicBlockUtils.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h diff -u llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.13 llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.14 --- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.13 Sat May 13 21:01:22 2006 +++ llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h Sat Oct 28 01:44:56 2006 @@ -63,9 +63,15 @@ /// split the critical edge. This will update DominatorSet, ImmediateDominator, /// DominatorTree, and DominatorFrontier information if it is available, thus /// calling this pass will not invalidate either of them. This returns true if -/// the edge was split, false otherwise. +/// the edge was split, false otherwise. If MergeIdenticalEdges is true (the +/// default), *all* edges from TI to the specified successor will be merged into +/// the same critical edge block. This is most commonly interesting with switch +/// instructions, which may have many edges to any one destination. This +/// ensures that all edges to that dest go to one block instead of each going to +/// a different block, but isn't the standard definition of a "critical edge". /// -bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0); +bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P = 0, + bool MergeIdenticalEdges = false); inline bool SplitCriticalEdge(BasicBlock *BB, succ_iterator SI, Pass *P = 0) { return SplitCriticalEdge(BB->getTerminator(), SI.getSuccessorIndex(), P); @@ -89,13 +95,14 @@ /// and return true, otherwise return false. This method requires that there be /// an edge between the two blocks. If P is specified, it updates the analyses /// described above. -inline bool SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst, Pass *P = 0) { +inline bool SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst, Pass *P = 0, + bool MergeIdenticalEdges = false) { TerminatorInst *TI = Src->getTerminator(); unsigned i = 0; while (1) { assert(i != TI->getNumSuccessors() && "Edge doesn't exist!"); if (TI->getSuccessor(i) == Dst) - return SplitCriticalEdge(TI, i, P); + return SplitCriticalEdge(TI, i, P, MergeIdenticalEdges); ++i; } } From sabre at nondot.org Sat Oct 28 01:45:12 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:45:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Message-ID: <200610280645.k9S6jC9B019031@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.34 -> 1.35 --- Log message: Expose a smarter way to break critical edges. --- Diffs of the changes: (+24 -5) BreakCriticalEdges.cpp | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.34 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.35 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.34 Tue Oct 3 23:58:58 2006 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Sat Oct 28 01:44:56 2006 @@ -100,10 +100,12 @@ // SplitCriticalEdge - If this edge is a critical edge, insert a new node to // split the critical edge. This will update DominatorSet, ImmediateDominator, // DominatorTree, and DominatorFrontier information if it is available, thus -// calling this pass will not invalidate either of them. This returns true if -// the edge was split, false otherwise. +// calling this pass will not invalidate any of them. This returns true if +// the edge was split, false otherwise. This ensures that all edges to that +// dest go to one block instead of each going to a different block. // -bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { +bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P, + bool MergeIdenticalEdges) { if (!isCriticalEdge(TI, SuccNum)) return false; BasicBlock *TIBB = TI->getParent(); BasicBlock *DestBB = TI->getSuccessor(SuccNum); @@ -114,13 +116,13 @@ // Create our unconditional branch... new BranchInst(DestBB, NewBB); - // Branch to the new block, breaking the edge... + // Branch to the new block, breaking the edge. TI->setSuccessor(SuccNum, NewBB); // Insert the block into the function... right after the block TI lives in. Function &F = *TIBB->getParent(); F.getBasicBlockList().insert(TIBB->getNext(), NewBB); - + // If there are any PHI nodes in DestBB, we need to update them so that they // merge incoming values from NewBB instead of from TIBB. // @@ -132,6 +134,23 @@ int BBIdx = PN->getBasicBlockIndex(TIBB); PN->setIncomingBlock(BBIdx, NewBB); } + + // If there are any other edges from TIBB to DestBB, update those to go + // through the split block, making those edges non-critical as well (and + // reducing the number of phi entries in the DestBB if relevant). + if (MergeIdenticalEdges) { + for (unsigned i = SuccNum+1, e = TI->getNumSuccessors(); i != e; ++i) { + if (TI->getSuccessor(i) != DestBB) continue; + + // Remove an entry for TIBB from DestBB phi nodes. + DestBB->removePredecessor(TIBB); + + // We found another edge to DestBB, go to NewBB instead. + TI->setSuccessor(i, NewBB); + } + } + + // If we don't have a pass object, we can't update anything... if (P == 0) return true; From sabre at nondot.org Sat Oct 28 01:45:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:45:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200610280645.k9S6jmiO019068@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.91 -> 1.92 --- Log message: break edges more intelligently --- Diffs of the changes: (+3 -2) LoopStrengthReduce.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.91 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.92 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.91 Fri Oct 27 19:59:20 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sat Oct 28 01:45:33 2006 @@ -378,7 +378,8 @@ // post-incremented value. for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (PN->getIncomingValue(i) == IV) { - SplitCriticalEdge(PN->getIncomingBlock(i), PN->getParent(), P); + SplitCriticalEdge(PN->getIncomingBlock(i), PN->getParent(), P, + true); // Splitting the critical edge can reduce the number of entries in this // PHI. e = PN->getNumIncomingValues(); @@ -582,7 +583,7 @@ (PN->getParent() != L->getHeader() || !L->contains(PHIPred))) { // First step, split the critical edge. - SplitCriticalEdge(PHIPred, PN->getParent(), P); + SplitCriticalEdge(PHIPred, PN->getParent(), P, true); // Next step: move the basic block. In particular, if the PHI node // is outside of the loop, and PredTI is in the loop, we want to From sabre at nondot.org Sat Oct 28 01:58:32 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:58:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Message-ID: <200610280658.k9S6wWJA019308@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: BreakCriticalEdges.cpp updated: 1.35 -> 1.36 --- Log message: add option to isCriticalEdge --- Diffs of the changes: (+12 -3) BreakCriticalEdges.cpp | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.35 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.36 --- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.35 Sat Oct 28 01:44:56 2006 +++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp Sat Oct 28 01:58:17 2006 @@ -84,7 +84,8 @@ // Critical edges are edges from a block with multiple successors to a block // with multiple predecessors. // -bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum) { +bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum, + bool AllowIdenticalEdges) { assert(SuccNum < TI->getNumSuccessors() && "Illegal edge specification!"); if (TI->getNumSuccessors() == 1) return false; @@ -93,8 +94,16 @@ // If there is more than one predecessor, this is a critical edge... assert(I != E && "No preds, but we have an edge to the block?"); + const BasicBlock *FirstPred = *I; ++I; // Skip one edge due to the incoming arc from TI. - return I != E; + if (!AllowIdenticalEdges) + return I != E; + + // If AllowIdenticalEdges is true, then we allow this edge to be considered + // non-critical iff all preds come from TI's block. + for (; I != E; ++I) + if (*I != FirstPred) return true; + return false; } // SplitCriticalEdge - If this edge is a critical edge, insert a new node to @@ -106,7 +115,7 @@ // bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P, bool MergeIdenticalEdges) { - if (!isCriticalEdge(TI, SuccNum)) return false; + if (!isCriticalEdge(TI, SuccNum, MergeIdenticalEdges)) return false; BasicBlock *TIBB = TI->getParent(); BasicBlock *DestBB = TI->getSuccessor(SuccNum); From sabre at nondot.org Sat Oct 28 01:58:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 01:58:33 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h Message-ID: <200610280658.k9S6wXA2019313@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Transforms/Utils: BasicBlockUtils.h updated: 1.14 -> 1.15 --- Log message: add option to isCriticalEdge --- Diffs of the changes: (+2 -1) BasicBlockUtils.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h diff -u llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.14 llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.15 --- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.14 Sat Oct 28 01:44:56 2006 +++ llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h Sat Oct 28 01:58:17 2006 @@ -57,7 +57,8 @@ /// Critical edges are edges from a block with multiple successors to a block /// with multiple predecessors. /// -bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum); +bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum, + bool AllowIdenticalEdges = false); /// SplitCriticalEdge - If this edge is a critical edge, insert a new node to /// split the critical edge. This will update DominatorSet, ImmediateDominator, From sabre at nondot.org Sat Oct 28 12:04:30 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 12:04:30 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/switch-crit-edge-constant.ll Message-ID: <200610281704.k9SH4U5s008649@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: switch-crit-edge-constant.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+55 -0) switch-crit-edge-constant.ll | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/switch-crit-edge-constant.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/switch-crit-edge-constant.ll:1.1 *** /dev/null Sat Oct 28 12:04:26 2006 --- llvm/test/Regression/CodeGen/Generic/switch-crit-edge-constant.ll Sat Oct 28 12:04:16 2006 *************** *** 0 **** --- 1,55 ---- + ; RUN: llvm-as < %s | llc -march=x86 && + ; RUN: llvm-as < %s | llc -march=x86 | grep 'mov.*str1' | wc -l | grep 1 + ; PR925 + + target endian = little + target pointersize = 32 + target triple = "i686-apple-darwin8.7.2" + %str1 = internal constant [5 x sbyte] c"bonk\00" ; <[5 x sbyte]*> [#uses=1] + %str2 = internal constant [5 x sbyte] c"bork\00" ; <[5 x sbyte]*> [#uses=1] + %str = internal constant [8 x sbyte] c"perfwap\00" ; <[8 x sbyte]*> [#uses=1] + + implementation ; Functions: + + void %foo(int %C) { + entry: + switch int %C, label %bb2 [ + int 1, label %blahaha + int 2, label %blahaha + int 3, label %blahaha + int 4, label %blahaha + int 5, label %blahaha + int 6, label %blahaha + int 7, label %blahaha + int 8, label %blahaha + int 9, label %blahaha + int 10, label %blahaha + ] + + bb2: ; preds = %entry + %tmp5 = and int %C, 123 ; [#uses=1] + %tmp = seteq int %tmp5, 0 ; [#uses=1] + br bool %tmp, label %blahaha, label %cond_true + + cond_true: ; preds = %bb2 + br label %blahaha + + blahaha: ; preds = %cond_true, %bb2, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry + %s.0 = phi sbyte* [ getelementptr ([8 x sbyte]* %str, int 0, uint 0), %cond_true ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str1, int 0, uint 0), %entry ], [ getelementptr ([5 x sbyte]* %str2, int 0, uint 0), %bb2 ] ; [#uses=13] + %tmp8 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp10 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp12 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp14 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp16 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp18 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp20 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp22 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp24 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp26 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp28 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp30 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + %tmp32 = tail call int (sbyte*, ...)* %printf( sbyte* %s.0 ) ; [#uses=0] + ret void + } + + declare int %printf(sbyte*, ...) From sabre at nondot.org Sat Oct 28 12:04:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 12:04:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610281704.k9SH4pW0008668@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.303 -> 1.304 --- Log message: Split *all* critical edges before isel. This resolves issues with spill code being inserted on unsplit critical edges, which introduces (sometimes large amounts of) partially dead spill code. This also fixes PR925: http://llvm.org/PR925 + CodeGen/Generic/switch-crit-edge-constant.ll --- Diffs of the changes: (+8 -44) SelectionDAGISel.cpp | 52 +++++++-------------------------------------------- 1 files changed, 8 insertions(+), 44 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.303 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.304 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.303 Fri Oct 27 18:50:33 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Oct 28 12:04:37 2006 @@ -3490,64 +3490,28 @@ return true; } -/// SplitCritEdgesForPHIConstants - If this block has any PHI nodes with -/// constant operands, and if any of the edges feeding the PHI node are -/// critical, split them so that the assignments of a constant to a register -/// will not be executed on a path that isn't relevant. -void SelectionDAGISel::SplitCritEdgesForPHIConstants(BasicBlock *BB) { - // The most common case is that this is a PHI node with two incoming - // successors handle this case efficiently, because it is simple. - PHINode *PN = cast(BB->begin()); - if (PN->getNumIncomingValues() == 2) { - // If neither edge is critical, we never need to split. - if (PN->getIncomingBlock(0)->getTerminator()->getNumSuccessors() == 1 && - PN->getIncomingBlock(1)->getTerminator()->getNumSuccessors() == 1) - return; - - BasicBlock::iterator BBI = BB->begin(); - while ((PN = dyn_cast(BBI++))) { - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) - if (isa(PN->getIncomingValue(i))) - SplitCriticalEdge(PN->getIncomingBlock(i), BB); - } - return; - } - - // Otherwise, things are a bit trickier. - - // BE SMART HERE. - - BasicBlock::iterator BBI = BB->begin(); - while ((PN = dyn_cast(BBI++))) { - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) - if (isa(PN->getIncomingValue(i))) - SplitCriticalEdge(PN->getIncomingBlock(i), BB); - } -} - - bool SelectionDAGISel::runOnFunction(Function &Fn) { MachineFunction &MF = MachineFunction::construct(&Fn, TLI.getTargetMachine()); RegMap = MF.getSSARegMap(); DEBUG(std::cerr << "\n\n\n=== " << Fn.getName() << "\n"); - // First, split all critical edges for PHI nodes with incoming values that are - // constants, this way the load of the constant into a vreg will not be placed - // into MBBs that are used some other way. + // First, split all critical edges. // // In this pass we also look for GEP and cast instructions that are used // across basic blocks and rewrite them to improve basic-block-at-a-time // selection. // - // bool MadeChange = true; while (MadeChange) { MadeChange = false; for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { - // If this block has any PHI nodes with constant operands, and if any of the - // edges feeding the PHI node are critical, split them. - if (isa(BB->begin())) - SplitCritEdgesForPHIConstants(BB); + // Split all critical edges. + TerminatorInst *BBTI = BB->getTerminator(); + if (BBTI->getNumSuccessors() > 1) { + for (unsigned i = 0, e = BBTI->getNumSuccessors(); i != e; ++i) + SplitCriticalEdge(BBTI, i, this, true); + } + for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { Instruction *I = BBI++; From jlaskey at apple.com Sat Oct 28 12:25:43 2006 From: jlaskey at apple.com (Jim Laskey) Date: Sat, 28 Oct 2006 12:25:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200610281725.k9SHPhnI009436@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.359 -> 1.360 --- Log message: Load and stores have not been uniqued properly. --- Diffs of the changes: (+42 -13) SelectionDAG.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 Sat Oct 28 01:15:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 12:25:28 2006 @@ -363,20 +363,24 @@ ID.AddDouble(cast(N)->getValue()); break; case ISD::TargetGlobalAddress: - case ISD::GlobalAddress: - ID.AddPointer(cast(N)->getGlobal()); - ID.AddInteger(cast(N)->getOffset()); + case ISD::GlobalAddress: { + GlobalAddressSDNode *GA = cast(N); + ID.AddPointer(GA->getGlobal()); + ID.AddInteger(GA->getOffset()); break; + } case ISD::BasicBlock: ID.AddPointer(cast(N)->getBasicBlock()); break; case ISD::Register: ID.AddInteger(cast(N)->getReg()); break; - case ISD::SRCVALUE: - ID.AddPointer(cast(N)->getValue()); - ID.AddInteger(cast(N)->getOffset()); + case ISD::SRCVALUE: { + SrcValueSDNode *SV = cast(N); + ID.AddPointer(SV->getValue()); + ID.AddInteger(SV->getOffset()); break; + } case ISD::FrameIndex: case ISD::TargetFrameIndex: ID.AddInteger(cast(N)->getIndex()); @@ -386,16 +390,41 @@ ID.AddInteger(cast(N)->getIndex()); break; case ISD::ConstantPool: - case ISD::TargetConstantPool: - ID.AddInteger(cast(N)->getAlignment()); - ID.AddInteger(cast(N)->getOffset()); - if (cast(N)->isMachineConstantPoolEntry()) - cast(N)->getMachineCPVal()-> - AddSelectionDAGCSEId(ID); + case ISD::TargetConstantPool: { + ConstantPoolSDNode *CP = cast(N); + ID.AddInteger(CP->getAlignment()); + ID.AddInteger(CP->getOffset()); + if (CP->isMachineConstantPoolEntry()) + CP->getMachineCPVal()->AddSelectionDAGCSEId(ID); else - ID.AddPointer(cast(N)->getConstVal()); + ID.AddPointer(CP->getConstVal()); + break; + } + case ISD::VLOAD: + case ISD::EXTLOAD: + case ISD::LOAD: { + LoadSDNode *LD = cast(N); + ID.AddInteger(LD->getAddressingMode()); + ID.AddInteger(LD->getExtensionType()); + ID.AddInteger(LD->getLoadedVT()); + ID.AddPointer(LD->getSrcValue()); + ID.AddInteger(LD->getSrcValueOffset()); + ID.AddInteger(LD->getAlignment()); + ID.AddInteger(LD->isVolatile()); + break; + } + case ISD::STORE: { + StoreSDNode *ST = cast(N); + ID.AddInteger(ST->getAddressingMode()); + ID.AddInteger(ST->isTruncatingStore()); + ID.AddInteger(ST->getStoredVT()); + ID.AddPointer(ST->getSrcValue()); + ID.AddInteger(ST->getSrcValueOffset()); + ID.AddInteger(ST->getAlignment()); + ID.AddInteger(ST->isVolatile()); break; } + } } } From sabre at nondot.org Sat Oct 28 12:30:11 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 12:30:11 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200610281730.k9SHUBMo009611@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.98 -> 1.99 --- Log message: add another target hook for branch folding. --- Diffs of the changes: (+8 -0) TargetInstrInfo.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.98 llvm/include/llvm/Target/TargetInstrInfo.h:1.99 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.98 Tue Oct 24 12:41:22 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Sat Oct 28 12:29:57 2006 @@ -318,6 +318,14 @@ assert(0 && "Target didn't implement TargetInstrInfo::InsertBranch!"); } + /// BlockHasNoFallThrough - Return true if the specified block does not + /// fall-through into its successor block. This is primarily used when a + /// branch is unanalyzable. It is useful for things like unconditional + /// indirect branches (jump tables). + virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const { + return false; + } + /// ReverseBranchCondition - Reverses the branch condition of the specified /// condition list, returning false on success and true if it cannot be /// reversed. From sabre at nondot.org Sat Oct 28 12:30:13 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 12:30:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrInfo.h Message-ID: <200610281730.k9SHUDXW009618@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.cpp updated: 1.69 -> 1.70 X86InstrInfo.h updated: 1.58 -> 1.59 --- Log message: add another target hook for branch folding. --- Diffs of the changes: (+13 -0) X86InstrInfo.cpp | 12 ++++++++++++ X86InstrInfo.h | 1 + 2 files changed, 13 insertions(+) Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.69 llvm/lib/Target/X86/X86InstrInfo.cpp:1.70 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.69 Sat Oct 21 00:52:40 2006 +++ llvm/lib/Target/X86/X86InstrInfo.cpp Sat Oct 28 12:29:57 2006 @@ -420,6 +420,18 @@ BuildMI(&MBB, X86::JMP, 1).addMBB(FBB); } +bool X86InstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const { + if (MBB.empty()) return false; + + switch (MBB.back().getOpcode()) { + case X86::JMP: // Uncond branch. + case X86::JMP32r: // Indirect branch. + case X86::JMP32m: // Indirect branch through mem. + return true; + default: return false; + } +} + bool X86InstrInfo:: ReverseBranchCondition(std::vector &Cond) const { assert(Cond.size() == 1 && "Invalid X86 branch condition!"); Index: llvm/lib/Target/X86/X86InstrInfo.h diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.58 llvm/lib/Target/X86/X86InstrInfo.h:1.59 --- llvm/lib/Target/X86/X86InstrInfo.h:1.58 Sat Oct 21 00:52:40 2006 +++ llvm/lib/Target/X86/X86InstrInfo.h Sat Oct 28 12:29:57 2006 @@ -267,6 +267,7 @@ virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const std::vector &Cond) const; + virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; virtual bool ReverseBranchCondition(std::vector &Cond) const; const TargetRegisterClass *getPointerRegClass() const; From sabre at nondot.org Sat Oct 28 12:33:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 12:33:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610281733.k9SHX2eP009763@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.24 -> 1.25 --- Log message: improve deletion of blocks that just contain branches by knowing that the pred block doesn't fall through into them if it's a jumptable. --- Diffs of the changes: (+38 -33) BranchFolding.cpp | 71 ++++++++++++++++++++++++++++-------------------------- 1 files changed, 38 insertions(+), 33 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.24 llvm/lib/CodeGen/BranchFolding.cpp:1.25 --- llvm/lib/CodeGen/BranchFolding.cpp:1.24 Wed Oct 25 17:21:37 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Sat Oct 28 12:32:47 2006 @@ -534,43 +534,48 @@ // completely eliminate the block is when the block before this one // falls through into MBB and we can't understand the prior block's branch // condition. - if (MBB->empty() && (!PriorUnAnalyzable || !PrevBB.isSuccessor(MBB))) { - // If the prior block falls through into us, turn it into an - // explicit branch to us to make updates simpler. - if (PrevBB.isSuccessor(MBB) && PriorTBB != MBB && PriorFBB != MBB) { - if (PriorTBB == 0) { - assert(PriorCond.empty() && PriorFBB == 0 && "Bad branch analysis"); - PriorTBB = MBB; - } else { - assert(PriorFBB == 0 && "Machine CFG out of date!"); - PriorFBB = MBB; + if (MBB->empty()) { + bool PredHasNoFallThrough = TII->BlockHasNoFallThrough(PrevBB); + if (PredHasNoFallThrough || !PriorUnAnalyzable || + !PrevBB.isSuccessor(MBB)) { + // If the prior block falls through into us, turn it into an + // explicit branch to us to make updates simpler. + if (!PredHasNoFallThrough && PrevBB.isSuccessor(MBB) && + PriorTBB != MBB && PriorFBB != MBB) { + if (PriorTBB == 0) { + assert(PriorCond.empty() && PriorFBB == 0 && "Bad branch analysis"); + PriorTBB = MBB; + } else { + assert(PriorFBB == 0 && "Machine CFG out of date!"); + PriorFBB = MBB; + } + TII->RemoveBranch(PrevBB); + TII->InsertBranch(PrevBB, PriorTBB, PriorFBB, PriorCond); } - TII->RemoveBranch(PrevBB); - TII->InsertBranch(PrevBB, PriorTBB, PriorFBB, PriorCond); - } - // Iterate through all the predecessors, revectoring each in-turn. - MachineBasicBlock::pred_iterator PI = MBB->pred_begin(); - bool DidChange = false; - bool HasBranchToSelf = false; - while (PI != MBB->pred_end()) { - if (*PI == MBB) { - // If this block has an uncond branch to itself, leave it. - ++PI; - HasBranchToSelf = true; - } else { - DidChange = true; - ReplaceUsesOfBlockWith(*PI, MBB, CurTBB, TII); + // Iterate through all the predecessors, revectoring each in-turn. + MachineBasicBlock::pred_iterator PI = MBB->pred_begin(); + bool DidChange = false; + bool HasBranchToSelf = false; + while (PI != MBB->pred_end()) { + if (*PI == MBB) { + // If this block has an uncond branch to itself, leave it. + ++PI; + HasBranchToSelf = true; + } else { + DidChange = true; + ReplaceUsesOfBlockWith(*PI, MBB, CurTBB, TII); + } } - } - // Change any jumptables to go to the new MBB. - MBB->getParent()->getJumpTableInfo()->ReplaceMBBInJumpTables(MBB, - CurTBB); - if (DidChange) { - ++NumBranchOpts; - MadeChange = true; - if (!HasBranchToSelf) return; + // Change any jumptables to go to the new MBB. + MBB->getParent()->getJumpTableInfo()->ReplaceMBBInJumpTables(MBB, + CurTBB); + if (DidChange) { + ++NumBranchOpts; + MadeChange = true; + if (!HasBranchToSelf) return; + } } } From sabre at nondot.org Sat Oct 28 12:35:16 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 12:35:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp PPCInstrInfo.h Message-ID: <200610281735.k9SHZGdb009868@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.cpp updated: 1.28 -> 1.29 PPCInstrInfo.h updated: 1.18 -> 1.19 --- Log message: implement the BlockHasNoFallThrough hook --- Diffs of the changes: (+12 -0) PPCInstrInfo.cpp | 11 +++++++++++ PPCInstrInfo.h | 1 + 2 files changed, 12 insertions(+) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.28 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.29 --- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.28 Sat Oct 21 01:03:11 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Sat Oct 28 12:35:02 2006 @@ -259,6 +259,17 @@ BuildMI(&MBB, PPC::B, 1).addMBB(FBB); } +bool PPCInstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const { + if (MBB.empty()) return false; + + switch (MBB.back().getOpcode()) { + case PPC::B: // Uncond branch. + case PPC::BCTR: // Indirect branch. + return true; + default: return false; + } +} + bool PPCInstrInfo:: ReverseBranchCondition(std::vector &Cond) const { assert(Cond.size() == 2 && "Invalid PPC branch opcode!"); Index: llvm/lib/Target/PowerPC/PPCInstrInfo.h diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.18 llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.19 --- llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.18 Tue Oct 17 17:39:33 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.h Sat Oct 28 12:35:02 2006 @@ -110,6 +110,7 @@ virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const std::vector &Cond) const; + virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; virtual bool ReverseBranchCondition(std::vector &Cond) const; From sabre at nondot.org Sat Oct 28 13:00:19 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:00:19 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Message-ID: <200610281800.k9SI0JdT010575@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h updated: 1.4 -> 1.5 --- Log message: determine whether a change was made --- Diffs of the changes: (+6 -2) MachineJumpTableInfo.h | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.4 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.5 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.4 Mon Oct 16 15:41:42 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Sat Oct 28 13:00:05 2006 @@ -57,13 +57,17 @@ /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update /// the jump tables to branch to New instead. - void ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) { + bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) { + bool MadeChange = false; for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) { MachineJumpTableEntry &JTE = JumpTables[i]; for (unsigned j = 0, e = JTE.MBBs.size(); j != e; ++j) - if (JTE.MBBs[j] == Old) + if (JTE.MBBs[j] == Old) { JTE.MBBs[j] = New; + MadeChange = true; + } } + return MadeChange; } /// getEntrySize - returns the size of an individual field in a jump table From sabre at nondot.org Sat Oct 28 13:10:20 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:10:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200610281810.k9SIAKRm010898@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.113 -> 1.114 --- Log message: don't print dead jump tables --- Diffs of the changes: (+3 -0) AsmPrinter.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.113 llvm/lib/CodeGen/AsmPrinter.cpp:1.114 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.113 Tue Oct 24 15:32:14 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Sat Oct 28 13:10:06 2006 @@ -221,6 +221,9 @@ for (unsigned i = 0, e = JT.size(); i != e; ++i) { const std::vector &JTBBs = JT[i].MBBs; + + // If this jump table was deleted, ignore it. + if (JTBBs.empty()) continue; // For PIC codegen, if possible we want to use the SetDirective to reduce // the number of relocations the assembler will generate for the jump table. From sabre at nondot.org Sat Oct 28 13:11:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:11:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200610281811.k9SIBYwA010986@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.102 -> 1.103 --- Log message: add an assert --- Diffs of the changes: (+1 -0) MachineFunction.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.102 llvm/lib/CodeGen/MachineFunction.cpp:1.103 --- llvm/lib/CodeGen/MachineFunction.cpp:1.102 Tue Oct 3 15:19:23 2006 +++ llvm/lib/CodeGen/MachineFunction.cpp Sat Oct 28 13:11:20 2006 @@ -363,6 +363,7 @@ /// unsigned MachineJumpTableInfo::getJumpTableIndex( std::vector &DestBBs) { + assert(!DestBBs.empty() && "Cannot create an empty jump table!"); for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) if (JumpTables[i].MBBs == DestBBs) return i; From sabre at nondot.org Sat Oct 28 13:12:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:12:14 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Message-ID: <200610281812.k9SICEvb011057@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h updated: 1.5 -> 1.6 --- Log message: add a method for deleting dead jump tables. --- Diffs of the changes: (+6 -0) MachineJumpTableInfo.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.5 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.6 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.5 Sat Oct 28 13:00:05 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Sat Oct 28 13:12:00 2006 @@ -55,6 +55,12 @@ return JumpTables; } + /// RemoveJumpTable - Mark the specific index as being dead. This will cause + /// it to not be emitted. + void RemoveJumpTable(unsigned Idx) { + JumpTables[Idx].MBBs.clear(); + } + /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update /// the jump tables to branch to New instead. bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) { From sabre at nondot.org Sat Oct 28 13:17:25 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:17:25 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Message-ID: <200610281817.k9SIHPkZ011251@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h updated: 1.6 -> 1.7 --- Log message: const'ify jump table stuff --- Diffs of the changes: (+2 -2) MachineJumpTableInfo.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.6 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.7 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.6 Sat Oct 28 13:12:00 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Sat Oct 28 13:17:09 2006 @@ -34,7 +34,7 @@ /// MBBs - The vector of basic blocks from which to create the jump table. std::vector MBBs; - MachineJumpTableEntry(std::vector &M) : MBBs(M) {} + MachineJumpTableEntry(const std::vector &M) : MBBs(M) {} }; class MachineJumpTableInfo { @@ -45,7 +45,7 @@ /// getJumpTableIndex - Create a new jump table or return an existing one. /// - unsigned getJumpTableIndex(std::vector &DestBBs); + unsigned getJumpTableIndex(const std::vector &DestBBs); /// isEmpty - Return true if there are no jump tables. /// From sabre at nondot.org Sat Oct 28 13:17:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:17:26 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp Message-ID: <200610281817.k9SIHQA4011256@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.103 -> 1.104 --- Log message: const'ify jump table stuff --- Diffs of the changes: (+1 -1) MachineFunction.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.103 llvm/lib/CodeGen/MachineFunction.cpp:1.104 --- llvm/lib/CodeGen/MachineFunction.cpp:1.103 Sat Oct 28 13:11:20 2006 +++ llvm/lib/CodeGen/MachineFunction.cpp Sat Oct 28 13:17:09 2006 @@ -362,7 +362,7 @@ /// or return an existing one. /// unsigned MachineJumpTableInfo::getJumpTableIndex( - std::vector &DestBBs) { + const std::vector &DestBBs) { assert(!DestBBs.empty() && "Cannot create an empty jump table!"); for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) if (JumpTables[i].MBBs == DestBBs) From sabre at nondot.org Sat Oct 28 13:18:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:18:50 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200610281818.k9SIIocF011350@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.191 -> 1.192 --- Log message: add a method for hacking on JTIdx's --- Diffs of the changes: (+4 -0) MachineInstr.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.191 llvm/include/llvm/CodeGen/MachineInstr.h:1.192 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.191 Fri Oct 20 17:44:45 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sat Oct 28 13:18:36 2006 @@ -206,6 +206,10 @@ assert(isConstantPoolIndex() && "Wrong MachineOperand accessor"); contents.immedVal = Idx; } + void setJumpTableIndex(unsigned Idx) { + assert(isJumpTableIndex() && "Wrong MachineOperand accessor"); + contents.immedVal = Idx; + } /// isIdenticalTo - Return true if this operand is identical to the specified /// operand. From sabre at nondot.org Sat Oct 28 13:21:44 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:21:44 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200610281821.k9SILiHu011478@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h updated: 1.30 -> 1.31 --- Log message: remove dead method --- Diffs of the changes: (+0 -1) SelectionDAGISel.h | 1 - 1 files changed, 1 deletion(-) Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.30 llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.31 --- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.30 Fri Oct 27 16:36:01 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Sat Oct 28 13:21:29 2006 @@ -126,7 +126,6 @@ bool CheckOrMask(SDOperand LHS, ConstantSDNode *RHS, int64_t DesiredMaskS); private: - void SplitCritEdgesForPHIConstants(BasicBlock *BB); void SelectBasicBlock(BasicBlock *BB, MachineFunction &MF, FunctionLoweringInfo &FuncInfo); From sabre at nondot.org Sat Oct 28 13:22:05 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:22:05 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Message-ID: <200610281822.k9SIM5Oq011517@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h updated: 1.7 -> 1.8 --- Log message: add an assertion --- Diffs of the changes: (+1 -0) MachineJumpTableInfo.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.7 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.8 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.7 Sat Oct 28 13:17:09 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Sat Oct 28 13:21:51 2006 @@ -64,6 +64,7 @@ /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update /// the jump tables to branch to New instead. bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) { + assert(Old != New && "Not making a change?"); bool MadeChange = false; for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) { MachineJumpTableEntry &JTE = JumpTables[i]; From sabre at nondot.org Sat Oct 28 13:35:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 13:35:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610281835.k9SIZ1Z6011887@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.25 -> 1.26 --- Log message: Teach branch folding to fold identical jump tables together and to delete jump tables that are dead. --- Diffs of the changes: (+53 -5) BranchFolding.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.25 llvm/lib/CodeGen/BranchFolding.cpp:1.26 --- llvm/lib/CodeGen/BranchFolding.cpp:1.25 Sat Oct 28 12:32:47 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Sat Oct 28 13:34:47 2006 @@ -98,6 +98,53 @@ EverMadeChange |= MadeChangeThisIteration; } + // See if any jump tables have become mergable or dead as the code generator + // did its thing. + MachineJumpTableInfo *JTI = MF.getJumpTableInfo(); + const std::vector &JTs = JTI->getJumpTables(); + if (!JTs.empty()) { + // Figure out how these jump tables should be merged. + std::vector JTMapping; + JTMapping.reserve(JTs.size()); + + // We always keep the 0th jump table. + JTMapping.push_back(0); + + // Scan the jump tables, seeing if there are any duplicates. Note that this + // is N^2, which should be fixed someday. + for (unsigned i = 1, e = JTs.size(); i != e; ++i) + JTMapping.push_back(JTI->getJumpTableIndex(JTs[i].MBBs)); + + // If a jump table was merge with another one, walk the function rewriting + // references to jump tables to reference the new JT ID's. Keep track of + // whether we see a jump table idx, if not, we can delete the JT. + std::vector JTIsLive; + JTIsLive.resize(JTs.size()); + for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); + BB != E; ++BB) { + for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); + I != E; ++I) + for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op) { + MachineOperand &Op = I->getOperand(op); + if (!Op.isJumpTableIndex()) continue; + unsigned NewIdx = JTMapping[Op.getJumpTableIndex()]; + Op.setJumpTableIndex(NewIdx); + + // Remember that this JT is live. + JTIsLive[NewIdx] = true; + } + } + + // Finally, remove dead jump tables. This happens either because the + // indirect jump was unreachable (and thus deleted) or because the jump + // table was merged with some other one. + for (unsigned i = 0, e = JTIsLive.size(); i != e; ++i) + if (!JTIsLive[i]) { + JTI->RemoveJumpTable(i); + EverMadeChange = true; + } + } + return EverMadeChange; } @@ -444,8 +491,8 @@ // If MBB was the target of a jump table, update jump tables to go to the // fallthrough instead. - MBB->getParent()->getJumpTableInfo()->ReplaceMBBInJumpTables(MBB, - FallThrough); + MBB->getParent()->getJumpTableInfo()-> + ReplaceMBBInJumpTables(MBB, FallThrough); MadeChange = true; } return; @@ -543,7 +590,8 @@ if (!PredHasNoFallThrough && PrevBB.isSuccessor(MBB) && PriorTBB != MBB && PriorFBB != MBB) { if (PriorTBB == 0) { - assert(PriorCond.empty() && PriorFBB == 0 && "Bad branch analysis"); + assert(PriorCond.empty() && PriorFBB == 0 && + "Bad branch analysis"); PriorTBB = MBB; } else { assert(PriorFBB == 0 && "Machine CFG out of date!"); @@ -569,8 +617,8 @@ } // Change any jumptables to go to the new MBB. - MBB->getParent()->getJumpTableInfo()->ReplaceMBBInJumpTables(MBB, - CurTBB); + MBB->getParent()->getJumpTableInfo()-> + ReplaceMBBInJumpTables(MBB, CurTBB); if (DidChange) { ++NumBranchOpts; MadeChange = true; From sabre at nondot.org Sat Oct 28 14:22:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 28 Oct 2006 14:22:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610281922.k9SJMO9F013221@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.304 -> 1.305 --- Log message: split critical edges more carefully and intelligently. In particular, critical edges whose destinations are not phi nodes don't bother us. Also, share split edges, since the split edge can't have a phi. This significantly reduces the complexity of generated code in some cases. --- Diffs of the changes: (+61 -4) SelectionDAGISel.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 61 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.304 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.305 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.304 Sat Oct 28 12:04:37 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Oct 28 14:22:10 2006 @@ -44,8 +44,6 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" -#include -#include #include #include using namespace llvm; @@ -3490,6 +3488,63 @@ return true; } + +/// SplitEdgeNicely - Split the critical edge from TI to it's specified +/// successor if it will improve codegen. We only do this if the successor has +/// phi nodes (otherwise critical edges are ok). If there is already another +/// predecessor of the succ that is empty (and thus has no phi nodes), use it +/// instead of introducing a new block. +static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum, Pass *P) { + BasicBlock *TIBB = TI->getParent(); + BasicBlock *Dest = TI->getSuccessor(SuccNum); + assert(isa(Dest->begin()) && + "This should only be called if Dest has a PHI!"); + + /// TIPHIValues - This array is lazily computed to determine the values of + /// PHIs in Dest that TI would provide. + std::vector TIPHIValues; + + // Check to see if Dest has any blocks that can be used as a split edge for + // this terminator. + for (pred_iterator PI = pred_begin(Dest), E = pred_end(Dest); PI != E; ++PI) { + BasicBlock *Pred = *PI; + // To be usable, the pred has to end with an uncond branch to the dest. + BranchInst *PredBr = dyn_cast(Pred->getTerminator()); + if (!PredBr || !PredBr->isUnconditional() || + // Must be empty other than the branch. + &Pred->front() != PredBr) + continue; + + // Finally, since we know that Dest has phi nodes in it, we have to make + // sure that jumping to Pred will have the same affect as going to Dest in + // terms of PHI values. + PHINode *PN; + unsigned PHINo = 0; + bool FoundMatch = true; + for (BasicBlock::iterator I = Dest->begin(); + (PN = dyn_cast(I)); ++I, ++PHINo) { + if (PHINo == TIPHIValues.size()) + TIPHIValues.push_back(PN->getIncomingValueForBlock(TIBB)); + + // If the PHI entry doesn't work, we can't use this pred. + if (TIPHIValues[PHINo] != PN->getIncomingValueForBlock(Pred)) { + FoundMatch = false; + break; + } + } + + // If we found a workable predecessor, change TI to branch to Succ. + if (FoundMatch) { + Dest->removePredecessor(TIBB); + TI->setSuccessor(SuccNum, Pred); + return; + } + } + + SplitCriticalEdge(TI, SuccNum, P, true); +} + + bool SelectionDAGISel::runOnFunction(Function &Fn) { MachineFunction &MF = MachineFunction::construct(&Fn, TLI.getTargetMachine()); RegMap = MF.getSSARegMap(); @@ -3505,11 +3560,13 @@ while (MadeChange) { MadeChange = false; for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { - // Split all critical edges. + // Split all critical edges where the dest block has a PHI. TerminatorInst *BBTI = BB->getTerminator(); if (BBTI->getNumSuccessors() > 1) { for (unsigned i = 0, e = BBTI->getNumSuccessors(); i != e; ++i) - SplitCriticalEdge(BBTI, i, this, true); + if (isa(BBTI->getSuccessor(i)->begin()) && + isCriticalEdge(BBTI, i, true)) + SplitEdgeNicely(BBTI, i, this); } From nicholas at mxc.ca Sat Oct 28 21:26:45 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 28 Oct 2006 21:26:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200610290226.k9T2QjM6019858@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.360 -> 1.361 --- Log message: Remove spurious case. EXTLOAD is not one of the node opcodes. --- Diffs of the changes: (+0 -1) SelectionDAG.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.361 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 Sat Oct 28 12:25:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 21:26:30 2006 @@ -401,7 +401,6 @@ break; } case ISD::VLOAD: - case ISD::EXTLOAD: case ISD::LOAD: { LoadSDNode *LD = cast(N); ID.AddInteger(LD->getAddressingMode()); From rspencer at reidspencer.com Sat Oct 28 21:29:56 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Sat, 28 Oct 2006 19:29:56 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <200610281725.k9SHPhnI009436@zion.cs.uiuc.edu> References: <200610281725.k9SHPhnI009436@zion.cs.uiuc.edu> Message-ID: <1162088996.2415.66.camel@bashful.x10sys.com> Jim, This commit broke llc, see below .. On Sat, 2006-10-28 at 12:25 -0500, Jim Laskey wrote: > > Changes in directory llvm/lib/CodeGen/SelectionDAG: > > SelectionDAG.cpp updated: 1.359 -> 1.360 > --- > Log message: > > Load and stores have not been uniqued properly. > > --- > Diffs of the changes: (+42 -13) > > SelectionDAG.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++------------- > 1 files changed, 42 insertions(+), 13 deletions(-) > > > Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.360 > --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.359 Sat Oct 28 01:15:26 2006 > +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Oct 28 12:25:28 2006 > @@ -363,20 +363,24 @@ > ID.AddDouble(cast(N)->getValue()); > break; > case ISD::TargetGlobalAddress: > - case ISD::GlobalAddress: > - ID.AddPointer(cast(N)->getGlobal()); > - ID.AddInteger(cast(N)->getOffset()); > + case ISD::GlobalAddress: { > + GlobalAddressSDNode *GA = cast(N); > + ID.AddPointer(GA->getGlobal()); > + ID.AddInteger(GA->getOffset()); > break; > + } > case ISD::BasicBlock: > ID.AddPointer(cast(N)->getBasicBlock()); > break; > case ISD::Register: > ID.AddInteger(cast(N)->getReg()); > break; > - case ISD::SRCVALUE: > - ID.AddPointer(cast(N)->getValue()); > - ID.AddInteger(cast(N)->getOffset()); > + case ISD::SRCVALUE: { > + SrcValueSDNode *SV = cast(N); > + ID.AddPointer(SV->getValue()); > + ID.AddInteger(SV->getOffset()); > break; > + } > case ISD::FrameIndex: > case ISD::TargetFrameIndex: > ID.AddInteger(cast(N)->getIndex()); > @@ -386,16 +390,41 @@ > ID.AddInteger(cast(N)->getIndex()); > break; > case ISD::ConstantPool: > - case ISD::TargetConstantPool: > - ID.AddInteger(cast(N)->getAlignment()); > - ID.AddInteger(cast(N)->getOffset()); > - if (cast(N)->isMachineConstantPoolEntry()) > - cast(N)->getMachineCPVal()-> > - AddSelectionDAGCSEId(ID); > + case ISD::TargetConstantPool: { > + ConstantPoolSDNode *CP = cast(N); > + ID.AddInteger(CP->getAlignment()); > + ID.AddInteger(CP->getOffset()); > + if (CP->isMachineConstantPoolEntry()) > + CP->getMachineCPVal()->AddSelectionDAGCSEId(ID); > else > - ID.AddPointer(cast(N)->getConstVal()); > + ID.AddPointer(CP->getConstVal()); > + break; > + } > + case ISD::VLOAD: > + case ISD::EXTLOAD: This value isn't in the same enum as that on which we're switching here. However, it does have the same value (1) as NodeType::EntryToken. So when N is an EntryToken it comes in here and the cast below fails. You will see this: /proj/llvm/llvm2/include/llvm/Support/Casting.h:199: typename llvm::cast_retty::ret_type llvm::cast(const Y&) [with X = llvm::LoadSDNode, Y = llvm::SDNode*]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed. Nick and I fixed it by simply removing the ISD::EXTLOAD case. Just wanted to make sure that's the correct thing to do (seems to fix it). > + case ISD::LOAD: { > + LoadSDNode *LD = cast(N); > + ID.AddInteger(LD->getAddressingMode()); > + ID.AddInteger(LD->getExtensionType()); > + ID.AddInteger(LD->getLoadedVT()); > + ID.AddPointer(LD->getSrcValue()); > + ID.AddInteger(LD->getSrcValueOffset()); > + ID.AddInteger(LD->getAlignment()); > + ID.AddInteger(LD->isVolatile()); > + break; > + } > + case ISD::STORE: { > + StoreSDNode *ST = cast(N); > + ID.AddInteger(ST->getAddressingMode()); > + ID.AddInteger(ST->isTruncatingStore()); > + ID.AddInteger(ST->getStoredVT()); > + ID.AddPointer(ST->getSrcValue()); > + ID.AddInteger(ST->getSrcValueOffset()); > + ID.AddInteger(ST->getAlignment()); > + ID.AddInteger(ST->isVolatile()); > break; > } > + } > } > } > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From zhousheng00 at gmail.com Sat Oct 28 21:46:23 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sat, 28 Oct 2006 21:46:23 -0500 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200610290246.k9T2kNdR020178@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.520.2.10 -> 1.520.2.11 --- Log message: --- Diffs of the changes: (+54 -102) InstructionCombining.cpp | 156 ++++++++++++++++------------------------------- 1 files changed, 54 insertions(+), 102 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.10 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.11 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.520.2.10 Wed Oct 25 20:58:05 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Oct 28 21:46:08 2006 @@ -2426,33 +2426,8 @@ return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); if (isa(Op1)) return ReplaceInstUsesWith(I, Op1); // X % undef -> undef - return 0; -} - -Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) { - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - - if (ConstantInt *RHS = dyn_cast(Op1)) { - // X % 0 == undef, we don't need to preserve faults! - if (RHS->equalsInt(0)) - return ReplaceInstUsesWith(I, UndefValue::get(I.getType())); - - if (RHS->equalsInt(1)) // X % 1 == 0 - return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); - if (Instruction *Op0I = dyn_cast(Op0)) { - if (SelectInst *SI = dyn_cast(Op0I)) { - if (Instruction *R = FoldOpIntoSelect(I, SI, this)) - return R; - } else if (isa(Op0I)) { - if (Instruction *NV = FoldOpIntoPhi(I)) - return NV; - } - } - } - - // If this is 'urem X, (Cond ? C1, C2)' where C1&C2 are powers of two, - // transform this into: '(Cond ? (urem X, C1) : (urem X, C2))'. + // Handle cases involving: rem X, (select Cond, Y, Z) if (SelectInst *SI = dyn_cast(Op1)) { // rem X, (Cond ? 0 : Y) -> rem X, Y. If the rem and the select are in // the same basic block, then we replace the select with Y, and the @@ -2482,37 +2457,43 @@ UpdateValueUsesWith(SI, SI->getOperand(1)); return &I; } - - - if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) - if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) - if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { - // STO == 0 and SFO == 0 handled above. - if (isPowerOf2_64(STO->getZExtValue()) && - isPowerOf2_64(SFO->getZExtValue())) { - Value *TrueAnd = InsertNewInstBefore( - BinaryOperator::createAnd(Op0, SubOne(STO), SI->getName()+".t"), - I); - Value *FalseAnd = InsertNewInstBefore( - BinaryOperator::createAnd(Op0, SubOne(SFO), SI->getName()+".f"), - I); - return new SelectInst(SI->getOperand(0), TrueAnd, FalseAnd); - } - } } return 0; } -Instruction *InstCombiner::visitURem(BinaryOperator &I) { +Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - Instruction* common = commonRemTransforms(I); - if (common) + if (Instruction *common = commonRemTransforms(I)) return common; - common = commonIRemTransforms(I); - if (common) + if (ConstantInt *RHS = dyn_cast(Op1)) { + // X % 0 == undef, we don't need to preserve faults! + if (RHS->equalsInt(0)) + return ReplaceInstUsesWith(I, UndefValue::get(I.getType())); + + if (RHS->equalsInt(1)) // X % 1 == 0 + return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); + + if (Instruction *Op0I = dyn_cast(Op0)) { + if (SelectInst *SI = dyn_cast(Op0I)) { + if (Instruction *R = FoldOpIntoSelect(I, SI, this)) + return R; + } else if (isa(Op0I)) { + if (Instruction *NV = FoldOpIntoPhi(I)) + return NV; + } + } + } + + return 0; +} + +Instruction *InstCombiner::visitURem(BinaryOperator &I) { + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); + + if (Instruction *common = commonIRemTransforms(I)) return common; if (ConstantInt *RHS = dyn_cast(Op1)) { @@ -2542,7 +2523,26 @@ return BinaryOperator::createAnd(Op0, Add); } } - + } + + // urem X, (Select Cond, C1, C2) --> Select Cond, (and X, C1), (and X, C2) + // where C1&C2 are powers of two. + if (SelectInst *SI = dyn_cast(Op1)) { + if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) + if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) + if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { + // STO == 0 and SFO == 0 handled above. + if (isPowerOf2_64(STO->getZExtValue()) && + isPowerOf2_64(SFO->getZExtValue())) { + Value *TrueAnd = InsertNewInstBefore( + BinaryOperator::createAnd(Op0, SubOne(STO), SI->getName()+".t"), + I); + Value *FalseAnd = InsertNewInstBefore( + BinaryOperator::createAnd(Op0, SubOne(SFO), SI->getName()+".f"), + I); + return new SelectInst(SI->getOperand(0), TrueAnd, FalseAnd); + } + } } return 0; @@ -2551,12 +2551,7 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - Instruction *common = commonRemTransforms(I); - if (common) - return common; - - common = commonIRemTransforms(I); - if (common) + if (Instruction *common = commonIRemTransforms(I)) return common; if (Value *RHSNeg = dyn_castNegVal(Op1)) @@ -2572,17 +2567,7 @@ // unsigned inputs), turn this into a urem. uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { - const Type *NTy = Op0->getType()->getUnsignedVersion(); - Instruction *LHS = new CastInst(Op0, NTy, Op0->getName()); - InsertNewInstBefore(LHS, I); - Value *RHS; - if (Constant *R = dyn_cast(Op1)) - RHS = ConstantExpr::getCast(R, NTy); - else - RHS = InsertNewInstBefore(new CastInst(Op1, NTy, Op1->getName()), I); - Instruction *URem = BinaryOperator::createURem(LHS, RHS, I.getName()); - InsertNewInstBefore(URem, I); - return new CastInst(URem, I.getType()); + return BinaryOperator::createURem(Op0, Op1, I.getName());; } if (ConstantInt *RHS = dyn_cast(Op1)) { @@ -2599,42 +2584,7 @@ Instruction *InstCombiner::visitFRem(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - Instruction *common = commonRemTransforms(I); - if (common) - return common; - - if (SelectInst *SI = dyn_cast(Op1)) { - // rem X, (Cond ? 0 : Y) -> rem X, Y. If the rem and the select are in - // the same basic block, then we replace the select with Y, and the - // condition of the select with false (if the cond value is in the same - // BB). If the select has uses other than the div, this allows them to be - // simplified also. - if (Constant *ST = dyn_cast(SI->getOperand(1))) - if (ST->isNullValue()) { - Instruction *CondI = dyn_cast(SI->getOperand(0)); - if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::getFalse()); - else if (I.getParent() != SI->getParent() || SI->hasOneUse()) - I.setOperand(1, SI->getOperand(2)); - else - UpdateValueUsesWith(SI, SI->getOperand(2)); - return &I; - } - // Likewise for: rem X, (Cond ? Y : 0) -> rem X, Y - if (Constant *ST = dyn_cast(SI->getOperand(2))) - if (ST->isNullValue()) { - Instruction *CondI = dyn_cast(SI->getOperand(0)); - if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::getTrue()); - else if (I.getParent() != SI->getParent() || SI->hasOneUse()) - I.setOperand(1, SI->getOperand(1)); - else - UpdateValueUsesWith(SI, SI->getOperand(1)); - return &I; - } - } - - return 0; + return commonRemTransforms(I); } // isMaxValueMinusOne - return true if this is Max-1 @@ -5843,6 +5793,8 @@ break; case Instruction::SDiv: case Instruction::UDiv: + case Instruction::SRem: + case Instruction::URem: // If we are just changing the sign, rewrite. if (DestBitSize == SrcBitSize) { // Don't insert two casts if they cannot be eliminated. We allow two From evan.cheng at apple.com Sun Oct 29 01:15:01 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 29 Oct 2006 01:15:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200610290615.k9T6F1GM023199@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.361 -> 1.362 --- Log message: VLOAD is not the LoadSDNode opcode. --- Diffs of the changes: (+0 -1) SelectionDAG.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.361 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.362 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.361 Sat Oct 28 21:26:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Oct 29 01:14:47 2006 @@ -400,7 +400,6 @@ ID.AddPointer(CP->getConstVal()); break; } - case ISD::VLOAD: case ISD::LOAD: { LoadSDNode *LD = cast(N); ID.AddInteger(LD->getAddressingMode()); From evan.cheng at apple.com Sun Oct 29 01:17:58 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 28 Oct 2006 23:17:58 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <1162088996.2415.66.camel@bashful.x10sys.com> References: <200610281725.k9SHPhnI009436@zion.cs.uiuc.edu> <1162088996.2415.66.camel@bashful.x10sys.com> Message-ID: <61786785-92D2-49E2-BFEA-9F89618DDF4C@apple.com> > > Nick and I fixed it by simply removing the ISD::EXTLOAD case. Just > wanted to make sure that's the correct thing to do (seems to fix it). Also removed the ISD::VLOAD case. We should be in good shape now. Thanks! Evan > >> + case ISD::LOAD: { >> + LoadSDNode *LD = cast(N); >> + ID.AddInteger(LD->getAddressingMode()); >> + ID.AddInteger(LD->getExtensionType()); >> + ID.AddInteger(LD->getLoadedVT()); >> + ID.AddPointer(LD->getSrcValue()); >> + ID.AddInteger(LD->getSrcValueOffset()); >> + ID.AddInteger(LD->getAlignment()); >> + ID.AddInteger(LD->isVolatile()); >> + break; >> + } >> + case ISD::STORE: { >> + StoreSDNode *ST = cast(N); >> + ID.AddInteger(ST->getAddressingMode()); >> + ID.AddInteger(ST->isTruncatingStore()); >> + ID.AddInteger(ST->getStoredVT()); >> + ID.AddPointer(ST->getSrcValue()); >> + ID.AddInteger(ST->getSrcValueOffset()); >> + ID.AddInteger(ST->getAlignment()); >> + ID.AddInteger(ST->isVolatile()); >> break; >> } >> + } >> } >> } >> >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From zhousheng00 at gmail.com Sun Oct 29 01:36:12 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:12 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200610290736.k9T7aCZC024414@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.139.6.5 -> 1.139.6.6 --- Log message: --- Diffs of the changes: (+51 -14) Execution.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 51 insertions(+), 14 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.5 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.6 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.139.6.5 Wed Oct 25 20:58:05 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Sun Oct 29 01:35:49 2006 @@ -40,7 +40,11 @@ const Type *Ty); static GenericValue executeMulInst(GenericValue Src1, GenericValue Src2, const Type *Ty); -static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, +static GenericValue executeURemInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeSRemInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeFRemInst(GenericValue Src1, GenericValue Src2, const Type *Ty); static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2, const Type *Ty); @@ -106,10 +110,17 @@ getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); case Instruction::URem: + return executeURemInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::SRem: - return executeRemInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); + return executeSRemInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); + case Instruction::FRem: + return executeFRemInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::And: return executeAndInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), @@ -296,24 +307,50 @@ IMPLEMENT_BINARY_OPERATOR(/, Float); IMPLEMENT_BINARY_OPERATOR(/, Double); default: - std::cout << "Unhandled type for Div instruction: " << *Ty << "\n"; + std::cout << "Unhandled type for FDiv instruction: " << *Ty << "\n"; abort(); } return Dest; } -static GenericValue executeRemInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeURemInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; + if (Ty->isSigned()) + Ty = Ty->getUnsignedVersion(); switch (Ty->getTypeID()) { IMPLEMENT_BINARY_OPERATOR(%, UByte); - IMPLEMENT_BINARY_OPERATOR(%, SByte); IMPLEMENT_BINARY_OPERATOR(%, UShort); - IMPLEMENT_BINARY_OPERATOR(%, Short); IMPLEMENT_BINARY_OPERATOR(%, UInt); - IMPLEMENT_BINARY_OPERATOR(%, Int); IMPLEMENT_BINARY_OPERATOR(%, ULong); + default: + std::cout << "Unhandled type for URem instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeSRemInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + if (Ty->isUnsigned()) + Ty = Ty->getSignedVersion(); + switch (Ty->getTypeID()) { + IMPLEMENT_BINARY_OPERATOR(%, SByte); + IMPLEMENT_BINARY_OPERATOR(%, Short); + IMPLEMENT_BINARY_OPERATOR(%, Int); IMPLEMENT_BINARY_OPERATOR(%, Long); + default: + std::cout << "Unhandled type for SRem instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeFRemInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { case Type::FloatTyID: Dest.FloatVal = fmod(Src1.FloatVal, Src2.FloatVal); break; @@ -321,7 +358,7 @@ Dest.DoubleVal = fmod(Src1.DoubleVal, Src2.DoubleVal); break; default: - std::cout << "Unhandled type for Rem instruction: " << *Ty << "\n"; + std::cout << "Unhandled type for FRem instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -543,9 +580,9 @@ case Instruction::Add: R = executeAddInst (Src1, Src2, Ty); break; case Instruction::Sub: R = executeSubInst (Src1, Src2, Ty); break; case Instruction::Mul: R = executeMulInst (Src1, Src2, Ty); break; - case Instruction::URem: - case Instruction::SRem: - case Instruction::FRem: R = executeRemInst (Src1, Src2, Ty); break; + case Instruction::URem: R = executeURemInst (Src1, Src2, Ty); break; + case Instruction::SRem: R = executeSRemInst (Src1, Src2, Ty); break; + case Instruction::FRem: R = executeFRemInst (Src1, Src2, Ty); break; case Instruction::UDiv: R = executeUDivInst (Src1, Src2, Ty); break; case Instruction::SDiv: R = executeSDivInst (Src1, Src2, Ty); break; case Instruction::FDiv: R = executeFDivInst (Src1, Src2, Ty); break; From zhousheng00 at gmail.com Sun Oct 29 01:36:13 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:13 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Constants.h Message-ID: <200610290736.k9T7aDBP024429@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.88.2.8 -> 1.88.2.9 --- Log message: --- Diffs of the changes: (+1 -1) Constants.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.88.2.8 llvm/include/llvm/Constants.h:1.88.2.9 --- llvm/include/llvm/Constants.h:1.88.2.8 Mon Oct 23 13:13:26 2006 +++ llvm/include/llvm/Constants.h Sun Oct 29 01:35:48 2006 @@ -547,7 +547,6 @@ static Constant *getUDiv(Constant *C1, Constant *C2); static Constant *getSDiv(Constant *C1, Constant *C2); static Constant *getFDiv(Constant *C1, Constant *C2); - static Constant *getFRem(Constant *C1, Constant *C2); static Constant *getAnd(Constant *C1, Constant *C2); static Constant *getOr(Constant *C1, Constant *C2); static Constant *getXor(Constant *C1, Constant *C2); @@ -564,6 +563,7 @@ static Constant *getSShr(Constant *C1, Constant *C2); // signed shr static Constant *getURem(Constant *C1, Constant *C2); // unsgied rem static Constant *getSRem(Constant *C1, Constant *C2); // signed rem + static Constant *getFRem(Constant *C1, Constant *C2); /// Getelementptr form. std::vector is only accepted for convenience: /// all elements must be Constant's. From zhousheng00 at gmail.com Sun Oct 29 01:36:13 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:13 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Message-ID: <200610290736.k9T7aDLV024438@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.93.2.9 -> 1.93.2.10 Constants.cpp updated: 1.163.2.10 -> 1.163.2.11 Instruction.cpp updated: 1.53.2.5 -> 1.53.2.6 --- Log message: --- Diffs of the changes: (+15 -15) ConstantFolding.cpp | 20 ++++++++++---------- Constants.cpp | 6 +++--- Instruction.cpp | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.9 llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.10 --- llvm/lib/VMCore/ConstantFolding.cpp:1.93.2.9 Wed Oct 25 20:58:05 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sun Oct 29 01:35:49 2006 @@ -116,15 +116,15 @@ virtual Constant *sdiv(const Constant *V1, const Constant *V2) const { return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2); } + virtual Constant *fdiv(const Constant *V1, const Constant *V2) const { + return SubClassName::FDiv((const ArgType *)V1, (const ArgType *)V2); + } virtual Constant *urem(const Constant *V1, const Constant *V2) const { return SubClassName::URem((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *srem(const Constant *V1, const Constant *V2) const { return SubClassName::SRem((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *fdiv(const Constant *V1, const Constant *V2) const { - return SubClassName::FDiv((const ArgType *)V1, (const ArgType *)V2); - } virtual Constant *frem(const Constant *V1, const Constant *V2) const { return SubClassName::FRem((const ArgType *)V1, (const ArgType *)V2); } @@ -199,6 +199,7 @@ static Constant *Mul(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *URem(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *SRem(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *FRem(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *And(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } static Constant *Xor(const ArgType *V1, const ArgType *V2) { return 0; } @@ -207,7 +208,6 @@ static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *FDiv(const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *FRem(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -399,15 +399,15 @@ static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getSDiv); } + static Constant *FDiv(const ConstantPacked *V1, const ConstantPacked *V2) { + return EvalVectorOp(V1, V2, ConstantExpr::getFDiv); + } static Constant *URem(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getURem); } static Constant *SRem(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getSRem); } - static Constant *FDiv(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getFDiv); - } static Constant *FRem(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getFRem); } @@ -1277,10 +1277,10 @@ case Instruction::Mul: C = ConstRules::get(V1, V2).mul(V1, V2); break; case Instruction::URem: C = ConstRules::get(V1, V2).urem(V1, V2); break; case Instruction::SRem: C = ConstRules::get(V1, V2).srem(V1, V2); break; + case Instruction::FRem: C = ConstRules::get(V1, V2).frem(V1, V2); break; case Instruction::UDiv: C = ConstRules::get(V1, V2).udiv(V1, V2); break; case Instruction::SDiv: C = ConstRules::get(V1, V2).sdiv(V1, V2); break; case Instruction::FDiv: C = ConstRules::get(V1, V2).fdiv(V1, V2); break; - case Instruction::FRem: C = ConstRules::get(V1, V2).frem(V1, V2); break; case Instruction::And: C = ConstRules::get(V1, V2).op_and(V1, V2); break; case Instruction::Or: C = ConstRules::get(V1, V2).op_or (V1, V2); break; case Instruction::Xor: C = ConstRules::get(V1, V2).op_xor(V1, V2); break; @@ -1364,10 +1364,10 @@ return Constant::getNullValue(V1->getType()); case Instruction::URem: case Instruction::SRem: + case Instruction::FRem: case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: - case Instruction::FRem: if (!isa(V2)) // undef/X -> 0 return Constant::getNullValue(V1->getType()); return const_cast(V2); // X/undef -> undef @@ -1482,10 +1482,10 @@ case Instruction::Sub: case Instruction::URem: case Instruction::SRem: + case Instruction::FRem: case Instruction::SDiv: case Instruction::UDiv: case Instruction::FDiv: - case Instruction::FRem: default: // These instructions cannot be flopped around. break; } Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.163.2.10 llvm/lib/VMCore/Constants.cpp:1.163.2.11 --- llvm/lib/VMCore/Constants.cpp:1.163.2.10 Wed Oct 25 20:58:05 2006 +++ llvm/lib/VMCore/Constants.cpp Sun Oct 29 01:35:49 2006 @@ -425,15 +425,15 @@ Constant *ConstantExpr::getSDiv(Constant *C1, Constant *C2) { return get(Instruction::SDiv, C1, C2); } +Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { + return get(Instruction::FDiv, C1, C2); +} Constant *ConstantExpr::getURem(Constant *C1, Constant *C2) { return get(Instruction::URem, C1, C2); } Constant *ConstantExpr::getSRem(Constant *C1, Constant *C2) { return get(Instruction::SRem, C1, C2); } -Constant *ConstantExpr::getFDiv(Constant *C1, Constant *C2) { - return get(Instruction::FDiv, C1, C2); -} Constant *ConstantExpr::getFRem(Constant *C1, Constant *C2) { return get(Instruction::FRem, C1, C2); } Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.53.2.5 llvm/lib/VMCore/Instruction.cpp:1.53.2.6 --- llvm/lib/VMCore/Instruction.cpp:1.53.2.5 Mon Oct 23 13:13:27 2006 +++ llvm/lib/VMCore/Instruction.cpp Sun Oct 29 01:35:49 2006 @@ -96,10 +96,10 @@ case Mul: return "mul"; case URem: return "urem"; case SRem: return "srem"; + case FRem: return "frem"; case UDiv: return "udiv"; case SDiv: return "sdiv"; case FDiv: return "fdiv"; - case FRem: return "frem"; // Logical operators... case And: return "and"; @@ -227,10 +227,10 @@ switch(op) { case URem: case SRem: + case FRem: case UDiv: case SDiv: case FDiv: - case FRem: case Load: case Store: case Call: From zhousheng00 at gmail.com Sun Oct 29 01:36:14 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:14 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610290736.k9T7aEZJ024449@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.289.2.7 -> 1.289.2.8 --- Log message: --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.7 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.8 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.7 Wed Oct 25 20:58:05 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Oct 29 01:35:49 2006 @@ -517,10 +517,10 @@ } void visitURem(User &I) { visitIntBinary(I, ISD::UREM, 0); } void visitSRem(User &I) { visitIntBinary(I, ISD::SREM, 0); } + void visitFRem(User &I) { visitFPBinary(I, ISD::FREM, 0); } void visitUDiv(User &I) { visitIntBinary(I, ISD::UDIV, ISD::VUDIV); } void visitSDiv(User &I) { visitIntBinary(I, ISD::SDIV, ISD::VSDIV); } void visitFDiv(User &I) { visitFPBinary(I, ISD::FDIV, ISD::VSDIV); } - void visitFRem(User &I) { visitFPBinary(I, ISD::FREM, 0); } void visitAnd(User &I) { visitIntBinary(I, ISD::AND, ISD::VAND); } void visitOr (User &I) { visitIntBinary(I, ISD::OR, ISD::VOR); } void visitXor(User &I) { visitIntBinary(I, ISD::XOR, ISD::VXOR); } From zhousheng00 at gmail.com Sun Oct 29 01:36:12 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:12 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200610290736.k9T7aCW0024419@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.9.2.3 -> 1.9.2.4 --- Log message: --- Diffs of the changes: (+6 -5) PatternMatch.h | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.9.2.3 llvm/include/llvm/Support/PatternMatch.h:1.9.2.4 --- llvm/include/llvm/Support/PatternMatch.h:1.9.2.3 Mon Oct 23 13:13:26 2006 +++ llvm/include/llvm/Support/PatternMatch.h Sun Oct 29 01:35:49 2006 @@ -123,6 +123,12 @@ return BinaryOp_match(L, R); } +template +inline BinaryOp_match m_FDiv(const LHS &L, + const RHS &R) { + return BinaryOp_match(L, R); +} + // SignlessType Revision: here we replace m_Rem with m_URem and add m_SRem // for SRem which is signed Rem. template @@ -136,11 +142,6 @@ const RHS &R) { return BinaryOp_match(L, R); } -template -inline BinaryOp_match m_FDiv(const LHS &L, - const RHS &R) { - return BinaryOp_match(L, R); -} template inline BinaryOp_match m_FRem(const LHS &L, From zhousheng00 at gmail.com Sun Oct 29 01:36:13 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:13 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200610290736.k9T7aDTj024424@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.272.2.7 -> 1.272.2.8 --- Log message: --- Diffs of the changes: (+13 -5) Writer.cpp | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.272.2.7 llvm/lib/Target/CBackend/Writer.cpp:1.272.2.8 --- llvm/lib/Target/CBackend/Writer.cpp:1.272.2.7 Wed Oct 25 20:58:05 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Sun Oct 29 01:35:49 2006 @@ -592,10 +592,10 @@ case Instruction::Mul: case Instruction::URem: case Instruction::SRem: + case Instruction::FRem: case Instruction::SDiv: case Instruction::UDiv: case Instruction::FDiv: - case Instruction::FRem: case Instruction::And: case Instruction::Or: case Instruction::Xor: @@ -607,6 +607,7 @@ case Instruction::SetGE: case Instruction::Shl: case Instruction::Shr: + { Out << '('; bool NeedsClosingParens = printConstExprCast(CE); printConstantWithCast(CE->getOperand(0), CE->getOpcode()); @@ -638,6 +639,7 @@ Out << "))"; Out << ')'; return; + } default: std::cerr << "CWriter Error: Unhandled constant expression: " @@ -827,7 +829,9 @@ bool Result = false; const Type* Ty = CE->getOperand(0)->getType(); switch (CE->getOpcode()) { + case Instruction::URem: case Instruction::UDiv: Result = Ty->isSigned(); break; + case Instruction::SRem: case Instruction::SDiv: Result = Ty->isUnsigned(); break; default: break; } @@ -857,6 +861,7 @@ default: // for most instructions, it doesn't matter break; + case Instruction::URem: case Instruction::UDiv: // For UDiv to have unsigned operands if (OpTy->isSigned()) { @@ -864,6 +869,7 @@ shouldCast = true; } break; + case Instruction::SRem: case Instruction::SDiv: if (OpTy->isUnsigned()) { OpTy = OpTy->getSignedVersion(); @@ -921,7 +927,9 @@ bool Result = false; const Type* Ty = I.getOperand(0)->getType(); switch (I.getOpcode()) { + case Instruction::URem: case Instruction::UDiv: Result = Ty->isSigned(); break; + case Instruction::SRem: case Instruction::SDiv: Result = Ty->isUnsigned(); break; default: break; } @@ -951,6 +959,7 @@ default: // for most instructions, it doesn't matter break; + case Instruction::URem: case Instruction::UDiv: // For UDiv to have unsigned operands if (OpTy->isSigned()) { @@ -958,6 +967,7 @@ shouldCast = true; } break; + case Instruction::SRem: case Instruction::SDiv: if (OpTy->isUnsigned()) { OpTy = OpTy->getSignedVersion(); @@ -1776,8 +1786,7 @@ Out << "-("; writeOperand(BinaryOperator::getNegArgument(cast(&I))); Out << ")"; - } else if ((I.getOpcode() == Instruction::URem || - I.getOpcode() == Instruction::SRem) && + } else if (I.getOpcode() == Instruction::FRem && I.getType()->isFloatingPoint()) { // Output a call to fmod/fmodf instead of emitting a%b if (I.getType() == Type::FloatTy) @@ -1804,8 +1813,7 @@ case Instruction::Sub: Out << " - "; break; case Instruction::Mul: Out << '*'; break; case Instruction::URem: - case Instruction::SRem: - case Instruction::FRem: Out << '%'; break; + case Instruction::SRem:Out << '%'; break; case Instruction::UDiv: case Instruction::SDiv: case Instruction::FDiv: Out << '/'; break; From zhousheng00 at gmail.com Sun Oct 29 01:36:14 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:36:14 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs Lexer.l Lexer.l.cvs llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200610290736.k9T7aEpc024460@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs updated: 1.10.2.7 -> 1.10.2.8 Lexer.l updated: 1.78.2.6 -> 1.78.2.7 Lexer.l.cvs updated: 1.8.2.6 -> 1.8.2.7 llvmAsmParser.cpp.cvs updated: 1.18.2.8 -> 1.18.2.9 llvmAsmParser.h.cvs updated: 1.13.2.8 -> 1.13.2.9 llvmAsmParser.y updated: 1.266.2.9 -> 1.266.2.10 llvmAsmParser.y.cvs updated: 1.18.2.8 -> 1.18.2.9 --- Log message: --- Diffs of the changes: (+340 -330) Lexer.cpp.cvs | 2 Lexer.l | 2 Lexer.l.cvs | 2 llvmAsmParser.cpp.cvs | 546 +++++++++++++++++++++++++------------------------- llvmAsmParser.h.cvs | 14 - llvmAsmParser.y | 6 llvmAsmParser.y.cvs | 98 ++++---- 7 files changed, 340 insertions(+), 330 deletions(-) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.10.2.7 llvm/lib/AsmParser/Lexer.cpp.cvs:1.10.2.8 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.10.2.7 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Sun Oct 29 01:35:49 2006 @@ -20,7 +20,7 @@ /* A lexical scanner generated by flex*/ /* Scanner skeleton version: - * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.10.2.7 2006/10/23 18:13:26 sheng Exp $ + * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.10.2.8 2006/10/29 07:35:49 sheng Exp $ */ #define FLEX_SCANNER Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.78.2.6 llvm/lib/AsmParser/Lexer.l:1.78.2.7 --- llvm/lib/AsmParser/Lexer.l:1.78.2.6 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/Lexer.l Sun Oct 29 01:35:49 2006 @@ -220,7 +220,7 @@ deplibs { return DEPLIBS; } endian { return ENDIAN; } pointersize { return POINTERSIZE; } -data { return DATA; } +data { return DATA; } little { return LITTLE; } big { return BIG; } volatile { return VOLATILE; } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.8.2.6 llvm/lib/AsmParser/Lexer.l.cvs:1.8.2.7 --- llvm/lib/AsmParser/Lexer.l.cvs:1.8.2.6 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/Lexer.l.cvs Sun Oct 29 01:35:49 2006 @@ -220,7 +220,7 @@ deplibs { return DEPLIBS; } endian { return ENDIAN; } pointersize { return POINTERSIZE; } -data { return DATA; } +data { return DATA; } little { return LITTLE; } big { return BIG; } volatile { return VOLATILE; } Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.8 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.9 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.18.2.8 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Sun Oct 29 01:35:49 2006 @@ -1095,50 +1095,48 @@ return Ty; } -// This template function is used to obtain the correct opcode for an -// instruction when an obsolete opcode is encountered. The OpcodeInfo template -// keeps track of the opcode and the "obsolete" flag. These are generated by -// the lexer and obsolete will be true when the lexer encounters the token for +// This function is used to obtain the correct opcode for an instruction when +// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +// an opcode and an "obsolete" flag. These are generated by the lexer and +// the "obsolete" member will be true when the lexer encounters the token for // an obsolete opcode. For example, "div" was replaced by [usf]div but we need // to maintain backwards compatibility for asm files that still have the "div" // instruction. This function handles converting div -> [usf]div appropriately. -template -static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { - if (OI.obsolete) { - switch (OI.opcode) { - default: - GenerateError("Invalid Obsolete OpCode"); - break; - case Instruction::UDiv: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isSigned()) - OI.opcode = Instruction::SDiv; - break; - case Instruction::SDiv: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isUnsigned()) - OI.opcode = Instruction::UDiv; - break; - case Instruction::URem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isSigned()) - OI.opcode = Instruction::SRem; - break; - case Instruction::SRem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isUnsigned()) - OI.opcode = Instruction::URem; - break; - } - OI.obsolete = false; +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; } - - + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1315,7 +1313,7 @@ #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1017 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1015 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1347,16 +1345,16 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - BinaryOpInfo BinaryOpVal; - TermOpInfo TermOpVal; - MemOpInfo MemOpVal; - OtherOpInfo OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 196 of yacc.c. */ -#line 1360 "llvmAsmParser.tab.c" +#line 1358 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1368,7 +1366,7 @@ /* Line 219 of yacc.c. */ -#line 1372 "llvmAsmParser.tab.c" +#line 1370 "llvmAsmParser.tab.c" #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ @@ -1703,32 +1701,32 @@ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1140, 1140, 1141, 1149, 1150, 1160, 1160, 1160, 1160, - 1160, 1160, 1160, 1160, 1160, 1161, 1161, 1161, 1162, 1162, - 1162, 1162, 1162, 1162, 1164, 1164, 1168, 1168, 1168, 1168, - 1169, 1169, 1169, 1169, 1170, 1170, 1171, 1171, 1174, 1178, - 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1192, 1193, - 1194, 1195, 1196, 1197, 1198, 1199, 1208, 1209, 1215, 1216, - 1224, 1232, 1233, 1238, 1239, 1240, 1245, 1259, 1259, 1260, - 1260, 1262, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1273, - 1273, 1273, 1273, 1273, 1273, 1274, 1278, 1282, 1290, 1298, - 1311, 1316, 1328, 1338, 1342, 1353, 1358, 1364, 1365, 1369, - 1373, 1384, 1410, 1424, 1454, 1480, 1501, 1514, 1524, 1529, - 1590, 1597, 1606, 1612, 1618, 1622, 1626, 1634, 1645, 1677, - 1685, 1709, 1720, 1726, 1734, 1740, 1746, 1755, 1759, 1767, - 1767, 1777, 1785, 1790, 1794, 1798, 1802, 1817, 1839, 1842, - 1845, 1845, 1853, 1853, 1861, 1861, 1869, 1869, 1878, 1881, - 1884, 1888, 1901, 1902, 1904, 1908, 1917, 1922, 1928, 1930, - 1935, 1940, 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, - 1976, 1982, 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, - 2104, 2105, 2106, 2108, 2108, 2118, 2122, 2127, 2131, 2135, - 2139, 2143, 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, - 2212, 2212, 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, - 2281, 2285, 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, - 2418, 2427, 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, - 2487, 2502, 2516, 2529, 2537, 2545, 2553, 2559, 2579, 2602, - 2608, 2614, 2620, 2635, 2694, 2701, 2704, 2709, 2713, 2720, - 2725, 2731, 2736, 2742, 2750, 2762, 2777 + 0, 1138, 1138, 1139, 1147, 1148, 1158, 1158, 1158, 1158, + 1158, 1158, 1158, 1158, 1158, 1159, 1159, 1159, 1160, 1160, + 1160, 1160, 1160, 1160, 1162, 1162, 1166, 1166, 1166, 1166, + 1167, 1167, 1167, 1167, 1168, 1168, 1169, 1169, 1172, 1176, + 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1190, 1191, + 1192, 1193, 1194, 1195, 1196, 1197, 1206, 1207, 1213, 1214, + 1222, 1230, 1231, 1236, 1237, 1238, 1243, 1257, 1257, 1258, + 1258, 1260, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1271, + 1271, 1271, 1271, 1271, 1271, 1272, 1276, 1280, 1288, 1296, + 1309, 1314, 1326, 1336, 1340, 1351, 1356, 1362, 1363, 1367, + 1371, 1382, 1408, 1422, 1452, 1478, 1499, 1512, 1522, 1527, + 1588, 1595, 1604, 1610, 1616, 1620, 1624, 1632, 1643, 1675, + 1683, 1710, 1721, 1727, 1735, 1741, 1747, 1756, 1760, 1768, + 1768, 1778, 1786, 1791, 1795, 1799, 1803, 1818, 1840, 1843, + 1846, 1846, 1854, 1854, 1862, 1862, 1870, 1870, 1879, 1882, + 1885, 1889, 1902, 1903, 1905, 1909, 1918, 1923, 1929, 1931, + 1936, 1941, 1950, 1950, 1951, 1951, 1953, 1960, 1966, 1973, + 1977, 1983, 1988, 1993, 2088, 2088, 2090, 2098, 2098, 2100, + 2105, 2106, 2107, 2109, 2109, 2119, 2123, 2128, 2132, 2136, + 2140, 2144, 2148, 2152, 2156, 2160, 2185, 2189, 2203, 2207, + 2213, 2213, 2219, 2224, 2228, 2237, 2248, 2253, 2265, 2278, + 2282, 2286, 2291, 2300, 2319, 2328, 2384, 2388, 2395, 2406, + 2419, 2428, 2437, 2447, 2451, 2458, 2458, 2460, 2464, 2469, + 2491, 2506, 2520, 2533, 2541, 2549, 2557, 2563, 2583, 2606, + 2612, 2618, 2624, 2639, 2698, 2705, 2708, 2713, 2717, 2724, + 2729, 2735, 2740, 2746, 2754, 2766, 2781 }; #endif @@ -3015,7 +3013,7 @@ switch (yyn) { case 3: -#line 1141 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1139 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -3025,7 +3023,7 @@ break; case 5: -#line 1150 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); @@ -3035,7 +3033,7 @@ break; case 38: -#line 1174 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1172 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -3043,7 +3041,7 @@ break; case 39: -#line 1178 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1176 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3051,82 +3049,82 @@ break; case 40: -#line 1183 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1181 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 41: -#line 1184 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1182 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 42: -#line 1185 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1183 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 43: -#line 1186 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1184 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 44: -#line 1187 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1185 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 45: -#line 1188 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 46: -#line 1189 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 47: -#line 1190 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 48: -#line 1192 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1190 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 49: -#line 1193 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1191 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 50: -#line 1194 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1192 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::CSRet; ;} break; case 51: -#line 1195 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1193 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 52: -#line 1196 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 53: -#line 1197 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1195 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 54: -#line 1198 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1196 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 55: -#line 1199 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1197 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large!"); @@ -3136,12 +3134,12 @@ break; case 56: -#line 1208 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1206 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 57: -#line 1209 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3151,12 +3149,12 @@ break; case 58: -#line 1215 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1213 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 59: -#line 1216 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1214 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) @@ -3166,7 +3164,7 @@ break; case 60: -#line 1224 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') @@ -3177,27 +3175,27 @@ break; case 61: -#line 1232 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 62: -#line 1233 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; case 63: -#line 1238 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1236 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 64: -#line 1239 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1237 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 65: -#line 1240 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -3206,7 +3204,7 @@ break; case 66: -#line 1245 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1243 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); @@ -3216,17 +3214,17 @@ break; case 68: -#line 1259 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; case 70: -#line 1260 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1258 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; case 71: -#line 1262 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1260 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); @@ -3236,7 +3234,7 @@ break; case 85: -#line 1274 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1272 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -3244,7 +3242,7 @@ break; case 86: -#line 1278 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1276 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR @@ -3252,7 +3250,7 @@ break; case 87: -#line 1282 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1280 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -3261,7 +3259,7 @@ break; case 88: -#line 1290 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1288 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3273,7 +3271,7 @@ break; case 89: -#line 1298 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1296 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3290,7 +3288,7 @@ break; case 90: -#line 1311 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1309 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); delete (yyvsp[-1].TypeVal); @@ -3299,7 +3297,7 @@ break; case 91: -#line 1316 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1314 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Packed array type? const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) @@ -3315,7 +3313,7 @@ break; case 92: -#line 1328 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1326 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), @@ -3329,7 +3327,7 @@ break; case 93: -#line 1338 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1336 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -3337,7 +3335,7 @@ break; case 94: -#line 1342 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1340 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -3348,7 +3346,7 @@ break; case 95: -#line 1353 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1351 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); @@ -3357,7 +3355,7 @@ break; case 96: -#line 1358 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1356 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR @@ -3365,7 +3363,7 @@ break; case 98: -#line 1365 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1363 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR @@ -3373,7 +3371,7 @@ break; case 99: -#line 1369 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1367 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR @@ -3381,7 +3379,7 @@ break; case 100: -#line 1373 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1371 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR @@ -3389,7 +3387,7 @@ break; case 101: -#line 1384 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1382 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) @@ -3419,7 +3417,7 @@ break; case 102: -#line 1410 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1408 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3437,7 +3435,7 @@ break; case 103: -#line 1424 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1422 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) @@ -3471,7 +3469,7 @@ break; case 104: -#line 1454 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1452 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) @@ -3501,7 +3499,7 @@ break; case 105: -#line 1480 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1478 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) @@ -3526,7 +3524,7 @@ break; case 106: -#line 1501 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1499 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) @@ -3543,7 +3541,7 @@ break; case 107: -#line 1514 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1512 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) @@ -3557,7 +3555,7 @@ break; case 108: -#line 1524 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1522 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); delete (yyvsp[-1].TypeVal); @@ -3566,7 +3564,7 @@ break; case 109: -#line 1529 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1527 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) @@ -3631,7 +3629,7 @@ break; case 110: -#line 1590 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1588 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); @@ -3642,7 +3640,7 @@ break; case 111: -#line 1597 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1595 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) @@ -3654,7 +3652,7 @@ break; case 112: -#line 1606 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1604 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3664,7 +3662,7 @@ break; case 113: -#line 1612 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1610 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); @@ -3674,7 +3672,7 @@ break; case 114: -#line 1618 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1616 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getTrue(); CHECK_FOR_ERROR @@ -3682,7 +3680,7 @@ break; case 115: -#line 1622 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1620 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getFalse(); CHECK_FOR_ERROR @@ -3690,7 +3688,7 @@ break; case 116: -#line 1626 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1624 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); @@ -3700,7 +3698,7 @@ break; case 117: -#line 1634 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1632 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + @@ -3715,7 +3713,7 @@ break; case 118: -#line 1645 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1643 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); @@ -3751,7 +3749,7 @@ break; case 119: -#line 1677 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1675 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); @@ -3763,12 +3761,15 @@ break; case 120: -#line 1685 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1683 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. sanitizeOpCode((yyvsp[-5].BinaryOpVal),(yyvsp[-3].ConstVal)->getType()); CHECK_FOR_ERROR; + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the @@ -3791,7 +3792,7 @@ break; case 121: -#line 1709 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1710 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); @@ -3806,7 +3807,7 @@ break; case 122: -#line 1720 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1721 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); @@ -3816,7 +3817,7 @@ break; case 123: -#line 1726 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1727 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); @@ -3828,7 +3829,7 @@ break; case 124: -#line 1734 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1735 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -3838,7 +3839,7 @@ break; case 125: -#line 1740 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1741 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -3848,7 +3849,7 @@ break; case 126: -#line 1746 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1747 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -3858,7 +3859,7 @@ break; case 127: -#line 1755 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1756 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR @@ -3866,7 +3867,7 @@ break; case 128: -#line 1759 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1760 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); @@ -3875,17 +3876,17 @@ break; case 129: -#line 1767 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1768 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 130: -#line 1767 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1768 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 131: -#line 1777 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1778 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); @@ -3894,7 +3895,7 @@ break; case 132: -#line 1785 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1786 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); @@ -3903,7 +3904,7 @@ break; case 133: -#line 1790 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1791 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR @@ -3911,7 +3912,7 @@ break; case 134: -#line 1794 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1795 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR @@ -3919,7 +3920,7 @@ break; case 135: -#line 1798 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1799 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR @@ -3927,7 +3928,7 @@ break; case 136: -#line 1802 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1803 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -3944,7 +3945,7 @@ break; case 137: -#line 1817 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1818 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -3970,21 +3971,21 @@ break; case 138: -#line 1839 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1840 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; case 139: -#line 1842 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1843 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; case 140: -#line 1845 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1846 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); @@ -3994,14 +3995,14 @@ break; case 141: -#line 1850 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1851 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 142: -#line 1853 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1854 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -4010,7 +4011,7 @@ break; case 143: -#line 1857 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1858 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4018,7 +4019,7 @@ break; case 144: -#line 1861 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1862 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR @@ -4027,7 +4028,7 @@ break; case 145: -#line 1865 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1866 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4035,7 +4036,7 @@ break; case 146: -#line 1869 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1870 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); @@ -4045,7 +4046,7 @@ break; case 147: -#line 1874 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1875 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4053,27 +4054,27 @@ break; case 148: -#line 1878 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1879 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 149: -#line 1881 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1882 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 150: -#line 1884 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1885 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ;} break; case 151: -#line 1888 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1889 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); @@ -4089,17 +4090,17 @@ break; case 152: -#line 1901 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1902 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; case 153: -#line 1902 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1903 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; case 154: -#line 1904 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1905 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR @@ -4107,7 +4108,7 @@ break; case 155: -#line 1908 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1909 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); @@ -4120,7 +4121,7 @@ break; case 156: -#line 1917 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1918 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4129,7 +4130,7 @@ break; case 157: -#line 1922 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1923 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4138,7 +4139,7 @@ break; case 159: -#line 1930 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1931 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4147,7 +4148,7 @@ break; case 160: -#line 1935 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1936 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); free((yyvsp[0].StrVal)); @@ -4156,19 +4157,19 @@ break; case 161: -#line 1940 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1941 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 165: -#line 1950 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1951 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 166: -#line 1952 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1953 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); @@ -4178,7 +4179,7 @@ break; case 167: -#line 1959 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1960 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4188,7 +4189,7 @@ break; case 168: -#line 1965 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1966 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); @@ -4198,7 +4199,7 @@ break; case 169: -#line 1972 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1973 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR @@ -4206,7 +4207,7 @@ break; case 170: -#line 1976 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1977 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = (yyvsp[-2].ArgList); (yyval.ArgList)->push_back(std::pair >(); (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); @@ -4225,7 +4226,7 @@ break; case 172: -#line 1987 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1988 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -4233,7 +4234,7 @@ break; case 173: -#line 1993 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1994 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { UnEscapeLexed((yyvsp[-5].StrVal)); std::string FunctionName((yyvsp[-5].StrVal)); @@ -4330,7 +4331,7 @@ break; case 176: -#line 2089 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2090 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; @@ -4341,7 +4342,7 @@ break; case 179: -#line 2099 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2100 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4349,22 +4350,22 @@ break; case 181: -#line 2105 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2106 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; case 182: -#line 2106 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2107 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; case 183: -#line 2108 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2109 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 184: -#line 2108 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2109 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -4373,7 +4374,7 @@ break; case 185: -#line 2118 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2119 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4381,7 +4382,7 @@ break; case 186: -#line 2122 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2123 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4389,7 +4390,7 @@ break; case 187: -#line 2127 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2128 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR @@ -4397,7 +4398,7 @@ break; case 188: -#line 2131 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2132 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR @@ -4405,7 +4406,7 @@ break; case 189: -#line 2135 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2136 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR @@ -4413,7 +4414,7 @@ break; case 190: -#line 2139 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2140 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR @@ -4421,7 +4422,7 @@ break; case 191: -#line 2143 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2144 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR @@ -4429,7 +4430,7 @@ break; case 192: -#line 2147 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2148 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -4437,7 +4438,7 @@ break; case 193: -#line 2151 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2152 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -4445,7 +4446,7 @@ break; case 194: -#line 2155 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2156 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -4453,7 +4454,7 @@ break; case 195: -#line 2159 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2160 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); int NumElements = (yyvsp[-1].ConstVector)->size(); @@ -4482,7 +4483,7 @@ break; case 196: -#line 2184 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2185 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR @@ -4490,7 +4491,7 @@ break; case 197: -#line 2188 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2189 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); std::string AsmStr = std::string((yyvsp[-2].StrVal), End); @@ -4504,7 +4505,7 @@ break; case 198: -#line 2202 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2203 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR @@ -4512,7 +4513,7 @@ break; case 199: -#line 2206 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2207 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR @@ -4520,7 +4521,7 @@ break; case 202: -#line 2218 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2219 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR @@ -4528,7 +4529,7 @@ break; case 203: -#line 2223 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2224 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4536,7 +4537,7 @@ break; case 204: -#line 2227 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2228 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR @@ -4544,7 +4545,7 @@ break; case 205: -#line 2236 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2237 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR @@ -4558,7 +4559,7 @@ break; case 206: -#line 2247 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2248 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); @@ -4567,7 +4568,7 @@ break; case 207: -#line 2252 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2253 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR @@ -4583,7 +4584,7 @@ break; case 208: -#line 2264 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2265 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); CHECK_FOR_ERROR @@ -4599,7 +4600,7 @@ break; case 209: -#line 2277 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2278 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR @@ -4607,7 +4608,7 @@ break; case 210: -#line 2281 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2282 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR @@ -4615,7 +4616,7 @@ break; case 211: -#line 2285 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2286 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR @@ -4624,7 +4625,7 @@ break; case 212: -#line 2290 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2291 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR @@ -4637,7 +4638,7 @@ break; case 213: -#line 2299 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2300 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR @@ -4660,7 +4661,7 @@ break; case 214: -#line 2318 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2319 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR @@ -4673,7 +4674,7 @@ break; case 215: -#line 2328 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2329 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -4732,7 +4733,7 @@ break; case 216: -#line 2383 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2384 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -4740,7 +4741,7 @@ break; case 217: -#line 2387 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2388 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -4748,7 +4749,7 @@ break; case 218: -#line 2394 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2395 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = (yyvsp[-5].JumpTable); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4763,7 +4764,7 @@ break; case 219: -#line 2405 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2406 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); @@ -4779,7 +4780,7 @@ break; case 220: -#line 2418 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2419 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); @@ -4791,7 +4792,7 @@ break; case 221: -#line 2427 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2428 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes (yyval.PHIList) = new std::list >(); Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); @@ -4804,7 +4805,7 @@ break; case 222: -#line 2436 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2437 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.PHIList) = (yyvsp[-6].PHIList); Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); @@ -4816,7 +4817,7 @@ break; case 223: -#line 2446 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2447 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); @@ -4824,7 +4825,7 @@ break; case 224: -#line 2450 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2451 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[-2].ValueList); (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); @@ -4833,12 +4834,12 @@ break; case 226: -#line 2457 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2458 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = 0; ;} break; case 227: -#line 2459 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2460 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4846,7 +4847,7 @@ break; case 228: -#line 2463 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2464 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4854,15 +4855,18 @@ break; case 229: -#line 2468 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2469 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && !isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); if (isa((*(yyvsp[-3].TypeVal)).get()) && - ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem || (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem)) - GEN_ERROR("URem and SRem not supported on packed types!"); + ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem || + (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem || + (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem)) + GEN_ERROR("U/S/FRem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal)); CHECK_FOR_ERROR; Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); @@ -4877,7 +4881,7 @@ break; case 230: -#line 2487 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2491 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { if (!isa((yyvsp[-3].TypeVal)->get()) || @@ -4896,7 +4900,7 @@ break; case 231: -#line 2502 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2506 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if(isa((*(yyvsp[-3].TypeVal)).get())) { GEN_ERROR( @@ -4914,7 +4918,7 @@ break; case 232: -#line 2516 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2520 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; @@ -4931,7 +4935,7 @@ break; case 233: -#line 2529 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2533 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); @@ -4943,7 +4947,7 @@ break; case 234: -#line 2537 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2541 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast instruction to a non-primitive type: '" + @@ -4955,7 +4959,7 @@ break; case 235: -#line 2545 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2549 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); @@ -4967,7 +4971,7 @@ break; case 236: -#line 2553 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2557 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { NewVarArgs = true; (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); @@ -4977,7 +4981,7 @@ break; case 237: -#line 2559 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2563 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -5001,7 +5005,7 @@ break; case 238: -#line 2579 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2583 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); @@ -5028,7 +5032,7 @@ break; case 239: -#line 2602 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2606 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); @@ -5038,7 +5042,7 @@ break; case 240: -#line 2608 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2612 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); @@ -5048,7 +5052,7 @@ break; case 241: -#line 2614 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2618 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); @@ -5058,7 +5062,7 @@ break; case 242: -#line 2620 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2624 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) @@ -5077,7 +5081,7 @@ break; case 243: -#line 2635 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2639 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; @@ -5140,7 +5144,7 @@ break; case 244: -#line 2694 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2698 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR @@ -5148,7 +5152,7 @@ break; case 245: -#line 2701 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2705 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR @@ -5156,7 +5160,7 @@ break; case 246: -#line 2704 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2708 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR @@ -5164,7 +5168,7 @@ break; case 247: -#line 2709 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2713 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5172,7 +5176,7 @@ break; case 248: -#line 2713 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2717 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5180,7 +5184,7 @@ break; case 249: -#line 2720 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2724 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5189,7 +5193,7 @@ break; case 250: -#line 2725 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2729 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5199,7 +5203,7 @@ break; case 251: -#line 2731 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2735 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); delete (yyvsp[-1].TypeVal); @@ -5208,7 +5212,7 @@ break; case 252: -#line 2736 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2740 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR @@ -5218,7 +5222,7 @@ break; case 253: -#line 2742 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2746 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5229,7 +5233,7 @@ break; case 254: -#line 2750 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2754 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + @@ -5245,7 +5249,7 @@ break; case 255: -#line 2762 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2766 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) @@ -5264,7 +5268,7 @@ break; case 256: -#line 2777 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2781 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); @@ -5296,7 +5300,7 @@ } /* Line 1126 of yacc.c. */ -#line 5300 "llvmAsmParser.tab.c" +#line 5304 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -5564,7 +5568,7 @@ } -#line 2803 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2807 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.8 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.9 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.13.2.8 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Sun Oct 29 01:35:49 2006 @@ -257,7 +257,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1017 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1015 "/developer/zsth/llvm-gcc-dev/BAT/llvm/llvm/lib/AsmParser/llvmAsmParser.y" typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -289,13 +289,13 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - BinaryOpInfo BinaryOpVal; - TermOpInfo TermOpVal; - MemOpInfo MemOpVal; - OtherOpInfo OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } YYSTYPE; /* Line 1447 of yacc.c. */ #line 302 "llvmAsmParser.tab.h" Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.9 llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.10 --- llvm/lib/AsmParser/llvmAsmParser.y:1.266.2.9 Wed Oct 25 20:58:05 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Oct 29 01:35:49 2006 @@ -2472,8 +2472,10 @@ GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); if (isa((*$2).get()) && - ($1.opcode == Instruction::URem || $1.opcode == Instruction::SRem)) - GEN_ERROR("URem and SRem not supported on packed types!"); + ($1.opcode == Instruction::URem || + $1.opcode == Instruction::SRem || + $1.opcode == Instruction::FRem)) + GEN_ERROR("U/S/FRem not supported on packed types!"); // Upgrade the opcode from obsolete versions before we do anything with it. sanitizeOpCode($1,*$2); CHECK_FOR_ERROR; Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.8 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.9 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.18.2.8 Mon Oct 23 13:13:26 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Sun Oct 29 01:35:49 2006 @@ -813,50 +813,48 @@ return Ty; } -// This template function is used to obtain the correct opcode for an -// instruction when an obsolete opcode is encountered. The OpcodeInfo template -// keeps track of the opcode and the "obsolete" flag. These are generated by -// the lexer and obsolete will be true when the lexer encounters the token for +// This function is used to obtain the correct opcode for an instruction when +// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +// an opcode and an "obsolete" flag. These are generated by the lexer and +// the "obsolete" member will be true when the lexer encounters the token for // an obsolete opcode. For example, "div" was replaced by [usf]div but we need // to maintain backwards compatibility for asm files that still have the "div" // instruction. This function handles converting div -> [usf]div appropriately. -template -static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& Ty) { - if (OI.obsolete) { - switch (OI.opcode) { - default: - GenerateError("Invalid Obsolete OpCode"); - break; - case Instruction::UDiv: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isSigned()) - OI.opcode = Instruction::SDiv; - break; - case Instruction::SDiv: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isUnsigned()) - OI.opcode = Instruction::UDiv; - break; - case Instruction::URem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isSigned()) - OI.opcode = Instruction::SRem; - break; - case Instruction::SRem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isUnsigned()) - OI.opcode = Instruction::URem; - break; - } - OI.obsolete = false; +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid Obsolete OpCode"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; } - - + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1045,13 +1043,13 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - BinaryOpInfo BinaryOpVal; - TermOpInfo TermOpVal; - MemOpInfo MemOpVal; - OtherOpInfo OtherOpVal; - llvm::Module::Endianness Endianness; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } %type Module FunctionList @@ -1685,8 +1683,11 @@ | ArithmeticOps '(' ConstVal ',' ConstVal ')' { if ($3->getType() != $5->getType()) GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. sanitizeOpCode($1,$3->getType()); CHECK_FOR_ERROR; + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the @@ -2471,8 +2472,11 @@ GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); if (isa((*$2).get()) && - ($1.opcode == Instruction::URem || $1.opcode == Instruction::SRem)) - GEN_ERROR("URem and SRem not supported on packed types!"); + ($1.opcode == Instruction::URem || + $1.opcode == Instruction::SRem || + $1.opcode == Instruction::FRem)) + GEN_ERROR("U/S/FRem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. sanitizeOpCode($1,*$2); CHECK_FOR_ERROR; Value* val1 = getVal(*$2, $3); From zhousheng00 at gmail.com Sun Oct 29 01:49:51 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Sun, 29 Oct 2006 01:49:51 -0600 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/test/Regression/CodeGen/X86/compare_folding.llx Message-ID: <200610290749.k9T7np6U024751@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: compare_folding.llx updated: 1.3 -> 1.3.2.1 --- Log message: --- Diffs of the changes: (+4 -4) compare_folding.llx | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/test/Regression/CodeGen/X86/compare_folding.llx diff -u llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3 llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3.2.1 --- llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3 Wed Oct 11 20:42:03 2006 +++ llvm/test/Regression/CodeGen/X86/compare_folding.llx Sun Oct 29 01:49:36 2006 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llc -march=x86 | grep movsd | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=x86 | grep ucomisd -declare bool %llvm.isunordered(double,double) +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep movsd | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep ucomisd +declare bool %llvm.isunordered.f64(double,double) bool %test1(double %X, double %Y) { ;; Returns isunordered(X,Y) - %COM = call bool %llvm.isunordered(double %X, double %Y) + %COM = call bool %llvm.isunordered.f64(double %X, double %Y) ret bool %COM } From jlaskey at apple.com Sun Oct 29 02:27:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Sun, 29 Oct 2006 02:27:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610290827.k9T8RUai001364@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.6 -> 1.7 --- Log message: Not handling zero length strings. --- Diffs of the changes: (+2 -2) FoldingSet.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.6 llvm/lib/Support/FoldingSet.cpp:1.7 --- llvm/lib/Support/FoldingSet.cpp:1.6 Fri Oct 27 14:38:32 2006 +++ llvm/lib/Support/FoldingSet.cpp Sun Oct 29 02:27:07 2006 @@ -61,7 +61,7 @@ Pos = Units * sizeof(unsigned); } else { // Otherwise do it the hard way. - for ( Pos += 4; Pos < Size; Pos += 4) { + for ( Pos += 4; Pos <= Size; Pos += 4) { unsigned V = ((unsigned char)String[Pos - 4] << 24) | ((unsigned char)String[Pos - 3] << 16) | ((unsigned char)String[Pos - 2] << 8) | @@ -77,7 +77,7 @@ case 1: V = (V << 8) | (unsigned char)String[Size - 3]; // Fall thru. case 2: V = (V << 8) | (unsigned char)String[Size - 2]; // Fall thru. case 3: V = (V << 8) | (unsigned char)String[Size - 1]; break; - case 0: return; // Nothing left. + default: return; // Nothing left. } Bits.push_back(V); From jlaskey at apple.com Sun Oct 29 03:20:20 2006 From: jlaskey at apple.com (Jim Laskey) Date: Sun, 29 Oct 2006 03:20:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp Message-ID: <200610290920.k9T9KKjH002252@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FoldingSet.cpp updated: 1.7 -> 1.8 --- Log message: Try again. --- Diffs of the changes: (+4 -1) FoldingSet.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/Support/FoldingSet.cpp diff -u llvm/lib/Support/FoldingSet.cpp:1.7 llvm/lib/Support/FoldingSet.cpp:1.8 --- llvm/lib/Support/FoldingSet.cpp:1.7 Sun Oct 29 02:27:07 2006 +++ llvm/lib/Support/FoldingSet.cpp Sun Oct 29 03:19:59 2006 @@ -51,6 +51,9 @@ } void FoldingSetImpl::NodeID::AddString(const std::string &String) { unsigned Size = String.size(); + Bits.push_back(Size); + if (!Size) return; + unsigned Units = Size / 4; unsigned Pos = 0; const unsigned *Base = (const unsigned *)String.data(); @@ -58,7 +61,7 @@ // If the string is aligned do a bulk transfer. if (!((intptr_t)Base & 3)) { Bits.append(Base, Base + Units); - Pos = Units * sizeof(unsigned); + Pos = (Units + 1) * 4; } else { // Otherwise do it the hard way. for ( Pos += 4; Pos <= Size; Pos += 4) { From clattner at apple.com Sun Oct 29 11:39:51 2006 From: clattner at apple.com (Chris Lattner) Date: Sun, 29 Oct 2006 09:39:51 -0800 Subject: [llvm-commits] llvm-gcc patch Message-ID: I just committed Anton's patch for PR973. This should greatly improve static ctor/dtor handling on linux. -Chris Index: crtstuff.c =================================================================== --- crtstuff.c (revision 119298) +++ crtstuff.c (working copy) @@ -51,9 +51,6 @@ This file must be compiled with gcc. */ -/* APPLE LOCAL begin LLVM */ -#ifndef __llvm__ /* FIXME: add inline asm support */ - /* It is incorrect to include config.h here, because this file is being compiled for the target, and hence definitions concerning only the host do not apply. */ @@ -69,6 +66,13 @@ #include "tm.h" #include "unwind-dw2-fde.h" +/* APPLE LOCAL begin LLVM */ +#ifdef __llvm__ + /* FIXME: Remove when external weak linkage will be alive. */ + #undef JCR_SECTION_NAME +#endif +/* APPLE LOCAL end LLVM */ + #ifndef FORCE_CODE_SECTION_ALIGN # define FORCE_CODE_SECTION_ALIGN #endif @@ -177,11 +181,25 @@ static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { }; asm (CTORS_SECTION_ASM_OP); STATIC func_ptr __CTOR_LIST__[1] +/* APPLE LOCAL begin LLVM */ +#ifdef __llvm__ +/* FIXME: Remove when external weak linkage will be alive. */ + __attribute__ ((__used__, aligned(sizeof(func_ptr)))) +#else __attribute__ ((__unused__, aligned(sizeof(func_ptr)))) +#endif +/* APPLE LOCAL end LLVM */ = { (func_ptr) (-1) }; #else STATIC func_ptr __CTOR_LIST__[1] - __attribute__ ((__unused__, section(".ctors"), aligned(sizeof (func_ptr)))) +/* APPLE LOCAL begin LLVM */ +#ifdef __llvm__ +/* FIXME: Remove when external weak linkage will be alive. */ + __attribute__ ((__used__, section(".ctors"), aligned(sizeof (func_ptr)))) +#else + __attribute__ ((__unused__, section(".ctors"), aligned(sizeof (func_ptr)))) +#endif +/* APPLE LOCAL end LLVM */ = { (func_ptr) (-1) }; #endif /* __CTOR_LIST__ alternatives */ @@ -449,11 +467,25 @@ #elif defined(DTORS_SECTION_ASM_OP) asm (DTORS_SECTION_ASM_OP); STATIC func_ptr __DTOR_END__[1] +/* APPLE LOCAL begin LLVM */ +#ifdef __llvm__ +/* FIXME: Remove when external weak linkage will be alive. */ +__attribute__ ((__used__, aligned(sizeof(func_ptr)))) +#else __attribute__ ((unused, aligned(sizeof(func_ptr)))) +#endif +/* APPLE LOCAL end LLVM */ = { (func_ptr) 0 }; #else STATIC func_ptr __DTOR_END__[1] - __attribute__((unused, section(".dtors"), aligned(sizeof(func_ptr)))) +/* APPLE LOCAL begin LLVM */ +#ifdef __llvm__ +/* FIXME: Remove when external weak linkage will be alive. */ + __attribute__((__used__, section(".dtors"), aligned(sizeof (func_ptr)))) +#else + __attribute__((unused, section(".dtors"), aligned(sizeof(func_ptr)))) +#endif +/* APPLE LOCAL end LLVM */ = { (func_ptr) 0 }; #endif @@ -558,5 +590,3 @@ #error "One of CRT_BEGIN or CRT_END must be defined." #endif -#endif -/* APPLE LOCAL end LLVM */ From sabre at nondot.org Sun Oct 29 12:23:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 12:23:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610291823.k9TINpCm003886@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.305 -> 1.306 --- Log message: Fix a load folding issue that Evan noticed: there is no need to export values used by comparisons in the main block. --- Diffs of the changes: (+17 -7) SelectionDAGISel.cpp | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.305 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.306 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.305 Sat Oct 28 14:22:10 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Oct 29 12:23:37 2006 @@ -841,12 +841,11 @@ // caseblock. if (BOp && isa(BOp) && // The operands of the setcc have to be in this block. We don't know - // how to export them from some other block. - isExportableFromCurrentBlock(BOp->getOperand(0), BB) && - isExportableFromCurrentBlock(BOp->getOperand(1), BB)) { - ExportFromCurrentBlock(BOp->getOperand(0)); - ExportFromCurrentBlock(BOp->getOperand(1)); - + // how to export them from some other block. If this is the first block + // of the sequence, no exporting is needed. + (CurBB == CurMBB || + (isExportableFromCurrentBlock(BOp->getOperand(0), BB) && + isExportableFromCurrentBlock(BOp->getOperand(1), BB)))) { ISD::CondCode SignCond, UnsCond, FPCond, Condition; switch (BOp->getOpcode()) { default: assert(0 && "Unknown setcc opcode!"); @@ -903,7 +902,6 @@ SelectionDAGISel::CaseBlock CB(ISD::SETEQ, Cond, ConstantBool::getTrue(), TBB, FBB, CurBB); SwitchCases.push_back(CB); - ExportFromCurrentBlock(Cond); return; } @@ -993,6 +991,18 @@ (BOp->getOpcode() == Instruction::And || BOp->getOpcode() == Instruction::Or)) { FindMergedConditions(BOp, Succ0MBB, Succ1MBB, CurMBB, BOp->getOpcode()); + + // If the compares in later blocks need to use values not currently + // exported from this block, export them now. This block should always be + // the first entry. + assert(SwitchCases[0].ThisBB == CurMBB && "Unexpected lowering!"); + + for (unsigned i = 1, e = SwitchCases.size(); i != e; ++i) { + ExportFromCurrentBlock(SwitchCases[i].CmpLHS); + ExportFromCurrentBlock(SwitchCases[i].CmpRHS); + } + + // Emit the branch for this block. visitSwitchCase(SwitchCases[0]); SwitchCases.erase(SwitchCases.begin()); return; From sabre at nondot.org Sun Oct 29 15:01:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 15:01:09 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-10-29-Crash.ll Message-ID: <200610292101.k9TL190u006257@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-10-29-Crash.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+21 -0) 2006-10-29-Crash.ll | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-10-29-Crash.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-10-29-Crash.ll:1.1 *** /dev/null Sun Oct 29 15:01:05 2006 --- llvm/test/Regression/CodeGen/Generic/2006-10-29-Crash.ll Sun Oct 29 15:00:55 2006 *************** *** 0 **** --- 1,21 ---- + ; RUN: llvm-as < %s | llc + + void %form_component_prediction(int %dy) { + entry: + %tmp7 = and int %dy, 1 ; [#uses=1] + %tmp27 = seteq int %tmp7, 0 ; [#uses=1] + br bool false, label %cond_next30, label %bb115 + + cond_next30: ; preds = %entry + ret void + + bb115: ; preds = %entry + %bothcond1 = or bool %tmp27, false ; [#uses=1] + br bool %bothcond1, label %bb228, label %cond_next125 + + cond_next125: ; preds = %bb115 + ret void + + bb228: ; preds = %bb115 + ret void + } From sabre at nondot.org Sun Oct 29 15:01:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 15:01:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200610292101.k9TL1Ydr006293@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.306 -> 1.307 --- Log message: fix Generic/2006-10-29-Crash.ll --- Diffs of the changes: (+9 -1) SelectionDAGISel.cpp | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.306 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.307 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.306 Sun Oct 29 12:23:37 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Oct 29 15:01:20 2006 @@ -824,6 +824,12 @@ return true; } +static bool InBlock(const Value *V, const BasicBlock *BB) { + if (const Instruction *I = dyn_cast(V)) + return I->getParent() == BB; + return true; +} + /// FindMergedConditions - If Cond is an expression like void SelectionDAGLowering::FindMergedConditions(Value *Cond, MachineBasicBlock *TBB, @@ -834,7 +840,9 @@ BinaryOperator *BOp = dyn_cast(Cond); if (!BOp || (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() || - BOp->getParent() != CurBB->getBasicBlock()) { + BOp->getParent() != CurBB->getBasicBlock() || + !InBlock(BOp->getOperand(0), CurBB->getBasicBlock()) || + !InBlock(BOp->getOperand(1), CurBB->getBasicBlock())) { const BasicBlock *BB = CurBB->getBasicBlock(); // If the leaf of the tree is a setcond inst, merge the condition into the From sabre at nondot.org Sun Oct 29 15:05:55 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 15:05:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200610292105.k9TL5tXn006407@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.26 -> 1.27 --- Log message: Make CanFallThrough more intelligent (so it can handle blocks with (e.g.) no successors), and make island block movement more general. This compiles CodeGen/X86/2006-04-27-ISelFoldingBug.ll to: _loadAndRLEsource_no_exit_2E_1_label_2E_0: subl $8, %esp movl %esi, 4(%esp) movl %ebx, (%esp) movl 16(%esp), %eax movl 12(%esp), %ecx LBB1_3: #label.0 movl _last, %edx movl %edx, %esi incl %esi movl %esi, _last movl %ecx, %ebx # TRUNCATE movb %bl, %bl movl _block, %esi movb %bl, 1(%esi,%edx) cmpl %eax, _last jge LBB1_2 #codeRepl5.exitStub LBB1_4: #label.0 cmpl $257, %ecx je LBB1_2 #codeRepl5.exitStub LBB1_1: #label.0.no_exit.1_crit_edge.exitStub movl $1, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret LBB1_2: #codeRepl5.exitStub xorl %eax, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret instead of: _loadAndRLEsource_no_exit_2E_1_label_2E_0: subl $8, %esp movl %esi, 4(%esp) movl %ebx, (%esp) movl 16(%esp), %eax movl 12(%esp), %ecx jmp LBB1_3 #label.0 LBB1_1: #label.0.no_exit.1_crit_edge.exitStub movl $1, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret LBB1_2: #codeRepl5.exitStub xorl %eax, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret LBB1_3: #label.0 movl _last, %edx movl %edx, %esi incl %esi movl %esi, _last movl %ecx, %ebx # TRUNCATE movb %bl, %bl movl _block, %esi movb %bl, 1(%esi,%edx) cmpl %eax, _last jge LBB1_2 #codeRepl5.exitStub LBB1_4: #label.0 cmpl $257, %ecx jne LBB1_1 #label.0.no_exit.1_crit_edge.exitStub jmp LBB1_2 #codeRepl5.exitStub ... which is much better layout :) --- Diffs of the changes: (+94 -62) BranchFolding.cpp | 156 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 94 insertions(+), 62 deletions(-) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.26 llvm/lib/CodeGen/BranchFolding.cpp:1.27 --- llvm/lib/CodeGen/BranchFolding.cpp:1.26 Sat Oct 28 13:34:47 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Sun Oct 29 15:05:41 2006 @@ -48,6 +48,11 @@ bool OptimizeBranches(MachineFunction &MF); void OptimizeBlock(MachineBasicBlock *MBB); void RemoveDeadBlock(MachineBasicBlock *MBB); + + bool CanFallThrough(MachineBasicBlock *CurBB); + bool CanFallThrough(MachineBasicBlock *CurBB, bool BranchUnAnalyzable, + MachineBasicBlock *TBB, MachineBasicBlock *FBB, + const std::vector &Cond); }; } @@ -443,19 +448,37 @@ } } -/// CanFallThrough - Return true of the specified branch condition can transfer -/// control to FallthroughBlock, the block immediately after the branch. -static bool CanFallThrough(MachineBasicBlock *TBB, - MachineBasicBlock *FBB, - const std::vector &Cond, - MachineFunction::iterator FallthroughBlock) { +/// CanFallThrough - Return true if the specified block (with the specified +/// branch condition) can implicitly transfer control to the block after it by +/// falling off the end of it. This should return false if it can reach the +/// block after it, but it uses an explicit branch to do so (e.g. a table jump). +/// +/// True is a conservative answer. +/// +bool BranchFolder::CanFallThrough(MachineBasicBlock *CurBB, + bool BranchUnAnalyzable, + MachineBasicBlock *TBB, MachineBasicBlock *FBB, + const std::vector &Cond) { + MachineFunction::iterator Fallthrough = CurBB; + ++Fallthrough; + // If FallthroughBlock is off the end of the function, it can't fall through. + if (Fallthrough == CurBB->getParent()->end()) + return false; + + // If FallthroughBlock isn't a successor of CurBB, no fallthrough is possible. + if (!CurBB->isSuccessor(Fallthrough)) + return false; + + // If we couldn't analyze the branch, assume it could fall through. + if (BranchUnAnalyzable) return true; + // If there is no branch, control always falls through. if (TBB == 0) return true; // If there is some explicit branch to the fallthrough block, it can obviously // reach, even though the branch should get folded to fall through implicitly. - if (MachineFunction::iterator(TBB) == FallthroughBlock || - MachineFunction::iterator(FBB) == FallthroughBlock) + if (MachineFunction::iterator(TBB) == Fallthrough || + MachineFunction::iterator(FBB) == Fallthrough) return true; // If it's an unconditional branch to some block not the fall through, it @@ -467,6 +490,20 @@ return FBB == 0; } +/// CanFallThrough - Return true if the specified can implicitly transfer +/// control to the block after it by falling off the end of it. This should +/// return false if it can reach the block after it, but it uses an explicit +/// branch to do so (e.g. a table jump). +/// +/// True is a conservative answer. +/// +bool BranchFolder::CanFallThrough(MachineBasicBlock *CurBB) { + MachineBasicBlock *TBB = 0, *FBB = 0; + std::vector Cond; + bool CurUnAnalyzable = TII->AnalyzeBranch(*CurBB, TBB, FBB, Cond); + return CanFallThrough(CurBB, CurUnAnalyzable, TBB, FBB, Cond); +} + /// OptimizeBlock - Analyze and optimize control flow related to the specified /// block. This is never called on the entry block. void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) { @@ -504,8 +541,8 @@ MachineBasicBlock *PriorTBB = 0, *PriorFBB = 0; std::vector PriorCond; - bool PriorUnAnalyzable = false; - PriorUnAnalyzable = TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond); + bool PriorUnAnalyzable = + TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond); if (!PriorUnAnalyzable) { // If the CFG for the prior block has extra edges, remove them. MadeChange |= CorrectExtraCFGEdges(PrevBB, PriorTBB, PriorFBB, @@ -561,7 +598,8 @@ // Analyze the branch in the current block. MachineBasicBlock *CurTBB = 0, *CurFBB = 0; std::vector CurCond; - if (!TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond)) { + bool CurUnAnalyzable = TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond); + if (!CurUnAnalyzable) { // If the CFG for the prior block has extra edges, remove them. MadeChange |= CorrectExtraCFGEdges(*MBB, CurTBB, CurFBB, !CurCond.empty(), @@ -630,62 +668,56 @@ // Add the branch back if the block is more than just an uncond branch. TII->InsertBranch(*MBB, CurTBB, 0, CurCond); } - - // If the prior block doesn't fall through into this block, and if this - // block doesn't fall through into some other block, see if we can find a - // place to move this block where a fall-through will happen. - if (!PriorUnAnalyzable && !CanFallThrough(PriorTBB, PriorFBB, - PriorCond, MBB)) { - // Now we know that there was no fall-through into this block, check to - // see if it has fall-throughs. - if (!CanFallThrough(CurTBB, CurFBB, CurCond, FallThrough)) { - - // Check all the predecessors of this block. If one of them has no fall - // throughs, move this block right after it. - for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), - E = MBB->pred_end(); PI != E; ++PI) { - // Analyze the branch at the end of the pred. - MachineBasicBlock *PredBB = *PI; - MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough; - MachineBasicBlock *PredTBB = 0, *PredFBB = 0; - std::vector PredCond; - if (PredBB != MBB && - !TII->AnalyzeBranch(*PredBB, PredTBB, PredFBB, PredCond) && - !CanFallThrough(PredTBB, PredFBB, PredCond, PredFallthrough)) { - MBB->moveAfter(PredBB); - MadeChange = true; - return OptimizeBlock(MBB); - } - } - - // Check all successors to see if we can move this block before it. - for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), - E = MBB->succ_end(); SI != E; ++SI) { - // Analyze the branch at the end of the block before the succ. - MachineBasicBlock *SuccBB = *SI; - MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev; - MachineBasicBlock *SuccPrevTBB = 0, *SuccPrevFBB = 0; - std::vector SuccPrevCond; - if (SuccBB != MBB && - !TII->AnalyzeBranch(*SuccPrev, SuccPrevTBB, SuccPrevFBB, - SuccPrevCond) && - !CanFallThrough(SuccPrevTBB, SuccPrevFBB, SuccPrevCond, SuccBB)) { - MBB->moveBefore(SuccBB); - MadeChange = true; - return OptimizeBlock(MBB); - } + } + + // If the prior block doesn't fall through into this block, and if this + // block doesn't fall through into some other block, see if we can find a + // place to move this block where a fall-through will happen. + if (!CanFallThrough(&PrevBB, PriorUnAnalyzable, + PriorTBB, PriorFBB, PriorCond)) { + // Now we know that there was no fall-through into this block, check to + // see if it has a fall-through into its successor. + if (!CanFallThrough(MBB, CurUnAnalyzable, CurTBB, CurFBB, CurCond)) { + // Check all the predecessors of this block. If one of them has no fall + // throughs, move this block right after it. + for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), + E = MBB->pred_end(); PI != E; ++PI) { + // Analyze the branch at the end of the pred. + MachineBasicBlock *PredBB = *PI; + MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough; + MachineBasicBlock *PredTBB = 0, *PredFBB = 0; + std::vector PredCond; + if (PredBB != MBB && !CanFallThrough(PredBB)) { + MBB->moveAfter(PredBB); + MadeChange = true; + return OptimizeBlock(MBB); } + } - // Okay, there is no really great place to put this block. If, however, - // the block before this one would be a fall-through if this block were - // removed, move this block to the end of the function. - if (FallThrough != MBB->getParent()->end() && - CanFallThrough(PriorTBB, PriorFBB, PriorCond, FallThrough)) { - MBB->moveAfter(--MBB->getParent()->end()); + // Check all successors to see if we can move this block before it. + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + E = MBB->succ_end(); SI != E; ++SI) { + // Analyze the branch at the end of the block before the succ. + MachineBasicBlock *SuccBB = *SI; + MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev; + MachineBasicBlock *SuccPrevTBB = 0, *SuccPrevFBB = 0; + std::vector SuccPrevCond; + if (SuccBB != MBB && !CanFallThrough(SuccPrev)) { + MBB->moveBefore(SuccBB); MadeChange = true; - return; + return OptimizeBlock(MBB); } } + + // Okay, there is no really great place to put this block. If, however, + // the block before this one would be a fall-through if this block were + // removed, move this block to the end of the function. + if (FallThrough != MBB->getParent()->end() && + PrevBB.isSuccessor(FallThrough)) { + MBB->moveAfter(--MBB->getParent()->end()); + MadeChange = true; + return; + } } } } From sabre at nondot.org Sun Oct 29 15:21:11 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 15:21:11 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll Message-ID: <200610292121.k9TLLBdl006689@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: 2006-10-29-InvokeCrash.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+652 -0) 2006-10-29-InvokeCrash.ll | 652 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 652 insertions(+) Index: llvm/test/Regression/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll:1.1 *** /dev/null Sun Oct 29 15:21:06 2006 --- llvm/test/Regression/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll Sun Oct 29 15:20:56 2006 *************** *** 0 **** --- 1,652 ---- + ; RUN: llvm-as < %s | opt -simplifycfg -disable-output + + %struct..4._102 = type { %struct.QVectorData* } + %struct..5._125 = type { %struct.QMapData* } + %struct.QAbstractTextDocumentLayout = type { %struct.QObject } + %struct.QBasicAtomic = type { int } + %struct.QFont = type { %struct.QFontPrivate*, uint } + %struct.QFontMetrics = type { %struct.QFontPrivate* } + %struct.QFontPrivate = type opaque + "struct.QFragmentMap" = type { %struct.QFragmentMapData } + %struct.QFragmentMapData = type { "struct.QFragmentMapData::._154", int } + "struct.QFragmentMapData::._154" = type { "struct.QFragmentMapData::Header"* } + "struct.QFragmentMapData::Header" = type { uint, uint, uint, uint, uint, uint, uint, uint } + "struct.QHash" = type { "struct.QHash::._152" } + "struct.QHash::._152" = type { %struct.QHashData* } + %struct.QHashData = type { "struct.QHashData::Node"*, "struct.QHashData::Node"**, %struct.QBasicAtomic, int, int, short, short, int, ubyte } + "struct.QHashData::Node" = type { "struct.QHashData::Node"*, uint } + "struct.QList::._92" = type { %struct.QListData } + "struct.QList >" = type { "struct.QList::._92" } + %struct.QListData = type { "struct.QListData::Data"* } + "struct.QListData::Data" = type { %struct.QBasicAtomic, int, int, int, ubyte, [1 x sbyte*] } + "struct.QMap" = type { %struct..5._125 } + %struct.QMapData = type { "struct.QMapData::Node"*, [12 x "struct.QMapData::Node"*], %struct.QBasicAtomic, int, int, uint, ubyte } + "struct.QMapData::Node" = type { "struct.QMapData::Node"*, [1 x "struct.QMapData::Node"*] } + %struct.QObject = type { int (...)**, %struct.QObjectData* } + %struct.QObjectData = type { int (...)**, %struct.QObject*, %struct.QObject*, "struct.QList >", ubyte, [3 x ubyte], int, int } + %struct.QObjectPrivate = type { %struct.QObjectData, int, %struct.QObject*, "struct.QList >", "struct.QVector", %struct.QString } + %struct.QPaintDevice = type { int (...)**, ushort } + %struct.QPainter = type { %struct.QPainterPrivate* } + %struct.QPainterPrivate = type opaque + %struct.QPointF = type { double, double } + %struct.QPrinter = type { %struct.QPaintDevice, %struct.QPrinterPrivate* } + %struct.QPrinterPrivate = type opaque + %struct.QRectF = type { double, double, double, double } + "struct.QSet" = type { "struct.QHash" } + "struct.QSharedDataPointer" = type { %struct.QTextFormatPrivate* } + %struct.QString = type { "struct.QString::Data"* } + "struct.QString::Data" = type { %struct.QBasicAtomic, int, int, ushort*, ubyte, ubyte, [1 x ushort] } + %struct.QTextBlockFormat = type { %struct.QTextFormat } + %struct.QTextBlockGroup = type { %struct.QAbstractTextDocumentLayout } + %struct.QTextDocumentConfig = type { %struct.QString } + %struct.QTextDocumentPrivate = type { %struct.QObjectPrivate, %struct.QString, "struct.QVector", bool, int, int, bool, int, int, int, int, bool, %struct.QTextFormatCollection, %struct.QTextBlockGroup*, %struct.QAbstractTextDocumentLayout*, "struct.QFragmentMap", "struct.QFragmentMap", int, "struct.QList >", "struct.QList >", "struct.QMap", "struct.QMap", "struct.QMap", %struct.QTextDocumentConfig, bool, bool, %struct.QPointF } + %struct.QTextFormat = type { "struct.QSharedDataPointer", int } + %struct.QTextFormatCollection = type { "struct.QVector", "struct.QVector", "struct.QSet", %struct.QFont } + %struct.QTextFormatPrivate = type opaque + "struct.QVector" = type { %struct..4._102 } + %struct.QVectorData = type { %struct.QBasicAtomic, int, int, ubyte } + + implementation ; Functions: + + void %_ZNK13QTextDocument5printEP8QPrinter(%struct.QAbstractTextDocumentLayout* %this, %struct.QPrinter* %printer) { + entry: + %tmp = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=2] + %tmp = alloca %struct.QRectF, align 16 ; <%struct.QRectF*> [#uses=5] + %tmp2 = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=3] + %tmp = alloca %struct.QFontMetrics, align 16 ; <%struct.QFontMetrics*> [#uses=4] + %tmp = alloca %struct.QFont, align 16 ; <%struct.QFont*> [#uses=4] + %tmp3 = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=2] + %p = alloca %struct.QPainter, align 16 ; <%struct.QPainter*> [#uses=14] + %body = alloca %struct.QRectF, align 16 ; <%struct.QRectF*> [#uses=9] + %pageNumberPos = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=4] + %scaledPageSize = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=6] + %printerPageSize = alloca %struct.QPointF, align 16 ; <%struct.QPointF*> [#uses=3] + %fmt = alloca %struct.QTextBlockFormat, align 16 ; <%struct.QTextBlockFormat*> [#uses=5] + %font = alloca %struct.QFont, align 16 ; <%struct.QFont*> [#uses=5] + %tmp = call %struct.QTextDocumentPrivate* %_ZNK13QTextDocument6d_funcEv( %struct.QAbstractTextDocumentLayout* %this ) ; <%struct.QTextDocumentPrivate*> [#uses=5] + %tmp = getelementptr %struct.QPrinter* %printer, int 0, uint 0 ; <%struct.QPaintDevice*> [#uses=1] + call void %_ZN8QPainterC1EP12QPaintDevice( %struct.QPainter* %p, %struct.QPaintDevice* %tmp ) + %tmp = invoke bool %_ZNK8QPainter8isActiveEv( %struct.QPainter* %p ) + to label %invcont unwind label %cleanup329 ; [#uses=1] + + invcont: ; preds = %entry + br bool %tmp, label %cond_next, label %cleanup328 + + cond_next: ; preds = %invcont + %tmp8 = invoke %struct.QAbstractTextDocumentLayout* %_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %this ) + to label %invcont7 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=0] + + invcont7: ; preds = %cond_next + %tmp10 = getelementptr %struct.QTextDocumentPrivate* %tmp, int 0, uint 26 ; <%struct.QPointF*> [#uses=1] + call void %_ZN7QPointFC1Edd( %struct.QPointF* %tmp, double 0.000000e+00, double 0.000000e+00 ) + call void %_ZN6QRectFC1ERK7QPointFRK6QSizeF( %struct.QRectF* %body, %struct.QPointF* %tmp, %struct.QPointF* %tmp10 ) + call void %_ZN7QPointFC1Ev( %struct.QPointF* %pageNumberPos ) + %tmp12 = getelementptr %struct.QTextDocumentPrivate* %tmp, int 0, uint 26 ; <%struct.QPointF*> [#uses=1] + %tmp13 = call bool %_ZNK6QSizeF7isValidEv( %struct.QPointF* %tmp12 ) ; [#uses=1] + br bool %tmp13, label %cond_next15, label %bb + + cond_next15: ; preds = %invcont7 + %tmp17 = getelementptr %struct.QTextDocumentPrivate* %tmp, int 0, uint 26 ; <%struct.QPointF*> [#uses=1] + %tmp = call double %_ZNK6QSizeF6heightEv( %struct.QPointF* %tmp17 ) ; [#uses=1] + %tmp18 = seteq double %tmp, 0x41DFFFFFFFC00000 ; [#uses=1] + br bool %tmp18, label %bb, label %cond_next20 + + cond_next20: ; preds = %cond_next15 + br label %bb21 + + bb: ; preds = %cond_next15, %invcont7 + br label %bb21 + + bb21: ; preds = %bb, %cond_next20 + %iftmp.406.0 = phi bool [ false, %bb ], [ true, %cond_next20 ] ; [#uses=1] + br bool %iftmp.406.0, label %cond_true24, label %cond_false + + cond_true24: ; preds = %bb21 + %tmp = invoke int %_Z13qt_defaultDpiv( ) + to label %invcont25 unwind label %cleanup329 ; [#uses=1] + + invcont25: ; preds = %cond_true24 + %tmp26 = cast int %tmp to double ; [#uses=2] + %tmp30 = invoke %struct.QAbstractTextDocumentLayout* %_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %this ) + to label %invcont29 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=1] + + invcont29: ; preds = %invcont25 + %tmp32 = invoke %struct.QPaintDevice* %_ZNK27QAbstractTextDocumentLayout11paintDeviceEv( %struct.QAbstractTextDocumentLayout* %tmp30 ) + to label %invcont31 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=3] + + invcont31: ; preds = %invcont29 + %tmp34 = seteq %struct.QPaintDevice* %tmp32, null ; [#uses=1] + br bool %tmp34, label %cond_next42, label %cond_true35 + + cond_true35: ; preds = %invcont31 + %tmp38 = invoke int %_ZNK12QPaintDevice11logicalDpiXEv( %struct.QPaintDevice* %tmp32 ) + to label %invcont37 unwind label %cleanup329 ; [#uses=1] + + invcont37: ; preds = %cond_true35 + %tmp38 = cast int %tmp38 to double ; [#uses=1] + %tmp41 = invoke int %_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp32 ) + to label %invcont40 unwind label %cleanup329 ; [#uses=1] + + invcont40: ; preds = %invcont37 + %tmp41 = cast int %tmp41 to double ; [#uses=1] + br label %cond_next42 + + cond_next42: ; preds = %invcont40, %invcont31 + %sourceDpiY.2 = phi double [ %tmp41, %invcont40 ], [ %tmp26, %invcont31 ] ; [#uses=1] + %sourceDpiX.2 = phi double [ %tmp38, %invcont40 ], [ %tmp26, %invcont31 ] ; [#uses=1] + %tmp44 = getelementptr %struct.QPrinter* %printer, int 0, uint 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp46 = invoke int %_ZNK12QPaintDevice11logicalDpiXEv( %struct.QPaintDevice* %tmp44 ) + to label %invcont45 unwind label %cleanup329 ; [#uses=1] + + invcont45: ; preds = %cond_next42 + %tmp46 = cast int %tmp46 to double ; [#uses=1] + %tmp48 = fdiv double %tmp46, %sourceDpiX.2 ; [#uses=2] + %tmp50 = getelementptr %struct.QPrinter* %printer, int 0, uint 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp52 = invoke int %_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp50 ) + to label %invcont51 unwind label %cleanup329 ; [#uses=1] + + invcont51: ; preds = %invcont45 + %tmp52 = cast int %tmp52 to double ; [#uses=1] + %tmp54 = fdiv double %tmp52, %sourceDpiY.2 ; [#uses=2] + invoke void %_ZN8QPainter5scaleEdd( %struct.QPainter* %p, double %tmp48, double %tmp54 ) + to label %invcont57 unwind label %cleanup329 + + invcont57: ; preds = %invcont51 + %tmp = getelementptr %struct.QPointF* %scaledPageSize, int 0, uint 0 ; [#uses=1] + %tmp60 = getelementptr %struct.QTextDocumentPrivate* %tmp, int 0, uint 26, uint 0 ; [#uses=1] + %tmp61 = load double* %tmp60 ; [#uses=1] + store double %tmp61, double* %tmp + %tmp62 = getelementptr %struct.QPointF* %scaledPageSize, int 0, uint 1 ; [#uses=1] + %tmp63 = getelementptr %struct.QTextDocumentPrivate* %tmp, int 0, uint 26, uint 1 ; [#uses=1] + %tmp64 = load double* %tmp63 ; [#uses=1] + store double %tmp64, double* %tmp62 + %tmp65 = call double* %_ZN6QSizeF6rwidthEv( %struct.QPointF* %scaledPageSize ) ; [#uses=2] + %tmp67 = load double* %tmp65 ; [#uses=1] + %tmp69 = mul double %tmp67, %tmp48 ; [#uses=1] + store double %tmp69, double* %tmp65 + %tmp71 = call double* %_ZN6QSizeF7rheightEv( %struct.QPointF* %scaledPageSize ) ; [#uses=2] + %tmp73 = load double* %tmp71 ; [#uses=1] + %tmp75 = mul double %tmp73, %tmp54 ; [#uses=1] + store double %tmp75, double* %tmp71 + %tmp78 = getelementptr %struct.QPrinter* %printer, int 0, uint 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp80 = invoke int %_ZNK12QPaintDevice6heightEv( %struct.QPaintDevice* %tmp78 ) + to label %invcont79 unwind label %cleanup329 ; [#uses=1] + + invcont79: ; preds = %invcont57 + %tmp82 = getelementptr %struct.QPrinter* %printer, int 0, uint 0 ; <%struct.QPaintDevice*> [#uses=1] + %tmp84 = invoke int %_ZNK12QPaintDevice5widthEv( %struct.QPaintDevice* %tmp82 ) + to label %invcont83 unwind label %cleanup329 ; [#uses=1] + + invcont83: ; preds = %invcont79 + %tmp80 = cast int %tmp80 to double ; [#uses=1] + %tmp84 = cast int %tmp84 to double ; [#uses=1] + call void %_ZN6QSizeFC1Edd( %struct.QPointF* %printerPageSize, double %tmp84, double %tmp80 ) + %tmp85 = call double %_ZNK6QSizeF6heightEv( %struct.QPointF* %printerPageSize ) ; [#uses=1] + %tmp86 = call double %_ZNK6QSizeF6heightEv( %struct.QPointF* %scaledPageSize ) ; [#uses=1] + %tmp87 = fdiv double %tmp85, %tmp86 ; [#uses=1] + %tmp88 = call double %_ZNK6QSizeF5widthEv( %struct.QPointF* %printerPageSize ) ; [#uses=1] + %tmp89 = call double %_ZNK6QSizeF5widthEv( %struct.QPointF* %scaledPageSize ) ; [#uses=1] + %tmp90 = fdiv double %tmp88, %tmp89 ; [#uses=1] + invoke void %_ZN8QPainter5scaleEdd( %struct.QPainter* %p, double %tmp90, double %tmp87 ) + to label %cond_next194 unwind label %cleanup329 + + cond_false: ; preds = %bb21 + %tmp = getelementptr %struct.QAbstractTextDocumentLayout* %this, int 0, uint 0 ; <%struct.QObject*> [#uses=1] + %tmp95 = invoke %struct.QAbstractTextDocumentLayout* %_ZNK13QTextDocument5cloneEP7QObject( %struct.QAbstractTextDocumentLayout* %this, %struct.QObject* %tmp ) + to label %invcont94 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=9] + + invcont94: ; preds = %cond_false + %tmp99 = invoke %struct.QAbstractTextDocumentLayout* %_ZNK13QTextDocument14documentLayoutEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) + to label %invcont98 unwind label %cleanup329 ; <%struct.QAbstractTextDocumentLayout*> [#uses=1] + + invcont98: ; preds = %invcont94 + %tmp101 = invoke %struct.QPaintDevice* %_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont100 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=1] + + invcont100: ; preds = %invcont98 + invoke void %_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice( %struct.QAbstractTextDocumentLayout* %tmp99, %struct.QPaintDevice* %tmp101 ) + to label %invcont103 unwind label %cleanup329 + + invcont103: ; preds = %invcont100 + %tmp105 = invoke %struct.QPaintDevice* %_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont104 unwind label %cleanup329 ; <%struct.QPaintDevice*> [#uses=1] + + invcont104: ; preds = %invcont103 + %tmp107 = invoke int %_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp105 ) + to label %invcont106 unwind label %cleanup329 ; [#uses=1] + + invcont106: ; preds = %invcont104 + %tmp108 = cast int %tmp107 to double ; [#uses=1] + %tmp109 = mul double %tmp108, 0x3FE93264C993264C ; [#uses=1] + %tmp109 = cast double %tmp109 to int ; [#uses=3] + %tmp = call %struct.QTextBlockGroup* %_ZNK13QTextDocument9rootFrameEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) ; <%struct.QTextBlockGroup*> [#uses=1] + invoke csretcc void %_ZNK10QTextFrame11frameFormatEv( %struct.QTextBlockFormat* %fmt, %struct.QTextBlockGroup* %tmp ) + to label %invcont111 unwind label %cleanup329 + + invcont111: ; preds = %invcont106 + %tmp112 = cast int %tmp109 to double ; [#uses=1] + invoke void %_ZN16QTextFrameFormat9setMarginEd( %struct.QTextBlockFormat* %fmt, double %tmp112 ) + to label %invcont114 unwind label %cleanup192 + + invcont114: ; preds = %invcont111 + %tmp116 = call %struct.QTextBlockGroup* %_ZNK13QTextDocument9rootFrameEv( %struct.QAbstractTextDocumentLayout* %tmp95 ) ; <%struct.QTextBlockGroup*> [#uses=1] + invoke void %_ZN10QTextFrame14setFrameFormatERK16QTextFrameFormat( %struct.QTextBlockGroup* %tmp116, %struct.QTextBlockFormat* %fmt ) + to label %invcont117 unwind label %cleanup192 + + invcont117: ; preds = %invcont114 + %tmp119 = invoke %struct.QPaintDevice* %_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont118 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1] + + invcont118: ; preds = %invcont117 + %tmp121 = invoke int %_ZNK12QPaintDevice6heightEv( %struct.QPaintDevice* %tmp119 ) + to label %invcont120 unwind label %cleanup192 ; [#uses=1] + + invcont120: ; preds = %invcont118 + %tmp121 = cast int %tmp121 to double ; [#uses=1] + %tmp123 = invoke %struct.QPaintDevice* %_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont122 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1] + + invcont122: ; preds = %invcont120 + %tmp125 = invoke int %_ZNK12QPaintDevice5widthEv( %struct.QPaintDevice* %tmp123 ) + to label %invcont124 unwind label %cleanup192 ; [#uses=1] + + invcont124: ; preds = %invcont122 + %tmp125 = cast int %tmp125 to double ; [#uses=1] + call void %_ZN6QRectFC1Edddd( %struct.QRectF* %tmp, double 0.000000e+00, double 0.000000e+00, double %tmp125, double %tmp121 ) + %tmp126 = getelementptr %struct.QRectF* %body, int 0, uint 0 ; [#uses=1] + %tmp127 = getelementptr %struct.QRectF* %tmp, int 0, uint 0 ; [#uses=1] + %tmp128 = load double* %tmp127 ; [#uses=1] + store double %tmp128, double* %tmp126 + %tmp129 = getelementptr %struct.QRectF* %body, int 0, uint 1 ; [#uses=1] + %tmp130 = getelementptr %struct.QRectF* %tmp, int 0, uint 1 ; [#uses=1] + %tmp131 = load double* %tmp130 ; [#uses=1] + store double %tmp131, double* %tmp129 + %tmp132 = getelementptr %struct.QRectF* %body, int 0, uint 2 ; [#uses=1] + %tmp133 = getelementptr %struct.QRectF* %tmp, int 0, uint 2 ; [#uses=1] + %tmp134 = load double* %tmp133 ; [#uses=1] + store double %tmp134, double* %tmp132 + %tmp135 = getelementptr %struct.QRectF* %body, int 0, uint 3 ; [#uses=1] + %tmp136 = getelementptr %struct.QRectF* %tmp, int 0, uint 3 ; [#uses=1] + %tmp137 = load double* %tmp136 ; [#uses=1] + store double %tmp137, double* %tmp135 + %tmp138 = call double %_ZNK6QRectF6heightEv( %struct.QRectF* %body ) ; [#uses=1] + %tmp139 = cast int %tmp109 to double ; [#uses=1] + %tmp140 = sub double %tmp138, %tmp139 ; [#uses=1] + %tmp142 = invoke %struct.QPaintDevice* %_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont141 unwind label %cleanup192 ; <%struct.QPaintDevice*> [#uses=1] + + invcont141: ; preds = %invcont124 + invoke csretcc void %_ZNK13QTextDocument11defaultFontEv( %struct.QFont* %tmp, %struct.QAbstractTextDocumentLayout* %tmp95 ) + to label %invcont144 unwind label %cleanup192 + + invcont144: ; preds = %invcont141 + invoke void %_ZN12QFontMetricsC1ERK5QFontP12QPaintDevice( %struct.QFontMetrics* %tmp, %struct.QFont* %tmp, %struct.QPaintDevice* %tmp142 ) + to label %invcont146 unwind label %cleanup173 + + invcont146: ; preds = %invcont144 + %tmp149 = invoke int %_ZNK12QFontMetrics6ascentEv( %struct.QFontMetrics* %tmp ) + to label %invcont148 unwind label %cleanup168 ; [#uses=1] + + invcont148: ; preds = %invcont146 + %tmp149 = cast int %tmp149 to double ; [#uses=1] + %tmp150 = add double %tmp140, %tmp149 ; [#uses=1] + %tmp152 = invoke %struct.QPaintDevice* %_ZNK8QPainter6deviceEv( %struct.QPainter* %p ) + to label %invcont151 unwind label %cleanup168 ; <%struct.QPaintDevice*> [#uses=1] + + invcont151: ; preds = %invcont148 + %tmp154 = invoke int %_ZNK12QPaintDevice11logicalDpiYEv( %struct.QPaintDevice* %tmp152 ) + to label %invcont153 unwind label %cleanup168 ; [#uses=1] + + invcont153: ; preds = %invcont151 + %tmp155 = mul int %tmp154, 5 ; [#uses=1] + %tmp156 = sdiv int %tmp155, 72 ; [#uses=1] + %tmp156 = cast int %tmp156 to double ; [#uses=1] + %tmp157 = add double %tmp150, %tmp156 ; [#uses=1] + %tmp158 = call double %_ZNK6QRectF5widthEv( %struct.QRectF* %body ) ; [#uses=1] + %tmp159 = cast int %tmp109 to double ; [#uses=1] + %tmp160 = sub double %tmp158, %tmp159 ; [#uses=1] + call void %_ZN7QPointFC1Edd( %struct.QPointF* %tmp2, double %tmp160, double %tmp157 ) + %tmp161 = getelementptr %struct.QPointF* %pageNumberPos, int 0, uint 0 ; [#uses=1] + %tmp162 = getelementptr %struct.QPointF* %tmp2, int 0, uint 0 ; [#uses=1] + %tmp163 = load double* %tmp162 ; [#uses=1] + store double %tmp163, double* %tmp161 + %tmp164 = getelementptr %struct.QPointF* %pageNumberPos, int 0, uint 1 ; [#uses=1] + %tmp165 = getelementptr %struct.QPointF* %tmp2, int 0, uint 1 ; [#uses=1] + %tmp166 = load double* %tmp165 ; [#uses=1] + store double %tmp166, double* %tmp164 + invoke void %_ZN12QFontMetricsD1Ev( %struct.QFontMetrics* %tmp ) + to label %cleanup171 unwind label %cleanup173 + + cleanup168: ; preds = %invcont151, %invcont148, %invcont146 + invoke void %_ZN12QFontMetricsD1Ev( %struct.QFontMetrics* %tmp ) + to label %cleanup173 unwind label %cleanup173 + + cleanup171: ; preds = %invcont153 + invoke void %_ZN5QFontD1Ev( %struct.QFont* %tmp ) + to label %finally170 unwind label %cleanup192 + + cleanup173: ; preds = %cleanup168, %cleanup168, %invcont153, %invcont144 + invoke void %_ZN5QFontD1Ev( %struct.QFont* %tmp ) + to label %cleanup192 unwind label %cleanup192 + + finally170: ; preds = %cleanup171 + invoke csretcc void %_ZNK13QTextDocument11defaultFontEv( %struct.QFont* %font, %struct.QAbstractTextDocumentLayout* %tmp95 ) + to label %invcont177 unwind label %cleanup192 + + invcont177: ; preds = %finally170 + invoke void %_ZN5QFont12setPointSizeEi( %struct.QFont* %font, int 10 ) + to label %invcont179 unwind label %cleanup187 + + invcont179: ; preds = %invcont177 + invoke void %_ZN13QTextDocument14setDefaultFontERK5QFont( %struct.QAbstractTextDocumentLayout* %tmp95, %struct.QFont* %font ) + to label %invcont181 unwind label %cleanup187 + + invcont181: ; preds = %invcont179 + call csretcc void %_ZNK6QRectF4sizeEv( %struct.QPointF* %tmp3, %struct.QRectF* %body ) + invoke void %_ZN13QTextDocument11setPageSizeERK6QSizeF( %struct.QAbstractTextDocumentLayout* %tmp95, %struct.QPointF* %tmp3 ) + to label %cleanup185 unwind label %cleanup187 + + cleanup185: ; preds = %invcont181 + invoke void %_ZN5QFontD1Ev( %struct.QFont* %font ) + to label %cleanup190 unwind label %cleanup192 + + cleanup187: ; preds = %invcont181, %invcont179, %invcont177 + invoke void %_ZN5QFontD1Ev( %struct.QFont* %font ) + to label %cleanup192 unwind label %cleanup192 + + cleanup190: ; preds = %cleanup185 + invoke void %_ZN16QTextFrameFormatD1Ev( %struct.QTextBlockFormat* %fmt ) + to label %cond_next194 unwind label %cleanup329 + + cleanup192: ; preds = %cleanup187, %cleanup187, %cleanup185, %finally170, %cleanup173, %cleanup173, %cleanup171, %invcont141, %invcont124, %invcont122, %invcont120, %invcont118, %invcont117, %invcont114, %invcont111 + invoke void %_ZN16QTextFrameFormatD1Ev( %struct.QTextBlockFormat* %fmt ) + to label %cleanup329 unwind label %cleanup329 + + cond_next194: ; preds = %cleanup190, %invcont83 + %clonedDoc.1 = phi %struct.QAbstractTextDocumentLayout* [ null, %invcont83 ], [ %tmp95, %cleanup190 ] ; <%struct.QAbstractTextDocumentLayout*> [#uses=3] + %doc.1 = phi %struct.QAbstractTextDocumentLayout* [ %this, %invcont83 ], [ %tmp95, %cleanup190 ] ; <%struct.QAbstractTextDocumentLayout*> [#uses=2] + %tmp197 = invoke bool %_ZNK8QPrinter13collateCopiesEv( %struct.QPrinter* %printer ) + to label %invcont196 unwind label %cleanup329 ; [#uses=1] + + invcont196: ; preds = %cond_next194 + br bool %tmp197, label %cond_true200, label %cond_false204 + + cond_true200: ; preds = %invcont196 + %tmp203 = invoke int %_ZNK8QPrinter9numCopiesEv( %struct.QPrinter* %printer ) + to label %invcont202 unwind label %cleanup329 ; [#uses=1] + + invcont202: ; preds = %cond_true200 + br label %cond_next208 + + cond_false204: ; preds = %invcont196 + %tmp207 = invoke int %_ZNK8QPrinter9numCopiesEv( %struct.QPrinter* %printer ) + to label %invcont206 unwind label %cleanup329 ; [#uses=1] + + invcont206: ; preds = %cond_false204 + br label %cond_next208 + + cond_next208: ; preds = %invcont206, %invcont202 + %pageCopies.0 = phi int [ %tmp203, %invcont202 ], [ 1, %invcont206 ] ; [#uses=2] + %docCopies.0 = phi int [ 1, %invcont202 ], [ %tmp207, %invcont206 ] ; [#uses=2] + %tmp211 = invoke int %_ZNK8QPrinter8fromPageEv( %struct.QPrinter* %printer ) + to label %invcont210 unwind label %cleanup329 ; [#uses=3] + + invcont210: ; preds = %cond_next208 + %tmp214 = invoke int %_ZNK8QPrinter6toPageEv( %struct.QPrinter* %printer ) + to label %invcont213 unwind label %cleanup329 ; [#uses=3] + + invcont213: ; preds = %invcont210 + %tmp216 = seteq int %tmp211, 0 ; [#uses=1] + br bool %tmp216, label %cond_true217, label %cond_next225 + + cond_true217: ; preds = %invcont213 + %tmp219 = seteq int %tmp214, 0 ; [#uses=1] + br bool %tmp219, label %cond_true220, label %cond_next225 + + cond_true220: ; preds = %cond_true217 + %tmp223 = invoke int %_ZNK13QTextDocument9pageCountEv( %struct.QAbstractTextDocumentLayout* %doc.1 ) + to label %invcont222 unwind label %cleanup329 ; [#uses=1] + + invcont222: ; preds = %cond_true220 + br label %cond_next225 + + cond_next225: ; preds = %invcont222, %cond_true217, %invcont213 + %toPage.1 = phi int [ %tmp223, %invcont222 ], [ %tmp214, %cond_true217 ], [ %tmp214, %invcont213 ] ; [#uses=2] + %fromPage.1 = phi int [ 1, %invcont222 ], [ %tmp211, %cond_true217 ], [ %tmp211, %invcont213 ] ; [#uses=2] + %tmp = invoke uint %_ZNK8QPrinter9pageOrderEv( %struct.QPrinter* %printer ) + to label %invcont227 unwind label %cleanup329 ; [#uses=1] + + invcont227: ; preds = %cond_next225 + %tmp228 = seteq uint %tmp, 1 ; [#uses=1] + br bool %tmp228, label %cond_true230, label %cond_next234 + + cond_true230: ; preds = %invcont227 + br label %cond_next234 + + cond_next234: ; preds = %cond_true230, %invcont227 + %ascending.1 = phi bool [ false, %cond_true230 ], [ true, %invcont227 ] ; [#uses=1] + %toPage.2 = phi int [ %fromPage.1, %cond_true230 ], [ %toPage.1, %invcont227 ] ; [#uses=1] + %fromPage.2 = phi int [ %toPage.1, %cond_true230 ], [ %fromPage.1, %invcont227 ] ; [#uses=1] + br label %bb309 + + bb237: ; preds = %cond_true313, %cond_next293 + %iftmp.410.4 = phi bool [ %iftmp.410.5, %cond_true313 ], [ %iftmp.410.1, %cond_next293 ] ; [#uses=1] + %page.4 = phi int [ %fromPage.2, %cond_true313 ], [ %page.3, %cond_next293 ] ; [#uses=4] + br label %bb273 + + invcont240: ; preds = %cond_true277 + %tmp242 = seteq uint %tmp241, 2 ; [#uses=1] + br bool %tmp242, label %bb252, label %cond_next244 + + cond_next244: ; preds = %invcont240 + %tmp247 = invoke uint %_ZNK8QPrinter12printerStateEv( %struct.QPrinter* %printer ) + to label %invcont246 unwind label %cleanup329 ; [#uses=1] + + invcont246: ; preds = %cond_next244 + %tmp248 = seteq uint %tmp247, 3 ; [#uses=1] + br bool %tmp248, label %bb252, label %bb253 + + bb252: ; preds = %invcont246, %invcont240 + br label %bb254 + + bb253: ; preds = %invcont246 + br label %bb254 + + bb254: ; preds = %bb253, %bb252 + %iftmp.410.0 = phi bool [ true, %bb252 ], [ false, %bb253 ] ; [#uses=2] + br bool %iftmp.410.0, label %UserCanceled, label %cond_next258 + + cond_next258: ; preds = %bb254 + invoke fastcc void %_Z9printPageiP8QPainterPK13QTextDocumentRK6QRectFRK7QPointF( int %page.4, %struct.QPainter* %p, %struct.QAbstractTextDocumentLayout* %doc.1, %struct.QRectF* %body, %struct.QPointF* %pageNumberPos ) + to label %invcont261 unwind label %cleanup329 + + invcont261: ; preds = %cond_next258 + %tmp263 = add int %pageCopies.0, -1 ; [#uses=1] + %tmp265 = setgt int %tmp263, %j.4 ; [#uses=1] + br bool %tmp265, label %cond_true266, label %cond_next270 + + cond_true266: ; preds = %invcont261 + %tmp269 = invoke bool %_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer ) + to label %cond_next270 unwind label %cleanup329 ; [#uses=0] + + cond_next270: ; preds = %cond_true266, %invcont261 + %tmp272 = add int %j.4, 1 ; [#uses=1] + br label %bb273 + + bb273: ; preds = %cond_next270, %bb237 + %iftmp.410.1 = phi bool [ %iftmp.410.4, %bb237 ], [ %iftmp.410.0, %cond_next270 ] ; [#uses=2] + %j.4 = phi int [ 0, %bb237 ], [ %tmp272, %cond_next270 ] ; [#uses=3] + %tmp276 = setlt int %j.4, %pageCopies.0 ; [#uses=1] + br bool %tmp276, label %cond_true277, label %bb280 + + cond_true277: ; preds = %bb273 + %tmp241 = invoke uint %_ZNK8QPrinter12printerStateEv( %struct.QPrinter* %printer ) + to label %invcont240 unwind label %cleanup329 ; [#uses=1] + + bb280: ; preds = %bb273 + %tmp283 = seteq int %page.4, %toPage.2 ; [#uses=1] + br bool %tmp283, label %bb297, label %cond_next285 + + cond_next285: ; preds = %bb280 + br bool %ascending.1, label %cond_true287, label %cond_false290 + + cond_true287: ; preds = %cond_next285 + %tmp289 = add int %page.4, 1 ; [#uses=1] + br label %cond_next293 + + cond_false290: ; preds = %cond_next285 + %tmp292 = add int %page.4, -1 ; [#uses=1] + br label %cond_next293 + + cond_next293: ; preds = %cond_false290, %cond_true287 + %page.3 = phi int [ %tmp289, %cond_true287 ], [ %tmp292, %cond_false290 ] ; [#uses=1] + %tmp296 = invoke bool %_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer ) + to label %bb237 unwind label %cleanup329 ; [#uses=0] + + bb297: ; preds = %bb280 + %tmp299 = add int %docCopies.0, -1 ; [#uses=1] + %tmp301 = setgt int %tmp299, %i.1 ; [#uses=1] + br bool %tmp301, label %cond_true302, label %cond_next306 + + cond_true302: ; preds = %bb297 + %tmp305 = invoke bool %_ZN8QPrinter7newPageEv( %struct.QPrinter* %printer ) + to label %cond_next306 unwind label %cleanup329 ; [#uses=0] + + cond_next306: ; preds = %cond_true302, %bb297 + %tmp308 = add int %i.1, 1 ; [#uses=1] + br label %bb309 + + bb309: ; preds = %cond_next306, %cond_next234 + %iftmp.410.5 = phi bool [ undef, %cond_next234 ], [ %iftmp.410.1, %cond_next306 ] ; [#uses=1] + %i.1 = phi int [ 0, %cond_next234 ], [ %tmp308, %cond_next306 ] ; [#uses=3] + %tmp312 = setlt int %i.1, %docCopies.0 ; [#uses=1] + br bool %tmp312, label %cond_true313, label %UserCanceled + + cond_true313: ; preds = %bb309 + br label %bb237 + + UserCanceled: ; preds = %bb309, %bb254 + %tmp318 = seteq %struct.QAbstractTextDocumentLayout* %clonedDoc.1, null ; [#uses=1] + br bool %tmp318, label %cleanup327, label %cond_true319 + + cond_true319: ; preds = %UserCanceled + %tmp = getelementptr %struct.QAbstractTextDocumentLayout* %clonedDoc.1, int 0, uint 0, uint 0 ; [#uses=1] + %tmp = load int (...)*** %tmp ; [#uses=1] + %tmp322 = getelementptr int (...)** %tmp, int 4 ; [#uses=1] + %tmp = load int (...)** %tmp322 ; [#uses=1] + %tmp = cast int (...)* %tmp to void (%struct.QAbstractTextDocumentLayout*)* ; [#uses=1] + invoke void %tmp( %struct.QAbstractTextDocumentLayout* %clonedDoc.1 ) + to label %cleanup327 unwind label %cleanup329 + + cleanup327: ; preds = %cond_true319, %UserCanceled + call void %_ZN8QPainterD1Ev( %struct.QPainter* %p ) + ret void + + cleanup328: ; preds = %invcont + call void %_ZN8QPainterD1Ev( %struct.QPainter* %p ) + ret void + + cleanup329: ; preds = %cond_true319, %cond_true302, %cond_next293, %cond_true277, %cond_true266, %cond_next258, %cond_next244, %cond_next225, %cond_true220, %invcont210, %cond_next208, %cond_false204, %cond_true200, %cond_next194, %cleanup192, %cleanup192, %cleanup190, %invcont106, %invcont104, %invcont103, %invcont100, %invcont98, %invcont94, %cond_false, %invcont83, %invcont79, %invcont57, %invcont51, %invcont45, %cond_next42, %invcont37, %cond_true35, %invcont29, %invcont25, %cond_true24, %cond_next, %entry + call void %_ZN8QPainterD1Ev( %struct.QPainter* %p ) + unwind + } + + declare void %_ZN6QSizeFC1Edd(%struct.QPointF*, double, double) + + declare bool %_ZNK6QSizeF7isValidEv(%struct.QPointF*) + + declare double %_ZNK6QSizeF5widthEv(%struct.QPointF*) + + declare double %_ZNK6QSizeF6heightEv(%struct.QPointF*) + + declare double* %_ZN6QSizeF6rwidthEv(%struct.QPointF*) + + declare double* %_ZN6QSizeF7rheightEv(%struct.QPointF*) + + declare %struct.QTextDocumentPrivate* %_ZNK13QTextDocument6d_funcEv(%struct.QAbstractTextDocumentLayout*) + + declare void %_ZN7QPointFC1Ev(%struct.QPointF*) + + declare void %_ZN7QPointFC1Edd(%struct.QPointF*, double, double) + + declare void %_ZN16QTextFrameFormat9setMarginEd(%struct.QTextBlockFormat*, double) + + declare void %_ZN6QRectFC1Edddd(%struct.QRectF*, double, double, double, double) + + declare void %_ZN6QRectFC1ERK7QPointFRK6QSizeF(%struct.QRectF*, %struct.QPointF*, %struct.QPointF*) + + declare double %_ZNK6QRectF5widthEv(%struct.QRectF*) + + declare double %_ZNK6QRectF6heightEv(%struct.QRectF*) + + declare void %_ZNK6QRectF4sizeEv(%struct.QPointF*, %struct.QRectF*) + + declare void %_ZN16QTextFrameFormatD1Ev(%struct.QTextBlockFormat*) + + declare void %_ZNK10QTextFrame11frameFormatEv(%struct.QTextBlockFormat*, %struct.QTextBlockGroup*) + + declare void %_ZN10QTextFrame14setFrameFormatERK16QTextFrameFormat(%struct.QTextBlockGroup*, %struct.QTextBlockFormat*) + + declare int %_ZNK12QPaintDevice5widthEv(%struct.QPaintDevice*) + + declare int %_ZNK12QPaintDevice6heightEv(%struct.QPaintDevice*) + + declare int %_ZNK12QPaintDevice11logicalDpiXEv(%struct.QPaintDevice*) + + declare int %_ZNK12QPaintDevice11logicalDpiYEv(%struct.QPaintDevice*) + + declare %struct.QAbstractTextDocumentLayout* %_ZNK13QTextDocument5cloneEP7QObject(%struct.QAbstractTextDocumentLayout*, %struct.QObject*) + + declare void %_ZN5QFontD1Ev(%struct.QFont*) + + declare %struct.QAbstractTextDocumentLayout* %_ZNK13QTextDocument14documentLayoutEv(%struct.QAbstractTextDocumentLayout*) + + declare %struct.QTextBlockGroup* %_ZNK13QTextDocument9rootFrameEv(%struct.QAbstractTextDocumentLayout*) + + declare int %_ZNK13QTextDocument9pageCountEv(%struct.QAbstractTextDocumentLayout*) + + declare void %_ZNK13QTextDocument11defaultFontEv(%struct.QFont*, %struct.QAbstractTextDocumentLayout*) + + declare void %_ZN13QTextDocument14setDefaultFontERK5QFont(%struct.QAbstractTextDocumentLayout*, %struct.QFont*) + + declare void %_ZN13QTextDocument11setPageSizeERK6QSizeF(%struct.QAbstractTextDocumentLayout*, %struct.QPointF*) + + declare void %_Z9printPageiP8QPainterPK13QTextDocumentRK6QRectFRK7QPointF(int, %struct.QPainter*, %struct.QAbstractTextDocumentLayout*, %struct.QRectF*, %struct.QPointF*) + + declare void %_ZN12QFontMetricsD1Ev(%struct.QFontMetrics*) + + declare void %_ZN8QPainterC1EP12QPaintDevice(%struct.QPainter*, %struct.QPaintDevice*) + + declare bool %_ZNK8QPainter8isActiveEv(%struct.QPainter*) + + declare int %_Z13qt_defaultDpiv() + + declare %struct.QPaintDevice* %_ZNK27QAbstractTextDocumentLayout11paintDeviceEv(%struct.QAbstractTextDocumentLayout*) + + declare void %_ZN8QPainter5scaleEdd(%struct.QPainter*, double, double) + + declare %struct.QPaintDevice* %_ZNK8QPainter6deviceEv(%struct.QPainter*) + + declare void %_ZN27QAbstractTextDocumentLayout14setPaintDeviceEP12QPaintDevice(%struct.QAbstractTextDocumentLayout*, %struct.QPaintDevice*) + + declare void %_ZN12QFontMetricsC1ERK5QFontP12QPaintDevice(%struct.QFontMetrics*, %struct.QFont*, %struct.QPaintDevice*) + + declare int %_ZNK12QFontMetrics6ascentEv(%struct.QFontMetrics*) + + declare void %_ZN5QFont12setPointSizeEi(%struct.QFont*, int) + + declare bool %_ZNK8QPrinter13collateCopiesEv(%struct.QPrinter*) + + declare int %_ZNK8QPrinter9numCopiesEv(%struct.QPrinter*) + + declare int %_ZNK8QPrinter8fromPageEv(%struct.QPrinter*) + + declare int %_ZNK8QPrinter6toPageEv(%struct.QPrinter*) + + declare uint %_ZNK8QPrinter9pageOrderEv(%struct.QPrinter*) + + declare uint %_ZNK8QPrinter12printerStateEv(%struct.QPrinter*) + + declare bool %_ZN8QPrinter7newPageEv(%struct.QPrinter*) + + declare void %_ZN8QPainterD1Ev(%struct.QPainter*) From sabre at nondot.org Sun Oct 29 15:21:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 15:21:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200610292121.k9TLLYcq006705@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.101 -> 1.102 --- Log message: Fix SimplifyCFG/2006-10-29-InvokeCrash.ll, a crash compiling QT. --- Diffs of the changes: (+1 -1) SimplifyCFG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.101 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.102 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.101 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Sun Oct 29 15:21:20 2006 @@ -853,7 +853,7 @@ Instruction *I1 = BB1->begin(), *I2 = BB2->begin(); if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2) || - isa(I1)) + isa(I1) || isa(I1)) return false; // If we get here, we can hoist at least one instruction. From sabre at nondot.org Sun Oct 29 16:08:20 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 16:08:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Allocator.cpp Message-ID: <200610292208.k9TM8KKC007504@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Allocator.cpp added (r1.1) --- Log message: Add a new llvm::Allocator abstraction, which will be used by a container I'm about to add. This is similar to, but necessarily different than, the STL allocator class. --- Diffs of the changes: (+106 -0) Allocator.cpp | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 106 insertions(+) Index: llvm/lib/Support/Allocator.cpp diff -c /dev/null llvm/lib/Support/Allocator.cpp:1.1 *** /dev/null Sun Oct 29 16:08:13 2006 --- llvm/lib/Support/Allocator.cpp Sun Oct 29 16:08:03 2006 *************** *** 0 **** --- 1,106 ---- + //===--- Allocator.cpp - Simple memory allocation abstraction -------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the BumpPtrAllocator interface. + // + //===----------------------------------------------------------------------===// + + #include "llvm/Support/Allocator.h" + #include + using namespace llvm; + + //===----------------------------------------------------------------------===// + // MemRegion class implementation + //===----------------------------------------------------------------------===// + + namespace { + /// MemRegion - This is one chunk of the BumpPtrAllocator. + class MemRegion { + unsigned RegionSize; + MemRegion *Next; + char *NextPtr; + public: + void Init(unsigned size, unsigned Alignment, MemRegion *next) { + RegionSize = size; + Next = next; + NextPtr = (char*)(this+1); + + // Align NextPtr. + NextPtr = (char*)((intptr_t)(NextPtr+Alignment-1) & + ~(intptr_t)(Alignment-1)); + } + + const MemRegion *getNext() const { return Next; } + unsigned getNumBytesAllocated() const { + return NextPtr-(const char*)this; + } + + /// Allocate - Allocate and return at least the specified number of bytes. + /// + void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) { + // Round size up to an even multiple of the alignment. + AllocSize = (AllocSize+Alignment-1) & ~(Alignment-1); + + // If there is space in this region, return it. + if (unsigned(NextPtr+AllocSize-(char*)this) <= RegionSize) { + void *Result = NextPtr; + NextPtr += AllocSize; + return Result; + } + + // Otherwise, we have to allocate a new chunk. Create one twice as big as + // this one. + MemRegion *NewRegion = (MemRegion *)malloc(RegionSize*2); + NewRegion->Init(RegionSize*2, Alignment, this); + + // Update the current "first region" pointer to point to the new region. + *RegPtr = NewRegion; + + // Try allocating from it now. + return NewRegion->Allocate(AllocSize, Alignment, RegPtr); + } + + /// Deallocate - Release all memory for this region to the system. + /// + void Deallocate() { + MemRegion *next = Next; + free(this); + if (next) + next->Deallocate(); + } + }; + } + + //===----------------------------------------------------------------------===// + // BumpPtrAllocator class implementation + //===----------------------------------------------------------------------===// + + BumpPtrAllocator::BumpPtrAllocator() { + TheMemory = malloc(4096); + ((MemRegion*)TheMemory)->Init(4096, 1, 0); + } + + BumpPtrAllocator::~BumpPtrAllocator() { + ((MemRegion*)TheMemory)->Deallocate(); + } + + void *BumpPtrAllocator::Allocate(unsigned Size, unsigned Align) { + return ((MemRegion*)TheMemory)->Allocate(Size, Align,(MemRegion**)&TheMemory); + } + + void BumpPtrAllocator::PrintStats() const { + unsigned BytesUsed = 0; + unsigned NumRegions = 0; + const MemRegion *R = (MemRegion*)TheMemory; + for (; R; R = R->getNext(), ++NumRegions) + BytesUsed += R->getNumBytesAllocated(); + + std::cerr << "\nNumber of memory regions: " << NumRegions << "\n"; + std::cerr << "Bytes allocated: " << BytesUsed << "\n"; + } From sabre at nondot.org Sun Oct 29 16:08:20 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 16:08:20 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/Allocator.h Message-ID: <200610292208.k9TM8K2N007501@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: Allocator.h added (r1.1) --- Log message: Add a new llvm::Allocator abstraction, which will be used by a container I'm about to add. This is similar to, but necessarily different than, the STL allocator class. --- Diffs of the changes: (+48 -0) Allocator.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+) Index: llvm/include/llvm/Support/Allocator.h diff -c /dev/null llvm/include/llvm/Support/Allocator.h:1.1 *** /dev/null Sun Oct 29 16:08:13 2006 --- llvm/include/llvm/Support/Allocator.h Sun Oct 29 16:08:03 2006 *************** *** 0 **** --- 1,48 ---- + //===--- Allocator.h - Simple memory allocation abstraction -----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines the MallocAllocator and BumpPtrAllocator interfaces. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_SUPPORT_ALLOCATOR_H + #define LLVM_SUPPORT_ALLOCATOR_H + + #include + + namespace llvm { + + class MallocAllocator { + public: + MallocAllocator() {} + ~MallocAllocator() {} + + void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); } + void Deallocate(void *Ptr) { free(Ptr); } + void PrintStats() const {} + }; + + /// BumpPtrAllocator - This allocator is useful for containers that need very + /// simple memory allocation strategies. In particular, this just keeps + /// allocating memory, and never deletes it until the entire block is dead. This + /// makes allocation speedy, but must only be used when the trade-off is ok. + class BumpPtrAllocator { + void *TheMemory; + public: + BumpPtrAllocator(); + ~BumpPtrAllocator(); + + void *Allocate(unsigned Size, unsigned Alignment); + void Deallocate(void *Ptr) {} + void PrintStats() const; + }; + + } // end namespace clang + + #endif From sabre at nondot.org Sun Oct 29 17:42:19 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 17:42:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/CStringMap.cpp Message-ID: <200610292342.k9TNgJM1008844@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CStringMap.cpp added (r1.1) --- Log message: add a highly efficient hash table that is specialized for mapping C strings to some other type. --- Diffs of the changes: (+134 -0) CStringMap.cpp | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 134 insertions(+) Index: llvm/lib/Support/CStringMap.cpp diff -c /dev/null llvm/lib/Support/CStringMap.cpp:1.1 *** /dev/null Sun Oct 29 17:42:13 2006 --- llvm/lib/Support/CStringMap.cpp Sun Oct 29 17:42:03 2006 *************** *** 0 **** --- 1,134 ---- + //===--- CStringMap.cpp - CString Hash table map implementation -----------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the CStringMap class. + // + //===----------------------------------------------------------------------===// + + #include "llvm/ADT/CStringMap.h" + #include + using namespace llvm; + + CStringMapVisitor::~CStringMapVisitor() { + } + + CStringMapImpl::CStringMapImpl(unsigned InitSize, unsigned itemSize) { + assert((InitSize & (InitSize-1)) == 0 && + "Init Size must be a power of 2 or zero!"); + NumBuckets = InitSize ? InitSize : 512; + ItemSize = itemSize; + NumItems = 0; + + TheTable = new ItemBucket[NumBuckets](); + memset(TheTable, 0, NumBuckets*sizeof(ItemBucket)); + } + + + /// HashString - Compute a hash code for the specified string. + /// + static unsigned HashString(const char *Start, const char *End) { + unsigned int Result = 0; + // Perl hash function. + while (Start != End) + Result = Result * 33 + *Start++; + Result = Result + (Result >> 5); + return Result; + } + + /// LookupBucketFor - Look up the bucket that the specified string should end + /// up in. If it already exists as a key in the map, the Item pointer for the + /// specified bucket will be non-null. Otherwise, it will be null. In either + /// case, the FullHashValue field of the bucket will be set to the hash value + /// of the string. + unsigned CStringMapImpl::LookupBucketFor(const char *NameStart, + const char *NameEnd) { + unsigned HTSize = NumBuckets; + unsigned FullHashValue = HashString(NameStart, NameEnd); + unsigned BucketNo = FullHashValue & (HTSize-1); + + unsigned ProbeAmt = 1; + while (1) { + ItemBucket &Bucket = TheTable[BucketNo]; + void *BucketItem = Bucket.Item; + // If we found an empty bucket, this key isn't in the table yet, return it. + if (BucketItem == 0) { + Bucket.FullHashValue = FullHashValue; + return BucketNo; + } + + // If the full hash value matches, check deeply for a match. The common + // case here is that we are only looking at the buckets (for item info + // being non-null and for the full hash value) not at the items. This + // is important for cache locality. + if (Bucket.FullHashValue == FullHashValue) { + // Do the comparison like this because NameStart isn't necessarily + // null-terminated! + char *ItemStr = (char*)BucketItem+ItemSize; + if (strlen(ItemStr) == unsigned(NameEnd-NameStart) && + memcmp(ItemStr, NameStart, (NameEnd-NameStart)) == 0) { + // We found a match! + return BucketNo; + } + } + + // Okay, we didn't find the item. Probe to the next bucket. + BucketNo = (BucketNo+ProbeAmt) & (HTSize-1); + + // Use quadratic probing, it has fewer clumping artifacts than linear + // probing and has good cache behavior in the common case. + ++ProbeAmt; + } + } + + /// RehashTable - Grow the table, redistributing values into the buckets with + /// the appropriate mod-of-hashtable-size. + void CStringMapImpl::RehashTable() { + unsigned NewSize = NumBuckets*2; + ItemBucket *NewTableArray = new ItemBucket[NewSize](); + memset(NewTableArray, 0, NewSize*sizeof(ItemBucket)); + + // Rehash all the items into their new buckets. Luckily :) we already have + // the hash values available, so we don't have to rehash any strings. + for (ItemBucket *IB = TheTable, *E = TheTable+NumBuckets; IB != E; ++IB) { + if (IB->Item) { + // Fast case, bucket available. + unsigned FullHash = IB->FullHashValue; + unsigned NewBucket = FullHash & (NewSize-1); + if (NewTableArray[NewBucket].Item == 0) { + NewTableArray[FullHash & (NewSize-1)].Item = IB->Item; + NewTableArray[FullHash & (NewSize-1)].FullHashValue = FullHash; + continue; + } + + unsigned ProbeSize = 1; + do { + NewBucket = (NewBucket + ProbeSize++) & (NewSize-1); + } while (NewTableArray[NewBucket].Item); + + // Finally found a slot. Fill it in. + NewTableArray[NewBucket].Item = IB->Item; + NewTableArray[NewBucket].FullHashValue = FullHash; + } + } + + delete[] TheTable; + + TheTable = NewTableArray; + NumBuckets = NewSize; + } + + + /// VisitEntries - This method walks through all of the items, + /// invoking Visitor.Visit for each of them. + void CStringMapImpl::VisitEntries(const CStringMapVisitor &Visitor) const { + for (ItemBucket *IB = TheTable, *E = TheTable+NumBuckets; IB != E; ++IB) { + if (void *Id = IB->Item) + Visitor.Visit((char*)Id + ItemSize, Id); + } + } From sabre at nondot.org Sun Oct 29 17:42:20 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 17:42:20 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/CStringMap.h Message-ID: <200610292342.k9TNgKTp008849@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: CStringMap.h added (r1.1) --- Log message: add a highly efficient hash table that is specialized for mapping C strings to some other type. --- Diffs of the changes: (+144 -0) CStringMap.h | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 144 insertions(+) Index: llvm/include/llvm/ADT/CStringMap.h diff -c /dev/null llvm/include/llvm/ADT/CStringMap.h:1.1 *** /dev/null Sun Oct 29 17:42:13 2006 --- llvm/include/llvm/ADT/CStringMap.h Sun Oct 29 17:42:03 2006 *************** *** 0 **** --- 1,144 ---- + //===--- CStringMap.h - CString Hash table map interface --------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines the CStringMap class. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_ADT_CSTRINGMAP_H + #define LLVM_ADT_CSTRINGMAP_H + + #include "llvm/Support/Allocator.h" + #include + + namespace llvm { + + /// CStringMapVisitor - Subclasses of this class may be implemented to walk all + /// of the items in a CStringMap. + class CStringMapVisitor { + public: + virtual ~CStringMapVisitor(); + virtual void Visit(const char *Key, void *Value) const = 0; + }; + + /// CStringMapImpl - This is the base class of CStringMap that is shared among + /// all of its instantiations. + class CStringMapImpl { + protected: + /// ItemBucket - The hash table consists of an array of these. If Item is + /// non-null, this is an extant entry, otherwise, it is a hole. + struct ItemBucket { + /// FullHashValue - This remembers the full hash value of the key for + /// easy scanning. + unsigned FullHashValue; + + /// Item - This is a pointer to the actual item object. + void *Item; + }; + + ItemBucket *TheTable; + unsigned NumBuckets; + unsigned NumItems; + unsigned ItemSize; + protected: + CStringMapImpl(unsigned InitSize, unsigned ItemSize); + void RehashTable(); + + /// LookupBucketFor - Look up the bucket that the specified string should end + /// up in. If it already exists as a key in the map, the Item pointer for the + /// specified bucket will be non-null. Otherwise, it will be null. In either + /// case, the FullHashValue field of the bucket will be set to the hash value + /// of the string. + unsigned LookupBucketFor(const char *KeyStart, const char *KeyEnd); + + public: + unsigned getNumBuckets() const { return NumBuckets; } + unsigned getNumItems() const { return NumItems; } + + void VisitEntries(const CStringMapVisitor &Visitor) const; + }; + + + /// CStringMap - This is an unconventional map that is specialized for handling + /// keys that are "C strings", that is, null-terminated strings. This does some + /// funky memory allocation and hashing things to make it extremely efficient, + /// storing the string data *after* the value in the map. + template + class CStringMap : public CStringMapImpl { + AllocatorTy Allocator; + public: + CStringMap(unsigned InitialSize = 0) + : CStringMapImpl(InitialSize, sizeof(ValueTy)) {} + + AllocatorTy &getAllocator() { return Allocator; } + const AllocatorTy &getAllocator() const { return Allocator; } + + /// FindValue - Look up the specified key in the map. If it exists, return a + /// pointer to the element, otherwise return null. + ValueTy *FindValue(const char *KeyStart, const char *KeyEnd) { + unsigned BucketNo = LookupBucketFor(KeyStart, KeyEnd); + return static_cast(TheTable[BucketNo].Item); + } + + /// GetOrCreateValue - Look up the specified key in the table. If a value + /// exists, return it. Otherwise, default construct a value, insert it, and + /// return. + ValueTy &GetOrCreateValue(const char *KeyStart, const char *KeyEnd) { + unsigned BucketNo = LookupBucketFor(KeyStart, KeyEnd); + ItemBucket &Bucket = TheTable[BucketNo]; + if (Bucket.Item) + return *static_cast(Bucket.Item); + + unsigned KeyLength = KeyEnd-KeyStart; + + // Okay, the item doesn't already exist, and Bucket is the bucket to fill + // in. Allocate a new item with space for the null-terminated string at the + // end. + unsigned AllocSize = sizeof(ValueTy)+KeyLength+1; + + #ifdef __GNUC__ + unsigned Alignment = __alignof__(ValueTy); + #else + // FIXME: ugly. + unsigned Alignment = 8; + #endif + ValueTy *NewItem = (ValueTy*)Allocator.Allocate(AllocSize, Alignment); + new (NewItem) ValueTy(); + ++NumItems; + + // Copy the string information. + char *StrBuffer = (char*)(NewItem+1); + memcpy(StrBuffer, KeyStart, KeyLength); + StrBuffer[KeyLength] = 0; // Null terminate string. + + // Fill in the bucket for the hash table. The FullHashValue was already + // filled in by LookupBucketFor. + Bucket.Item = NewItem; + + // If the hash table is now more than 3/4 full, rehash into a larger table. + if (NumItems > NumBuckets*3/4) + RehashTable(); + return *NewItem; + } + + ~CStringMap() { + for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) { + if (ValueTy *Id = static_cast(I->Item)) { + // Free memory referenced by the item. + Id->~ValueTy(); + Allocator.Deallocate(Id); + } + } + delete [] TheTable; + } + }; + + } + + #endif \ No newline at end of file From sabre at nondot.org Sun Oct 29 17:47:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 17:47:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/CStringMap.h Message-ID: <200610292347.k9TNlFks008949@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: CStringMap.h updated: 1.1 -> 1.2 --- Log message: add newline at end of file --- Diffs of the changes: (+2 -1) CStringMap.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/ADT/CStringMap.h diff -u llvm/include/llvm/ADT/CStringMap.h:1.1 llvm/include/llvm/ADT/CStringMap.h:1.2 --- llvm/include/llvm/ADT/CStringMap.h:1.1 Sun Oct 29 17:42:03 2006 +++ llvm/include/llvm/ADT/CStringMap.h Sun Oct 29 17:47:01 2006 @@ -141,4 +141,5 @@ } -#endif \ No newline at end of file +#endif + From nicholas at mxc.ca Sun Oct 29 20:42:30 2006 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 29 Oct 2006 21:42:30 -0500 Subject: [llvm-commits] [SignlessTypes] CVS:llvm/test/Regression/CodeGen/X86/compare_folding.llx Message-ID: <45456696.7020802@mxc.ca> Zhou Sheng, could you please try to include some sort of commit message, no matter how brief? "reorder frem" would be fine, though "Moved FREM to be with the other REM instrucions." would be better. Thanks, Nick Lewycky From rspencer at reidspencer.com Sun Oct 29 20:43:34 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Sun, 29 Oct 2006 18:43:34 -0800 Subject: [llvm-commits] [SignlessTypes] CVS: llvm/test/Regression/CodeGen/X86/compare_folding.llx In-Reply-To: <200610290749.k9T7np6U024751@zion.cs.uiuc.edu> References: <200610290749.k9T7np6U024751@zion.cs.uiuc.edu> Message-ID: <1162176214.891.44.camel@bashful.x10sys.com> Sheng, One of the policies for LLVM is that we *never* commit anything with a blank log message. All your recent commits were blank. In the future, please make a detailed summary of your changes. What is needed is some context on the change. For our work, all your commits should start with: For PR950: Then describe the change. This gives other developers a quick way to review the patch or determine that it is not of interest to them. With 100+ commits a day, this is essential for everyone reviewing code. Thanks for your cooperation. Reid. On Sun, 2006-10-29 at 01:49 -0600, Zhou Sheng wrote: > > Changes in directory llvm/test/Regression/CodeGen/X86: > > compare_folding.llx updated: 1.3 -> 1.3.2.1 > --- > Log message: > > > > --- > Diffs of the changes: (+4 -4) > > compare_folding.llx | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > > Index: llvm/test/Regression/CodeGen/X86/compare_folding.llx > diff -u llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3 llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3.2.1 > --- llvm/test/Regression/CodeGen/X86/compare_folding.llx:1.3 Wed Oct 11 20:42:03 2006 > +++ llvm/test/Regression/CodeGen/X86/compare_folding.llx Sun Oct 29 01:49:36 2006 > @@ -1,8 +1,8 @@ > -; RUN: llvm-as < %s | llc -march=x86 | grep movsd | wc -l | grep 1 && > -; RUN: llvm-as < %s | llc -march=x86 | grep ucomisd > -declare bool %llvm.isunordered(double,double) > +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep movsd | wc -l | grep 1 && > +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah | grep ucomisd > +declare bool %llvm.isunordered.f64(double,double) > > bool %test1(double %X, double %Y) { ;; Returns isunordered(X,Y) > - %COM = call bool %llvm.isunordered(double %X, double %Y) > + %COM = call bool %llvm.isunordered.f64(double %X, double %Y) > ret bool %COM > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Sun Oct 29 21:14:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 21:14:29 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/CStringMap.h Message-ID: <200610300314.k9U3ETxG012098@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: CStringMap.h updated: 1.2 -> 1.3 --- Log message: add a method --- Diffs of the changes: (+8 -0) CStringMap.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/ADT/CStringMap.h diff -u llvm/include/llvm/ADT/CStringMap.h:1.2 llvm/include/llvm/ADT/CStringMap.h:1.3 --- llvm/include/llvm/ADT/CStringMap.h:1.2 Sun Oct 29 17:47:01 2006 +++ llvm/include/llvm/ADT/CStringMap.h Sun Oct 29 21:14:15 2006 @@ -86,6 +86,14 @@ return static_cast(TheTable[BucketNo].Item); } + /// GetKeyForValueInMap - Given a value that is inserted into this map, return + /// the string that corresponds to it. This is an efficient operation that + /// is provided by CStringMap. The string is live as long as the value is in + /// the map. + static const char *GetKeyForValueInMap(const ValueTy &Val) { + return reinterpret_cast(&Val+1); + } + /// GetOrCreateValue - Look up the specified key in the table. If a value /// exists, return it. Otherwise, default construct a value, insert it, and /// return. From sabre at nondot.org Sun Oct 29 21:39:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 29 Oct 2006 21:39:34 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/SmallString.h SmallVector.h Message-ID: <200610300339.k9U3dY0X012509@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: SmallString.h added (r1.1) SmallVector.h updated: 1.20 -> 1.21 --- Log message: Add SmallString a (currently) minimal class that adapts SmallVector to be more string-like. --- Diffs of the changes: (+58 -0) SmallString.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SmallVector.h | 1 + 2 files changed, 58 insertions(+) Index: llvm/include/llvm/ADT/SmallString.h diff -c /dev/null llvm/include/llvm/ADT/SmallString.h:1.1 *** /dev/null Sun Oct 29 21:39:30 2006 --- llvm/include/llvm/ADT/SmallString.h Sun Oct 29 21:39:20 2006 *************** *** 0 **** --- 1,57 ---- + //===- llvm/ADT/SmallString.h - 'Normally small' strings --------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines the SmallString class. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_ADT_SMALLSTRING_H + #define LLVM_ADT_SMALLSTRING_H + + #include "llvm/ADT/SmallVector.h" + #include + + namespace llvm { + + /// SmallString - A SmallString is just a SmallVector with methods and accessors + /// that make it work better as a string (e.g. operator+ etc). + template + class SmallString : public SmallVector { + public: + // Default ctor - Initialize to empty. + SmallString() {} + + // Initialize with a range. + template + SmallString(ItTy S, ItTy E) : SmallVector(S, E) {} + + // Copy ctor. + SmallString(const SmallString &RHS) : SmallVector(RHS) {} + + + // Extra methods. + const char *c_str() const { + SmallString *This = const_cast(this); + // Ensure that there is a \0 at the end of the string. + This->reserve(this->size()+1); + This->End[0] = 0; + return this->begin(); + } + + // Extra operators. + SmallString &operator+=(const char *RHS) { + this->append(RHS, RHS+strlen(RHS)); + return *this; + } + }; + + + } + + #endif Index: llvm/include/llvm/ADT/SmallVector.h diff -u llvm/include/llvm/ADT/SmallVector.h:1.20 llvm/include/llvm/ADT/SmallVector.h:1.21 --- llvm/include/llvm/ADT/SmallVector.h:1.20 Mon Oct 9 14:05:44 2006 +++ llvm/include/llvm/ADT/SmallVector.h Sun Oct 29 21:39:20 2006 @@ -25,6 +25,7 @@ /// template parameter. template class SmallVectorImpl { +protected: T *Begin, *End, *Capacity; // Allocate raw space for N elements of type T. If T has a ctor or dtor, we From rspencer at reidspencer.com Sun Oct 29 22:14:46 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Sun, 29 Oct 2006 20:14:46 -0800 Subject: [llvm-commits] llvm-gcc patch In-Reply-To: References: Message-ID: <1162181686.891.54.camel@bashful.x10sys.com> Chris, Could you please resend this as an attachment. It is not applying correctly. Thanks, Reid. On Sun, 2006-10-29 at 09:39 -0800, Chris Lattner wrote: > Index: crtstuff.c > =================================================================== > --- crtstuff.c (revision 119298) > +++ crtstuff.c (working copy) > @@ -51,9 +51,6 @@ > This file must be compiled with gcc. */ > -/* APPLE LOCAL begin LLVM */ > -#ifndef __llvm__ /* FIXME: add inline asm support */ > - > /* It is incorrect to include config.h here, because this file is > being > compiled for the target, and hence definitions concerning only > the host > do not apply. */ > @@ -69,6 +66,13 @@ > #include "tm.h" > #include "unwind-dw2-fde.h" > +/* APPLE LOCAL begin LLVM */ > +#ifdef __llvm__ > + /* FIXME: Remove when external weak linkage will be alive. */ > + #undef JCR_SECTION_NAME > +#endif > +/* APPLE LOCAL end LLVM */ > + > #ifndef FORCE_CODE_SECTION_ALIGN > # define FORCE_CODE_SECTION_ALIGN > #endif > @@ -177,11 +181,25 @@ > static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { }; > asm (CTORS_SECTION_ASM_OP); > STATIC func_ptr __CTOR_LIST__[1] > +/* APPLE LOCAL begin LLVM */ > +#ifdef __llvm__ > +/* FIXME: Remove when external weak linkage will be alive. */ > + __attribute__ ((__used__, aligned(sizeof(func_ptr)))) > +#else > __attribute__ ((__unused__, aligned(sizeof(func_ptr)))) > +#endif > +/* APPLE LOCAL end LLVM */ > = { (func_ptr) (-1) }; > #else > STATIC func_ptr __CTOR_LIST__[1] > - __attribute__ ((__unused__, section(".ctors"), aligned(sizeof > (func_ptr)))) > +/* APPLE LOCAL begin LLVM */ > +#ifdef __llvm__ > +/* FIXME: Remove when external weak linkage will be alive. */ > + __attribute__ ((__used__, section(".ctors"), aligned(sizeof > (func_ptr)))) > +#else > + __attribute__ ((__unused__, section(".ctors"), aligned(sizeof > (func_ptr)))) > +#endif > +/* APPLE LOCAL end LLVM */ > = { (func_ptr) (-1) }; > #endif /* __CTOR_LIST__ alternatives */ > @@ -449,11 +467,25 @@ > #elif defined(DTORS_SECTION_ASM_OP) > asm (DTORS_SECTION_ASM_OP); > STATIC func_ptr __DTOR_END__[1] > +/* APPLE LOCAL begin LLVM */ > +#ifdef __llvm__ > +/* FIXME: Remove when external weak linkage will be alive. */ > +__attribute__ ((__used__, aligned(sizeof(func_ptr)))) > +#else > __attribute__ ((unused, aligned(sizeof(func_ptr)))) > +#endif > +/* APPLE LOCAL end LLVM */ > = { (func_ptr) 0 }; > #else > STATIC func_ptr __DTOR_END__[1] > - __attribute__((unused, section(".dtors"), > aligned(sizeof(func_ptr)))) > +/* APPLE LOCAL begin LLVM */ > +#ifdef __llvm__ > +/* FIXME: Remove when external weak linkage will be alive. */ > + __attribute__((__used__, section(".dtors"), aligned(sizeof > (func_ptr)))) > +#else > + __attribute__((unused, section(".dtors"), > aligned(sizeof(func_ptr)))) > +#endif > +/* APPLE LOCAL end LLVM */ > = { (func_ptr) 0 }; > #endif > @@ -558,5 +590,3 @@ > #error "One of CRT_BEGIN or CRT_END must be defined." > #endif > -#endif > -/* APPLE LOCAL end LLVM */ From clattner at apple.com Sun Oct 29 22:31:27 2006 From: clattner at apple.com (Chris Lattner) Date: Sun, 29 Oct 2006 20:31:27 -0800 Subject: [llvm-commits] llvm-gcc patch In-Reply-To: <1162181686.891.54.camel@bashful.x10sys.com> References: <1162181686.891.54.camel@bashful.x10sys.com> Message-ID: http://llvm.org/bugs/attachment.cgi?id=423&action=view -Chris On Oct 29, 2006, at 8:14 PM, Reid Spencer wrote: > Chris, > > Could you please resend this as an attachment. It is not applying > correctly. > > Thanks, > > Reid. > > On Sun, 2006-10-29 at 09:39 -0800, Chris Lattner wrote: >> Index: crtstuff.c >> =================================================================== >> --- crtstuff.c (revision 119298) >> +++ crtstuff.c (working copy) >> @@ -51,9 +51,6 @@ >> This file must be compiled with gcc. */ >> -/* APPLE LOCAL begin LLVM */ >> -#ifndef __llvm__ /* FIXME: add inline asm support */ >> - >> /* It is incorrect to include config.h here, because this file is >> being >> compiled for the target, and hence definitions concerning only >> the host >> do not apply. */ >> @@ -69,6 +66,13 @@ >> #include "tm.h" >> #include "unwind-dw2-fde.h" >> +/* APPLE LOCAL begin LLVM */ >> +#ifdef __llvm__ >> + /* FIXME: Remove when external weak linkage will be alive. */ >> + #undef JCR_SECTION_NAME >> +#endif >> +/* APPLE LOCAL end LLVM */ >> + >> #ifndef FORCE_CODE_SECTION_ALIGN >> # define FORCE_CODE_SECTION_ALIGN >> #endif >> @@ -177,11 +181,25 @@ >> static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { }; >> asm (CTORS_SECTION_ASM_OP); >> STATIC func_ptr __CTOR_LIST__[1] >> +/* APPLE LOCAL begin LLVM */ >> +#ifdef __llvm__ >> +/* FIXME: Remove when external weak linkage will be alive. */ >> + __attribute__ ((__used__, aligned(sizeof(func_ptr)))) >> +#else >> __attribute__ ((__unused__, aligned(sizeof(func_ptr)))) >> +#endif >> +/* APPLE LOCAL end LLVM */ >> = { (func_ptr) (-1) }; >> #else >> STATIC func_ptr __CTOR_LIST__[1] >> - __attribute__ ((__unused__, section(".ctors"), aligned(sizeof >> (func_ptr)))) >> +/* APPLE LOCAL begin LLVM */ >> +#ifdef __llvm__ >> +/* FIXME: Remove when external weak linkage will be alive. */ >> + __attribute__ ((__used__, section(".ctors"), aligned(sizeof >> (func_ptr)))) >> +#else >> + __attribute__ ((__unused__, section(".ctors"), aligned(sizeof >> (func_ptr)))) >> +#endif >> +/* APPLE LOCAL end LLVM */ >> = { (func_ptr) (-1) }; >> #endif /* __CTOR_LIST__ alternatives */ >> @@ -449,11 +467,25 @@ >> #elif defined(DTORS_SECTION_ASM_OP) >> asm (DTORS_SECTION_ASM_OP); >> STATIC func_ptr __DTOR_END__[1] >> +/* APPLE LOCAL begin LLVM */ >> +#ifdef __llvm__ >> +/* FIXME: Remove when external weak linkage will be alive. */ >> +__attribute__ ((__used__, aligned(sizeof(func_ptr)))) >> +#else >> __attribute__ ((unused, aligned(sizeof(func_ptr)))) >> +#endif >> +/* APPLE LOCAL end LLVM */ >> = { (func_ptr) 0 }; >> #else >> STATIC func_ptr __DTOR_END__[1] >> - __attribute__((unused, section(".dtors"), >> aligned(sizeof(func_ptr)))) >> +/* APPLE LOCAL begin LLVM */ >> +#ifdef __llvm__ >> +/* FIXME: Remove when external weak linkage will be alive. */ >> + __attribute__((__used__, section(".dtors"), aligned(sizeof >> (func_ptr)))) >> +#else >> + __attribute__((unused, section(".dtors"), >> aligned(sizeof(func_ptr)))) >> +#endif >> +/* APPLE LOCAL end LLVM */ >> = { (func_ptr) 0 }; >> #endif >> @@ -558,5 +590,3 @@ >> #error "One of CRT_BEGIN or CRT_END must be defined." >> #endif >> -#endif >> -/* APPLE LOCAL end LLVM */ >