[PATCH] D10958: [JIT] Use std::function with InstallLazyFunctionCreator
Pierre-Andre Saulais
pierre-andre at codeplay.com
Mon Jul 6 06:44:13 PDT 2015
pasaulais added a reviewer: lhames.
pasaulais added a subscriber: llvm-commits.
ExecutionEngine::InstallLazyFunctionCreator takes a function pointer, which prevents passing lambdas that capture state or member functions. With this commit, InstallLazyFunctionCreator takes a std::function parameter which allows lambdas and member functions to be used.
Repository:
rL LLVM
http://reviews.llvm.org/D10958
Files:
include/llvm/ExecutionEngine/ExecutionEngine.h
Index: include/llvm/ExecutionEngine/ExecutionEngine.h
===================================================================
--- include/llvm/ExecutionEngine/ExecutionEngine.h
+++ include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -31,6 +31,7 @@
#include <map>
#include <string>
#include <vector>
+#include <functional>
namespace llvm {
@@ -89,6 +90,8 @@
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 @@
/// 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 @@
/// 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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10958.29083.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150706/d19dfa4f/attachment.bin>
More information about the llvm-commits
mailing list