LLVM  10.0.0svn
Public Types | Public Member Functions | Static Public Attributes | List of all members
llvm::SimpleBitstreamCursor Class Reference

This represents a position within a bitstream. More...

#include "llvm/Bitstream/BitstreamReader.h"

Inheritance diagram for llvm::SimpleBitstreamCursor:
Inheritance graph
[legend]
Collaboration diagram for llvm::SimpleBitstreamCursor:
Collaboration graph
[legend]

Public Types

using word_t = size_t
 This is the current data we have pulled from the stream but have not returned to the client. More...
 

Public Member Functions

 SimpleBitstreamCursor ()=default
 
 SimpleBitstreamCursor (ArrayRef< uint8_t > BitcodeBytes)
 
 SimpleBitstreamCursor (StringRef BitcodeBytes)
 
 SimpleBitstreamCursor (MemoryBufferRef BitcodeBytes)
 
bool canSkipToPos (size_t pos) const
 
bool AtEndOfStream ()
 
uint64_t GetCurrentBitNo () const
 Return the bit # of the bit we are reading. More...
 
uint64_t getCurrentByteNo () const
 
ArrayRef< uint8_t > getBitcodeBytes () const
 
Error JumpToBit (uint64_t BitNo)
 Reset the stream to the specified bit number. More...
 
const uint8_t * getPointerToByte (uint64_t ByteNo, uint64_t NumBytes)
 Get a pointer into the bitstream at the specified byte offset. More...
 
const uint8_t * getPointerToBit (uint64_t BitNo, uint64_t NumBytes)
 Get a pointer into the bitstream at the specified bit offset. More...
 
Error fillCurWord ()
 
Expected< word_tRead (unsigned NumBits)
 
Expected< uint32_tReadVBR (unsigned NumBits)
 
Expected< uint64_t > ReadVBR64 (unsigned NumBits)
 
void SkipToFourByteBoundary ()
 
size_t SizeInBytes () const
 Return the size of the stream in bytes. More...
 
void skipToEnd ()
 Skip to the end of the file. More...
 

Static Public Attributes

static const constexpr size_t MaxChunkSize = sizeof(word_t) * 8
 

Detailed Description

This represents a position within a bitstream.

There may be multiple independent cursors reading within one bitstream, each maintaining their own local state.

Definition at line 80 of file BitstreamReader.h.

Member Typedef Documentation

◆ word_t

This is the current data we have pulled from the stream but have not returned to the client.

This is specifically and intentionally defined to follow the word size of the host machine for efficiency. We use word_t in places that are aware of this to make it perfectly explicit what is going on.

Definition at line 90 of file BitstreamReader.h.

Constructor & Destructor Documentation

◆ SimpleBitstreamCursor() [1/4]

llvm::SimpleBitstreamCursor::SimpleBitstreamCursor ( )
default

◆ SimpleBitstreamCursor() [2/4]

llvm::SimpleBitstreamCursor::SimpleBitstreamCursor ( ArrayRef< uint8_t >  BitcodeBytes)
inlineexplicit

Definition at line 103 of file BitstreamReader.h.

◆ SimpleBitstreamCursor() [3/4]

llvm::SimpleBitstreamCursor::SimpleBitstreamCursor ( StringRef  BitcodeBytes)
inlineexplicit

Definition at line 105 of file BitstreamReader.h.

◆ SimpleBitstreamCursor() [4/4]

llvm::SimpleBitstreamCursor::SimpleBitstreamCursor ( MemoryBufferRef  BitcodeBytes)
inlineexplicit

Definition at line 107 of file BitstreamReader.h.

Member Function Documentation

◆ AtEndOfStream()

bool llvm::SimpleBitstreamCursor::AtEndOfStream ( )
inline

◆ canSkipToPos()

bool llvm::SimpleBitstreamCursor::canSkipToPos ( size_t  pos) const
inline

◆ fillCurWord()

Error llvm::SimpleBitstreamCursor::fillCurWord ( )
inline

◆ getBitcodeBytes()

ArrayRef<uint8_t> llvm::SimpleBitstreamCursor::getBitcodeBytes ( ) const
inline

◆ GetCurrentBitNo()

uint64_t llvm::SimpleBitstreamCursor::GetCurrentBitNo ( ) const
inline

◆ getCurrentByteNo()

uint64_t llvm::SimpleBitstreamCursor::getCurrentByteNo ( ) const
inline

◆ getPointerToBit()

const uint8_t* llvm::SimpleBitstreamCursor::getPointerToBit ( uint64_t  BitNo,
uint64_t  NumBytes 
)
inline

Get a pointer into the bitstream at the specified bit offset.

The bit offset must be on a byte boundary.

Definition at line 158 of file BitstreamReader.h.

References assert().

◆ getPointerToByte()

const uint8_t* llvm::SimpleBitstreamCursor::getPointerToByte ( uint64_t  ByteNo,
uint64_t  NumBytes 
)
inline

Get a pointer into the bitstream at the specified byte offset.

Definition at line 151 of file BitstreamReader.h.

References llvm::ArrayRef< T >::data().

Referenced by llvm::BitstreamCursor::BitstreamCursor().

◆ JumpToBit()

Error llvm::SimpleBitstreamCursor::JumpToBit ( uint64_t  BitNo)
inline

◆ Read()

Expected<word_t> llvm::SimpleBitstreamCursor::Read ( unsigned  NumBits)
inline

◆ ReadVBR()

Expected<uint32_t> llvm::SimpleBitstreamCursor::ReadVBR ( unsigned  NumBits)
inline

◆ ReadVBR64()

Expected<uint64_t> llvm::SimpleBitstreamCursor::ReadVBR64 ( unsigned  NumBits)
inline

◆ SizeInBytes()

size_t llvm::SimpleBitstreamCursor::SizeInBytes ( ) const
inline

Return the size of the stream in bytes.

Definition at line 298 of file BitstreamReader.h.

References llvm::ArrayRef< T >::size().

Referenced by llvm::BitstreamCursor::BitstreamCursor().

◆ skipToEnd()

void llvm::SimpleBitstreamCursor::skipToEnd ( )
inline

◆ SkipToFourByteBoundary()

void llvm::SimpleBitstreamCursor::SkipToFourByteBoundary ( )
inline

Member Data Documentation

◆ MaxChunkSize

const constexpr size_t llvm::SimpleBitstreamCursor::MaxChunkSize = sizeof(word_t) * 8
static

Definition at line 100 of file BitstreamReader.h.


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