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. | |
std::unique_ptr< OutlinedHashTree > | releaseOutlinedHashTree () |
Return the outlined hash tree that is released from the reader. | |
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) |
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. | |
Definition at line 23 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 92 of file CodeGenDataReader.cpp.
References create(), and llvm::setupMemoryBuffer().
Referenced by create().
|
static |
Factory method to create an appropriately typed reader for the given memory buffer.
Definition at line 101 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 66 of file CodeGenDataReader.h.
References llvm::success, and llvm::Error::success().
Definition at line 74 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.
|
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.
Definition at line 33 of file CodeGenDataReader.cpp.
References llvm::Data, llvm::OutlinedHashTreeRecord::deserialize(), llvm::getCodeGenDataSectionName(), llvm::object::ObjectFile::makeTriple(), llvm::OutlinedHashTreeRecord::merge(), llvm::object::ObjectFile::sections(), llvm::Error::success(), and llvm::Expected< T >::takeError().
|
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 40 of file CodeGenDataReader.h.
References llvm::OutlinedHashTreeRecord::HashTree, and HashTreeRecord.
|
inlineprotected |
Clear the current error and return a successful one.
Definition at line 83 of file CodeGenDataReader.h.
References error, and llvm::success.
Referenced by llvm::IndexedCodeGenDataReader::read().
|
protected |
The outlined hash tree that has been read.
When it's released by releaseOutlinedHashTree(), it's no longer valid.
Definition at line 63 of file CodeGenDataReader.h.
Referenced by llvm::IndexedCodeGenDataReader::read(), llvm::TextCodeGenDataReader::read(), and releaseOutlinedHashTree().