15 #ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H 16 #define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H 49 class JITEventListener;
50 class MCJITMemoryManager;
52 class RTDyldMemoryManager;
78 std::map<uint64_t, std::string> GlobalAddressReverseMap;
82 return GlobalAddressMap;
86 return GlobalAddressReverseMap;
117 bool CompilingLazily;
120 bool GVCompilationDisabled;
124 bool SymbolSearchingDisabled;
140 std::unique_ptr<Module> M, std::string *ErrorStr,
141 std::shared_ptr<MCJITMemoryManager> MM,
142 std::shared_ptr<LegacyJITSymbolResolver> SR,
143 std::unique_ptr<TargetMachine>
TM);
146 std::string *ErrorStr, std::shared_ptr<MCJITMemoryManager> MM,
147 std::shared_ptr<LegacyJITSymbolResolver> SR,
148 std::unique_ptr<TargetMachine>
TM);
151 std::string *ErrorStr);
187 virtual void addObjectFile(std::unique_ptr<object::ObjectFile>
O);
208 virtual bool removeModule(
Module *M);
241 virtual void *getPointerToNamedFunction(
StringRef Name,
242 bool AbortOnFailure =
true) = 0;
249 uint64_t TargetAddress) {
284 virtual void runStaticConstructorsDestructors(
bool isDtors);
290 void runStaticConstructorsDestructors(
Module &module,
bool isDtors);
296 int runFunctionAsMain(
Function *Fn,
const std::vector<std::string> &argv,
297 const char *
const * envp);
307 void addGlobalMapping(
const GlobalValue *GV,
void *Addr);
308 void addGlobalMapping(
StringRef Name, uint64_t Addr);
312 void clearAllGlobalMappings();
316 void clearGlobalMappingsFromModule(
Module *M);
322 uint64_t updateGlobalMapping(
const GlobalValue *GV,
void *Addr);
323 uint64_t updateGlobalMapping(
StringRef Name, uint64_t Addr);
327 uint64_t getAddressToGlobalIfAvailable(
StringRef S);
332 void *getPointerToGlobalIfAvailable(
StringRef S);
333 void *getPointerToGlobalIfAvailable(
const GlobalValue *GV);
350 virtual void *getPointerToFunction(
Function *F) = 0;
361 return getPointerToFunction(F);
385 const GlobalValue *getGlobalValueAtAddress(
void *Addr);
394 void InitializeMemory(
const Constant *
Init,
void *Addr);
403 return getPointerToGlobal((
const GlobalValue *)GV);
451 CompilingLazily = !Disabled;
454 return CompilingLazily;
461 GVCompilationDisabled = Disabled;
464 return GVCompilationDisabled;
471 SymbolSearchingDisabled = Disabled;
474 return SymbolSearchingDisabled;
485 return VerifyModules;
492 LazyFunctionCreator = std::move(C);
509 void Init(std::unique_ptr<Module> M);
512 namespace EngineKind {
528 std::unique_ptr<Module> M;
530 std::string *ErrorStr;
532 std::shared_ptr<MCJITMemoryManager> MemMgr;
533 std::shared_ptr<LegacyJITSymbolResolver>
Resolver;
541 bool UseOrcMCJITReplacement;
542 bool EmulatedTLS =
true;
567 EngineBuilder &setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);
570 setMemoryManager(std::unique_ptr<MCJITMemoryManager> MM);
572 EngineBuilder &setSymbolResolver(std::unique_ptr<LegacyJITSymbolResolver> SR);
612 MArch.assign(march.
begin(), march.
end());
618 MCPU.assign(mcpu.
begin(), mcpu.
end());
630 template<
typename StringSequence>
633 MAttrs.
append(mattrs.begin(), mattrs.end());
639 this->UseOrcMCJITReplacement = UseOrcMCJITReplacement;
643 this->EmulatedTLS = EmulatedTLS;
656 return create(selectTarget());
667 #endif // LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
A parsed version of the target data layout string in and methods for querying it. ...
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
virtual void * getOrEmitGlobalVariable(const GlobalVariable *GV)
getOrEmitGlobalVariable - Return the address of the specified global variable, possibly emitting it t...
This class represents lattice values for constants.
struct LLVMOpaqueExecutionEngine * LLVMExecutionEngineRef
A Module instance is used to store all the information related to an LLVM module. ...
sys::Mutex lock
lock - This lock protects the ExecutionEngine and MCJIT classes.
void push_back(const T &Elt)
JITEventListener - Abstract interface for use by the JIT to notify clients about significant events d...
virtual void setObjectCache(ObjectCache *)
Sets the pre-compiled object cache.
static bool getConstantValue(SDValue N, uint32_t &Out)
virtual void * getPointerToFunctionOrStub(Function *F)
getPointerToFunctionOrStub - If the specified function has been code-gen'd, return a pointer to the f...
const DataLayout & getDataLayout() const
virtual void RegisterJITEventListener(JITEventListener *)
Registers a listener to be called back on various events within the JIT.
EngineBuilder & setMArch(StringRef march)
setMArch - Override the architecture set by the Module's triple.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
EngineBuilder & setVerifyModules(bool Verify)
setVerifyModules - Set whether the JIT implementation should verify IR modules during compilation...
virtual void addModule(std::unique_ptr< Module > M)
Add a Module to the list of modules that we can JIT from.
ppc ctr loops PowerPC CTR Loops Verify
std::function< void *(const std::string &)> FunctionCreator
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
virtual void finalizeObject()
finalizeObject - ensure the module is fully processed and is usable.
EngineBuilder & setCodeModel(CodeModel::Model M)
setCodeModel - Set the CodeModel that the ExecutionEngine target data is using.
bool isSymbolSearchingDisabled() const
bool isCompilingLazily() const
EngineBuilder & setEngineKind(EngineKind::Kind w)
setEngineKind - Controls whether the user wants the interpreter, the JIT, or whichever engine works...
virtual void generateCodeForModule(Module *M)
generateCodeForModule - Run code generation for the specified module and load it into memory...
void setUseOrcMCJITReplacement(bool UseOrcMCJITReplacement)
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important base class in LLVM.
EngineBuilder & setErrorStr(std::string *e)
setErrorStr - Set the error string to write to on error.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
bool isGVCompilationDisabled() const
EngineBuilder & setMAttrs(const StringSequence &mattrs)
setMAttrs - Set cpu-specific attributes.
GlobalAddressMapTy & getGlobalAddressMap()
void InstallLazyFunctionCreator(FunctionCreator C)
InstallLazyFunctionCreator - If an unknown function is needed, the specified function pointer is invo...
bool getVerifyModules() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter...
Triple - Helper class for working with autoconf configuration names.
std::map< uint64_t, std::string > & getGlobalAddressReverseMap()
ExecutionEngine(DataLayout DL)
void DisableSymbolSearching(bool Disabled=true)
DisableSymbolSearching - If called, the JIT will not try to lookup unknown symbols with dlsym...
EngineBuilder & setRelocationModel(Reloc::Model RM)
setRelocationModel - Set the relocation model that the ExecutionEngine target is using.
EngineBuilder & setTargetOptions(const TargetOptions &Opts)
setTargetOptions - Set the target options that the ExecutionEngine target is using.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
virtual void setProcessAllSections(bool ProcessAllSections)
setProcessAllSections (MCJIT Only): By default, only sections that are "required for execution" are p...
void setVerifyModules(bool Verify)
Enable/Disable IR module verification.
void DisableLazyCompilation(bool Disabled=true)
DisableLazyCompilation - When lazy compilation is off (the default), the JIT will eagerly compile eve...
SmallVector< std::unique_ptr< Module >, 1 > Modules
The list of Modules that we are JIT'ing from.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
ExecutionEngine * create()
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
void setEmulatedTLS(bool EmulatedTLS)
This is the base ObjectCache type which can be provided to an ExecutionEngine for the purpose of avoi...
Helper class for helping synchronize access to the global address map table.
Builder class for ExecutionEngines.
virtual void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress)
mapSectionAddress - map a section to its target address space value.
virtual TargetMachine * getTargetMachine()
Return the target machine (if available).
FunctionCreator LazyFunctionCreator
LazyFunctionCreator - If an unknown function is needed, this function pointer is invoked to create it...
Primary interface to the complete machine description for the target machine.
void DisableGVCompilation(bool Disabled=true)
DisableGVCompilation - If called, the JIT will abort if it's asked to allocate space and populate a G...
virtual uint64_t getFunctionAddress(const std::string &Name)
getFunctionAddress - Return the address of the specified function.
StringRef - Represent a constant reference to a string, i.e.
virtual void UnregisterJITEventListener(JITEventListener *)
virtual uint64_t getGlobalValueAddress(const std::string &Name)
getGlobalValueAddress - Return the address of the specified global value.
EngineBuilder & setOptLevel(CodeGenOpt::Level l)
setOptLevel - Set the optimization level for the JIT.
EngineBuilder & setMCPU(StringRef mcpu)
setMCPU - Target a specific cpu type.