My Project
|
#include <ExecutionEngine.h>
Public Member Functions | |
ExecutionEngine (bool enableObjectCache) | |
llvm::Expected< void(*)(void **)> | lookup (StringRef name) const |
template<typename... Args> | |
llvm::Error | invoke (StringRef name, Args &... args) |
llvm::Error | invoke (StringRef name, MutableArrayRef< void *> args) |
void | dumpToObjectFile (StringRef filename) |
Dump object code to output file filename . More... | |
Static Public Member Functions | |
static llvm::Expected< std::unique_ptr< ExecutionEngine > > | create (ModuleOp m, std::function< llvm::Error(llvm::Module *)> transformer={}, Optional< llvm::CodeGenOpt::Level > jitCodeGenOptLevel=llvm::None, ArrayRef< StringRef > sharedLibPaths={}, bool enableObjectCache=false) |
static bool | setupTargetTriple (llvm::Module *llvmModule) |
JIT-backed execution engine for MLIR modules. Assumes the module can be converted to LLVM IR. For each function, creates a wrapper function with the fixed interface
void _mlir_funcName(void **)
where the only argument is interpreted as a list of pointers to the actual arguments of the function, followed by a pointer to the result. This allows the engine to provide the caller with a generic function pointer that can be used to invoke the JIT-compiled function.
ExecutionEngine::ExecutionEngine | ( | bool | enableObjectCache | ) |
|
static |
Creates an execution engine for the given module. If transformer
is provided, it will be called on the LLVM module during JIT-compilation and can be used, e.g., for reporting or optimization. jitCodeGenOptLevel
, when provided, is used as the optimization level for target code generation. If sharedLibPaths
are provided, the underlying JIT-compilation will open and link the shared libraries for symbol resolution. If objectCache
is provided, JIT compiler will use it to store the object generated for the given module.
void ExecutionEngine::dumpToObjectFile | ( | StringRef | filename | ) |
Dump object code to output file filename
.
llvm::Error mlir::ExecutionEngine::invoke | ( | StringRef | name, |
Args &... | args | ||
) |
Invokes the function with the given name passing it the list of arguments. The arguments are accepted by lvalue-reference since the packed function interface expects a list of non-null pointers.
Error ExecutionEngine::invoke | ( | StringRef | name, |
MutableArrayRef< void *> | args | ||
) |
Invokes the function with the given name passing it the list of arguments as a list of opaque pointers. This is the arity-agnostic equivalent of the templated invoke
.
Expected< void(*)(void **)> ExecutionEngine::lookup | ( | StringRef | name | ) | const |
Looks up a packed-argument function with the given name and returns a pointer to it. Propagates errors in case of failure.
|
static |
Set the target triple on the module. This is implicitly done when creating the engine.