LLVM 22.0.0git
|
C++ class which implements the opaque lto_module_t type. More...
#include "llvm/LTO/legacy/LTOModule.h"
Public Member Functions | |
LLVM_ABI | ~LTOModule () |
LLVM_ABI bool | isThinLTO () |
Returns 'true' if the Module is produced for ThinLTO. | |
const Module & | getModule () const |
Module & | getModule () |
std::unique_ptr< Module > | takeModule () |
const Triple & | getTargetTriple () |
Return the Module's target triple. | |
void | setTargetTriple (Triple T) |
Set the Module's target triple. | |
uint32_t | getSymbolCount () |
Get the number of symbols. | |
lto_symbol_attributes | getSymbolAttributes (uint32_t index) |
Get the attributes for a symbol at the specified index. | |
StringRef | getSymbolName (uint32_t index) |
Get the name of the symbol at the specified index. | |
uint32_t | getAsmUndefSymbolCount () |
StringRef | getAsmUndefSymbolName (uint32_t index) |
const GlobalValue * | getSymbolGV (uint32_t index) |
StringRef | getLinkerOpts () |
const std::vector< StringRef > & | getAsmUndefinedRefs () |
LLVM_ABI Expected< uint32_t > | getMachOCPUType () const |
LLVM_ABI Expected< uint32_t > | getMachOCPUSubType () const |
LLVM_ABI bool | hasCtorDtor () const |
Returns true if the module has either the @llvm.global_ctors or the @llvm.global_dtors symbol. |
Static Public Member Functions | |
static LLVM_ABI bool | isBitcodeFile (const void *mem, size_t length) |
Returns 'true' if the file or memory contents is LLVM bitcode. | |
static LLVM_ABI bool | isBitcodeFile (StringRef path) |
static LLVM_ABI bool | isBitcodeForTarget (MemoryBuffer *memBuffer, StringRef triplePrefix) |
Returns 'true' if the memory buffer is LLVM bitcode for the specified triple. | |
static LLVM_ABI std::string | getProducerString (MemoryBuffer *Buffer) |
Returns a string representing the producer identification stored in the bitcode, or "" if the bitcode does not contains any. | |
static LLVM_ABI std::unique_ptr< MemoryBuffer > | makeBuffer (const void *mem, size_t length, StringRef name="") |
Create a MemoryBuffer from a memory range with an optional name. | |
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > | createFromFile (LLVMContext &Context, StringRef path, const TargetOptions &options) |
Create an LTOModule. | |
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > | createFromOpenFile (LLVMContext &Context, int fd, StringRef path, size_t size, const TargetOptions &options) |
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > | createFromOpenFileSlice (LLVMContext &Context, int fd, StringRef path, size_t map_size, off_t offset, const TargetOptions &options) |
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > | createFromBuffer (LLVMContext &Context, const void *mem, size_t length, const TargetOptions &options, StringRef path="") |
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > | createInLocalContext (std::unique_ptr< LLVMContext > Context, const void *mem, size_t length, const TargetOptions &options, StringRef path) |
static LLVM_ABI lto::InputFile * | createInputFile (const void *buffer, size_t buffer_size, const char *path, std::string &out_error) |
static LLVM_ABI size_t | getDependentLibraryCount (lto::InputFile *input) |
static LLVM_ABI const char * | getDependentLibrary (lto::InputFile *input, size_t index, size_t *size) |
C++ class which implements the opaque lto_module_t type.
Definition at line 39 of file LTOModule.h.
|
default |
References LLVM_ABI, name, and llvm::size().
|
static |
Definition at line 143 of file LTOModule.cpp.
References llvm::Data.
|
static |
Create an LTOModule.
N.B. These methods take ownership of the buffer. The caller must have initialized the Targets, the TargetMCs, the AsmPrinters, and the AsmParsers by calling:
InitializeAllTargets(); InitializeAllTargetMCs(); InitializeAllAsmPrinters(); InitializeAllAsmParsers();
Definition at line 107 of file LTOModule.cpp.
References llvm::ErrorOr< T >::get(), llvm::ErrorOr< T >::getError(), and llvm::MemoryBuffer::getFile().
|
static |
Definition at line 121 of file LTOModule.cpp.
References createFromOpenFileSlice(), and llvm::size().
|
static |
Definition at line 127 of file LTOModule.cpp.
References llvm::sys::fs::convertFDToNativeFile(), llvm::ErrorOr< T >::get(), llvm::ErrorOr< T >::getError(), and llvm::MemoryBuffer::getOpenFileSlice().
Referenced by createFromOpenFile().
|
static |
Definition at line 152 of file LTOModule.cpp.
References llvm::Data.
|
static |
Definition at line 661 of file LTOModule.cpp.
References llvm::lto::InputFile::create(), llvm::Data, llvm::Expected< T >::takeError(), and llvm::toString().
Definition at line 162 of file LTOModule.h.
|
inline |
Definition at line 146 of file LTOModule.h.
Definition at line 148 of file LTOModule.h.
|
static |
Definition at line 682 of file LTOModule.cpp.
References llvm::StringRef::data(), llvm::lto::InputFile::getDependentLibraries(), llvm::size(), and llvm::StringRef::size().
|
static |
Definition at line 678 of file LTOModule.cpp.
References llvm::lto::InputFile::getDependentLibraries().
|
inline |
Definition at line 160 of file LTOModule.h.
Definition at line 693 of file LTOModule.cpp.
References llvm::MachO::getCPUSubType().
Definition at line 689 of file LTOModule.cpp.
References llvm::MachO::getCPUType().
|
inline |
Definition at line 117 of file LTOModule.h.
Definition at line 116 of file LTOModule.h.
Referenced by getTargetTriple(), and setTargetTriple().
|
static |
Returns a string representing the producer identification stored in the bitcode, or "" if the bitcode does not contains any.
Definition at line 93 of file LTOModule.cpp.
References llvm::errorToBool(), llvm::expectedToErrorOrAndEmitErrors(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::getBitcodeProducerString(), llvm::MemoryBuffer::getMemBufferRef(), and llvm::Expected< T >::takeError().
|
inline |
Get the attributes for a symbol at the specified index.
Definition at line 133 of file LTOModule.h.
|
inline |
Get the number of symbols.
Definition at line 128 of file LTOModule.h.
|
inline |
Definition at line 154 of file LTOModule.h.
Get the name of the symbol at the specified index.
Definition at line 140 of file LTOModule.h.
Return the Module's target triple.
Definition at line 122 of file LTOModule.h.
References getModule(), and llvm::Module::getTargetTriple().
bool LTOModule::hasCtorDtor | ( | ) | const |
Returns true if the module has either the @llvm.global_ctors or the @llvm.global_dtors symbol.
Otherwise returns false.
Definition at line 697 of file LTOModule.cpp.
References llvm::dyn_cast_if_present().
Returns 'true' if the file or memory contents is LLVM bitcode.
isBitcodeFile - Returns 'true' if the file (or memory contents) is LLVM bitcode.
Definition at line 53 of file LTOModule.cpp.
References llvm::errorToBool(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::Length, and llvm::Expected< T >::takeError().
Definition at line 59 of file LTOModule.cpp.
References llvm::errorToBool(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::ErrorOr< T >::get(), llvm::MemoryBuffer::getFile(), and llvm::Expected< T >::takeError().
|
static |
Returns 'true' if the memory buffer is LLVM bitcode for the specified triple.
Definition at line 79 of file LTOModule.cpp.
References llvm::errorToBool(), llvm::expectedToErrorOrAndEmitErrors(), llvm::object::IRObjectFile::findBitcodeInMemBuffer(), llvm::getBitcodeTargetTriple(), llvm::MemoryBuffer::getMemBufferRef(), llvm::StringRef::starts_with(), and llvm::Expected< T >::takeError().
bool LTOModule::isThinLTO | ( | ) |
Returns 'true' if the Module is produced for ThinLTO.
Definition at line 70 of file LTOModule.cpp.
References llvm::errs(), llvm::getBitcodeLTOInfo(), and llvm::logAllUnhandledErrors().
|
static |
Create a MemoryBuffer from a memory range with an optional name.
Definition at line 241 of file LTOModule.cpp.
References llvm::MemoryBuffer::getMemBuffer(), and name.
|
inline |
Set the Module's target triple.
Definition at line 125 of file LTOModule.h.
References getModule(), llvm::Module::setTargetTriple(), and T.
|
inline |
Definition at line 119 of file LTOModule.h.