13#ifndef LLVM_LTO_LEGACY_LTOMODULE_H
14#define LLVM_LTO_LEGACY_LTOMODULE_H
40 struct NameAndAttributes {
43 bool isFunction =
false;
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,
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;
160 const char *path, std::string &out_error);
178 void parseMetadata();
216 bool objcClassNameFromExpression(
const Constant *c, std::string &
name);
This file defines the StringMap class.
Module.h This file contains the declarations for the Module class.
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
static bool isFunction(SDValue Op)
StringSet - A set-like wrapper for the StringMap.
This is an important base class in LLVM.
Represents either an error or a value T.
Tagged union holding either a T or a Error.
This is an important class for using LLVM in a threaded context.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
A Module instance is used to store all the information related to an LLVM module.
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
void setTargetTriple(StringRef T)
Set the target triple.
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
StringSet - A wrapper for StringMap that provides set-like functionality.
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
This is an optimization pass for GlobalISel generic memory operations.
C++ class which implements the opaque lto_module_t type.
StringRef getSymbolName(uint32_t index)
Get the name of the symbol at the specified index.
const GlobalValue * getSymbolGV(uint32_t index)
static ErrorOr< std::unique_ptr< LTOModule > > createFromFile(LLVMContext &Context, StringRef path, const TargetOptions &options)
Create an LTOModule.
static bool isBitcodeFile(const void *mem, size_t length)
Returns 'true' if the file or memory contents is LLVM bitcode.
Expected< uint32_t > getMachOCPUType() const
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.
uint32_t getSymbolCount()
Get the number of symbols.
static size_t getDependentLibraryCount(lto::InputFile *input)
bool hasCtorDtor() const
Returns true if the module has either the @llvm.global_ctors or the @llvm.global_dtors symbol.
static const char * getDependentLibrary(lto::InputFile *input, size_t index, size_t *size)
lto_symbol_attributes getSymbolAttributes(uint32_t index)
Get the attributes for a symbol at the specified index.
const Module & getModule() const
static ErrorOr< std::unique_ptr< LTOModule > > createFromOpenFileSlice(LLVMContext &Context, int fd, StringRef path, size_t map_size, off_t offset, const TargetOptions &options)
StringRef getLinkerOpts()
static std::string getProducerString(MemoryBuffer *Buffer)
Returns a string representing the producer identification stored in the bitcode, or "" if the bitcode...
const std::string & getTargetTriple()
Return the Module's target triple.
const std::vector< StringRef > & getAsmUndefinedRefs()
static bool isBitcodeForTarget(MemoryBuffer *memBuffer, StringRef triplePrefix)
Returns 'true' if the memory buffer is LLVM bitcode for the specified triple.
void setTargetTriple(StringRef Triple)
Set the Module's target triple.
bool isThinLTO()
Returns 'true' if the Module is produced for ThinLTO.
static ErrorOr< std::unique_ptr< LTOModule > > createFromOpenFile(LLVMContext &Context, int fd, StringRef path, size_t size, const TargetOptions &options)
static ErrorOr< std::unique_ptr< LTOModule > > createInLocalContext(std::unique_ptr< LLVMContext > Context, const void *mem, size_t length, const TargetOptions &options, StringRef path)
static ErrorOr< std::unique_ptr< LTOModule > > createFromBuffer(LLVMContext &Context, const void *mem, size_t length, const TargetOptions &options, StringRef path="")
Expected< uint32_t > getMachOCPUSubType() const
std::unique_ptr< Module > takeModule()
static lto::InputFile * createInputFile(const void *buffer, size_t buffer_size, const char *path, std::string &out_error)