15 #ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
16 #define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
37 class ExecutionEngine;
41 class JITEventListener;
42 class JITMemoryManager;
43 class MachineCodeInfo;
47 class RTDyldMemoryManager;
77 std::map<void *, AssertingVH<const GlobalValue> > GlobalAddressReverseMap;
83 return GlobalAddressMap;
86 std::map<void*, AssertingVH<const GlobalValue> > &
88 return GlobalAddressReverseMap;
112 bool CompilingLazily;
115 bool GVCompilationDisabled;
119 bool SymbolSearchingDisabled;
138 std::string *ErrorStr,
144 std::string *ErrorStr,
153 void *(*LazyFunctionCreator)(
const std::string &);
178 bool ForceInterpreter =
false,
179 std::string *ErrorStr = 0,
182 bool GVsWithCode =
true);
191 std::string *ErrorStr = 0,
195 bool GVsWithCode =
true,
223 const std::vector<GenericValue> &ArgValues) = 0;
239 bool AbortOnFailure =
true) = 0;
294 const char *
const * envp);
447 CompilingLazily = !Disabled;
450 return CompilingLazily;
455 return !CompilingLazily;
462 GVCompilationDisabled = Disabled;
465 return GVCompilationDisabled;
472 SymbolSearchingDisabled = Disabled;
475 return SymbolSearchingDisabled;
497 namespace EngineKind {
513 std::string *ErrorStr;
517 bool AllocateGVsWithCode;
534 AllocateGVsWithCode =
false;
624 AllocateGVsWithCode = a;
630 MArch.assign(march.
begin(), march.
end());
636 MCPU.assign(mcpu.
begin(), mcpu.
end());
648 template<
typename StringSequence>
651 MAttrs.
append(mattrs.begin(), mattrs.end());
EngineBuilder & setMCJITMemoryManager(RTDyldMemoryManager *mcjmm)
void * RemoveMapping(const MutexGuard &, const GlobalValue *ToUnmap)
Erase an entry from the mapping table.
COFF::RelocationTypeX86 Type
virtual void * getOrEmitGlobalVariable(const GlobalVariable *GV)
void clearAllGlobalMappings()
struct LLVMOpaqueExecutionEngine * LLVMExecutionEngineRef
int runFunctionAsMain(Function *Fn, const std::vector< std::string > &argv, const char *const *envp)
The main container class for the LLVM Intermediate Representation.
virtual bool removeModule(Module *M)
ValueMap< const GlobalValue *, void *, AddressMapConfig > GlobalAddressMapTy
virtual void setObjectCache(ObjectCache *)
void EmitGlobalVariable(const GlobalVariable *GV)
virtual void * getPointerToFunctionOrStub(Function *F)
virtual void RegisterJITEventListener(JITEventListener *)
EngineBuilder & setMArch(StringRef march)
setMArch - Override the architecture set by the Module's triple.
GlobalAddressMapTy & getGlobalAddressMap(const MutexGuard &)
static ExecutionEngine * create(Module *M, bool ForceInterpreter=false, std::string *ErrorStr=0, CodeGenOpt::Level OptLevel=CodeGenOpt::Default, bool GVsWithCode=true)
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
virtual void runStaticConstructorsDestructors(bool isDtors)
void setDataLayout(const DataLayout *td)
void * getPointerToGlobal(const GlobalValue *GV)
void InitializeMemory(const Constant *Init, void *Addr)
#define llvm_unreachable(msg)
void *(* LazyFunctionCreator)(const std::string &)
virtual GenericValue runFunction(Function *F, const std::vector< GenericValue > &ArgValues)=0
virtual char * getMemoryForGV(const GlobalVariable *GV)
getMemoryforGV - Allocate memory for a global variable.
void LoadValueFromMemory(GenericValue &Result, GenericValue *Ptr, Type *Ty)
virtual void finalizeObject()
static void onDelete(ExecutionEngineState *EES, const GlobalValue *Old)
EngineBuilder & setCodeModel(CodeModel::Model M)
GenericValue getConstantValue(const Constant *C)
Converts a Constant* into a GenericValue, including handling of ConstantExpr values.
static void onRAUW(ExecutionEngineState *, const GlobalValue *, const GlobalValue *)
EngineBuilder & setAllocateGVsWithCode(bool a)
void StoreValueToMemory(const GenericValue &Val, GenericValue *Ptr, Type *Ty)
EngineBuilder & setEngineKind(EngineKind::Kind w)
virtual void runJITOnFunction(Function *, MachineCodeInfo *=0)
virtual void generateCodeForModule(Module *M)
Guard a section of code with a Mutex.
bool isGVCompilationDisabled() const
bool isCompilingLazily() const
LLVM Basic Block Representation.
virtual void * getPointerToBasicBlock(BasicBlock *BB)=0
LLVM Constant Representation.
static ExecutionEngine * createJIT(Module *M, std::string *ErrorStr=0, JITMemoryManager *JMM=0, CodeGenOpt::Level OptLevel=CodeGenOpt::Default, bool GVsWithCode=true, Reloc::Model RM=Reloc::Default, CodeModel::Model CMM=CodeModel::JITDefault)
EngineBuilder & setErrorStr(std::string *e)
bool isSymbolSearchingDisabled() const
bool isLazyCompilationDisabled() const
EngineBuilder & setMAttrs(const StringSequence &mattrs)
setMAttrs - Set cpu-specific attributes.
EngineBuilder & setUseMCJIT(bool Value)
void * getPointerToGlobalIfAvailable(const GlobalValue *GV)
void append(in_iter in_start, in_iter in_end)
void clearGlobalMappingsFromModule(Module *M)
virtual void addModule(Module *M)
Abstract interface for implementation execution of LLVM modules, designed to support both interpreter...
EngineBuilder & setJITMemoryManager(JITMemoryManager *jmm)
void * updateGlobalMapping(const GlobalValue *GV, void *Addr)
virtual void freeMachineCodeForFunction(Function *F)=0
void DisableSymbolSearching(bool Disabled=true)
EngineBuilder & setRelocationModel(Reloc::Model RM)
static sys::Mutex * getMutex(ExecutionEngineState *EES)
EngineBuilder & setTargetOptions(const TargetOptions &Opts)
void InstallLazyFunctionCreator(void *(*P)(const std::string &))
virtual Function * FindFunctionNamed(const char *FnName)
virtual void * getPointerToFunction(Function *F)=0
void DisableLazyCompilation(bool Disabled=true)
virtual ~ExecutionEngine()
ExecutionEngine * create()
void addGlobalMapping(const GlobalValue *GV, void *Addr)
const DataLayout * getDataLayout() const
SmallVector< Module *, 1 > Modules
const GlobalValue * getGlobalValueAtAddress(void *Addr)
Helper class for helping synchronize access to the global address map table.
virtual void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress)
TargetMachine * selectTarget()
ExecutionEngineState(ExecutionEngine &EE)
ExecutionEngine(Module *M)
LLVM Value Representation.
ExecutionEngineState * ExtraData
virtual void * getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true)=0
void DisableGVCompilation(bool Disabled=true)
virtual uint64_t getFunctionAddress(const std::string &Name)
virtual void UnregisterJITEventListener(JITEventListener *)
virtual uint64_t getGlobalValueAddress(const std::string &Name)
virtual void * recompileAndRelinkFunction(Function *F)=0
std::map< void *, AssertingVH< const GlobalValue > > & getGlobalAddressReverseMap(const MutexGuard &)
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
EngineBuilder & setOptLevel(CodeGenOpt::Level l)
EngineBuilder & setMCPU(StringRef mcpu)
setMCPU - Target a specific cpu type.