|
LLVM
10.0.0
|
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor. More...
#include "llvm/Bitstream/BitstreamReader.h"
Public Types | |
| enum | { AF_DontPopBlockAtEnd = 1, AF_DontAutoprocessAbbrevs = 2 } |
| Flags that modify the behavior of advance(). More... | |
Public Member Functions | |
| BitstreamCursor ()=default | |
| BitstreamCursor (ArrayRef< uint8_t > BitcodeBytes) | |
| BitstreamCursor (StringRef BitcodeBytes) | |
| BitstreamCursor (MemoryBufferRef BitcodeBytes) | |
| unsigned | getAbbrevIDWidth () const |
| Return the number of bits used to encode an abbrev #. More... | |
| Expected< BitstreamEntry > | advance (unsigned Flags=0) |
| Advance the current bitstream, returning the next entry in the stream. More... | |
| Expected< BitstreamEntry > | advanceSkippingSubblocks (unsigned Flags=0) |
| This is a convenience function for clients that don't expect any subblocks. More... | |
| Expected< unsigned > | ReadCode () |
| Expected< unsigned > | ReadSubBlockID () |
| Having read the ENTER_SUBBLOCK code, read the BlockID for the block. More... | |
| Error | SkipBlock () |
| Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block. More... | |
| Error | EnterSubBlock (unsigned BlockID, unsigned *NumWordsP=nullptr) |
| Having read the ENTER_SUBBLOCK abbrevid, and enter the block. More... | |
| bool | ReadBlockEnd () |
| const BitCodeAbbrev * | getAbbrev (unsigned AbbrevID) |
| Return the abbreviation for the specified AbbrevId. More... | |
| Expected< unsigned > | skipRecord (unsigned AbbrevID) |
| Read the current record and discard it, returning the code for the record. More... | |
| Expected< unsigned > | readRecord (unsigned AbbrevID, SmallVectorImpl< uint64_t > &Vals, StringRef *Blob=nullptr) |
| Error | ReadAbbrevRecord () |
| Expected< Optional< BitstreamBlockInfo > > | ReadBlockInfoBlock (bool ReadBlockInfoNames=false) |
| Read and return a block info block from the bitstream. More... | |
| void | setBlockInfo (BitstreamBlockInfo *BI) |
| Set the block info to be used by this BitstreamCursor to interpret abbreviated records. More... | |
Static Public Attributes | |
| static const size_t | MaxChunkSize = sizeof(word_t) * 8 |
This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor.
Unlike iterators, BitstreamCursors are heavy-weight objects that should not be passed by value.
Definition at line 339 of file BitstreamReader.h.
| anonymous enum |
Flags that modify the behavior of advance().
| Enumerator | |
|---|---|
| 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 | If this flag is used, abbrev entries are returned just like normal records. |
Definition at line 388 of file BitstreamReader.h.
|
default |
|
inlineexplicit |
Definition at line 363 of file BitstreamReader.h.
|
inlineexplicit |
Definition at line 365 of file BitstreamReader.h.
|
inlineexplicit |
Definition at line 367 of file BitstreamReader.h.
References llvm::SimpleBitstreamCursor::AtEndOfStream(), llvm::SimpleBitstreamCursor::canSkipToPos(), llvm::SimpleBitstreamCursor::fillCurWord(), llvm::SimpleBitstreamCursor::getBitcodeBytes(), llvm::SimpleBitstreamCursor::GetCurrentBitNo(), llvm::SimpleBitstreamCursor::getCurrentByteNo(), llvm::SimpleBitstreamCursor::getPointerToByte(), llvm::SimpleBitstreamCursor::JumpToBit(), llvm::SimpleBitstreamCursor::Read(), llvm::SimpleBitstreamCursor::ReadVBR(), llvm::SimpleBitstreamCursor::ReadVBR64(), llvm::SimpleBitstreamCursor::SizeInBytes(), and llvm::SimpleBitstreamCursor::skipToEnd().
|
inline |
Advance the current bitstream, returning the next entry in the stream.
Definition at line 399 of file BitstreamReader.h.
References llvm::bitc::DEFINE_ABBREV, llvm::bitc::END_BLOCK, llvm::bitc::ENTER_SUBBLOCK, llvm::Expected< T >::get(), llvm::BitstreamEntry::getEndBlock(), llvm::BitstreamEntry::getError(), llvm::BitstreamEntry::getSubBlock(), and llvm::Expected< T >::takeError().
Referenced by llvm::getBitcodeFileContents(), isBlock(), jumpToValueSymbolTable(), parseBlock(), llvm::remarks::BitstreamParserHelper::parseBlockInfoBlock(), and readTriple().
|
inline |
This is a convenience function for clients that don't expect any subblocks.
This just skips over them automatically.
Definition at line 438 of file BitstreamReader.h.
References llvm::Expected< T >::get(), llvm::BitstreamEntry::Kind, and llvm::BitstreamEntry::SubBlock.
Referenced by llvm::MetadataLoader::MetadataLoaderImpl::upgradeDebugIntrinsics().
Having read the ENTER_SUBBLOCK abbrevid, and enter the block.
Having read the ENTER_SUBBLOCK abbrevid, enter the block.
Definition at line 21 of file BitstreamReader.cpp.
References llvm::SimpleBitstreamCursor::AtEndOfStream(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::bitc::BlockSizeWidth, llvm::bitc::CodeLenWidth, llvm::createStringError(), llvm::Expected< T >::get(), llvm::BitstreamBlockInfo::getBlockInfo(), Info, MaxChunkSize, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SimpleBitstreamCursor::Read(), llvm::SimpleBitstreamCursor::ReadVBR(), llvm::SimpleBitstreamCursor::SkipToFourByteBoundary(), llvm::Error::success(), and llvm::Expected< T >::takeError().
Referenced by parseBlock().
|
inline |
Return the abbreviation for the specified AbbrevId.
Definition at line 524 of file BitstreamReader.h.
References llvm::bitc::FIRST_APPLICATION_ABBREV, and llvm::report_fatal_error().
Referenced by readRecord(), and skipRecord().
|
inline |
Return the number of bits used to encode an abbrev #.
Definition at line 385 of file BitstreamReader.h.
Referenced by jumpToValueSymbolTable().
| Error BitstreamCursor::ReadAbbrevRecord | ( | ) |
Definition at line 345 of file BitstreamReader.cpp.
References llvm::Data, E, llvm::BitCodeAbbrevOp::Fixed, llvm::Expected< T >::get(), llvm::BitCodeAbbrevOp::hasEncodingData(), MaxChunkSize, llvm::SimpleBitstreamCursor::Read(), llvm::SimpleBitstreamCursor::ReadVBR(), llvm::SimpleBitstreamCursor::ReadVBR64(), llvm::report_fatal_error(), llvm::Error::success(), llvm::Expected< T >::takeError(), and llvm::BitCodeAbbrevOp::VBR.
|
inline |
Definition at line 499 of file BitstreamReader.h.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase::empty(), and llvm::SmallVectorTemplateBase< T, bool >::pop_back().
| Expected< Optional< BitstreamBlockInfo > > BitstreamCursor::ReadBlockInfoBlock | ( | bool | ReadBlockInfoNames = false | ) |
Read and return a block info block from the bitstream.
If an error was encountered, return None.
| ReadBlockInfoNames | Whether to read block/record name information in the BlockInfo block. Only llvm-bcanalyzer uses this. |
Definition at line 402 of file BitstreamReader.cpp.
Referenced by llvm::BitcodeAnalyzer::analyze(), llvm::remarks::BitstreamParserHelper::parseBlockInfoBlock(), and llvm::BitcodeAnalyzer::printStats().
Definition at line 455 of file BitstreamReader.h.
Referenced by llvm::BitcodeAnalyzer::analyze().
| Expected< unsigned > BitstreamCursor::readRecord | ( | unsigned | AbbrevID, |
| SmallVectorImpl< uint64_t > & | Vals, | ||
| StringRef * | Blob = nullptr |
||
| ) |
Definition at line 205 of file BitstreamReader.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::BitCodeAbbrevOp::Array, assert(), llvm::BitCodeAbbrevOp::Blob, llvm::SimpleBitstreamCursor::canSkipToPos(), llvm::BitCodeAbbrevOp::Char6, llvm::BitCodeAbbrevOp::DecodeChar6(), llvm::numbers::e, llvm::BitCodeAbbrevOp::Fixed, llvm::Expected< T >::get(), getAbbrev(), llvm::SimpleBitstreamCursor::GetCurrentBitNo(), llvm::BitCodeAbbrevOp::getEncoding(), llvm::BitCodeAbbrevOp::getEncodingData(), llvm::BitCodeAbbrevOp::getLiteralValue(), llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrev::getOperandInfo(), llvm::BitCodeAbbrevOp::isEncoding(), llvm::BitCodeAbbrevOp::isLiteral(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SimpleBitstreamCursor::Read(), readAbbreviatedField(), llvm::SimpleBitstreamCursor::ReadVBR(), llvm::SimpleBitstreamCursor::ReadVBR64(), llvm::report_fatal_error(), llvm::SimpleBitstreamCursor::skipToEnd(), llvm::SimpleBitstreamCursor::SkipToFourByteBoundary(), llvm::Expected< T >::takeError(), llvm::bitc::UNABBREV_RECORD, and llvm::BitCodeAbbrevOp::VBR.
Referenced by parseRecord().
Having read the ENTER_SUBBLOCK code, read the BlockID for the block.
Definition at line 461 of file BitstreamReader.h.
References llvm::bitc::BlockIDWidth.
Referenced by llvm::BitcodeAnalyzer::analyze().
|
inline |
Set the block info to be used by this BitstreamCursor to interpret abbreviated records.
Definition at line 553 of file BitstreamReader.h.
Referenced by llvm::BitcodeAnalyzer::analyze(), and llvm::remarks::BitstreamParserHelper::parseBlockInfoBlock().
|
inline |
Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block.
Definition at line 465 of file BitstreamReader.h.
References llvm::BitstreamBlockInfo::BlockInfo::BlockID, llvm::bitc::BlockSizeWidth, llvm::bitc::CodeLenWidth, llvm::createStringError(), llvm::Expected< T >::get(), llvm::Error::success(), and llvm::Expected< T >::takeError().
Read the current record and discard it, returning the code for the record.
skipRecord - Read the current record and discard it.
Definition at line 92 of file BitstreamReader.cpp.
References llvm::BitCodeAbbrevOp::Array, assert(), llvm::BitCodeAbbrevOp::Blob, llvm::createStringError(), llvm::numbers::e, llvm::BitCodeAbbrevOp::Fixed, llvm::Expected< T >::get(), getAbbrev(), llvm::BitCodeAbbrevOp::getEncoding(), llvm::BitCodeAbbrevOp::getEncodingData(), llvm::BitCodeAbbrevOp::getLiteralValue(), llvm::BitCodeAbbrev::getNumOperandInfos(), llvm::BitCodeAbbrev::getOperandInfo(), llvm::BitCodeAbbrevOp::isLiteral(), MaxChunkSize, readAbbreviatedField(), llvm::SimpleBitstreamCursor::ReadVBR(), llvm::SimpleBitstreamCursor::ReadVBR64(), llvm::report_fatal_error(), llvm::Expected< T >::takeError(), and llvm::bitc::UNABBREV_RECORD.
Referenced by llvm::MetadataLoader::MetadataLoaderImpl::upgradeDebugIntrinsics().
Definition at line 360 of file BitstreamReader.h.
Referenced by EnterSubBlock(), readAbbreviatedField(), ReadAbbrevRecord(), and skipRecord().
1.8.13