summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-24 00:01:22 +0000
committerChris Lattner <sabre@nondot.org>2002-12-24 00:01:22 +0000
commite6761db9617a71674940bfa6a293d6101bc76b49 (patch)
treed318cea17dd5a1bb94a40609bad79b186a21a1dd /llvm/lib/ExecutionEngine
parent996fe0102878d706d47a06bc78d21d1f38ed2aec (diff)
downloadbcm5719-llvm-e6761db9617a71674940bfa6a293d6101bc76b49.tar.gz
bcm5719-llvm-e6761db9617a71674940bfa6a293d6101bc76b49.zip
Initial checkin
llvm-svn: 5127
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/VM.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/VM.h b/llvm/lib/ExecutionEngine/JIT/VM.h
new file mode 100644
index 00000000000..d3745e50827
--- /dev/null
+++ b/llvm/lib/ExecutionEngine/JIT/VM.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
OpenPOWER on IntegriCloud