14 #ifndef LLVM_LTO_LTOMODULE_H 15 #define LLVM_LTO_LTOMODULE_H 40 struct NameAndAttributes {
47 std::unique_ptr<LLVMContext> OwnedContext;
49 std::string LinkerOpts;
51 std::unique_ptr<Module>
Mod;
54 std::unique_ptr<TargetMachine> _target;
55 std::vector<NameAndAttributes> _symbols;
60 std::vector<StringRef> _asm_undefines;
86 static std::unique_ptr<MemoryBuffer>
105 size_t map_size, off_t offset,
118 std::unique_ptr<Module>
takeModule() {
return std::move(Mod); }
132 return _symbols.size();
137 if (index < _symbols.size())
144 if (index < _symbols.size())
145 return _symbols[index].
name;
150 if (index < _symbols.size())
151 return _symbols[index].symbol;
162 void parseMetadata();
200 bool objcClassNameFromExpression(
const Constant *c, std::string &
name);
uint32_t getSymbolCount()
Get the number of symbols.
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
Represents either an error or a value T.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
static ErrorOr< std::unique_ptr< LTOModule > > createFromFile(LLVMContext &Context, StringRef path, const TargetOptions &options)
Create an LTOModule.
bool isThinLTO()
Returns 'true' if the Module is produced for ThinLTO.
static ErrorOr< std::unique_ptr< LTOModule > > createFromOpenFileSlice(LLVMContext &Context, int fd, StringRef path, size_t map_size, off_t offset, const TargetOptions &options)
static std::string getProducerString(MemoryBuffer *Buffer)
Returns a string representing the producer identification stored in the bitcode, or "" if the bitcode...
std::unique_ptr< Module > takeModule()
amdgpu Simplify well known AMD library false Value Value const Twine & Name
lto_symbol_attributes getSymbolAttributes(uint32_t index)
Get the attributes for a symbol at the specified index.
const GlobalValue * getSymbolGV(uint32_t index)
static ErrorOr< std::unique_ptr< LTOModule > > createFromOpenFile(LLVMContext &Context, int fd, StringRef path, size_t size, const TargetOptions &options)
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.
StringRef 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.
const Module & getModule() const
C++ class which implements the opaque lto_module_t type.
Triple - Helper class for working with autoconf configuration names.
const std::vector< StringRef > & getAsmUndefinedRefs()
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
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...
The access may modify the value stored in memory.
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.
Deduce function attributes
void setTargetTriple(StringRef T)
Set the target triple.
static bool isBitcodeFile(const void *mem, size_t length)
Returns 'true' if the file or memory contents is LLVM bitcode.
StringRef getLinkerOpts()
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 ErrorOr< std::unique_ptr< LTOModule > > createInLocalContext(std::unique_ptr< LLVMContext > Context, const void *mem, size_t length, const TargetOptions &options, StringRef path)
A discriminated union of two pointer types, with the discriminator in the low bit of the pointer...
static ErrorOr< std::unique_ptr< LTOModule > > createFromBuffer(LLVMContext &Context, const void *mem, size_t length, const TargetOptions &options, StringRef path="")