LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::CodeGenDataReader Class Referenceabstract

#include "llvm/CGData/CodeGenDataReader.h"

Inheritance diagram for llvm::CodeGenDataReader:
Inheritance graph
[legend]

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< OutlinedHashTreereleaseOutlinedHashTree ()
 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.
 

Detailed Description

Definition at line 23 of file CodeGenDataReader.h.

Constructor & Destructor Documentation

◆ CodeGenDataReader()

llvm::CodeGenDataReader::CodeGenDataReader ( )
default

◆ ~CodeGenDataReader()

virtual llvm::CodeGenDataReader::~CodeGenDataReader ( )
virtualdefault

Member Function Documentation

◆ create() [1/2]

Expected< std::unique_ptr< CodeGenDataReader > > llvm::CodeGenDataReader::create ( const Twine Path,
vfs::FileSystem FS 
)
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().

◆ create() [2/2]

Expected< std::unique_ptr< CodeGenDataReader > > llvm::CodeGenDataReader::create ( std::unique_ptr< MemoryBuffer Buffer)
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.

◆ error() [1/2]

Error llvm::CodeGenDataReader::error ( cgdata_error  Err,
const std::string &  ErrMsg = "" 
)
inlineprotected

Set the current error and return same.

Definition at line 66 of file CodeGenDataReader.h.

References llvm::success, and llvm::Error::success().

◆ error() [2/2]

Error llvm::CodeGenDataReader::error ( Error &&  E)
inlineprotected

◆ getDataKind()

virtual CGDataKind llvm::CodeGenDataReader::getDataKind ( ) const
pure virtual

Return the codegen data kind.

Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.

◆ getVersion()

virtual uint32_t llvm::CodeGenDataReader::getVersion ( ) const
pure virtual

Return the codegen data version.

Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.

◆ hasOutlinedHashTree()

virtual bool llvm::CodeGenDataReader::hasOutlinedHashTree ( ) const
pure virtual

Return true if the data has an outlined hash tree.

Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.

◆ mergeFromObjectFile()

Error llvm::CodeGenDataReader::mergeFromObjectFile ( const object::ObjectFile Obj,
OutlinedHashTreeRecord GlobalOutlineRecord 
)
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().

◆ read()

virtual Error llvm::CodeGenDataReader::read ( )
pure virtual

Read the header. Required before reading first record.

Implemented in llvm::IndexedCodeGenDataReader, and llvm::TextCodeGenDataReader.

◆ releaseOutlinedHashTree()

std::unique_ptr< OutlinedHashTree > llvm::CodeGenDataReader::releaseOutlinedHashTree ( )
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.

◆ success()

Error llvm::CodeGenDataReader::success ( )
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().

Member Data Documentation

◆ HashTreeRecord

OutlinedHashTreeRecord llvm::CodeGenDataReader::HashTreeRecord
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().


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