13#ifndef LLVM_LTO_LEGACY_LTOMODULE_H
14#define LLVM_LTO_LEGACY_LTOMODULE_H
41 struct NameAndAttributes {
44 bool isFunction =
false;
48 std::unique_ptr<LLVMContext> OwnedContext;
50 std::string LinkerOpts;
52 std::unique_ptr<Module> Mod;
55 std::unique_ptr<TargetMachine> _target;
56 std::vector<NameAndAttributes> _symbols;
61 std::vector<StringRef> _asm_undefines;
87 LLVM_ABI static std::unique_ptr<MemoryBuffer>
106 size_t map_size, off_t offset,
129 return _symbols.size();
134 if (index < _symbols.size())
141 if (index < _symbols.size())
142 return _symbols[index].name;
149 if (index < _asm_undefines.size())
150 return _asm_undefines[index];
155 if (index < _symbols.size())
156 return _symbols[index].symbol;
167 std::string &out_error);
172 size_t index,
size_t *size);
186 void parseMetadata();
224 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 Triple & getTargetTriple() const
Get the target triple which is a string describing the target host.
void setTargetTriple(Triple 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 LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > createFromFile(LLVMContext &Context, StringRef path, const TargetOptions &options)
Create an LTOModule.
static LLVM_ABI bool isBitcodeFile(const void *mem, size_t length)
Returns 'true' if the file or memory contents is LLVM bitcode.
LLVM_ABI Expected< uint32_t > getMachOCPUType() const
static LLVM_ABI 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 LLVM_ABI size_t getDependentLibraryCount(lto::InputFile *input)
uint32_t getAsmUndefSymbolCount()
LLVM_ABI bool hasCtorDtor() const
Returns true if the module has either the @llvm.global_ctors or the @llvm.global_dtors symbol.
static LLVM_ABI 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 LLVM_ABI 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 LLVM_ABI std::string getProducerString(MemoryBuffer *Buffer)
Returns a string representing the producer identification stored in the bitcode, or "" if the bitcode...
const std::vector< StringRef > & getAsmUndefinedRefs()
static LLVM_ABI bool isBitcodeForTarget(MemoryBuffer *memBuffer, StringRef triplePrefix)
Returns 'true' if the memory buffer is LLVM bitcode for the specified triple.
LLVM_ABI bool isThinLTO()
Returns 'true' if the Module is produced for ThinLTO.
void setTargetTriple(Triple T)
Set the Module's target triple.
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > createFromOpenFile(LLVMContext &Context, int fd, StringRef path, size_t size, const TargetOptions &options)
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > createInLocalContext(std::unique_ptr< LLVMContext > Context, const void *mem, size_t length, const TargetOptions &options, StringRef path)
static LLVM_ABI ErrorOr< std::unique_ptr< LTOModule > > createFromBuffer(LLVMContext &Context, const void *mem, size_t length, const TargetOptions &options, StringRef path="")
LLVM_ABI Expected< uint32_t > getMachOCPUSubType() const
std::unique_ptr< Module > takeModule()
const Triple & getTargetTriple()
Return the Module's target triple.
static LLVM_ABI lto::InputFile * createInputFile(const void *buffer, size_t buffer_size, const char *path, std::string &out_error)
StringRef getAsmUndefSymbolName(uint32_t index)