MCPcopy Create free account
hub / github.com/GANGE666/xVMP / parseTypeTableBody

Method parseTypeTableBody

src/lib/Bitcode/Reader/BitcodeReader.cpp:1541–1775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1539}
1540
1541Error BitcodeReader::parseTypeTableBody() {
1542 if (!TypeList.empty())
1543 return error("Invalid multiple blocks");
1544
1545 SmallVector<uint64_t, 64> Record;
1546 unsigned NumRecords = 0;
1547
1548 SmallString<64> TypeName;
1549
1550 // Read all the records for this type table.
1551 while (true) {
1552 BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
1553
1554 switch (Entry.Kind) {
1555 case BitstreamEntry::SubBlock: // Handled for us already.
1556 case BitstreamEntry::Error:
1557 return error("Malformed block");
1558 case BitstreamEntry::EndBlock:
1559 if (NumRecords != TypeList.size())
1560 return error("Malformed block");
1561 return Error::success();
1562 case BitstreamEntry::Record:
1563 // The interesting case.
1564 break;
1565 }
1566
1567 // Read a record.
1568 Record.clear();
1569 Type *ResultTy = nullptr;
1570 switch (Stream.readRecord(Entry.ID, Record)) {
1571 default:
1572 return error("Invalid value");
1573 case bitc::TYPE_CODE_NUMENTRY: // TYPE_CODE_NUMENTRY: [numentries]
1574 // TYPE_CODE_NUMENTRY contains a count of the number of types in the
1575 // type list. This allows us to reserve space.
1576 if (Record.size() < 1)
1577 return error("Invalid record");
1578 TypeList.resize(Record[0]);
1579 continue;
1580 case bitc::TYPE_CODE_VOID: // VOID
1581 ResultTy = Type::getVoidTy(Context);
1582 break;
1583 case bitc::TYPE_CODE_HALF: // HALF
1584 ResultTy = Type::getHalfTy(Context);
1585 break;
1586 case bitc::TYPE_CODE_FLOAT: // FLOAT
1587 ResultTy = Type::getFloatTy(Context);
1588 break;
1589 case bitc::TYPE_CODE_DOUBLE: // DOUBLE
1590 ResultTy = Type::getDoubleTy(Context);
1591 break;
1592 case bitc::TYPE_CODE_X86_FP80: // X86_FP80
1593 ResultTy = Type::getX86_FP80Ty(Context);
1594 break;
1595 case bitc::TYPE_CODE_FP128: // FP128
1596 ResultTy = Type::getFP128Ty(Context);
1597 break;
1598 case bitc::TYPE_CODE_PPC_FP128: // PPC_FP128

Callers

nothing calls this directly

Calls 15

successFunction · 0.85
isValidElementTypeFunction · 0.85
errorFunction · 0.70
convertToStringFunction · 0.70
getFunction · 0.50
assertFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
readRecordMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected