LLVM 22.0.0git
llvm::StableFunctionMapRecord Struct Reference

The structure of the serialized stable function map is as follows: More...

#include "llvm/CGData/StableFunctionMapRecord.h"

Public Member Functions

 StableFunctionMapRecord ()
 StableFunctionMapRecord (std::unique_ptr< StableFunctionMap > FunctionMap)
LLVM_ABI void serialize (raw_ostream &OS, std::vector< CGDataPatchItem > &PatchItems) const
 Serialize the stable function map to a raw_ostream.
LLVM_ABI void deserialize (const unsigned char *&Ptr)
 Deserialize the stable function map from a raw_ostream.
LLVM_ABI void lazyDeserialize (std::shared_ptr< MemoryBuffer > Buffer, uint64_t Offset)
 Lazily deserialize the stable function map from Buffer starting at Offset.
LLVM_ABI void serializeYAML (yaml::Output &YOS) const
 Serialize the stable function map to a YAML stream.
LLVM_ABI void deserializeYAML (yaml::Input &YIS)
 Deserialize the stable function map from a YAML stream.
void finalize (bool SkipTrim=false)
 Finalize the stable function map by trimming content.
void merge (const StableFunctionMapRecord &Other)
 Merge the stable function map into this one.
bool empty () const
void print (raw_ostream &OS=llvm::errs()) const
 Print the stable function map in a YAML format.
void setReadStableFunctionMapNames (bool Read)
 Set whether to read stable function names from the buffer.

Static Public Member Functions

static LLVM_ABI void serialize (raw_ostream &OS, const StableFunctionMap *FunctionMap, std::vector< CGDataPatchItem > &PatchItems)
 A static helper function to serialize the stable function map without owning the stable function map.
static LLVM_ABI void deserializeEntry (const unsigned char *Ptr, stable_hash Hash, StableFunctionMap *FunctionMap)
 A static helper function to deserialize the stable function map entry.

Public Attributes

std::unique_ptr< StableFunctionMapFunctionMap

Detailed Description

The structure of the serialized stable function map is as follows:

  • Number of unique function/module names
  • Total size of unique function/module names for opt-in skipping
  • Unique function/module names
  • Padding to align to 4 bytes
  • Number of StableFunctionEntries
  • Hashes of each StableFunctionEntry
  • Fixed-size fields for each StableFunctionEntry (the order is consistent with the hashes above):
    • FunctionNameId
    • ModuleNameId
    • InstCount
    • Relative offset to the beginning of IndexOperandHashes for this entry
  • Total size of variable-sized IndexOperandHashes for lazy-loading support
  • Variable-sized IndexOperandHashes for each StableFunctionEntry:
    • Number of IndexOperandHashes
    • Contents of each IndexOperandHashes
      • InstIndex
      • OpndIndex
      • OpndHash

Definition at line 47 of file StableFunctionMapRecord.h.

Constructor & Destructor Documentation

◆ StableFunctionMapRecord() [1/2]

llvm::StableFunctionMapRecord::StableFunctionMapRecord ( )
inline

Definition at line 50 of file StableFunctionMapRecord.h.

References FunctionMap.

Referenced by merge().

◆ StableFunctionMapRecord() [2/2]

llvm::StableFunctionMapRecord::StableFunctionMapRecord ( std::unique_ptr< StableFunctionMap > FunctionMap)
inline

Definition at line 54 of file StableFunctionMapRecord.h.

References FunctionMap, and llvm::move().

Member Function Documentation

◆ deserialize()

void StableFunctionMapRecord::deserialize ( const unsigned char *& Ptr)

Deserialize the stable function map from a raw_ostream.

Definition at line 258 of file StableFunctionMapRecord.cpp.

References deserialize(), and Ptr.

Referenced by deserialize(), lazyDeserialize(), and llvm::CodeGenDataReader::mergeFromObjectFile().

◆ deserializeEntry()

void StableFunctionMapRecord::deserializeEntry ( const unsigned char * Ptr,
stable_hash Hash,
StableFunctionMap * FunctionMap )
static

A static helper function to deserialize the stable function map entry.

Ptr should be pointing to the start of the fixed-sized fields of the entry when passed in.

Definition at line 145 of file StableFunctionMapRecord.cpp.

References assert(), FunctionMap, Ptr, and llvm::support::endian::readNext().

◆ deserializeYAML()

void StableFunctionMapRecord::deserializeYAML ( yaml::Input & YIS)

Deserialize the stable function map from a YAML stream.

Definition at line 284 of file StableFunctionMapRecord.cpp.

References FunctionMap, and llvm::yaml::Input::nextDocument().

◆ empty()

bool llvm::StableFunctionMapRecord::empty ( ) const
inline
Returns
true if the stable function map is empty.

Definition at line 98 of file StableFunctionMapRecord.h.

References FunctionMap.

Referenced by llvm::cgdata::mergeCodeGenData().

◆ finalize()

void llvm::StableFunctionMapRecord::finalize ( bool SkipTrim = false)
inline

Finalize the stable function map by trimming content.

Definition at line 90 of file StableFunctionMapRecord.h.

References FunctionMap.

Referenced by llvm::cgdata::mergeCodeGenData().

◆ lazyDeserialize()

void StableFunctionMapRecord::lazyDeserialize ( std::shared_ptr< MemoryBuffer > Buffer,
uint64_t Offset )

Lazily deserialize the stable function map from Buffer starting at Offset.

The individual stable function entry would be read lazily from Buffer when the function map is accessed.

Definition at line 262 of file StableFunctionMapRecord.cpp.

References deserialize(), FunctionMap, llvm::Offset, and Ptr.

◆ merge()

void llvm::StableFunctionMapRecord::merge ( const StableFunctionMapRecord & Other)
inline

Merge the stable function map into this one.

Definition at line 93 of file StableFunctionMapRecord.h.

References FunctionMap, llvm::Other, and StableFunctionMapRecord().

Referenced by llvm::CodeGenDataReader::mergeFromObjectFile().

◆ print()

void llvm::StableFunctionMapRecord::print ( raw_ostream & OS = llvm::errs()) const
inline

Print the stable function map in a YAML format.

Definition at line 101 of file StableFunctionMapRecord.h.

References llvm::errs(), and serializeYAML().

◆ serialize() [1/2]

void StableFunctionMapRecord::serialize ( raw_ostream & OS,
const StableFunctionMap * FunctionMap,
std::vector< CGDataPatchItem > & PatchItems )
static

◆ serialize() [2/2]

void StableFunctionMapRecord::serialize ( raw_ostream & OS,
std::vector< CGDataPatchItem > & PatchItems ) const

Serialize the stable function map to a raw_ostream.

Definition at line 80 of file StableFunctionMapRecord.cpp.

References FunctionMap, and serialize().

◆ serializeYAML()

void StableFunctionMapRecord::serializeYAML ( yaml::Output & YOS) const

Serialize the stable function map to a YAML stream.

Definition at line 270 of file StableFunctionMapRecord.cpp.

References FunctionMap, getStableFunctionEntries(), and getStableIndexOperandHashes().

Referenced by print().

◆ setReadStableFunctionMapNames()

void llvm::StableFunctionMapRecord::setReadStableFunctionMapNames ( bool Read)
inline

Set whether to read stable function names from the buffer.

Has no effect if the function map is read from a YAML stream.

Definition at line 108 of file StableFunctionMapRecord.h.

References assert(), FunctionMap, and llvm::Read.

Member Data Documentation

◆ FunctionMap


The documentation for this struct was generated from the following files: