31 BlockScope.
back().PrevAbbrevs.swap(CurAbbrevs);
36 CurAbbrevs.insert(CurAbbrevs.end(), Info->Abbrevs.begin(),
46 SkipToFourByteBoundary();
48 if (NumWordsP) *NumWordsP = NumWords;
56 assert(!Op.
isLiteral() &&
"Not to be used with literals!");
77 assert(!Op.
isLiteral() &&
"Not to be used with literals!");
107 for (
unsigned i = 0; i != NumElts; ++i)
130 assert(i+2 == e &&
"array op not second to last?");
134 for (; NumElts; --NumElts)
142 SkipToFourByteBoundary();
165 for (
unsigned i = 0; i != NumElts; ++i)
176 if (CodeOp.isLiteral())
177 Code = CodeOp.getLiteralValue();
208 "Array element type has to be an encoding of a type");
214 for (; NumElts; --NumElts)
222 SkipToFourByteBoundary();
226 size_t NewEnd = CurBitPos+((NumElts+3)&~3)*8;
237 const char *Ptr = (
const char*)
245 for (; NumElts; --NumElts)
258 unsigned NumOpInfo =
ReadVBR(5);
259 for (
unsigned i = 0; i != NumOpInfo; ++i) {
260 bool IsLiteral =
Read(1);
282 "Fixed or VBR abbrev record with size > MaxChunkData");
291 CurAbbrevs.push_back(Abbv);
308 switch (Entry.
Kind) {
321 if (!CurBlockInfo)
return true;
326 CurBlockInfo->
Abbrevs.push_back(std::move(CurAbbrevs.back()));
327 CurAbbrevs.pop_back();
336 if (Record.
size() < 1)
return true;
340 if (!CurBlockInfo)
return true;
343 for (
unsigned i = 0, e = Record.size(); i != e; ++i)
344 Name += (
char)Record[i];
349 if (!CurBlockInfo)
return true;
352 for (
unsigned i = 1, e = Record.size(); i != e; ++i)
353 Name += (
char)Record[i];
354 CurBlockInfo->
RecordNames.push_back(std::make_pair((
unsigned)Record[0],
void push_back(const T &Elt)
const BitCodeAbbrev * getAbbrev(unsigned AbbrevID)
Return the abbreviation for the specified AbbrevId.
BLOCKINFO_BLOCK is used to define metadata about blocks, for example, standard abbrevs that should be...
virtual uint64_t getExtent() const =0
Returns the size of the region in bytes.
BitCodeAbbrev - This class represents an abbreviation record.
static const size_t MaxChunkSize
const BitCodeAbbrevOp & getOperandInfo(unsigned N) const
bool hasBlockInfoRecords() const
Return true if we've already read and processed the block info block for this Bitstream.
void Add(const BitCodeAbbrevOp &OpInfo)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
uint64_t GetCurrentBitNo() const
Return the bit # of the bit we are reading.
bool canSkipToPos(size_t pos) const
const BlockInfo * getBlockInfo(unsigned BlockID) const
If there is block info for the specified ID, return it, otherwise return null.
enum llvm::BitstreamEntry::@28 Kind
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::vector< std::pair< unsigned, std::string > > RecordNames
uint64_t getEncodingData() const
BlockInfo & getOrCreateBlockInfo(unsigned BlockID)
BitstreamEntry advanceSkippingSubblocks(unsigned Flags=0)
This is a convenience function for clients that don't expect any subblocks.
If this flag is used, abbrev entries are returned just like normal records.
bool hasEncodingData() const
This represents a position within a bitcode file.
BitCodeAbbrevOp - This describes one or more operands in an abbreviation.
static void skipAbbreviatedField(BitstreamCursor &Cursor, const BitCodeAbbrevOp &Op)
uint64_t ReadVBR64(unsigned NumBits)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
uint64_t getLiteralValue() const
bool SkipBlock()
Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block...
MemoryObject & getBitcodeBytes()
This contains information emitted to BLOCKINFO_BLOCK blocks.
uint32_t ReadVBR(unsigned NumBits)
std::vector< IntrusiveRefCntPtr< BitCodeAbbrev > > Abbrevs
When advancing through a bitstream cursor, each advance can discover a few different kinds of entries...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
unsigned readRecord(unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=nullptr)
word_t Read(unsigned NumBits)
void skipRecord(unsigned AbbrevID)
Read the current record and discard it.
DEFINE_ABBREV - Defines an abbrev for the current block.
static uint64_t readAbbreviatedField(BitstreamCursor &Cursor, const BitCodeAbbrevOp &Op)
bool isIgnoringBlockInfoNames()
virtual const uint8_t * getPointer(uint64_t address, uint64_t size) const =0
Ensures that the requested data is in memory, and returns a pointer to it.
bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP=nullptr)
Having read the ENTER_SUBBLOCK abbrevid, enter the block, and return true if the block has an error...
static char DecodeChar6(unsigned V)
unsigned getNumOperandInfos() const
void JumpToBit(uint64_t BitNo)
Reset the stream to the specified bit number.
StringRef - Represent a constant reference to a string, i.e.
Encoding getEncoding() const
bool ReadBlockInfoBlock()