class BitstreamWriter
Declaration
class BitstreamWriter { /* full declaration omitted */ };
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:30
Member Variables
- private SmallVectorImpl<char>& Out
- Out - The buffer that keeps unflushed bytes.
- private llvm::raw_fd_stream* FS
- FS - The file stream that Out flushes to. If FS is nullptr, it does not support read or seek, Out cannot be flushed until all data are written.
- private const uint64_t FlushThreshold
- FlushThreshold - If FS is valid, this is the threshold (unit B) to flush FS.
- private unsigned int CurBit
- CurBit - Always between 0 and 31 inclusive, specifies the next bit to use.
- private uint32_t CurValue
- CurValue - The current value. Only bits < CurBit are valid.
- private unsigned int CurCodeSize
- CurCodeSize - This is the declared size of code values used for the current block, in bits.
- private unsigned int BlockInfoCurBID
- BlockInfoCurBID - When emitting a BLOCKINFO_BLOCK, this is the currently selected BLOCK ID.
- private std::vector<std::shared_ptr<BitCodeAbbrev>> CurAbbrevs
- CurAbbrevs - Abbrevs installed at in this block.
- private std::vector<Block> BlockScope
- BlockScope - This tracks the current blocks that we have entered.
- private std::vector<BlockInfo> BlockInfoRecords
Method Overview
- public void BackpatchWord(uint64_t BitNo, unsigned int NewWord)
- public void BackpatchWord64(uint64_t BitNo, uint64_t Val)
- public BitstreamWriter(SmallVectorImpl<char> & O, llvm::raw_fd_stream * FS = nullptr, uint32_t FlushThreshold = 512)
- public void Emit(uint32_t Val, unsigned int NumBits)
- public unsigned int EmitAbbrev(std::shared_ptr<BitCodeAbbrev> Abbv)
- private template <typename uintty>void EmitAbbreviatedField(const llvm::BitCodeAbbrevOp & Op, uintty V)
- private template <typename uintty>void EmitAbbreviatedLiteral(const llvm::BitCodeAbbrevOp & Op, uintty V)
- public unsigned int EmitBlockInfoAbbrev(unsigned int BlockID, std::shared_ptr<BitCodeAbbrev> Abbv)
- public void EmitCode(unsigned int Val)
- public template <typename Container>void EmitRecord(unsigned int Code, const Container & Vals, unsigned int Abbrev = 0)
- public template <typename Container>void EmitRecordWithAbbrev(unsigned int Abbrev, const Container & Vals)
- private template <typename uintty>void EmitRecordWithAbbrevImpl(unsigned int Abbrev, ArrayRef<uintty> Vals, llvm::StringRef Blob, Optional<unsigned int> Code)
- public template <typename Container>void EmitRecordWithArray(unsigned int Abbrev, const Container & Vals, llvm::StringRef Array)
- public template <typename Container>void EmitRecordWithArray(unsigned int Abbrev, const Container & Vals, const char * ArrayData, unsigned int ArrayLen)
- public template <typename Container>void EmitRecordWithBlob(unsigned int Abbrev, const Container & Vals, const char * BlobData, unsigned int BlobLen)
- public template <typename Container>void EmitRecordWithBlob(unsigned int Abbrev, const Container & Vals, llvm::StringRef Blob)
- public void EmitVBR(uint32_t Val, unsigned int NumBits)
- public void EmitVBR64(uint64_t Val, unsigned int NumBits)
- private void EncodeAbbrev(const llvm::BitCodeAbbrev & Abbv)
- public void EnterBlockInfoBlock()
- public void EnterSubblock(unsigned int BlockID, unsigned int CodeLen)
- public void ExitBlock()
- private void FlushToFile()
- public void FlushToWord()
- public unsigned int GetAbbrevIDWidth() const
- private size_t GetBufferOffset() const
- public uint64_t GetCurrentBitNo() const
- private uint64_t GetNumOfFlushedBytes() const
- private size_t GetWordIndex() const
- private void SwitchToBlockID(unsigned int BlockID)
- private void WriteWord(unsigned int Value)
- public void emitBlob(llvm::StringRef Bytes, bool ShouldEmitSize = true)
- public template <class UIntTy>void emitBlob(ArrayRef<UIntTy> Bytes, bool ShouldEmitSize = true)
- public llvm::BitstreamWriter::BlockInfo * getBlockInfo(unsigned int BlockID)
- private llvm::BitstreamWriter::BlockInfo & getOrCreateBlockInfo(unsigned int BlockID)
- public ~BitstreamWriter()
Methods
¶void BackpatchWord(uint64_t BitNo,
unsigned int NewWord)
void BackpatchWord(uint64_t BitNo,
unsigned int NewWord)
Description
Backpatch a 32-bit word in the output at the given bit offset with the specified value.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:134
Parameters
- uint64_t BitNo
- unsigned int NewWord
¶void BackpatchWord64(uint64_t BitNo, uint64_t Val)
void BackpatchWord64(uint64_t BitNo, uint64_t Val)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:192
Parameters
- uint64_t BitNo
- uint64_t Val
¶BitstreamWriter(SmallVectorImpl<char>& O,
llvm::raw_fd_stream* FS = nullptr,
uint32_t FlushThreshold = 512)
BitstreamWriter(SmallVectorImpl<char>& O,
llvm::raw_fd_stream* FS = nullptr,
uint32_t FlushThreshold = 512)
Description
Create a BitstreamWriter that writes to Buffer \p O. \p FS is the file stream that \p O flushes to incrementally. If \p FS is null, \p O does not flush incrementially, but writes to disk at the end. \p FlushThreshold is the threshold (unit M) to flush \p O if \p FS is valid. Flushing only occurs at (sub)block boundaries.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:112
Parameters
- SmallVectorImpl<char>& O
- llvm::raw_fd_stream* FS = nullptr
- uint32_t FlushThreshold = 512
¶void Emit(uint32_t Val, unsigned int NumBits)
void Emit(uint32_t Val, unsigned int NumBits)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:197
Parameters
- uint32_t Val
- unsigned int NumBits
¶unsigned int EmitAbbrev(
std::shared_ptr<BitCodeAbbrev> Abbv)
unsigned int EmitAbbrev(
std::shared_ptr<BitCodeAbbrev> Abbv)
Description
Emits the abbreviation \p Abbv to the stream.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:565
Parameters
- std::shared_ptr<BitCodeAbbrev> Abbv
¶template <typename uintty>
void EmitAbbreviatedField(
const llvm::BitCodeAbbrevOp& Op,
uintty V)
template <typename uintty>
void EmitAbbreviatedField(
const llvm::BitCodeAbbrevOp& Op,
uintty V)
Description
EmitAbbreviatedField - Emit a single scalar field value with the specified encoding.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:346
Templates
- uintty
Parameters
- const llvm::BitCodeAbbrevOp& Op
- uintty V
¶template <typename uintty>
void EmitAbbreviatedLiteral(
const llvm::BitCodeAbbrevOp& Op,
uintty V)
template <typename uintty>
void EmitAbbreviatedLiteral(
const llvm::BitCodeAbbrevOp& Op,
uintty V)
Description
EmitAbbreviatedLiteral - Emit a literal value according to its abbrev record. This is a no-op, since the abbrev specifies the literal to use.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:335
Templates
- uintty
Parameters
- const llvm::BitCodeAbbrevOp& Op
- uintty V
¶unsigned int EmitBlockInfoAbbrev(
unsigned int BlockID,
std::shared_ptr<BitCodeAbbrev> Abbv)
unsigned int EmitBlockInfoAbbrev(
unsigned int BlockID,
std::shared_ptr<BitCodeAbbrev> Abbv)
Description
EmitBlockInfoAbbrev - Emit a DEFINE_ABBREV record for the specified BlockID.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:607
Parameters
- unsigned int BlockID
- std::shared_ptr<BitCodeAbbrev> Abbv
¶void EmitCode(unsigned int Val)
void EmitCode(unsigned int Val)
Description
EmitCode - Emit the specified code.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:255
Parameters
- unsigned int Val
¶template <typename Container>
void EmitRecord(unsigned int Code,
const Container& Vals,
unsigned int Abbrev = 0)
template <typename Container>
void EmitRecord(unsigned int Code,
const Container& Vals,
unsigned int Abbrev = 0)
Description
EmitRecord - Emit the specified record to the stream, using an abbrev if we have one to compress the output.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:485
Templates
- Container
Parameters
- unsigned int Code
- const Container& Vals
- unsigned int Abbrev = 0
¶template <typename Container>
void EmitRecordWithAbbrev(unsigned int Abbrev,
const Container& Vals)
template <typename Container>
void EmitRecordWithAbbrev(unsigned int Abbrev,
const Container& Vals)
Description
EmitRecordWithAbbrev - Emit a record with the specified abbreviation. Unlike EmitRecord, the code for the record should be included in Vals as the first entry.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:505
Templates
- Container
Parameters
- unsigned int Abbrev
- const Container& Vals
¶template <typename uintty>
void EmitRecordWithAbbrevImpl(
unsigned int Abbrev,
ArrayRef<uintty> Vals,
llvm::StringRef Blob,
Optional<unsigned int> Code)
template <typename uintty>
void EmitRecordWithAbbrevImpl(
unsigned int Abbrev,
ArrayRef<uintty> Vals,
llvm::StringRef Blob,
Optional<unsigned int> Code)
Description
EmitRecordWithAbbrevImpl - This is the core implementation of the record emission code. If BlobData is non-null, then it specifies an array of data that should be emitted as part of the Blob or Array operand that is known to exist at the end of the record. If Code is specified, then it is the record code to emit before the Vals, which must not contain the code.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:373
Templates
- uintty
Parameters
- unsigned int Abbrev
- ArrayRef<uintty> Vals
- llvm::StringRef Blob
- Optional<unsigned int> Code
¶template <typename Container>
void EmitRecordWithArray(unsigned int Abbrev,
const Container& Vals,
llvm::StringRef Array)
template <typename Container>
void EmitRecordWithArray(unsigned int Abbrev,
const Container& Vals,
llvm::StringRef Array)
Description
EmitRecordWithArray - Just like EmitRecordWithBlob, works with records that end with an array.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:529
Templates
- Container
Parameters
- unsigned int Abbrev
- const Container& Vals
- llvm::StringRef Array
¶template <typename Container>
void EmitRecordWithArray(unsigned int Abbrev,
const Container& Vals,
const char* ArrayData,
unsigned int ArrayLen)
template <typename Container>
void EmitRecordWithArray(unsigned int Abbrev,
const Container& Vals,
const char* ArrayData,
unsigned int ArrayLen)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:534
Templates
- Container
Parameters
- unsigned int Abbrev
- const Container& Vals
- const char* ArrayData
- unsigned int ArrayLen
¶template <typename Container>
void EmitRecordWithBlob(unsigned int Abbrev,
const Container& Vals,
const char* BlobData,
unsigned int BlobLen)
template <typename Container>
void EmitRecordWithBlob(unsigned int Abbrev,
const Container& Vals,
const char* BlobData,
unsigned int BlobLen)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:520
Templates
- Container
Parameters
- unsigned int Abbrev
- const Container& Vals
- const char* BlobData
- unsigned int BlobLen
¶template <typename Container>
void EmitRecordWithBlob(unsigned int Abbrev,
const Container& Vals,
llvm::StringRef Blob)
template <typename Container>
void EmitRecordWithBlob(unsigned int Abbrev,
const Container& Vals,
llvm::StringRef Blob)
Description
EmitRecordWithBlob - Emit the specified record to the stream, using an abbrev that includes a blob at the end. The blob data to emit is specified by the pointer and length specified at the end. In contrast to EmitRecord, this routine expects that the first entry in Vals is the code of the record.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:515
Templates
- Container
Parameters
- unsigned int Abbrev
- const Container& Vals
- llvm::StringRef Blob
¶void EmitVBR(uint32_t Val, unsigned int NumBits)
void EmitVBR(uint32_t Val, unsigned int NumBits)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:224
Parameters
- uint32_t Val
- unsigned int NumBits
¶void EmitVBR64(uint64_t Val, unsigned int NumBits)
void EmitVBR64(uint64_t Val, unsigned int NumBits)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:237
Parameters
- uint64_t Val
- unsigned int NumBits
¶void EncodeAbbrev(const llvm::BitCodeAbbrev& Abbv)
void EncodeAbbrev(const llvm::BitCodeAbbrev& Abbv)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:546
Parameters
- const llvm::BitCodeAbbrev& Abbv
¶void EnterBlockInfoBlock()
void EnterBlockInfoBlock()
Description
EnterBlockInfoBlock - Start emitting the BLOCKINFO_BLOCK.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:577
¶void EnterSubblock(unsigned int BlockID,
unsigned int CodeLen)
void EnterSubblock(unsigned int BlockID,
unsigned int CodeLen)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:277
Parameters
- unsigned int BlockID
- unsigned int CodeLen
¶void ExitBlock()
void ExitBlock()
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:304
¶void FlushToFile()
void FlushToFile()
Description
If the related file stream supports reading, seeking and writing, flush the buffer if its size is above a threshold.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:95
¶void FlushToWord()
void FlushToWord()
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:216
¶unsigned int GetAbbrevIDWidth() const
unsigned int GetAbbrevIDWidth() const
Description
Retrieve the number of bits currently used to encode an abbrev ID.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:126
¶size_t GetBufferOffset() const
size_t GetBufferOffset() const
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:85
¶uint64_t GetCurrentBitNo() const
uint64_t GetCurrentBitNo() const
Description
Retrieve the current position in the stream, in bits.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:123
¶uint64_t GetNumOfFlushedBytes() const
uint64_t GetNumOfFlushedBytes() const
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:83
¶size_t GetWordIndex() const
size_t GetWordIndex() const
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:87
¶void SwitchToBlockID(unsigned int BlockID)
void SwitchToBlockID(unsigned int BlockID)
Description
SwitchToBlockID - If we aren't already talking about the specified block ID, emit a BLOCKINFO_CODE_SETBID record.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:585
Parameters
- unsigned int BlockID
¶void WriteWord(unsigned int Value)
void WriteWord(unsigned int Value)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:77
Parameters
- unsigned int Value
¶void emitBlob(llvm::StringRef Bytes,
bool ShouldEmitSize = true)
void emitBlob(llvm::StringRef Bytes,
bool ShouldEmitSize = true)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:477
Parameters
- llvm::StringRef Bytes
- bool ShouldEmitSize = true
¶template <class UIntTy>
void emitBlob(ArrayRef<UIntTy> Bytes,
bool ShouldEmitSize = true)
template <class UIntTy>
void emitBlob(ArrayRef<UIntTy> Bytes,
bool ShouldEmitSize = true)
Description
Emit a blob, including flushing before and tail-padding.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:461
Templates
- UIntTy
Parameters
- ArrayRef<UIntTy> Bytes
- bool ShouldEmitSize = true
¶llvm::BitstreamWriter::BlockInfo* getBlockInfo(
unsigned int BlockID)
llvm::BitstreamWriter::BlockInfo* getBlockInfo(
unsigned int BlockID)
Description
getBlockInfo - If there is block info for the specified ID, return it, otherwise return null.
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:265
Parameters
- unsigned int BlockID
¶llvm::BitstreamWriter::BlockInfo&
getOrCreateBlockInfo(unsigned int BlockID)
llvm::BitstreamWriter::BlockInfo&
getOrCreateBlockInfo(unsigned int BlockID)
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:593
Parameters
- unsigned int BlockID
¶~BitstreamWriter()
~BitstreamWriter()
Declared at: llvm/include/llvm/Bitstream/BitstreamWriter.h:117