mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
[ExecutionEngine] Use std::function rather than a function pointer for the
LazyFunctionCreator. Patch by Pierre-Andre Saulais. Thanks Pierre! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -89,6 +90,8 @@ public:
|
||||
uint64_t RemoveMapping(StringRef Name);
|
||||
};
|
||||
|
||||
using FunctionCreator = std::function<void *(const std::string &)>;
|
||||
|
||||
/// \brief Abstract interface for implementation execution of LLVM modules,
|
||||
/// designed to support both interpreter and just-in-time (JIT) compiler
|
||||
/// implementations.
|
||||
@@ -147,7 +150,7 @@ protected:
|
||||
/// LazyFunctionCreator - If an unknown function is needed, this function
|
||||
/// pointer is invoked to create it. If this returns null, the JIT will
|
||||
/// abort.
|
||||
void *(*LazyFunctionCreator)(const std::string &);
|
||||
FunctionCreator LazyFunctionCreator;
|
||||
|
||||
/// getMangledName - Get mangled name.
|
||||
std::string getMangledName(const GlobalValue *GV);
|
||||
@@ -470,8 +473,8 @@ public:
|
||||
/// InstallLazyFunctionCreator - If an unknown function is needed, the
|
||||
/// specified function pointer is invoked to create it. If it returns null,
|
||||
/// the JIT will abort.
|
||||
void InstallLazyFunctionCreator(void* (*P)(const std::string &)) {
|
||||
LazyFunctionCreator = P;
|
||||
void InstallLazyFunctionCreator(FunctionCreator C) {
|
||||
LazyFunctionCreator = C;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
Reference in New Issue
Block a user