LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
llvm::BCGenericRecordLayout< IDField, Fields > Class Template Reference

Represents a single bitcode record type. More...

#include "llvm/Bitcode/BitcodeConvenience.h"

Inheritance diagram for llvm::BCGenericRecordLayout< IDField, Fields >:
Inheritance graph
[legend]

Public Member Functions

 BCGenericRecordLayout (llvm::BitstreamWriter &Stream)
 Create a layout and register it with the given bitstream writer.
 
template<typename BufferTy , typename... Data>
void emit (BufferTy &buffer, unsigned id, Data &&...data) const
 Emit a record to the bitstream writer, using the given buffer for scratch space.
 

Static Public Member Functions

static unsigned emitAbbrev (llvm::BitstreamWriter &Stream)
 Registers this record's layout with the bitstream reader.
 
template<typename BufferTy , typename... Data>
static void emitRecord (llvm::BitstreamWriter &Stream, BufferTy &buffer, unsigned abbrCode, unsigned recordID, Data &&...data)
 Emit a record identified by abbrCode to bitstream reader Stream, using buffer for scratch space.
 
template<typename ElementTy , typename... Data>
static void readRecord (ArrayRef< ElementTy > buffer, Data &&...data)
 Extract record data from buffer into the given data fields.
 
template<typename BufferTy , typename... Data>
static void readRecord (BufferTy &buffer, Data &&...data)
 Extract record data from buffer into the given data fields.
 

Public Attributes

const unsigned AbbrevCode
 The abbreviation code used for this record in the current block.
 

Detailed Description

template<typename IDField, typename... Fields>
class llvm::BCGenericRecordLayout< IDField, Fields >

Represents a single bitcode record type.

This class template is meant to be instantiated and then given a name, so that from then on that name can be used.

Definition at line 357 of file BitcodeConvenience.h.

Constructor & Destructor Documentation

◆ BCGenericRecordLayout()

template<typename IDField , typename... Fields>
llvm::BCGenericRecordLayout< IDField, Fields >::BCGenericRecordLayout ( llvm::BitstreamWriter Stream)
inlineexplicit

Create a layout and register it with the given bitstream writer.

Definition at line 368 of file BitcodeConvenience.h.

Member Function Documentation

◆ emit()

template<typename IDField , typename... Fields>
template<typename BufferTy , typename... Data>
void llvm::BCGenericRecordLayout< IDField, Fields >::emit ( BufferTy &  buffer,
unsigned  id,
Data &&...  data 
) const
inline

Emit a record to the bitstream writer, using the given buffer for scratch space.

Note that even fixed arguments must be specified here.

Definition at line 376 of file BitcodeConvenience.h.

References llvm::BCGenericRecordLayout< IDField, Fields >::AbbrevCode, and llvm::BCGenericRecordLayout< IDField, Fields >::emitRecord().

◆ emitAbbrev()

template<typename IDField , typename... Fields>
static unsigned llvm::BCGenericRecordLayout< IDField, Fields >::emitAbbrev ( llvm::BitstreamWriter Stream)
inlinestatic

Registers this record's layout with the bitstream reader.

eturns The abbreviation code for the newly-registered record type.

Definition at line 383 of file BitcodeConvenience.h.

References llvm::BitstreamWriter::EmitAbbrev(), and llvm::detail::emitOps().

◆ emitRecord()

template<typename IDField , typename... Fields>
template<typename BufferTy , typename... Data>
static void llvm::BCGenericRecordLayout< IDField, Fields >::emitRecord ( llvm::BitstreamWriter Stream,
BufferTy &  buffer,
unsigned  abbrCode,
unsigned  recordID,
Data &&...  data 
)
inlinestatic

Emit a record identified by abbrCode to bitstream reader Stream, using buffer for scratch space.

Note that even fixed arguments must be specified here. Blobs are passed as StringRefs, while arrays can be passed inline, as aggregates, or as pre-encoded StringRef data. Skipped values and empty arrays should use the special Nothing value.

Definition at line 397 of file BitcodeConvenience.h.

References llvm::detail::BCRecordCoding< ElementTy, Fields >::emit(), and value.

Referenced by llvm::BCGenericRecordLayout< IDField, Fields >::emit().

◆ readRecord() [1/2]

template<typename IDField , typename... Fields>
template<typename ElementTy , typename... Data>
static void llvm::BCGenericRecordLayout< IDField, Fields >::readRecord ( ArrayRef< ElementTy >  buffer,
Data &&...  data 
)
inlinestatic

Extract record data from buffer into the given data fields.

Note that even fixed arguments must be specified here. Pass Nothing if you don't care about a particular parameter. Blob data is not included in the buffer and should be handled separately by the caller.

Definition at line 415 of file BitcodeConvenience.h.

References llvm::detail::BCRecordCoding< ElementTy, Fields >::read(), and value.

Referenced by llvm::BCGenericRecordLayout< IDField, Fields >::readRecord().

◆ readRecord() [2/2]

template<typename IDField , typename... Fields>
template<typename BufferTy , typename... Data>
static void llvm::BCGenericRecordLayout< IDField, Fields >::readRecord ( BufferTy &  buffer,
Data &&...  data 
)
inlinestatic

Extract record data from buffer into the given data fields.

Note that even fixed arguments must be specified here. Pass Nothing if you don't care about a particular parameter. Blob data is not included in the buffer and should be handled separately by the caller.

Definition at line 431 of file BitcodeConvenience.h.

References llvm::BCGenericRecordLayout< IDField, Fields >::readRecord().

Member Data Documentation

◆ AbbrevCode

template<typename IDField , typename... Fields>
const unsigned llvm::BCGenericRecordLayout< IDField, Fields >::AbbrevCode

The abbreviation code used for this record in the current block.

Note that this is not the same as the semantic record code, which is the first field of the record.

Definition at line 365 of file BitcodeConvenience.h.

Referenced by llvm::BCGenericRecordLayout< IDField, Fields >::emit().


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