13 #ifndef LLVM_LTO_LTOMODULE_H 14 #define LLVM_LTO_LTOMODULE_H 40 struct NameAndAttributes {
47 std::unique_ptr<LLVMContext> OwnedContext;
49 std::string LinkerOpts;
51 std::string DependentLibraries;
53 std::unique_ptr<Module>
Mod;
56 std::unique_ptr<TargetMachine> _target;
57 std::vector<NameAndAttributes> _symbols;
62 std::vector<StringRef> _asm_undefines;
88 static std::unique_ptr<MemoryBuffer>
107 size_t map_size, off_t offset,
120 std::unique_ptr<Module>
takeModule() {
return std::move(Mod); }
134 return _symbols.size();
139 if (index < _symbols.size())
146 if (index < _symbols.size())
147 return _symbols[index].
name;
152 if (index < _symbols.size())
153 return _symbols[index].symbol;
162 const char *path, std::string &out_error);
172 void parseMetadata();
210 bool objcClassNameFromExpression(
const Constant *c, std::string &
name);
static size_t getDependentLibraryCount(lto::InputFile *input)
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. ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static ErrorOr< std::unique_ptr< LTOModule > > createFromFile(LLVMContext &Context, StringRef path, const TargetOptions &options)
Create an LTOModule.
static lto::InputFile * createInputFile(const void *buffer, size_t buffer_size, const char *path, std::string &out_error)
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()
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.
static const char * getDependentLibrary(lto::InputFile *input, size_t index, size_t *size)
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.
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()
Deduce and propagate attributes
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 or more pointer types, with the discriminator in the low bit of the poin...
static ErrorOr< std::unique_ptr< LTOModule > > createFromBuffer(LLVMContext &Context, const void *mem, size_t length, const TargetOptions &options, StringRef path="")