forked from OSchip/llvm-project
[mlir][python] ExecutionEngine can dump to object file
Differential Revision: https://reviews.llvm.org/D100786
This commit is contained in:
parent
cc68799056
commit
1dc533cea4
|
@ -67,6 +67,11 @@ MLIR_CAPI_EXPORTED void
|
|||
mlirExecutionEngineRegisterSymbol(MlirExecutionEngine jit, MlirStringRef name,
|
||||
void *sym);
|
||||
|
||||
/// Dump as an object in `fileName`.
|
||||
MLIR_CAPI_EXPORTED void
|
||||
mlirExecutionEngineDumpToObjectFile(MlirExecutionEngine jit,
|
||||
MlirStringRef fileName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -93,5 +93,13 @@ void mlir::python::populateExecutionEngineSubmodule(py::module &m) {
|
|||
mlirStringRefCreate(name.c_str(), name.size()),
|
||||
reinterpret_cast<void *>(sym));
|
||||
},
|
||||
"Lookup function `func` in the ExecutionEngine.");
|
||||
"Lookup function `func` in the ExecutionEngine.")
|
||||
.def(
|
||||
"dump_to_object_file",
|
||||
[](PyExecutionEngine &executionEngine, const std::string &fileName) {
|
||||
mlirExecutionEngineDumpToObjectFile(
|
||||
executionEngine.get(),
|
||||
mlirStringRefCreate(fileName.c_str(), fileName.size()));
|
||||
},
|
||||
"Dump ExecutionEngine to an object file.");
|
||||
}
|
||||
|
|
|
@ -66,3 +66,8 @@ extern "C" void mlirExecutionEngineRegisterSymbol(MlirExecutionEngine jit,
|
|||
return symbolMap;
|
||||
});
|
||||
}
|
||||
|
||||
extern "C" void mlirExecutionEngineDumpToObjectFile(MlirExecutionEngine jit,
|
||||
MlirStringRef name) {
|
||||
unwrap(jit)->dumpToObjectFile(unwrap(name));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue