diff options
author | Chris Lattner <sabre@nondot.org> | 2002-12-24 00:01:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-12-24 00:01:22 +0000 |
commit | 836f675c49bbb482daf6e0e01a66dd0beee11a49 (patch) | |
tree | 10cde483146ad76bdb1a12ca7af2039303f6b83d /lib/ExecutionEngine/JIT/JIT.h | |
parent | bd199fb1148b9e16c4e6f3d0ee386c2505a55b71 (diff) |
Initial checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.h')
-rw-r--r-- | lib/ExecutionEngine/JIT/JIT.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h new file mode 100644 index 0000000000..d3745e5082 --- /dev/null +++ b/lib/ExecutionEngine/JIT/JIT.h @@ -0,0 +1,54 @@ +//===-- VM.h - Definitions for Virtual Machine ------------------*- C++ -*-===// +// +// This file defines the top-level Virtual Machine data structure. +// +//===----------------------------------------------------------------------===// + +#ifndef VM_H +#define VM_H + +#include "../ExecutionEngine.h" +#include "llvm/PassManager.h" +#include <map> + +class Function; +class GlobalValue; +class Constant; +class TargetMachine; +class MachineCodeEmitter; + +class VM : public ExecutionEngine { + TargetMachine &TM; // The current target we are compiling to + PassManager PM; // Passes to compile a function + MachineCodeEmitter *MCE; // MCE object + + // FunctionRefs - A mapping between addresses that refer to unresolved + // functions and the LLVM function object itself. This is used by the fault + // handler to lazily patch up references... + // + std::map<void*, Function*> FunctionRefs; +public: + VM(Module *M, TargetMachine *tm); + ~VM(); + + /// run - Start execution with the specified function and arguments. + /// + virtual int run(const std::string &FnName, + const std::vector<std::string> &Args); + + void addFunctionRef(void *Ref, Function *F) { + FunctionRefs[Ref] = F; + } + + const std::string &getFunctionReferencedName(void *RefAddr); + + void *resolveFunctionReference(void *RefAddr); + +private: + static MachineCodeEmitter *createEmitter(VM &V); + void setupPassManager(); + void *getPointerToFunction(const Function *F); + void registerCallback(); +}; + +#endif |