LLVM API Documentation
#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 (const BitstreamCursor &RHS) | |
BitstreamCursor (BitstreamReader &R) | |
void | init (BitstreamReader &R) |
~BitstreamCursor () | |
void | operator= (const BitstreamCursor &RHS) |
void | freeState () |
bool | isEndPos (size_t pos) |
bool | canSkipToPos (size_t pos) const |
uint32_t | getWord (size_t pos) |
bool | AtEndOfStream () |
unsigned | getAbbrevIDWidth () const |
getAbbrevIDWidth - Return the number of bits used to encode an abbrev #. More... | |
uint64_t | GetCurrentBitNo () const |
GetCurrentBitNo - Return the bit # of the bit we are reading. More... | |
BitstreamReader * | getBitStreamReader () |
const BitstreamReader * | getBitStreamReader () const |
BitstreamEntry | advance (unsigned Flags=0) |
BitstreamEntry | advanceSkippingSubblocks (unsigned Flags=0) |
void | JumpToBit (uint64_t BitNo) |
JumpToBit - Reset the stream to the specified bit number. More... | |
uint32_t | Read (unsigned NumBits) |
uint64_t | Read64 (unsigned NumBits) |
uint32_t | ReadVBR (unsigned NumBits) |
uint64_t | ReadVBR64 (unsigned NumBits) |
unsigned | ReadCode () |
unsigned | ReadSubBlockID () |
bool | SkipBlock () |
bool | EnterSubBlock (unsigned BlockID, unsigned *NumWordsP=0) |
bool | ReadBlockEnd () |
const BitCodeAbbrev * | getAbbrev (unsigned AbbrevID) |
getAbbrev - Return the abbreviation for the specified AbbrevId. More... | |
void | skipRecord (unsigned AbbrevID) |
skipRecord - Read the current record and discard it. More... | |
unsigned | readRecord (unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=0) |
void | ReadAbbrevRecord () |
bool | ReadBlockInfoBlock () |
Friends | |
class | Deserializer |
BitstreamCursor - 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 168 of file BitstreamReader.h.
anonymous enum |
Flags that modify the behavior of advance().
Enumerator | |
---|---|
AF_DontPopBlockAtEnd |
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 |
AF_DontAutoprocessAbbrevs - If this flag is used, abbrev entries are returned just like normal records. |
Definition at line 271 of file BitstreamReader.h.
|
inline |
Definition at line 204 of file BitstreamReader.h.
|
inline |
Definition at line 206 of file BitstreamReader.h.
References operator=().
|
inlineexplicit |
Definition at line 210 of file BitstreamReader.h.
|
inline |
Definition at line 227 of file BitstreamReader.h.
References freeState().
|
inline |
advance - Advance the current bitstream, returning the next entry in the stream.
Definition at line 284 of file BitstreamReader.h.
References AF_DontAutoprocessAbbrevs, AF_DontPopBlockAtEnd, llvm::tgtok::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(), llvm::BitcodeReader::ParseBitcodeInto(), and llvm::BitcodeReader::ParseTriple().
|
inline |
advanceSkippingSubblocks - This is a convenience function for clients that don't expect any subblocks. This just skips over them automatically.
Definition at line 311 of file BitstreamReader.h.
References advance(), llvm::BitstreamEntry::getError(), llvm::BitstreamEntry::Kind, SkipBlock(), and llvm::BitstreamEntry::SubBlock.
Referenced by ReadBlockInfoBlock().
|
inline |
Definition at line 251 of file BitstreamReader.h.
References isEndPos().
Referenced by EnterSubBlock(), llvm::BitcodeReader::ParseBitcodeInto(), and SkipBlock().
|
inline |
Definition at line 239 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), and llvm::StreamableMemoryObject::isValidAddress().
Referenced by JumpToBit(), readRecord(), SkipBlock(), and skipRecord().
EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter the block, and return true if the block has an error.
Definition at line 58 of file BitstreamReader.cpp.
References AtEndOfStream(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::bitc::BlockSizeWidth, llvm::bitc::CodeLenWidth, llvm::BitstreamReader::getBlockInfo(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), Read(), and ReadVBR().
Referenced by ReadBlockInfoBlock().
void BitstreamCursor::freeState | ( | ) |
Definition at line 41 of file BitstreamReader.cpp.
References llvm::SmallVectorImpl< T >::clear(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by init(), operator=(), and ~BitstreamCursor().
|
inline |
getAbbrev - Return the abbreviation for the specified AbbrevId.
Definition at line 535 of file BitstreamReader.h.
References llvm::bitc::FIRST_APPLICATION_ABBREV.
Referenced by readRecord(), and skipRecord().
|
inline |
getAbbrevIDWidth - Return the number of bits used to encode an abbrev #.
Definition at line 256 of file BitstreamReader.h.
Referenced by llvm::BitcodeReader::ParseBitcodeInto().
|
inline |
Definition at line 263 of file BitstreamReader.h.
|
inline |
Definition at line 266 of file BitstreamReader.h.
|
inline |
GetCurrentBitNo - Return the bit # of the bit we are reading.
Definition at line 259 of file BitstreamReader.h.
Referenced by readRecord(), SkipBlock(), and skipRecord().
|
inline |
Definition at line 245 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), and llvm::StreamableMemoryObject::readBytes().
|
inline |
Definition at line 217 of file BitstreamReader.h.
References freeState().
|
inline |
Definition at line 235 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), and llvm::StreamableMemoryObject::isObjectEnd().
Referenced by AtEndOfStream(), and Read().
|
inline |
JumpToBit - Reset the stream to the specified bit number.
Definition at line 325 of file BitstreamReader.h.
References canSkipToPos(), Read(), and Read64().
Referenced by llvm::BitcodeReader::Materialize(), readRecord(), SkipBlock(), and skipRecord().
void BitstreamCursor::operator= | ( | const BitstreamCursor & | RHS | ) |
Definition at line 18 of file BitstreamReader.cpp.
References freeState(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by BitstreamCursor().
|
inline |
Definition at line 345 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), isEndPos(), llvm::support::little, llvm::Intrinsic::memcpy, llvm::StreamableMemoryObject::readBytes(), and llvm::support::unaligned.
Referenced by EnterSubBlock(), JumpToBit(), llvm::BitcodeReader::ParseBitcodeInto(), llvm::BitcodeReader::ParseTriple(), Read64(), ReadAbbrevRecord(), ReadCode(), ReadVBR(), ReadVBR64(), and SkipBlock().
|
inline |
void BitstreamCursor::ReadAbbrevRecord | ( | ) |
Definition at line 280 of file BitstreamReader.cpp.
References llvm::BitCodeAbbrev::Add(), llvm::BitCodeAbbrevOp::Fixed, llvm::BitCodeAbbrevOp::hasEncodingData(), Read(), ReadVBR(), ReadVBR64(), and llvm::BitCodeAbbrevOp::VBR.
Referenced by advance(), and ReadBlockInfoBlock().
|
inline |
Definition at line 496 of file BitstreamReader.h.
References llvm::SmallVectorBase::empty().
Referenced by advance().
bool BitstreamCursor::ReadBlockInfoBlock | ( | ) |
Definition at line 310 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.
Referenced by llvm::BitcodeReader::ParseBitcodeInto().
|
inline |
unsigned BitstreamCursor::readRecord | ( | unsigned | AbbrevID, |
SmallVectorImpl< uint64_t > & | Vals, | ||
StringRef * | Blob = 0 |
||
) |
Definition at line 194 of file BitstreamReader.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::BitCodeAbbrevOp::Array, llvm::BitCodeAbbrevOp::Blob, canSkipToPos(), llvm::tgtok::Code, getAbbrev(), llvm::BitstreamReader::getBitcodeBytes(), GetCurrentBitNo(), llvm::BitCodeAbbrevOp::getEncoding(), llvm::StreamableMemoryObject::getExtent(), llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrev::getOperandInfo(), llvm::StreamableMemoryObject::getPointer(), llvm::BitCodeAbbrevOp::isLiteral(), JumpToBit(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), ReadVBR(), ReadVBR64(), and llvm::bitc::UNABBREV_RECORD.
Referenced by ReadBlockInfoBlock().
|
inline |
ReadSubBlockID - Having read the ENTER_SUBBLOCK code, read the BlockID for the block.
Definition at line 468 of file BitstreamReader.h.
References llvm::bitc::BlockIDWidth, and ReadVBR().
Referenced by advance().
|
inline |
Definition at line 404 of file BitstreamReader.h.
References Read().
Referenced by EnterSubBlock(), ReadAbbrevRecord(), readRecord(), ReadSubBlockID(), SkipBlock(), and skipRecord().
|
inline |
Definition at line 424 of file BitstreamReader.h.
References Read().
Referenced by ReadAbbrevRecord(), readRecord(), and skipRecord().
|
inline |
SkipBlock - 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 475 of file BitstreamReader.h.
References AtEndOfStream(), llvm::bitc::BlockSizeWidth, canSkipToPos(), llvm::bitc::CodeLenWidth, GetCurrentBitNo(), JumpToBit(), Read(), and ReadVBR().
Referenced by advanceSkippingSubblocks(), llvm::BitcodeReader::ParseBitcodeInto(), llvm::BitcodeReader::ParseTriple(), and ReadBlockInfoBlock().
void BitstreamCursor::skipRecord | ( | unsigned | AbbrevID | ) |
skipRecord - Read the current record and discard it.
Definition at line 136 of file BitstreamReader.cpp.
References llvm::BitCodeAbbrevOp::Array, llvm::BitCodeAbbrevOp::Blob, canSkipToPos(), llvm::tgtok::Code, getAbbrev(), llvm::BitstreamReader::getBitcodeBytes(), GetCurrentBitNo(), llvm::BitCodeAbbrevOp::getEncoding(), llvm::StreamableMemoryObject::getExtent(), llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrev::getOperandInfo(), llvm::BitCodeAbbrevOp::isLiteral(), JumpToBit(), ReadVBR(), ReadVBR64(), and llvm::bitc::UNABBREV_RECORD.
Referenced by llvm::BitcodeReader::ParseTriple().
|
friend |
Definition at line 169 of file BitstreamReader.h.