struct LTOModule
Declaration
struct LTOModule { /* full declaration omitted */ };
Description
C++ class which implements the opaque lto_module_t type.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:38
Member Variables
- private std::unique_ptr<LLVMContext> OwnedContext
- private std::string LinkerOpts
- private std::unique_ptr<Module> Mod
- private llvm::MemoryBufferRef MBRef
- private llvm::ModuleSymbolTable SymTab
- private std::unique_ptr<TargetMachine> _target
- private std::vector<NameAndAttributes> _symbols
- private StringSet<> _defines
- private StringMap<llvm::LTOModule::NameAndAttributes> _undefines
- private std::vector<StringRef> _asm_undefines
Method Overview
- private LTOModule(std::unique_ptr<Module> M, llvm::MemoryBufferRef MBRef, llvm::TargetMachine * TM)
- private void addAsmGlobalSymbol(llvm::StringRef, lto_symbol_attributes scope)
- private void addAsmGlobalSymbolUndef(llvm::StringRef)
- private void addDefinedDataSymbol(llvm::StringRef Name, const llvm::GlobalValue * v)
- private void addDefinedDataSymbol(ModuleSymbolTable::Symbol Sym)
- private void addDefinedFunctionSymbol(llvm::StringRef Name, const llvm::Function * F)
- private void addDefinedFunctionSymbol(ModuleSymbolTable::Symbol Sym)
- private void addDefinedSymbol(llvm::StringRef Name, const llvm::GlobalValue * def, bool isFunction)
- private void addObjCCategory(const llvm::GlobalVariable * clgv)
- private void addObjCClass(const llvm::GlobalVariable * clgv)
- private void addObjCClassRef(const llvm::GlobalVariable * clgv)
- private void addPotentialUndefinedSymbol(ModuleSymbolTable::Symbol Sym, bool isFunc)
- public static ErrorOr<std::unique_ptr<LTOModule>> createFromBuffer(llvm::LLVMContext & Context, const void * mem, size_t length, const llvm::TargetOptions & options, llvm::StringRef path = "")
- public static ErrorOr<std::unique_ptr<LTOModule>> createFromFile(llvm::LLVMContext & Context, llvm::StringRef path, const llvm::TargetOptions & options)
- public static ErrorOr<std::unique_ptr<LTOModule>> createFromOpenFile(llvm::LLVMContext & Context, int fd, llvm::StringRef path, size_t size, const llvm::TargetOptions & options)
- public static ErrorOr<std::unique_ptr<LTOModule>> createFromOpenFileSlice(llvm::LLVMContext & Context, int fd, llvm::StringRef path, size_t map_size, off_t offset, const llvm::TargetOptions & options)
- public static ErrorOr<std::unique_ptr<LTOModule>> createInLocalContext(std::unique_ptr<LLVMContext> Context, const void * mem, size_t length, const llvm::TargetOptions & options, llvm::StringRef path)
- public static lto::InputFile * createInputFile(const void * buffer, size_t buffer_size, const char * path, std::string & out_error)
- public const std::vector<StringRef> & getAsmUndefinedRefs()
- public static const char * getDependentLibrary(lto::InputFile * input, size_t index, size_t * size)
- public static size_t getDependentLibraryCount(lto::InputFile * input)
- public llvm::StringRef getLinkerOpts()
- public Expected<uint32_t> getMachOCPUSubType() const
- public Expected<uint32_t> getMachOCPUType() const
- public llvm::Module & getModule()
- public const llvm::Module & getModule() const
- public static std::string getProducerString(llvm::MemoryBuffer * Buffer)
- public lto_symbol_attributes getSymbolAttributes(uint32_t index)
- public uint32_t getSymbolCount()
- public const llvm::GlobalValue * getSymbolGV(uint32_t index)
- public llvm::StringRef getSymbolName(uint32_t index)
- public const std::string & getTargetTriple()
- public bool hasCtorDtor() const
- public static bool isBitcodeFile(llvm::StringRef path)
- public static bool isBitcodeFile(const void * mem, size_t length)
- public static bool isBitcodeForTarget(llvm::MemoryBuffer * memBuffer, llvm::StringRef triplePrefix)
- public bool isThinLTO()
- public static std::unique_ptr<MemoryBuffer> makeBuffer(const void * mem, size_t length, llvm::StringRef name = "")
- private static ErrorOr<std::unique_ptr<LTOModule>> makeLTOModule(llvm::MemoryBufferRef Buffer, const llvm::TargetOptions & options, llvm::LLVMContext & Context, bool ShouldBeLazy)
- private bool objcClassNameFromExpression(const llvm::Constant * c, std::string & name)
- private void parseMetadata()
- private void parseSymbols()
- public void setTargetTriple(llvm::StringRef Triple)
- public std::unique_ptr<Module> takeModule()
- public ~LTOModule()
Methods
¶LTOModule(std::unique_ptr<Module> M,
llvm::MemoryBufferRef MBRef,
llvm::TargetMachine* TM)
LTOModule(std::unique_ptr<Module> M,
llvm::MemoryBufferRef MBRef,
llvm::TargetMachine* TM)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:62
Parameters
- std::unique_ptr<Module> M
- llvm::MemoryBufferRef MBRef
- llvm::TargetMachine* TM
¶void addAsmGlobalSymbol(
llvm::StringRef,
lto_symbol_attributes scope)
void addAsmGlobalSymbol(
llvm::StringRef,
lto_symbol_attributes scope)
Description
Add a global symbol from module-level ASM to the defined list.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:201
Parameters
- llvm::StringRef
- lto_symbol_attributes scope
¶void addAsmGlobalSymbolUndef(llvm::StringRef)
void addAsmGlobalSymbolUndef(llvm::StringRef)
Description
Add a global symbol from module-level ASM to the undefined list.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:204
Parameters
¶void addDefinedDataSymbol(
llvm::StringRef Name,
const llvm::GlobalValue* v)
void addDefinedDataSymbol(
llvm::StringRef Name,
const llvm::GlobalValue* v)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:194
Parameters
- llvm::StringRef Name
- const llvm::GlobalValue* v
¶void addDefinedDataSymbol(
ModuleSymbolTable::Symbol Sym)
void addDefinedDataSymbol(
ModuleSymbolTable::Symbol Sym)
Description
Add a data symbol as defined to the list.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:193
Parameters
¶void addDefinedFunctionSymbol(
llvm::StringRef Name,
const llvm::Function* F)
void addDefinedFunctionSymbol(
llvm::StringRef Name,
const llvm::Function* F)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:198
Parameters
- llvm::StringRef Name
- const llvm::Function* F
¶void addDefinedFunctionSymbol(
ModuleSymbolTable::Symbol Sym)
void addDefinedFunctionSymbol(
ModuleSymbolTable::Symbol Sym)
Description
Add a function symbol as defined to the list.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:197
Parameters
¶void addDefinedSymbol(
llvm::StringRef Name,
const llvm::GlobalValue* def,
bool isFunction)
void addDefinedSymbol(
llvm::StringRef Name,
const llvm::GlobalValue* def,
bool isFunction)
Description
Add a defined symbol to the list.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:189
Parameters
- llvm::StringRef Name
- const llvm::GlobalValue* def
- bool isFunction
¶void addObjCCategory(
const llvm::GlobalVariable* clgv)
void addObjCCategory(
const llvm::GlobalVariable* clgv)
Description
Parse i386/ppc ObjC category data structure.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:210
Parameters
- const llvm::GlobalVariable* clgv
¶void addObjCClass(
const llvm::GlobalVariable* clgv)
void addObjCClass(
const llvm::GlobalVariable* clgv)
Description
Parse i386/ppc ObjC class data structure.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:207
Parameters
- const llvm::GlobalVariable* clgv
¶void addObjCClassRef(
const llvm::GlobalVariable* clgv)
void addObjCClassRef(
const llvm::GlobalVariable* clgv)
Description
Parse i386/ppc ObjC class list data structure.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:213
Parameters
- const llvm::GlobalVariable* clgv
¶void addPotentialUndefinedSymbol(
ModuleSymbolTable::Symbol Sym,
bool isFunc)
void addPotentialUndefinedSymbol(
ModuleSymbolTable::Symbol Sym,
bool isFunc)
Description
Add a symbol which isn't defined just yet to a list to be resolved later.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:185
Parameters
- ModuleSymbolTable::Symbol Sym
- bool isFunc
¶static ErrorOr<std::unique_ptr<LTOModule>>
createFromBuffer(
llvm::LLVMContext& Context,
const void* mem,
size_t length,
const llvm::TargetOptions& options,
llvm::StringRef path = "")
static ErrorOr<std::unique_ptr<LTOModule>>
createFromBuffer(
llvm::LLVMContext& Context,
const void* mem,
size_t length,
const llvm::TargetOptions& options,
llvm::StringRef path = "")
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:108
Parameters
- llvm::LLVMContext& Context
- const void* mem
- size_t length
- const llvm::TargetOptions& options
- llvm::StringRef path = ""
¶static ErrorOr<std::unique_ptr<LTOModule>>
createFromFile(llvm::LLVMContext& Context,
llvm::StringRef path,
const llvm::TargetOptions& options)
static ErrorOr<std::unique_ptr<LTOModule>>
createFromFile(llvm::LLVMContext& Context,
llvm::StringRef path,
const llvm::TargetOptions& options)
Description
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();
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:98
Parameters
- llvm::LLVMContext& Context
- llvm::StringRef path
- const llvm::TargetOptions& options
¶static ErrorOr<std::unique_ptr<LTOModule>>
createFromOpenFile(
llvm::LLVMContext& Context,
int fd,
llvm::StringRef path,
size_t size,
const llvm::TargetOptions& options)
static ErrorOr<std::unique_ptr<LTOModule>>
createFromOpenFile(
llvm::LLVMContext& Context,
int fd,
llvm::StringRef path,
size_t size,
const llvm::TargetOptions& options)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:101
Parameters
- llvm::LLVMContext& Context
- int fd
- llvm::StringRef path
- size_t size
- const llvm::TargetOptions& options
¶static ErrorOr<std::unique_ptr<LTOModule>>
createFromOpenFileSlice(
llvm::LLVMContext& Context,
int fd,
llvm::StringRef path,
size_t map_size,
off_t offset,
const llvm::TargetOptions& options)
static ErrorOr<std::unique_ptr<LTOModule>>
createFromOpenFileSlice(
llvm::LLVMContext& Context,
int fd,
llvm::StringRef path,
size_t map_size,
off_t offset,
const llvm::TargetOptions& options)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:104
Parameters
- llvm::LLVMContext& Context
- int fd
- llvm::StringRef path
- size_t map_size
- off_t offset
- const llvm::TargetOptions& options
¶static ErrorOr<std::unique_ptr<LTOModule>>
createInLocalContext(
std::unique_ptr<LLVMContext> Context,
const void* mem,
size_t length,
const llvm::TargetOptions& options,
llvm::StringRef path)
static ErrorOr<std::unique_ptr<LTOModule>>
createInLocalContext(
std::unique_ptr<LLVMContext> Context,
const void* mem,
size_t length,
const llvm::TargetOptions& options,
llvm::StringRef path)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:111
Parameters
- std::unique_ptr<LLVMContext> Context
- const void* mem
- size_t length
- const llvm::TargetOptions& options
- llvm::StringRef path
¶static lto::InputFile* createInputFile(
const void* buffer,
size_t buffer_size,
const char* path,
std::string& out_error)
static lto::InputFile* createInputFile(
const void* buffer,
size_t buffer_size,
const char* path,
std::string& out_error)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:159
Parameters
- const void* buffer
- size_t buffer_size
- const char* path
- std::string& out_error
¶const std::vector<StringRef>&
getAsmUndefinedRefs()
const std::vector<StringRef>&
getAsmUndefinedRefs()
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:157
¶static const char* getDependentLibrary(
lto::InputFile* input,
size_t index,
size_t* size)
static const char* getDependentLibrary(
lto::InputFile* input,
size_t index,
size_t* size)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:164
Parameters
- lto::InputFile* input
- size_t index
- size_t* size
¶static size_t getDependentLibraryCount(
lto::InputFile* input)
static size_t getDependentLibraryCount(
lto::InputFile* input)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:162
Parameters
- lto::InputFile* input
¶llvm::StringRef getLinkerOpts()
llvm::StringRef getLinkerOpts()
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:155
¶Expected<uint32_t> getMachOCPUSubType() const
Expected<uint32_t> getMachOCPUSubType() const
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:168
¶Expected<uint32_t> getMachOCPUType() const
Expected<uint32_t> getMachOCPUType() const
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:166
¶llvm::Module& getModule()
llvm::Module& getModule()
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:116
¶const llvm::Module& getModule() const
const llvm::Module& getModule() const
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:115
¶static std::string getProducerString(
llvm::MemoryBuffer* Buffer)
static std::string getProducerString(
llvm::MemoryBuffer* Buffer)
Description
Returns a string representing the producer identification stored in the bitcode, or "" if the bitcode does not contains any.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:83
Parameters
- llvm::MemoryBuffer* Buffer
¶lto_symbol_attributes getSymbolAttributes(
uint32_t index)
lto_symbol_attributes getSymbolAttributes(
uint32_t index)
Description
Get the attributes for a symbol at the specified index.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:136
Parameters
- uint32_t index
¶uint32_t getSymbolCount()
uint32_t getSymbolCount()
Description
Get the number of symbols
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:131
¶const llvm::GlobalValue* getSymbolGV(
uint32_t index)
const llvm::GlobalValue* getSymbolGV(
uint32_t index)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:149
Parameters
- uint32_t index
¶llvm::StringRef getSymbolName(uint32_t index)
llvm::StringRef getSymbolName(uint32_t index)
Description
Get the name of the symbol at the specified index.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:143
Parameters
- uint32_t index
¶const std::string& getTargetTriple()
const std::string& getTargetTriple()
Description
Return the Module's target triple.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:121
¶bool hasCtorDtor() const
bool hasCtorDtor() const
Description
Returns true if the module has either the @llvm.global_ctors or the@llvm.global_dtors symbol. Otherwise returns false.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:172
¶static bool isBitcodeFile(llvm::StringRef path)
static bool isBitcodeFile(llvm::StringRef path)
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:70
Parameters
- llvm::StringRef path
¶static bool isBitcodeFile(const void* mem,
size_t length)
static bool isBitcodeFile(const void* mem,
size_t length)
Description
Returns 'true' if the file or memory contents is LLVM bitcode.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:69
Parameters
- const void* mem
- size_t length
¶static bool isBitcodeForTarget(
llvm::MemoryBuffer* memBuffer,
llvm::StringRef triplePrefix)
static bool isBitcodeForTarget(
llvm::MemoryBuffer* memBuffer,
llvm::StringRef triplePrefix)
Description
Returns 'true' if the memory buffer is LLVM bitcode for the specified triple.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:77
Parameters
- llvm::MemoryBuffer* memBuffer
- llvm::StringRef triplePrefix
¶bool isThinLTO()
bool isThinLTO()
Description
Returns 'true' if the Module is produced for ThinLTO.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:73
¶static std::unique_ptr<MemoryBuffer> makeBuffer(
const void* mem,
size_t length,
llvm::StringRef name = "")
static std::unique_ptr<MemoryBuffer> makeBuffer(
const void* mem,
size_t length,
llvm::StringRef name = "")
Description
Create a MemoryBuffer from a memory range with an optional name.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:87
Parameters
- const void* mem
- size_t length
- llvm::StringRef name = ""
¶static ErrorOr<std::unique_ptr<LTOModule>>
makeLTOModule(llvm::MemoryBufferRef Buffer,
const llvm::TargetOptions& options,
llvm::LLVMContext& Context,
bool ShouldBeLazy)
static ErrorOr<std::unique_ptr<LTOModule>>
makeLTOModule(llvm::MemoryBufferRef Buffer,
const llvm::TargetOptions& options,
llvm::LLVMContext& Context,
bool ShouldBeLazy)
Description
Create an LTOModule (private version).
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:220
Parameters
- llvm::MemoryBufferRef Buffer
- const llvm::TargetOptions& options
- llvm::LLVMContext& Context
- bool ShouldBeLazy
¶bool objcClassNameFromExpression(
const llvm::Constant* c,
std::string& name)
bool objcClassNameFromExpression(
const llvm::Constant* c,
std::string& name)
Description
Get string that the data pointer points to.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:216
Parameters
- const llvm::Constant* c
- std::string& name
¶void parseMetadata()
void parseMetadata()
Description
Parse metadata from the module
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:178
¶void parseSymbols()
void parseSymbols()
Description
Parse the symbols from the module and model-level ASM and add them to either the defined or undefined lists.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:182
¶void setTargetTriple(llvm::StringRef Triple)
void setTargetTriple(llvm::StringRef Triple)
Description
Set the Module's target triple.
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:126
Parameters
- llvm::StringRef Triple
¶std::unique_ptr<Module> takeModule()
std::unique_ptr<Module> takeModule()
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:118
¶~LTOModule()
~LTOModule()
Declared at: llvm/include/llvm/LTO/legacy/LTOModule.h:66