LLVM API Documentation
#include <BitstreamReader.h>
Classes | |
| struct | Block |
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 #. | |
| uint64_t | GetCurrentBitNo () const |
| GetCurrentBitNo - Return the bit # of the bit we are reading. | |
| 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. | |
| 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. | |
| void | skipRecord (unsigned AbbrevID) |
| skipRecord - Read the current record and discard it. | |
| 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().
| 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.
| llvm::BitstreamCursor::BitstreamCursor | ( | ) | [inline] |
Definition at line 204 of file BitstreamReader.h.
| llvm::BitstreamCursor::BitstreamCursor | ( | const BitstreamCursor & | RHS | ) | [inline] |
Definition at line 206 of file BitstreamReader.h.
References operator=().
| llvm::BitstreamCursor::BitstreamCursor | ( | BitstreamReader & | R | ) | [inline, explicit] |
Definition at line 210 of file BitstreamReader.h.
| llvm::BitstreamCursor::~BitstreamCursor | ( | ) | [inline] |
Definition at line 227 of file BitstreamReader.h.
References freeState().
| BitstreamEntry llvm::BitstreamCursor::advance | ( | unsigned | Flags = 0 | ) | [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().
| BitstreamEntry llvm::BitstreamCursor::advanceSkippingSubblocks | ( | unsigned | Flags = 0 | ) | [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().
| bool llvm::BitstreamCursor::AtEndOfStream | ( | ) | [inline] |
Definition at line 251 of file BitstreamReader.h.
References isEndPos().
Referenced by EnterSubBlock(), llvm::BitcodeReader::ParseBitcodeInto(), and SkipBlock().
| bool llvm::BitstreamCursor::canSkipToPos | ( | size_t | pos | ) | const [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().
| const BitCodeAbbrev* llvm::BitstreamCursor::getAbbrev | ( | unsigned | AbbrevID | ) | [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().
| unsigned llvm::BitstreamCursor::getAbbrevIDWidth | ( | ) | const [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().
| BitstreamReader* llvm::BitstreamCursor::getBitStreamReader | ( | ) | [inline] |
Definition at line 263 of file BitstreamReader.h.
| const BitstreamReader* llvm::BitstreamCursor::getBitStreamReader | ( | ) | const [inline] |
Definition at line 266 of file BitstreamReader.h.
| uint64_t llvm::BitstreamCursor::GetCurrentBitNo | ( | ) | const [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().
| uint32_t llvm::BitstreamCursor::getWord | ( | size_t | pos | ) | [inline] |
Definition at line 245 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), and llvm::StreamableMemoryObject::readBytes().
| void llvm::BitstreamCursor::init | ( | BitstreamReader & | R | ) | [inline] |
Definition at line 217 of file BitstreamReader.h.
References freeState().
| bool llvm::BitstreamCursor::isEndPos | ( | size_t | pos | ) | [inline] |
Definition at line 235 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), and llvm::StreamableMemoryObject::isObjectEnd().
Referenced by AtEndOfStream(), and Read().
| void llvm::BitstreamCursor::JumpToBit | ( | uint64_t | BitNo | ) | [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().
| uint32_t llvm::BitstreamCursor::Read | ( | unsigned | NumBits | ) | [inline] |
Definition at line 345 of file BitstreamReader.h.
References llvm::BitstreamReader::getBitcodeBytes(), isEndPos(), llvm::support::little, llvm::LibFunc::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().
| uint64_t llvm::BitstreamCursor::Read64 | ( | unsigned | NumBits | ) | [inline] |
| void BitstreamCursor::ReadAbbrevRecord | ( | ) |
Definition at line 280 of file BitstreamReader.cpp.
References llvm::BitCodeAbbrev::Add(), llvm::object::macho::Data, llvm::BitCodeAbbrevOp::Fixed, llvm::BitCodeAbbrevOp::hasEncodingData(), Read(), ReadVBR(), ReadVBR64(), and llvm::BitCodeAbbrevOp::VBR.
Referenced by advance(), and ReadBlockInfoBlock().
| bool llvm::BitstreamCursor::ReadBlockEnd | ( | ) | [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().
| unsigned llvm::BitstreamCursor::ReadCode | ( | ) | [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().
| unsigned llvm::BitstreamCursor::ReadSubBlockID | ( | ) | [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().
| uint32_t llvm::BitstreamCursor::ReadVBR | ( | unsigned | NumBits | ) | [inline] |
Definition at line 404 of file BitstreamReader.h.
References Read().
Referenced by EnterSubBlock(), ReadAbbrevRecord(), readRecord(), ReadSubBlockID(), SkipBlock(), and skipRecord().
| uint64_t llvm::BitstreamCursor::ReadVBR64 | ( | unsigned | NumBits | ) | [inline] |
Definition at line 424 of file BitstreamReader.h.
References Read().
Referenced by ReadAbbrevRecord(), readRecord(), and skipRecord().
| bool llvm::BitstreamCursor::SkipBlock | ( | ) | [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 class Deserializer [friend] |
Definition at line 169 of file BitstreamReader.h.