|
LLVM
3.7.0
|
This represents a position within a bitcode file. More...
#include <BitstreamReader.h>
Public Types | |
| enum | { AF_DontPopBlockAtEnd = 1, AF_DontAutoprocessAbbrevs = 2 } |
| Flags that modify the behavior of advance(). More... | |
Public Member Functions | |
| BitstreamCursor () | |
| BitstreamCursor (BitstreamReader &R) | |
| void | init (BitstreamReader *R) |
| void | freeState () |
| bool | canSkipToPos (size_t pos) const |
| bool | AtEndOfStream () |
| unsigned | getAbbrevIDWidth () const |
| Return the number of bits used to encode an abbrev #. More... | |
| uint64_t | GetCurrentBitNo () const |
| Return the bit # of the bit we are reading. More... | |
| BitstreamReader * | getBitStreamReader () |
| const BitstreamReader * | getBitStreamReader () const |
| BitstreamEntry | advance (unsigned Flags=0) |
| Advance the current bitstream, returning the next entry in the stream. More... | |
| BitstreamEntry | advanceSkippingSubblocks (unsigned Flags=0) |
| This is a convenience function for clients that don't expect any subblocks. More... | |
| void | JumpToBit (uint64_t BitNo) |
| Reset the stream to the specified bit number. More... | |
| void | fillCurWord () |
| word_t | Read (unsigned NumBits) |
| uint32_t | ReadVBR (unsigned NumBits) |
| uint64_t | ReadVBR64 (unsigned NumBits) |
| unsigned | ReadCode () |
| unsigned | ReadSubBlockID () |
| Having read the ENTER_SUBBLOCK code, read the BlockID for the block. More... | |
| bool | SkipBlock () |
| Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block. More... | |
| 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. More... | |
| bool | ReadBlockEnd () |
| const BitCodeAbbrev * | getAbbrev (unsigned AbbrevID) |
| Return the abbreviation for the specified AbbrevId. More... | |
| void | skipRecord (unsigned AbbrevID) |
| Read the current record and discard it. More... | |
| unsigned | readRecord (unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=nullptr) |
| void | ReadAbbrevRecord () |
| bool | ReadBlockInfoBlock () |
Static Public Attributes | |
| static const size_t | MaxChunkSize = sizeof(word_t) * 8 |
This represents a position within a bitcode file.
There may be multiple independent cursors reading within one bitstream, each maintaining their own local state.
Unlike iterators, BitstreamCursors are heavy-weight objects that should not be passed by value.
Definition at line 164 of file BitstreamReader.h.
| anonymous enum |
Flags that modify the behavior of advance().
| Enumerator | |
|---|---|
| AF_DontPopBlockAtEnd |
If this flag is used, the advance() method does not automatically pop the block scope when the end of a block is reached. |
| AF_DontAutoprocessAbbrevs |
If this flag is used, abbrev entries are returned just like normal records. |
Definition at line 250 of file BitstreamReader.h.
|
inline |
Definition at line 203 of file BitstreamReader.h.
References init().
|
inlineexplicit |
Definition at line 205 of file BitstreamReader.h.
References init().
|
inline |
Advance the current bitstream, returning the next entry in the stream.
Definition at line 261 of file BitstreamReader.h.
References AF_DontAutoprocessAbbrevs, AF_DontPopBlockAtEnd, llvm::Code, llvm::bitc::DEFINE_ABBREV, llvm::bitc::END_BLOCK, llvm::bitc::ENTER_SUBBLOCK, llvm::BitstreamEntry::getEndBlock(), llvm::BitstreamEntry::getError(), llvm::BitstreamEntry::getRecord(), llvm::BitstreamEntry::getSubBlock(), ReadAbbrevRecord(), ReadBlockEnd(), ReadCode(), and ReadSubBlockID().
Referenced by advanceSkippingSubblocks().
|
inline |
This is a convenience function for clients that don't expect any subblocks.
This just skips over them automatically.
Definition at line 288 of file BitstreamReader.h.
References advance(), llvm::BitstreamEntry::getError(), llvm::BitstreamEntry::Kind, SkipBlock(), and llvm::BitstreamEntry::SubBlock.
Referenced by ReadBlockInfoBlock().
|
inline |
Definition at line 225 of file BitstreamReader.h.
References fillCurWord().
Referenced by EnterSubBlock(), and SkipBlock().
|
inline |
Definition at line 219 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), and llvm::MemoryObject::isValidAddress().
Referenced by JumpToBit(), readRecord(), SkipBlock(), and skipRecord().
Having read the ENTER_SUBBLOCK abbrevid, enter the block, and return true if the block has an error.
EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter the block, and return true if the block has an error.
Definition at line 28 of file BitstreamReader.cpp.
References AtEndOfStream(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::Block, llvm::bitc::BlockSizeWidth, llvm::bitc::CodeLenWidth, llvm::BitstreamReader::getBlockInfo(), MaxChunkSize, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), Read(), and ReadVBR().
Referenced by ReadBlockInfoBlock().
|
inline |
Definition at line 316 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), llvm::MemoryObject::readBytes(), and llvm::report_fatal_error().
Referenced by AtEndOfStream(), and Read().
| void BitstreamCursor::freeState | ( | ) |
Definition at line 18 of file BitstreamReader.cpp.
References llvm::SmallVectorImpl< T >::clear().
Referenced by init().
|
inline |
Return the abbreviation for the specified AbbrevId.
Definition at line 494 of file BitstreamReader.h.
References llvm::bitc::FIRST_APPLICATION_ABBREV, and llvm::report_fatal_error().
Referenced by readRecord(), and skipRecord().
|
inline |
Return the number of bits used to encode an abbrev #.
Definition at line 235 of file BitstreamReader.h.
|
inline |
Definition at line 242 of file BitstreamReader.h.
|
inline |
Definition at line 245 of file BitstreamReader.h.
|
inline |
Return the bit # of the bit we are reading.
Definition at line 238 of file BitstreamReader.h.
Referenced by readRecord(), SkipBlock(), and skipRecord().
|
inline |
Definition at line 207 of file BitstreamReader.h.
References freeState().
Referenced by BitstreamCursor().
|
inline |
Reset the stream to the specified bit number.
Definition at line 302 of file BitstreamReader.h.
References canSkipToPos(), and Read().
Referenced by readRecord(), SkipBlock(), and skipRecord().
|
inline |
Definition at line 339 of file BitstreamReader.h.
References fillCurWord(), MaxChunkSize, and R2.
Referenced by EnterSubBlock(), JumpToBit(), readAbbreviatedField(), ReadAbbrevRecord(), ReadCode(), ReadVBR(), ReadVBR64(), skipAbbreviatedField(), and SkipBlock().
| void BitstreamCursor::ReadAbbrevRecord | ( | ) |
Definition at line 256 of file BitstreamReader.cpp.
References llvm::BitCodeAbbrev::Add(), llvm::Data, llvm::BitCodeAbbrevOp::Fixed, llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrevOp::hasEncodingData(), MaxChunkSize, Read(), ReadVBR(), ReadVBR64(), llvm::report_fatal_error(), and llvm::BitCodeAbbrevOp::VBR.
Referenced by advance(), and ReadBlockInfoBlock().
|
inline |
Definition at line 468 of file BitstreamReader.h.
References llvm::SmallVectorBase::empty().
Referenced by advance().
| bool BitstreamCursor::ReadBlockInfoBlock | ( | ) |
Definition at line 294 of file BitstreamReader.cpp.
References llvm::BitstreamReader::BlockInfo::Abbrevs, advanceSkippingSubblocks(), AF_DontAutoprocessAbbrevs, llvm::bitc::BLOCKINFO_BLOCK_ID, llvm::bitc::BLOCKINFO_CODE_BLOCKNAME, llvm::bitc::BLOCKINFO_CODE_SETBID, llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME, llvm::SmallVectorImpl< T >::clear(), llvm::bitc::DEFINE_ABBREV, llvm::BitstreamEntry::EndBlock, EnterSubBlock(), llvm::BitstreamEntry::Error, llvm::BitstreamReader::getOrCreateBlockInfo(), llvm::BitstreamReader::hasBlockInfoRecords(), llvm::BitstreamEntry::ID, llvm::BitstreamReader::isIgnoringBlockInfoNames(), llvm::BitstreamEntry::Kind, llvm::BitstreamReader::BlockInfo::Name, ReadAbbrevRecord(), readRecord(), llvm::BitstreamEntry::Record, llvm::BitstreamReader::BlockInfo::RecordNames, llvm::SmallVectorTemplateCommon< T >::size(), SkipBlock(), and llvm::BitstreamEntry::SubBlock.
|
inline |
| unsigned BitstreamCursor::readRecord | ( | unsigned | AbbrevID, |
| SmallVectorImpl< uint64_t > & | Vals, | ||
| StringRef * | Blob = nullptr |
||
| ) |
Definition at line 159 of file BitstreamReader.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::BitCodeAbbrevOp::Array, llvm::BitCodeAbbrevOp::Blob, canSkipToPos(), llvm::Code, getAbbrev(), llvm::BitstreamReader::getBitcodeBytes(), GetCurrentBitNo(), llvm::BitCodeAbbrevOp::getEncoding(), llvm::MemoryObject::getExtent(), llvm::BitCodeAbbrevOp::getLiteralValue(), llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrev::getOperandInfo(), llvm::MemoryObject::getPointer(), llvm::BitCodeAbbrevOp::isEncoding(), llvm::BitCodeAbbrevOp::isLiteral(), JumpToBit(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), readAbbreviatedField(), ReadVBR(), ReadVBR64(), llvm::report_fatal_error(), and llvm::bitc::UNABBREV_RECORD.
Referenced by ReadBlockInfoBlock().
|
inline |
Having read the ENTER_SUBBLOCK code, read the BlockID for the block.
Definition at line 441 of file BitstreamReader.h.
References llvm::bitc::BlockIDWidth, and ReadVBR().
Referenced by advance().
|
inline |
Definition at line 379 of file BitstreamReader.h.
References Read().
Referenced by EnterSubBlock(), ReadAbbrevRecord(), readRecord(), ReadSubBlockID(), SkipBlock(), and skipRecord().
|
inline |
Definition at line 399 of file BitstreamReader.h.
References Read().
Referenced by readAbbreviatedField(), ReadAbbrevRecord(), readRecord(), skipAbbreviatedField(), and skipRecord().
|
inline |
Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block.
If the block record is malformed, return true.
Definition at line 447 of file BitstreamReader.h.
References AtEndOfStream(), llvm::bitc::BlockSizeWidth, canSkipToPos(), llvm::bitc::CodeLenWidth, GetCurrentBitNo(), JumpToBit(), Read(), and ReadVBR().
Referenced by advanceSkippingSubblocks(), and ReadBlockInfoBlock().
| void BitstreamCursor::skipRecord | ( | unsigned | AbbrevID | ) |
Read the current record and discard it.
skipRecord - Read the current record and discard it.
Definition at line 101 of file BitstreamReader.cpp.
References llvm::BitCodeAbbrevOp::Array, llvm::BitCodeAbbrevOp::Blob, canSkipToPos(), llvm::Code, getAbbrev(), llvm::BitstreamReader::getBitcodeBytes(), GetCurrentBitNo(), llvm::BitCodeAbbrevOp::getEncoding(), llvm::MemoryObject::getExtent(), llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrev::getOperandInfo(), llvm::BitCodeAbbrevOp::isLiteral(), JumpToBit(), ReadVBR(), ReadVBR64(), skipAbbreviatedField(), and llvm::bitc::UNABBREV_RECORD.
|
static |
Definition at line 201 of file BitstreamReader.h.
Referenced by EnterSubBlock(), Read(), readAbbreviatedField(), ReadAbbrevRecord(), and skipAbbreviatedField().
1.8.6