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 (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.
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=0)
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=0)
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 168 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 271 of file BitstreamReader.h.


Constructor & Destructor Documentation

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


Member Function Documentation

BitstreamEntry llvm::BitstreamCursor::advance ( unsigned  Flags = 0) [inline]
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]
bool BitstreamCursor::EnterSubBlock ( unsigned  BlockID,
unsigned NumWordsP = 0 
)

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 ( )
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]
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]
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)
uint32_t llvm::BitstreamCursor::Read ( unsigned  NumBits) [inline]
uint64_t llvm::BitstreamCursor::Read64 ( unsigned  NumBits) [inline]

Definition at line 397 of file BitstreamReader.h.

References Read().

Referenced by JumpToBit().

void BitstreamCursor::ReadAbbrevRecord ( )
bool llvm::BitstreamCursor::ReadBlockEnd ( ) [inline]

Definition at line 496 of file BitstreamReader.h.

References llvm::SmallVectorBase::empty().

Referenced by advance().

bool BitstreamCursor::ReadBlockInfoBlock ( )
unsigned llvm::BitstreamCursor::ReadCode ( ) [inline]

Definition at line 458 of file BitstreamReader.h.

References Read().

Referenced by advance().

unsigned BitstreamCursor::readRecord ( unsigned  AbbrevID,
SmallVectorImpl< uint64_t > &  Vals,
StringRef Blob = 0 
)
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)

Friends And Related Function Documentation

friend class Deserializer [friend]

Definition at line 169 of file BitstreamReader.h.


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