14 #ifndef LLVM_LTO_LTOMODULE_H
15 #define LLVM_LTO_LTOMODULE_H
41 struct NameAndAttributes {
48 std::unique_ptr<LLVMContext> OwnedContext;
50 std::string LinkerOpts;
52 std::unique_ptr<object::IRObjectFile> IRFile;
53 std::unique_ptr<TargetMachine> _target;
54 std::vector<NameAndAttributes> _symbols;
59 std::vector<const char*> _asm_undefines;
63 std::unique_ptr<LLVMContext> Context);
78 static std::unique_ptr<MemoryBuffer>
95 size_t map_size, off_t offset,
113 return IRFile->getModule();
128 return _symbols.size();
133 if (index < _symbols.size())
140 if (index < _symbols.size())
141 return _symbols[index].
name;
146 if (index < _symbols.size())
147 return _symbols[index].symbol;
152 return LinkerOpts.c_str();
156 return _asm_undefines;
162 void parseMetadata();
166 bool parseSymbols(std::string &errMsg);
182 void addDefinedFunctionSymbol(
const char *
Name,
const Function *
F);
188 void addAsmGlobalSymbolUndef(
const char *);
200 bool objcClassNameFromExpression(
const Constant *c, std::string &
name);
uint32_t getSymbolCount()
Get the number of symbols.
static LTOModule * createInLocalContext(const void *mem, size_t length, TargetOptions options, std::string &errMsg, StringRef path)
A Module instance is used to store all the information related to an LLVM module. ...
const char * getLinkerOpts()
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
lto_symbol_attributes getSymbolAttributes(uint32_t index)
Get the attributes for a symbol at the specified index.
const GlobalValue * getSymbolGV(uint32_t index)
const Module & getModule() const
const std::string & getTargetTriple()
Return the Module's target triple.
static bool isBitcodeForTarget(MemoryBuffer *memBuffer, StringRef triplePrefix)
Returns 'true' if the memory buffer is LLVM bitcode for the specified triple.
const char * getSymbolName(uint32_t index)
Get the name of the symbol at the specified index.
This is an important class for using LLVM in a threaded context.
This is an important base class in LLVM.
void setTargetTriple(StringRef Triple)
Set the Module's target triple.
C++ class which implements the opaque lto_module_t type.
Triple - Helper class for working with autoconf configuration names.
Module.h This file contains the declarations for the Module class.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
static LTOModule * createInContext(const void *mem, size_t length, TargetOptions options, std::string &errMsg, StringRef path, LLVMContext *Context)
static std::unique_ptr< MemoryBuffer > makeBuffer(const void *mem, size_t length, StringRef name="")
Create a MemoryBuffer from a memory range with an optional name.
This is a value type class that represents a single symbol in the list of symbols in the object file...
Deduce function attributes
const std::vector< const char * > & getAsmUndefinedRefs()
void setTargetTriple(StringRef T)
Set the target triple.
static LTOModule * createFromFile(const char *path, TargetOptions options, std::string &errMsg)
Create an LTOModule.
static LTOModule * createFromOpenFileSlice(int fd, const char *path, size_t map_size, off_t offset, TargetOptions options, std::string &errMsg)
static bool isBitcodeFile(const void *mem, size_t length)
Returns 'true' if the file or memory contents is LLVM bitcode.
static LTOModule * createFromBuffer(const void *mem, size_t length, TargetOptions options, std::string &errMsg, StringRef path="")
StringSet - A wrapper for StringMap that provides set-like functionality.
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
static LTOModule * createFromOpenFile(int fd, const char *path, size_t size, TargetOptions options, std::string &errMsg)