LLVM 20.0.0git
|
#include "llvm/CGData/CodeGenDataReader.h"
Public Member Functions | |
CodeGenDataReader ()=default | |
virtual | ~CodeGenDataReader ()=default |
virtual Error | read ()=0 |
Read the header. Required before reading first record. | |
virtual uint32_t | getVersion () const =0 |
Return the codegen data version. | |
virtual CGDataKind | getDataKind () const =0 |
Return the codegen data kind. | |
virtual bool | hasOutlinedHashTree () const =0 |
Return true if the data has an outlined hash tree. | |
virtual bool | hasStableFunctionMap () const =0 |
Return true if the data has a stable function map. | |
std::unique_ptr< OutlinedHashTree > | releaseOutlinedHashTree () |
Return the outlined hash tree that is released from the reader. | |
std::unique_ptr< StableFunctionMap > | releaseStableFunctionMap () |
Static Public Member Functions | |
static Expected< std::unique_ptr< CodeGenDataReader > > | create (const Twine &Path, vfs::FileSystem &FS) |
Factory method to create an appropriately typed reader for the given codegen data file path and file system. | |
static Expected< std::unique_ptr< CodeGenDataReader > > | create (std::unique_ptr< MemoryBuffer > Buffer) |
Factory method to create an appropriately typed reader for the given memory buffer. | |
static Error | mergeFromObjectFile (const object::ObjectFile *Obj, OutlinedHashTreeRecord &GlobalOutlineRecord, StableFunctionMapRecord &GlobalFunctionMapRecord, stable_hash *CombinedHash=nullptr) |
Extract the cgdata embedded in sections from the given object file and merge them into the GlobalOutlineRecord. | |
Protected Member Functions | |
Error | error (cgdata_error Err, const std::string &ErrMsg="") |
Set the current error and return same. | |
Error | error (Error &&E) |
Error | success () |
Clear the current error and return a successful one. | |
Protected Attributes | |
OutlinedHashTreeRecord | HashTreeRecord |
The outlined hash tree that has been read. | |
StableFunctionMapRecord | FunctionMapRecord |
The stable function map that has been read. When it's released by. | |
Definition at line 24 of file CodeGenDataReader.h.
|
default |
|
virtualdefault |
|
static |
Factory method to create an appropriately typed reader for the given codegen data file path and file system.
Definition at line 116 of file CodeGenDataReader.cpp.
References create(), and llvm::setupMemoryBuffer().
Referenced by create(), and llvm::CodeGenData::getInstance().
|
static |
Factory method to create an appropriately typed reader for the given memory buffer.
Definition at line 125 of file CodeGenDataReader.cpp.
References llvm::empty_cgdata, llvm::IndexedCodeGenDataReader::hasFormat(), llvm::TextCodeGenDataReader::hasFormat(), and llvm::malformed.
|
inlineprotected |
Set the current error and return same.
Definition at line 81 of file CodeGenDataReader.h.
References llvm::success, and llvm::Error::success().
Definition at line 89 of file CodeGenDataReader.h.
References E, llvm::CGDataError::get(), llvm::CGDataError::getMessage(), and llvm::handleAllErrors().
|
pure virtual |
Return the codegen data kind.
Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.
|
pure virtual |
Return the codegen data version.
Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.
|
pure virtual |
Return true if the data has an outlined hash tree.
Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.
|
pure virtual |
Return true if the data has a stable function map.
Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.
|
static |
Extract the cgdata embedded in sections from the given object file and merge them into the GlobalOutlineRecord.
This is a static helper that is used by llvm-cgdata --merge
or ThinLTO's two-codegen rounds. Optionally, CombinedHash
can be used to compuate the combined hash of the merged data.
Definition at line 33 of file CodeGenDataReader.cpp.
References llvm::Data, llvm::OutlinedHashTreeRecord::deserialize(), llvm::StableFunctionMapRecord::deserialize(), llvm::getCodeGenDataSectionName(), llvm::object::ObjectFile::makeTriple(), llvm::OutlinedHashTreeRecord::merge(), llvm::StableFunctionMapRecord::merge(), Name, llvm::object::ObjectFile::sections(), llvm::stable_hash_combine(), llvm::Error::success(), llvm::Expected< T >::takeError(), and llvm::xxh3_64bits().
Referenced by llvm::cgdata::mergeCodeGenData().
|
pure virtual |
Read the header. Required before reading first record.
Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.
|
inline |
Return the outlined hash tree that is released from the reader.
Definition at line 43 of file CodeGenDataReader.h.
References llvm::OutlinedHashTreeRecord::HashTree, and HashTreeRecord.
|
inline |
Definition at line 46 of file CodeGenDataReader.h.
References llvm::StableFunctionMapRecord::FunctionMap, and FunctionMapRecord.
|
inlineprotected |
Clear the current error and return a successful one.
Definition at line 98 of file CodeGenDataReader.h.
References error, and llvm::success.
Referenced by llvm::IndexedCodeGenDataReader::read().
|
protected |
The stable function map that has been read. When it's released by.
Definition at line 78 of file CodeGenDataReader.h.
Referenced by llvm::IndexedCodeGenDataReader::read(), llvm::TextCodeGenDataReader::read(), and releaseStableFunctionMap().
|
protected |
The outlined hash tree that has been read.
When it's released by releaseOutlinedHashTree(), it's no longer valid.
Definition at line 74 of file CodeGenDataReader.h.
Referenced by llvm::IndexedCodeGenDataReader::read(), llvm::TextCodeGenDataReader::read(), and releaseOutlinedHashTree().