LLVM API Documentation

Classes | Public Types | Public Member Functions | Friends
llvm::BitstreamCursor Class Reference

#include <BitstreamReader.h>

List of all members.

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 (BitstreamReader &R)
void init (BitstreamReader &R)
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.
BitstreamReadergetBitStreamReader ()
const BitstreamReadergetBitStreamReader () 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=nullptr)
bool ReadBlockEnd ()
const BitCodeAbbrevgetAbbrev (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=nullptr)
void ReadAbbrevRecord ()
bool ReadBlockInfoBlock ()

Friends

class Deserializer

Detailed Description

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 176 of file BitstreamReader.h.


Member Enumeration Documentation

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 269 of file BitstreamReader.h.


Constructor & Destructor Documentation

Definition at line 212 of file BitstreamReader.h.

Definition at line 214 of file BitstreamReader.h.


Member Function Documentation

advanceSkippingSubblocks - This is a convenience function for clients that don't expect any subblocks. This just skips over them automatically.

Definition at line 309 of file BitstreamReader.h.

References advance(), llvm::BitstreamEntry::getError(), llvm::BitstreamEntry::Kind, SkipBlock(), and llvm::BitstreamEntry::SubBlock.

Referenced by ReadBlockInfoBlock().

Definition at line 249 of file BitstreamReader.h.

References isEndPos().

Referenced by EnterSubBlock(), llvm::BitcodeReader::ParseBitcodeInto(), and SkipBlock().

bool llvm::BitstreamCursor::canSkipToPos ( size_t  pos) const [inline]
bool BitstreamCursor::EnterSubBlock ( unsigned  BlockID,
unsigned NumWordsP = nullptr 
)

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::bitc::BlockSizeWidth, llvm::bitc::CodeLenWidth, llvm::BitstreamReader::getBlockInfo(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), Read(), and ReadVBR().

Referenced by ReadBlockInfoBlock().

Definition at line 18 of file BitstreamReader.cpp.

References llvm::SmallVectorImpl< T >::clear().

Referenced by init().

getAbbrev - Return the abbreviation for the specified AbbrevId.

Definition at line 528 of file BitstreamReader.h.

References llvm::bitc::FIRST_APPLICATION_ABBREV.

Referenced by readRecord(), and skipRecord().

getAbbrevIDWidth - Return the number of bits used to encode an abbrev #.

Definition at line 254 of file BitstreamReader.h.

Referenced by llvm::BitcodeReader::ParseBitcodeInto().

Definition at line 261 of file BitstreamReader.h.

Definition at line 264 of file BitstreamReader.h.

uint64_t llvm::BitstreamCursor::GetCurrentBitNo ( ) const [inline]

GetCurrentBitNo - Return the bit # of the bit we are reading.

Definition at line 257 of file BitstreamReader.h.

Referenced by readRecord(), SkipBlock(), and skipRecord().

uint32_t llvm::BitstreamCursor::getWord ( size_t  pos) [inline]

Definition at line 221 of file BitstreamReader.h.

References freeState().

bool llvm::BitstreamCursor::isEndPos ( size_t  pos) [inline]
void llvm::BitstreamCursor::JumpToBit ( uint64_t  BitNo) [inline]

JumpToBit - Reset the stream to the specified bit number.

Definition at line 323 of file BitstreamReader.h.

References canSkipToPos(), Read(), and Read64().

Referenced by llvm::BitcodeReader::Materialize(), readRecord(), SkipBlock(), and skipRecord().

uint32_t llvm::BitstreamCursor::Read ( unsigned  NumBits) [inline]
uint64_t llvm::BitstreamCursor::Read64 ( unsigned  NumBits) [inline]

Definition at line 395 of file BitstreamReader.h.

References Read().

Referenced by JumpToBit().

Definition at line 494 of file BitstreamReader.h.

References llvm::SmallVectorBase::empty().

Referenced by advance().

Definition at line 456 of file BitstreamReader.h.

References Read().

Referenced by advance().

unsigned BitstreamCursor::readRecord ( unsigned  AbbrevID,
SmallVectorImpl< uint64_t > &  Vals,
StringRef Blob = nullptr 
)

ReadSubBlockID - Having read the ENTER_SUBBLOCK code, read the BlockID for the block.

Definition at line 466 of file BitstreamReader.h.

References llvm::bitc::BlockIDWidth, and ReadVBR().

Referenced by advance().

uint32_t llvm::BitstreamCursor::ReadVBR ( unsigned  NumBits) [inline]

Definition at line 402 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 422 of file BitstreamReader.h.

References Read().

Referenced by ReadAbbrevRecord(), readRecord(), and skipRecord().

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 473 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().


Friends And Related Function Documentation

friend class Deserializer [friend]

Definition at line 177 of file BitstreamReader.h.


The documentation for this class was generated from the following files: