Factory methods for function passes now return type FunctionPass *.
[oota-llvm.git] / lib / ExecutionEngine / JIT / JIT.h
index 3b267ed877bba7c4824778d53ffc3280ec541b6e..b4a1e0fa121e086af21c1c2dd2ec4821d39c5a95 100644 (file)
@@ -19,14 +19,9 @@ class MachineCodeEmitter;
 
 class VM : public ExecutionEngine {
   TargetMachine &TM;       // The current target we are compiling to
-  PassManager PM;          // Passes to compile a function
+  FunctionPassManager 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();
@@ -36,25 +31,29 @@ public:
   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);
-
   /// getPointerToNamedFunction - This method returns the address of the
   /// specified function by using the dlsym function call.  As such it is only
   /// useful for resolving library symbols, not code generated symbols.
   ///
   void *getPointerToNamedFunction(const std::string &Name);
 
+  // CompilationCallback - Invoked the first time that a call site is found,
+  // which causes lazy compilation of the target function.
+  // 
+  static void CompilationCallback();
+
+  /// runAtExitHandlers - Before exiting the program, at_exit functions must be
+  /// called.  This method calls them.
+  ///
+  static void runAtExitHandlers();
+
+  /// getPointerToFunction - This returns the address of the specified function,
+  /// compiling it if necessary.
+  void *getPointerToFunction(Function *F);
+
 private:
   static MachineCodeEmitter *createEmitter(VM &V);
   void setupPassManager();
-  void *getPointerToFunction(const Function *F);
-  void registerCallback();
 };
 
 #endif