|
LLVM 24.0.0git
|
This represents a position within a bitstream. More...
#include "llvm/Bitstream/BitstreamReader.h"
Public Types | |
| using | word_t = size_t |
| The type of the values returned by Read. | |
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. | |
| uint64_t | getCurrentByteNo () const |
| ArrayRef< uint8_t > | getBitcodeBytes () const |
| Error | JumpToBit (uint64_t NewBitNo) |
| Reset the stream to the specified bit number. | |
| const uint8_t * | getPointerToByte (uint64_t ByteNo, uint64_t NumBytes) |
| Get a pointer into the bitstream at the specified byte offset. | |
| const uint8_t * | getPointerToBit (uint64_t BitNo, uint64_t NumBytes) |
| Get a pointer into the bitstream at the specified bit offset. | |
| Expected< word_t > | Read (unsigned NumBits) |
| LLVM_ABI Expected< word_t > | readSlow (unsigned NumBits) |
Read NumBits bits that don't fit in a word load from the current byte, or are near the end of the stream. | |
| Expected< uint32_t > | ReadVBR (const unsigned NumBits) |
| Expected< uint64_t > | ReadVBR64 (const unsigned NumBits) |
| void | SkipToFourByteBoundary () |
| size_t | SizeInBytes () const |
| Return the size of the stream in bytes. | |
| uint64_t | sizeInBits () const |
| Return the size of the stream in bits. | |
| void | skipToEnd () |
| Skip to the end of the file. | |
| bool | isSizePlausible (size_t Size) const |
| Check whether a reservation of Size elements is plausible. | |
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 82 of file BitstreamReader.h.
The type of the values returned by Read.
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 96 of file BitstreamReader.h.
|
default |
|
inlineexplicit |
Definition at line 103 of file BitstreamReader.h.
References llvm::size().
|
inlineexplicit |
Definition at line 108 of file BitstreamReader.h.
References llvm::arrayRefFromStringRef(), and SimpleBitstreamCursor().
|
inlineexplicit |
Definition at line 110 of file BitstreamReader.h.
References SimpleBitstreamCursor().
|
inline |
Definition at line 118 of file BitstreamReader.h.
References sizeInBits().
Definition at line 113 of file BitstreamReader.h.
Referenced by JumpToBit().
Definition at line 126 of file BitstreamReader.h.
|
inline |
Return the bit # of the bit we are reading.
Definition at line 121 of file BitstreamReader.h.
References uint64_t.
Referenced by getCurrentByteNo().
|
inline |
Definition at line 124 of file BitstreamReader.h.
References GetCurrentBitNo(), and uint64_t.
|
inline |
Get a pointer into the bitstream at the specified bit offset.
The bit offset must be on a byte boundary.
Definition at line 148 of file BitstreamReader.h.
References assert(), getPointerToByte(), and uint64_t.
Referenced by llvm::BitstreamCursor::readRecord().
|
inline |
Get a pointer into the bitstream at the specified byte offset.
Definition at line 141 of file BitstreamReader.h.
References uint64_t.
Referenced by getPointerToBit().
Check whether a reservation of Size elements is plausible.
Definition at line 264 of file BitstreamReader.h.
References llvm::Size.
Referenced by llvm::BitstreamCursor::readRecord().
Reset the stream to the specified bit number.
Definition at line 129 of file BitstreamReader.h.
References assert(), canSkipToPos(), llvm::createStringError(), sizeInBits(), llvm::Error::success(), and uint64_t.
Definition at line 164 of file BitstreamReader.h.
References assert(), and readSlow().
| Expected< SimpleBitstreamCursor::word_t > SimpleBitstreamCursor::readSlow | ( | unsigned | NumBits | ) |
Read NumBits bits that don't fit in a word load from the current byte, or are near the end of the stream.
Definition at line 27 of file BitstreamReader.cpp.
References llvm::createStringError(), llvm::little, llvm::support::endian::readAtBitAlignment(), sizeInBits(), and llvm::support::unaligned.
Referenced by Read().
Definition at line 183 of file BitstreamReader.h.
References assert(), llvm::createStringError(), llvm::Expected< T >::get(), and llvm::Read.
Definition at line 218 of file BitstreamReader.h.
References assert(), llvm::createStringError(), llvm::Expected< T >::get(), llvm::Read, and uint64_t.
|
inline |
Return the size of the stream in bits.
Definition at line 258 of file BitstreamReader.h.
References uint64_t.
Referenced by AtEndOfStream(), JumpToBit(), readSlow(), skipToEnd(), and SkipToFourByteBoundary().
|
inline |
Return the size of the stream in bytes.
Definition at line 255 of file BitstreamReader.h.
|
inline |
Skip to the end of the file.
Definition at line 261 of file BitstreamReader.h.
References sizeInBits().
|
inline |
Definition at line 250 of file BitstreamReader.h.
References llvm::alignTo(), and sizeInBits().
Referenced by llvm::BitstreamCursor::EnterSubBlock(), llvm::BitstreamCursor::ReadBlockEnd(), llvm::BitstreamCursor::readRecord(), llvm::BitstreamCursor::SkipBlock(), and llvm::BitstreamCursor::skipRecord().