Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / ExecutionEngine / ExecutionEngine.h
index 7dc2c0a42ce16ac2b7d0591527fbdee0f47fd34e..d67371376d06f448d3723bc1383f9d6730e23a42 100644 (file)
@@ -1,4 +1,11 @@
 //===- ExecutionEngine.h - Abstract Execution Engine Interface --*- C++ -*-===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This file defines the abstract interface that implements execution support
 // for LLVM.
 #include <map>
 #include <cassert>
 class Constant;
-class Type;
-class GlobalValue;
 class Function;
+union GenericValue;
+class GlobalValue;
 class Module;
+class ModuleProvider;
 class TargetData;
-union GenericValue;
+class Type;
 
 class ExecutionEngine {
   Module &CurMod;
   const TargetData *TD;
 
 protected:
+  ModuleProvider *MP;
   // GlobalAddress - A mapping between LLVM global values and their actualized
   // version...
   std::map<const GlobalValue*, void *> GlobalAddress;
@@ -32,10 +41,10 @@ protected:
   void setTargetData(const TargetData &td) {
     TD = &td;
   }
+
 public:
-  ExecutionEngine(Module *M) : CurMod(*M) {
-    assert(M && "Module is null?");
-  }
+  ExecutionEngine(ModuleProvider *P);
+  ExecutionEngine(Module *M);
   virtual ~ExecutionEngine();
   
   Module &getModule() const { return CurMod; }
@@ -44,21 +53,11 @@ public:
   /// run - Start execution with the specified function, arguments, and
   ///       environment.
   ///
-  virtual int run(const std::string &FnName,
-                  const std::vector<std::string> &Args,
-                  const char ** envp) = 0;
+  virtual GenericValue run(Function *F,
+                           const std::vector<GenericValue> &ArgValues) = 0;
 
-  static ExecutionEngine *create (Module *M, bool ForceInterpreter,
-                                 bool TraceMode);
-
-  /// createJIT - Create an return a new JIT compiler if there is one available
-  /// for the current target.  Otherwise it returns null.
-  ///
-  static ExecutionEngine *createJIT(Module *M);
-
-  /// createInterpreter - Create a new interpreter object.  This can never fail.
-  ///
-  static ExecutionEngine *createInterpreter(Module *M, bool TraceMode);
+  static ExecutionEngine *create(ModuleProvider *MP, bool ForceInterpreter,
+                                 bool TraceMode);
 
   void addGlobalMapping(const Function *F, void *Addr) {
     void *&CurVal = GlobalAddress[(const GlobalValue*)F];
@@ -85,15 +84,13 @@ public:
   //
   virtual void *getPointerToFunction(Function *F) = 0;
 
+  void StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty);
+  void InitializeMemory(const Constant *Init, void *Addr);
+
 protected:
   void emitGlobals();
-
-public:   // FIXME: protected:   // API shared among subclasses
   GenericValue getConstantValue(const Constant *C);
-  void StoreValueToMemory(GenericValue Val, GenericValue *Ptr, const Type *Ty);
   GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty);
-  void *CreateArgv(const std::vector<std::string> &InputArgv);
-  void InitializeMemory(const Constant *Init, void *Addr);
 };
 
 #endif