A small re-factored JIT/MCJIT::getPointerToNamedFunction(), so it could be called...
authorDanil Malyshev <dmalyshev@accesssoftek.com>
Thu, 5 Jan 2012 21:16:14 +0000 (21:16 +0000)
committerDanil Malyshev <dmalyshev@accesssoftek.com>
Thu, 5 Jan 2012 21:16:14 +0000 (21:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147610 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/ExecutionEngine.h
lib/ExecutionEngine/Interpreter/Interpreter.h
lib/ExecutionEngine/JIT/JIT.h
lib/ExecutionEngine/MCJIT/MCJIT.h

index e89fd2ea4aca68cb8f024829113a5112ec2113af..9f77ebeb9e666b2b2c506e22c021461d4188ea36 100644 (file)
@@ -228,6 +228,17 @@ public:
   virtual GenericValue runFunction(Function *F,
                                 const std::vector<GenericValue> &ArgValues) = 0;
 
+  /// 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.
+  ///
+  /// If AbortOnFailure is false and no function with the given name is
+  /// found, this function silently returns a null pointer. Otherwise,
+  /// it prints a message to stderr and aborts.
+  ///
+  virtual void *getPointerToNamedFunction(const std::string &Name,
+                                          bool AbortOnFailure = true) = 0;
+
   /// runStaticConstructorsDestructors - This method is used to execute all of
   /// the static constructors or destructors for a program.
   ///
index ee2b4596f38f5c05754c27dd4ddaf2be4bacc39f..7c8e71e14f6fa34c3ef10824818b9159a49b4b00 100644 (file)
@@ -115,6 +115,12 @@ public:
   virtual GenericValue runFunction(Function *F,
                                    const std::vector<GenericValue> &ArgValues);
 
+  virtual void *getPointerToNamedFunction(const std::string &Name,
+                                          bool AbortOnFailure = true) {
+    // FIXME: not implemented.
+    return 0;
+  };
+
   /// recompileAndRelinkFunction - For the interpreter, functions are always
   /// up-to-date.
   ///
index fbb941667b089cbea937f7fac46d99b0ee59b32a..17d33fe808748489ad1a11a896e39c0574392422 100644 (file)
@@ -124,8 +124,8 @@ public:
   /// found, this function silently returns a null pointer. Otherwise,
   /// it prints a message to stderr and aborts.
   ///
-  void *getPointerToNamedFunction(const std::string &Name,
-                                  bool AbortOnFailure = true);
+  virtual void *getPointerToNamedFunction(const std::string &Name,
+                                          bool AbortOnFailure = true);
 
   // CompilationCallback - Invoked the first time that a call site is found,
   // which causes lazy compilation of the target function.
index 2a98fc9f5e8fd36656cab58702e2e34f1b90de7b..51e63d96e45bd92b12d713198fa8ded22e27d0cf 100644 (file)
@@ -65,8 +65,8 @@ public:
   /// found, this function silently returns a null pointer. Otherwise,
   /// it prints a message to stderr and aborts.
   ///
-  void *getPointerToNamedFunction(const std::string &Name,
-                                  bool AbortOnFailure = true);
+  virtual void *getPointerToNamedFunction(const std::string &Name,
+                                          bool AbortOnFailure = true);
   /// @}
   /// @name (Private) Registration Interfaces
   /// @{