Lines Matching refs:Record
61 /// ConvertToString - Convert a string from a record into an std::string, return
64 static bool ConvertToString(ArrayRef<uint64_t> Record, unsigned Idx,
66 if (Idx > Record.size())
69 for (unsigned i = Idx, e = Record.size(); i != e; ++i)
70 Result += (char)Record[i];
455 return Error("Malformed block record");
460 SmallVector<uint64_t, 64> Record;
474 case BitstreamEntry::Record:
479 // Read a record.
480 Record
481 switch (Stream.readRecord(Entry.ID, Record)) {
486 if (Record.size() & 1)
487 return Error("Invalid ENTRY record");
489 for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
491 decodeLLVMAttributesForBitcode(B, Record[i+1]);
492 Attrs.push_back(AttributeSet::get(Context, Record[i], B));
500 for (unsigned i = 0, e = Record.size(); i != e; ++i)
501 Attrs.push_back(MAttributeGroups[Record[i]]);
632 return Error("Malformed block record");
637 SmallVector<uint64_t, 64> Record;
649 case BitstreamEntry::Record:
654 // Read a record.
655 Record.clear();
656 switch (Stream.readRecord(Entry.ID, Record)) {
660 if (Record.size() < 3)
661 return Error("Invalid ENTRY record");
663 uint64_t GrpID = Record[0];
664 uint64_t Idx = Record[1]; // Index of the object this attribute refers to.
667 for (unsigned i = 2, e = Record.size(); i != e; ++i) {
668 if (Record[i] == 0) { // Enum attribute
670 if (ParseAttrKind(Record[++i], &Kind))
674 } else if (Record[i] == 1) { // Align attribute
676 if (ParseAttrKind(Record[++i], &Kind))
679 B.addAlignmentAttr(Record[++i]);
681 B.addStackAlignmentAttr(Record[++i]);
683 assert((Record[i] == 3 || Record[i] == 4) &&
685 bool HasValue = (Record[i++] == 4);
689 while (Record[i] != 0 && i != e)
690 KindStr += Record[i++];
691 assert(Record[i] == 0 && "Kind string not null terminated");
696 while (Record[i] != 0 && i != e)
697 ValStr += Record[i++];
698 assert(Record[i] == 0 && "Value string not null terminated");
714 return Error("Malformed block record");
723 SmallVector<uint64_t, 64> Record;
741 case BitstreamEntry::Record:
746 // Read a record.
747 Record.clear();
749 switch (Stream.readRecord(Entry.ID, Record)) {
754 if (Record.size() < 1)
755 return Error("Invalid TYPE_CODE_NUMENTRY record");
756 TypeList.resize(Record[0]);
789 if (Record.size() < 1)
790 return Error("Invalid Integer type record");
792 ResultTy = IntegerType::get(Context, Record[0]);
796 if (Record.size() < 1)
797 return Error("Invalid POINTER type record");
799 if (Record.size() == 2)
800 AddressSpace = Record[1];
801 ResultTy = getTypeByID(Record[0]);
809 if (Record.size() < 3)
810 return Error("Invalid FUNCTION type record");
812 for (unsigned i = 3, e = Record.size(); i != e; ++i) {
813 if (Type *T = getTypeByID(Record[i]))
819 ResultTy = getTypeByID(Record[2]);
820 if (ResultTy == 0 || ArgTys.size() < Record.size()-3)
823 ResultTy = FunctionType::get(ResultTy, ArgTys, Record[0]);
828 if (Record.size() < 2)
829 return Error("Invalid FUNCTION type record");
831 for (unsigned i = 2, e = Record.size(); i != e; ++i) {
832 if (Type *T = getTypeByID(Record[i]))
838 ResultTy = getTypeByID(Record[1]);
839 if (ResultTy == 0 || ArgTys.size() < Record.size()-2)
842 ResultTy = FunctionType::get(ResultTy, ArgTys, Record[0]);
846 if (Record.size() < 1)
847 return Error("Invalid STRUCT type record");
849 for (unsigned i = 1, e = Record.size(); i != e; ++i) {
850 if (Type *T = getTypeByID(Record[i]))
855 if (EltTys.size() != Record.size()-1)
857 ResultTy = StructType::get(Context, EltTys, Record[0]);
861 if (ConvertToString(Record, 0, TypeName))
862 return Error("Invalid STRUCT_NAME record");
866 if (Record.size() < 1)
867 return Error("Invalid STRUCT type record");
882 for (unsigned i = 1, e = Record.size(); i != e; ++i) {
883 if (Type *T = getTypeByID(Record[i]))
888 if (EltTys.size() != Record.size()-1)
889 return Error("invalid STRUCT type record");
890 Res->setBody(EltTys, Record[0]);
895 if (Record.size() != 1)
896 return Error("Invalid OPAQUE type record");
913 if (Record.size() < 2)
914 return Error("Invalid ARRAY type record");
915 if ((ResultTy = getTypeByID(Record[1])))
916 ResultTy = ArrayType::get(ResultTy, Record[0]);
921 if (Record.size() < 2)
922 return Error("Invalid VECTOR type record");
923 if ((ResultTy = getTypeByID(Record[1])))
924 ResultTy = VectorType::get(ResultTy, Record[0]);
940 return Error("Malformed block record");
942 SmallVector<uint64_t, 64> Record;
955 case BitstreamEntry::Record:
960 // Read a record.
961 Record.clear();
962 switch (Stream.readRecord(Entry.ID, Record)) {
966 if (ConvertToString(Record, 1, ValueName))
967 return Error("Invalid VST_ENTRY record");
968 unsigned ValueID = Record[0];
970 return Error("Invalid Value ID in VST_ENTRY record");
978 if (ConvertToString(Record, 1, ValueName))
979 return Error("Invalid VST_BBENTRY record");
980 BasicBlock *BB = getBasicBlock(Record[0]);
982 return Error("Invalid BB ID in VST_BBENTRY record");
996 return Error("Malformed block record");
998 SmallVector<uint64_t, 64> Record;
1011 case BitstreamEntry::Record:
1017 // Read a record.
1018 Record.clear();
1019 unsigned Code = Stream.readRecord(Entry.ID, Record);
1025 SmallString<8> Name(Record.begin(), Record.end());
1026 Record.clear();
1030 unsigned NextBitCode = Stream.readRecord(Code, Record);
1034 unsigned Size = Record.size();
1037 MDNode *MD = dyn_cast<MDNode>(MDValueList.getValueFwdRef(Record[i]));
1039 return Error("Malformed metadata record");
1048 if (Record.size() % 2 == 1)
1049 return Error("Invalid METADATA_NODE record");
1051 unsigned Size = Record.size();
1054 Type *Ty = getTypeByID(Record[i]);
1055 if (!Ty) return Error("Invalid METADATA_NODE record");
1057 Elts.push_back(MDValueList.getValueFwdRef(Record[i+1]));
1059 Elts.push_back(ValueList.getValueFwdRef(Record[i+1], Ty));
1069 SmallString<8> String(Record.begin(), Record.end());
1075 if (Record.size() < 2)
1076 return Error("Invalid METADATA_KIND record");
1078 unsigned Kind = Record[0];
1079 SmallString<8> Name(Record.begin()+1, Record.end());
1149 return Error("Malformed block record");
1151 SmallVector<uint64_t, 64> Record;
1162 return Error("malformed block record in AST file");
1171 case BitstreamEntry::Record:
1176 // Read a record.
1177 Record.clear();
1179 unsigned BitCode = Stream.readRecord(Entry.ID, Record);
1186 if (Record.empty())
1187 return Error("Malformed CST_SETTYPE record");
1188 if (Record[0] >= TypeList.size())
1189 return Error("Invalid Type ID in CST_SETTYPE record");
1190 CurTy = TypeList[Record[0]];
1196 if (!CurTy->isIntegerTy() || Record.empty())
1197 return Error("Invalid CST_INTEGER record");
1198 V = ConstantInt::get(CurTy, decodeSignRotatedValue(Record[0]));
1201 if (!CurTy->isIntegerTy() || Record.empty())
1202 return Error("Invalid WIDE_INTEGER record");
1204 APInt VInt = ReadWideAPInt(Record,
1211 if (Record.empty())
1212 return Error("Invalid FLOAT record");
1215 APInt(16, (uint16_t)Record[0])));
1218 APInt(32, (uint32_t)Record[0])));
1221 APInt(64, Record[0])));
1225 Rearrange[0] = (Record[1] & 0xffffLL) | (Record[0] << 16);
1226 Rearrange[1] = Record[0] >> 48;
1231 APInt(128, Record)));
1234 APInt(128, Record)));
1241 if (Record.empty())
1242 return Error("Invalid CST_AGGREGATE record");
1244 unsigned Size = Record.size();
1249 Elts.push_back(ValueList.getConstantFwdRef(Record[i],
1255 Elts.push_back(ValueList.getConstantFwdRef(Record[i], EltTy));
1260 Elts.push_back(ValueList.getConstantFwdRef(Record[i], EltTy));
1269 if (Record.empty())
1270 return Error("Invalid CST_STRING record");
1272 SmallString<16> Elts(Record.begin(), Record.end());
1278 if (Record.empty())
1279 return Error("Invalid CST_DATA record");
1282 unsigned Size = Record.size();
1285 SmallVector<uint8_t, 16> Elts(Record.begin(), Record.end());
1291 SmallVector<uint16_t, 16> Elts(Record.begin(), Record.end());
1297 SmallVector<uint32_t, 16> Elts(Record.begin(), Record.end());
1303 SmallVector<uint64_t, 16> Elts(Record.begin(), Record.end());
1310 std::transform(Record.begin(), Record.end(), Elts.begin(), BitsToFloat);
1317 std::transform(Record.begin(), Record.end(), Elts.begin(),
1330 if (Record.size() < 3) return Error("Invalid CE_BINOP record");
1331 int Opc = GetDecodedBinaryOpcode(Record[0], CurTy);
1335 Constant *LHS = ValueList.getConstantFwdRef(Record[1], CurTy);
1336 Constant *RHS = ValueList.getConstantFwdRef(Record[2], CurTy);
1338 if (Record.size() >= 4) {
1343 if (Record[3] & (1 << bitc::OBO_NO_SIGNED_WRAP))
1345 if (Record[3] & (1 << bitc::OBO_NO_UNSIGNED_WRAP))
1351 if (Record[3] & (1 << bitc::PEO_EXACT))
1360 if (Record.size() < 3) return Error("Invalid CE_CAST record");
1361 int Opc = GetDecodedCastOpcode(Record[0]);
1365 Type *OpTy = getTypeByID(Record[1]);
1366 if (!OpTy) return Error("Invalid CE_CAST record");
1367 Constant *Op = ValueList.getConstantFwdRef(Record[2], OpTy);
1374 if (Record.size() & 1) return Error("Invalid CE_GEP record");
1376 for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
1377 Type *ElTy = getTypeByID(Record[i]);
1378 if (!ElTy) return Error("Invalid CE_GEP record");
1379 Elts.push_back(ValueList.getConstantFwdRef(Record[i+1], ElTy));
1388 if (Record.size() < 3) return Error("Invalid CE_SELECT record");
1390 ValueList.getConstantFwdRef(Record[0],
1392 ValueList.getConstantFwdRef(Record[1],CurTy),
1393 ValueList.getConstantFwdRef(Record[2],CurTy));
1396 if (Record.size() < 3) return Error("Invalid CE_EXTRACTELT record");
1398 dyn_cast_or_null<VectorType>(getTypeByID(Record[0]));
1399 if (OpTy == 0) return Error("Invalid CE_EXTRACTELT record");
1400 Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
1401 Constant *Op1 = ValueList.getConstantFwdRef(Record[2],
1408 if (Record.size() < 3 || OpTy == 0)
1409 return Error("Invalid CE_INSERTELT record");
1410 Record[0], OpTy);
1411 Constant *Op1 = ValueList.getConstantFwdRef(Record[1],
1413 Constant *Op2 = ValueList.getConstantFwdRef(Record[2],
1420 if (Record.size() < 3 || OpTy == 0)
1421 return Error("Invalid CE_SHUFFLEVEC record");
1422 Constant *Op0 = ValueList.getConstantFwdRef(Record[0], OpTy);
1423 Constant *Op1 = ValueList.getConstantFwdRef(Record[1], OpTy);
1426 Constant *Op2 = ValueList.getConstantFwdRef(Record[2], ShufTy);
1433 dyn_cast_or_null<VectorType>(getTypeByID(Record[0]));
1434 if (Record.size() < 4 || RTy == 0 || OpTy == 0)
1435 return Error("Invalid CE_SHUFVEC_EX record");
1436 Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
1437 Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy);
1440 Constant *Op2 = ValueList.getConstantFwdRef(Record[3], ShufTy);
1445 if (Record.size() < 4) return Error("Invalid CE_CMP record");
1446 Type *OpTy = getTypeByID(Record[0]);
1447 if (OpTy == 0) return Error("Invalid CE_CMP record");
1448 Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
1449 Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy);
1452 V = ConstantExpr::getFCmp(Record[3], Op0, Op1);
1454 V = ConstantExpr::getICmp(Record[3], Op0, Op1);
1460 if (Record.size() < 2) return Error("Invalid INLINEASM record");
1462 bool HasSideEffects = Record[0] & 1;
1463 bool IsAlignStack = Record[0] >> 1;
1464 unsigned AsmStrSize = Record[1];
1465 if (2+AsmStrSize >= Record.size())
1466 return Error("Invalid INLINEASM record");
1467 unsigned ConstStrSize = Record[2+AsmStrSize];
1468 if (3+AsmStrSize+ConstStrSize > Record.size())
1469 return Error("Invalid INLINEASM record");
1472 AsmStr += (char)Record[2+i];
1474 ConstrStr += (char)Record[3+AsmStrSize+i];
1483 if (Record.size() < 2) return Error("Invalid INLINEASM record");
1485 bool HasSideEffects = Record[0] & 1;
1486 bool IsAlignStack = (Record[0] >> 1) & 1;
1487 unsigned AsmDialect = Record[0] >> 2;
1488 unsigned AsmStrSize = Record[1];
1489 if (2+AsmStrSize >= Record.size())
1490 return Error("Invalid INLINEASM record");
1491 unsigned ConstStrSize = Record[2+AsmStrSize];
1492 if (3+AsmStrSize+ConstStrSize > Record.size())
1493 return Error("Invalid INLINEASM record");
1496 AsmStr += (char)Record[2+i];
1498 ConstrStr += (char)Record[3+AsmStrSize+i];
1506 if (Record.size() < 3) return Error("Invalid CE_BLOCKADDRESS record");
1507 Type *FnTy = getTypeByID(Record[0]);
1508 if (FnTy == 0) return Error("Invalid CE_BLOCKADDRESS record");
1510 dyn_cast_or_null<Function>(ValueList.getConstantFwdRef(Record[1],FnTy));
1511 if (Fn == 0) return Error("Invalid CE_BLOCKADDRESS record");
1517 for (size_t I = 0, E = Record[2]; I != E; ++I) {
1530 BlockAddrFwdRefs[Fn].push_back(std::make_pair(Record[2], FwdRef));
1544 return Error("Malformed block record");
1546 SmallVector<uint64_t, 64> Record;
1558 case BitstreamEntry::Record:
1563 // Read a use list record.
1564 Record.clear();
1565 switch (Stream.readRecord(Entry.ID, Record)) {
1569 unsigned RecordLength = Record.size();
1572 UseListRecords.push_back(Record);
1596 return Error("Malformed block record");
1630 return Error("Malformed block record");
1632 SmallVector<uint64_t, 64> Record;
1651 return Error("Malformed block record");
1712 case BitstreamEntry::Record:
1718 // Read a record.
1719 switch (Stream.readRecord(Entry.ID, Record)) {
1722 if (Record.size() < 1)
1725 unsigned module_version = Record[0];
1739 if (ConvertToString(Record, 0, S))
1740 return Error("Invalid MODULE_CODE_TRIPLE record");
1746 if (ConvertToString(Record, 0, S))
1747 return Error("Invalid MODULE_CODE_DATALAYOUT record");
1753 if (ConvertToString(Record, 0, S))
1754 return Error("Invalid MODULE_CODE_ASM record");
1761 if (ConvertToString(Record, 0, S))
1762 return Error("Invalid MODULE_CODE_DEPLIB record");
1768 if (ConvertToString(Record, 0, S))
1769 return Error("Invalid MODULE_CODE_SECTIONNAME record");
1775 if (ConvertToString(Record, 0, S))
1776 return Error("Invalid MODULE_CODE_GCNAME record");
1784 if (Record.size() < 6)
1785 return Error("Invalid MODULE_CODE_GLOBALVAR record");
1786 Type *Ty = getTypeByID(Record[0]);
1787 if (!Ty) return Error("Invalid MODULE_CODE_GLOBALVAR record");
1793 bool isConstant = Record[1];
1794 GlobalValue::LinkageTypes Linkage = GetDecodedLinkage(Record[3]);
1795 unsigned Alignment = (1 << Record[4]) >> 1;
1797 if (Record[5]) {
1798 if (Record[5]-1 >= SectionTable.size())
1800 Section = SectionTable[Record[5]-1];
1803 if (Record.size() > 6)
1804 Visibility = GetDecodedVisibility(Record[6]);
1807 if (Record.size() > 7)
1808 TLM = GetDecodedThreadLocalMode(Record[7]);
1811 if (Record.size() > 8)
1812 UnnamedAddr = Record[8];
1815 if (Record.size() > 9)
1816 ExternallyInitialized = Record[9];
1830 if (unsigned InitID = Record[2])
1837 if (Record.size() < 8)
1838 return Error("Invalid MODULE_CODE_FUNCTION record");
1839 Type *Ty = getTypeByID(Record[0]);
1840 if (!Ty) return Error("Invalid MODULE_CODE_FUNCTION record");
1851 Func->setCallingConv(static_cast<CallingConv::ID>(Record[1]));
1852 bool isProto = Record[2];
1853 Func->setLinkage(GetDecodedLinkage(Record[3]));
1854 Func->setAttributes(getAttributes(Record[4]));
1856 Func->setAlignment((1 << Record[5]) >> 1);
1857 if (Record[6]) {
1858 if (Record[6]-1 >= SectionTable.size())
1860 Func->setSection(SectionTable[Record[6]-1]);
1862 Func->setVisibility(GetDecodedVisibility(Record[7]));
1863 if (Record.size() > 8 && Record[8]) {
1864 if (Record[8]-1 > GCTable.size())
1866 Func->setGC(GCTable[Record[8]-1].c_str());
1869 if (Record.size() > 9)
1870 UnnamedAddr = Record[9];
1885 if (Record.size() < 3)
1886 return Error("Invalid MODULE_ALIAS record");
1887 Type *Ty = getTypeByID(Record[0]);
1888 if (!Ty) return Error("Invalid MODULE_ALIAS record");
1892 GlobalAlias *NewGA = new GlobalAlias(Ty, GetDecodedLinkage(Record[2]),
1895 if (Record.size() > 3)
1896 NewGA->setVisibility(GetDecodedVisibility(Record[3]));
1898 AliasInits.push_back(std::make_pair(NewGA, Record[1]));
1904 if (Record.size() < 1 || Record[0] > ValueList.size())
1905 return Error("Invalid MODULE_PURGEVALS record");
1906 ValueList.shrinkTo(Record[0]);
1909 Record.clear();
1960 return Error("Malformed block record");
1964 case BitstreamEntry::Record:
1975 return Error("Invalid record at top-level");
1982 return Error("Malformed block record");
1984 SmallVector<uint64_t, 64> Record;
1996 case BitstreamEntry::Record:
2001 // Read a record.
2002 switch (Stream.readRecord(Entry.ID, Record)) {
2006 if (ConvertToString(Record, 0, S))
2007 return Error("Invalid MODULE_CODE_TRIPLE record");
2012 Record.clear();
2046 Error("malformed block record in AST file");
2051 case BitstreamEntry::Record:
2061 return Error("Malformed block record");
2063 SmallVector<uint64_t, 64> Record;
2073 case BitstreamEntry::Record:
2078 // Read a metadata attachment record.
2079 Record.clear();
2080 switch (Stream.readRecord(Entry.ID, Record)) {
2084 unsigned RecordLength = Record.size();
2085 if (Record.empty() || (RecordLength - 1) % 2 == 1)
2087 Instruction *Inst = InstructionList[Record[0]];
2089 unsigned Kind = Record[i];
2094 Value *Node = MDValueList.getValueFwdRef(Record[i+1]);
2106 return Error("Malformed block record");
2123 SmallVector<uint64_t, 64> Record;
2137 return Error("Malformed block record");
2155 case BitstreamEntry::Record:
2160 // Read a record.
2161 Record.clear();
2163 unsigned BitCode = Stream.readRecord(Entry.ID, Record);
2168 if (Record.size() < 1 || Record[0] == 0)
2169 return Error("Invalid DECLAREBLOCKS record");
2171 FunctionBBs.resize(Record[0]);
2178 // This record indicates that the last instruction is at the same
2189 if (I == 0) return Error("Invalid DEBUG_LOC_AGAIN record");
2201 if (I == 0 || Record.size() < 4)
2202 return Error("Invalid FUNC_CODE_DEBUG_LOC record");
2204 unsigned Line = Record[0], Col = Record[1];
2205 unsigned ScopeID = Record[2], IAID = Record[3];
2219 if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
2220 popValue(Record, OpNum, NextValueNo, LHS->getType(), RHS) ||
2221 OpNum+1 > Record.size())
2222 return Error("Invalid BINOP record");
2224 int Opc = GetDecodedBinaryOpcode(Record[OpNum++], LHS->getType());
2225 if (Opc == -1) return Error("Invalid BINOP record");
2228 if (OpNum < Record.size()) {
2233 if (Record[OpNum] & (1 << bitc::OBO_NO_SIGNED_WRAP))
2235 if (Record[OpNum] & (1 << bitc::OBO_NO_UNSIGNED_WRAP))
2241 if (Record[OpNum] & (1 << bitc::PEO_EXACT))
2245 if (0 != (Record[OpNum] & FastMathFlags::UnsafeAlgebra))
2247 if (0 != (Record[OpNum] & FastMathFlags::NoNaNs))
2249 if (0 != (Record[OpNum] & FastMathFlags::NoInfs))
2251 if (0 != (Record[OpNum] & FastMathFlags::NoSignedZeros))
2253 if (0 != (Record[OpNum] & FastMathFlags::AllowReciprocal))
2265 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
2266 OpNum+2 != Record.size())
2267 return Error("Invalid CAST record");
2269 Type *ResTy = getTypeByID(Record[OpNum]);
2270 int Opc = GetDecodedCastOpcode(Record[OpNum+1]);
2272 return Error("Invalid CAST record");
2281 if (getValueTypePair(Record, OpNum, NextValueNo, BasePtr))
2282 return Error("Invalid GEP record");
2285 while (OpNum != Record.size()) {
2287 if (getValueTypePair(Record, OpNum, NextValueNo, Op))
2288 return Error("Invalid GEP record");
2303 if (getValueTypePair(Record, OpNum, NextValueNo, Agg))
2304 return Error("Invalid EXTRACTVAL record");
2307 for (unsigned RecSize = Record.size();
2309 uint64_t Index = Record[OpNum];
2324 if (getValueTypePair(Record, OpNum, NextValueNo, Agg))
2325 return Error("Invalid INSERTVAL record");
2327 if (getValueTypePair(Record, OpNum, NextValueNo, Val))
2328 return Error("Invalid INSERTVAL record");
2331 for (unsigned RecSize = Record.size();
2333 uint64_t Index = Record[OpNum];
2349 if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
2350 popValue(Record, OpNum, NextValueNo, TrueVal->getType(), FalseVal) ||
2351 popValue(Record, OpNum, NextValueNo, Type::getInt1Ty(Context), Cond))
2352 return Error("Invalid SELECT record");
2364 if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
2365 popValue(Record, OpNum, NextValueNo, TrueVal->getType(), FalseVal) ||
2366 getValueTypePair(Record, OpNum, NextValueNo, Cond))
2367 return Error("Invalid SELECT record");
2389 if (getValueTypePair(Record, OpNum, NextValueNo, Vec) ||
2390 popValue(Record, OpNum, NextValueNo, Type::getInt32Ty(Context), Idx))
2391 return Error("Invalid EXTRACTELT record");
2400 if (getValueTypePair(Record, OpNum, NextValueNo, Vec) ||
2401 popValue(Record, OpNum, NextValueNo,
2403 popValue(Record, OpNum, NextValueNo, Type::getInt32Ty(Context), Idx))
2404 return Error("Invalid INSERTELT record");
2413 if (getValueTypePair(Record, OpNum, NextValueNo, Vec1) ||
2414 popValue(Record, OpNum, NextValueNo, Vec1->getType(), Vec2))
2415 return Error("Invalid SHUFFLEVEC record");
2417 if (getValueTypePair(Record, OpNum, NextValueNo, Mask))
2418 return Error("Invalid SHUFFLEVEC record");
2433 if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
2434 popValue(Record, OpNum, NextValueNo, LHS->getType(), RHS) ||
2435 OpNum+1 != Record.size())
2436 return Error("Invalid CMP record");
2439 I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);
2441 I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
2448 unsigned Size = Record.size();
2457 if (getValueTypePair(Record, OpNum, NextValueNo, Op))
2458 return Error("Invalid RET record");
2459 if (OpNum != Record.size())
2460 return Error("Invalid RET record");
2467 if (Record.size() != 1 && Record.size() != 3)
2468 return Error("Invalid BR record");
2469 BasicBlock *TrueDest = getBasicBlock(Record[0]);
2471 return Error("Invalid BR record");
2473 if (Record.size() == 1) {
2478 BasicBlock *FalseDest = getBasicBlock(Record[1]);
2479 Value *Cond = getValue(Record, 2, NextValueNo,
2482 return Error("Invalid BR record");
2490 if ((Record[0] >> 16) == SWITCH_INST_MAGIC) {
2493 Type *OpTy = getTypeByID(Record[1]);
2496 Value *Cond = getValue(Record, 2, NextValueNo, OpTy);
2497 BasicBlock *Default = getBasicBlock(Record[3]);
2499 return Error("Invalid SWITCH record");
2501 unsigned NumCases = Record[4];
2509 unsigned NumItems = Record[CurIdx++];
2511 bool isSingleNumber = Record[CurIdx++];
2516 ActiveWords = Record[CurIdx++];
2517 Low = ReadWideAPInt(makeArrayRef(&Record[CurIdx], ActiveWords),
2524 ActiveWords = Record[CurIdx++];
2526 ReadWideAPInt(makeArrayRef(&Record[CurIdx], ActiveWords),
2535 BasicBlock *DestBB = getBasicBlock(Record[CurIdx++]);
2540 if (Hash != (Record[0] & 0xFFFF))
2541 return Error("Invalid SWITCH record");
2548 if (Record.size() < 3 || (Record.size() & 1) == 0)
2549 return Error("Invalid SWITCH record");
2550 Type *OpTy = getTypeByID(Record[0]);
2551 Value *Cond = getValue(Record, 1, NextValueNo, OpTy);
2552 BasicBlock *Default = getBasicBlock(Record[2]);
2554 return Error("Invalid SWITCH record");
2555 unsigned NumCases = (Record.size()-3)/2;
2560 dyn_cast_or_null<ConstantInt>(getFnValueByID(Record[3+i*2], OpTy));
2561 BasicBlock *DestBB = getBasicBlock(Record[1+3+i*2]);
2564 return Error("Invalid SWITCH record!");
2572 if (Record.size() < 2)
2573 return Error("Invalid INDIRECTBR record");
2574 Type *OpTy = getTypeByID(Record[0]);
2575 Value *Address = getValue(Record, 1, NextValueNo, OpTy);
2577 return Error("Invalid INDIRECTBR record");
2578 unsigned NumDests = Record.size()-2;
2582 if (BasicBlock *DestBB = getBasicBlock(Record[2+i])) {
2586 return Error("Invalid INDIRECTBR record!");
2595 if (Record.size() < 4) return Error("Invalid INVOKE record");
2596 AttributeSet PAL = getAttributes(Record[0]);
2597 unsigned CCInfo = Record[1];
2598 BasicBlock *NormalBB = getBasicBlock(Record[2]);
2599 BasicBlock *UnwindBB = getBasicBlock(Record[3]);
2603 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
2604 return Error("Invalid INVOKE record");
2612 Record.size() < OpNum+FTy->getNumParams())
2613 return Error("Invalid INVOKE record");
2617 Ops.push_back(getValue(Record, OpNum, NextValueNo,
2619 if (Ops.back() == 0) return Error("Invalid INVOKE record");
2623 if (Record.size() != OpNum)
2624 return Error("Invalid INVOKE record");
2627 while (OpNum != Record.size()) {
2629 if (getValueTypePair(Record, OpNum, NextValueNo, Op))
2630 return Error("Invalid INVOKE record");
2645 if (getValueTypePair(Record, Idx, NextValueNo, Val))
2646 return Error("Invalid RESUME record");
2656 if (Record.size() < 1 || ((Record.size()-1)&1))
2657 return Error("Invalid PHI record");
2658 Type *Ty = getTypeByID(Record[0]);
2659 if (!Ty) return Error("Invalid PHI record");
2661 PHINode *PN = PHINode::Create(Ty, (Record.size()-1)/2);
2664 for (unsigned i = 0, e = Record.size()-1; i != e; i += 2) {
2670 V = getValueSigned(Record, 1+i, NextValueNo, Ty);
2672 V = getValue(Record, 1+i, NextValueNo, Ty);
2673 BasicBlock *BB = getBasicBlock(Record[2+i]);
2674 if (!V || !BB) return Error("Invalid PHI record");
2684 if (Record.size() < 4)
2685 return Error("Invalid LANDINGPAD record");
2686 Type *Ty = getTypeByID(Record[Idx++]);
2687 if (!Ty) return Error("Invalid LANDINGPAD record");
2689 if (getValueTypePair(Record, Idx, NextValueNo, PersFn))
2690 return Error("Invalid LANDINGPAD record");
2692 bool IsCleanup = !!Record[Idx++];
2693 unsigned NumClauses = Record[Idx++];
2698 LandingPadInst::ClauseType(Record[Idx++]); (void)CT;
2701 if (getValueTypePair(Record, Idx, NextValueNo, Val)) {
2703 return Error("Invalid LANDINGPAD record");
2721 if (Record.size() != 4)
2722 return Error("Invalid ALLOCA record");
2724 dyn_cast_or_null<PointerType>(getTypeByID(Record[0]));
2725 Type *OpTy = getTypeByID(Record[1]);
2726 Value *Size = getFnValueByID(Record[2], OpTy);
2727 unsigned Align = Record[3];
2728 if (!Ty || !Size) return Error("Invalid ALLOCA record");
2736 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
2737 OpNum+2 != Record.size())
2738 return Error("Invalid LOAD record");
2740 I = new LoadInst(Op, "", Record[OpNum+1], (1 << Record[OpNum]) >> 1);
2748 if (getValueTypePair(Record, OpNum, NextValueNo, Op) ||
2749 OpNum+4 != Record.size())
2750 return Error("Invalid LOADATOMIC record");
2753 AtomicOrdering Ordering = GetDecodedOrdering(Record[OpNum+2]);
2756 return Error("Invalid LOADATOMIC record");
2757 if (Ordering != NotAtomic && Record[OpNum] == 0)
2758 return Error("Invalid LOADATOMIC record");
2759 SynchronizationScope SynchScope = GetDecodedSynchScope(Record[OpNum+3]);
2761 I = new LoadInst(Op, "", Record[OpNum+1], (1 << Record[OpNum]) >> 1,
2769 Record, OpNum, NextValueNo, Ptr) ||
2770 popValue(Record, OpNum, NextValueNo,
2772 OpNum+2 != Record.size())
2773 return Error("Invalid STORE record");
2775 I = new StoreInst(Val, Ptr, Record[OpNum+1], (1 << Record[OpNum]) >> 1);
2783 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
2784 popValue(Record, OpNum, NextValueNo,
2786 OpNum+4 != Record.size())
2787 return Error("Invalid STOREATOMIC record");
2789 AtomicOrdering Ordering = GetDecodedOrdering(Record[OpNum+2]);
2792 return Error("Invalid STOREATOMIC record");
2793 SynchronizationScope SynchScope = GetDecodedSynchScope(Record[OpNum+3]);
2794 if (Ordering != NotAtomic && Record[OpNum] == 0)
2795 return Error("Invalid STOREATOMIC record");
2797 I = new StoreInst(Val, Ptr, Record[OpNum+1], (1 << Record[OpNum]) >> 1,
2806 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
2807 popValue(Record, OpNum, NextValueNo,
2809 popValue(Record, OpNum, NextValueNo,
2811 OpNum+3 != Record.size())
2812 return Error("Invalid CMPXCHG record");
2813 AtomicOrdering Ordering = GetDecodedOrdering(Record[OpNum+1]);
2815 return Error("Invalid CMPXCHG record");
2816 SynchronizationScope SynchScope = GetDecodedSynchScope(Record[OpNum+2]);
2818 cast<AtomicCmpXchgInst>(I)->setVolatile(Record[OpNum]);
2826 if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
2827 popValue(Record, OpNum, NextValueNo,
2829 OpNum+4 != Record.size())
2830 return Error("Invalid ATOMICRMW record");
2831 AtomicRMWInst::BinOp Operation = GetDecodedRMWOperation(Record[OpNum]);
2834 return Error("Invalid ATOMICRMW record");
2835 AtomicOrdering Ordering = GetDecodedOrdering(Record[OpNum+2]);
2837 return Error("Invalid ATOMICRMW record");
2838 SynchronizationScope SynchScope = GetDecodedSynchScope(Record[OpNum+3]);
2840 cast<AtomicRMWInst>(I)->setVolatile(Record[OpNum+1]);
2845 if (2 != Record.size())
2846 return Error("Invalid FENCE record");
2847 AtomicOrdering Ordering = GetDecodedOrdering(Record[0]);
2850 return Error("Invalid FENCE record");
2851 SynchronizationScope SynchScope = GetDecodedSynchScope(Record[1]);
2858 if (Record.size() < 3)
2859 return Error("Invalid CALL record");
2861 AttributeSet PAL = getAttributes(Record[0]);
2862 unsigned CCInfo = Record[1];
2866 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
2867 return Error("Invalid CALL record");
2872 if (!FTy || Record.size() < FTy->getNumParams()+OpNum)
2873 return Error("Invalid CALL record");
2879 Args.push_back(getBasicBlock(Record[OpNum]));
2881 Args.push_back(getValue(Record, OpNum, NextValueNo,
2883 if (Args.back() == 0) return Error("Invalid CALL record");
2888 if (OpNum != Record.size())
2889 return Error("Invalid CALL record");
2891 while (OpNum != Record.size()) {
2893 if (getValueTypePair(Record, OpNum, NextValueNo, Op))
2894 return Error("Invalid CALL record");
2908 if (Record.size() < 3)
2909 return Error("Invalid VAARG record");
2910 Type *OpTy = getTypeByID(Record[0]);
2911 Value *Op = getValue(Record, 1, NextValueNo, OpTy);
2912 Type *ResTy = getTypeByID(Record[2]);
2914 return Error("Invalid VAARG record");
3078 // pointing to the END_BLOCK record after them. Now make sure the rest