forked from OSchip/llvm-project
Expose `setupTargetTriple` as a public static method on ExecutionEngine
This allows client to be able to reuse the same logic to setup a module for the ExecutionEngine without instanciating one. One use case is running the optimization pipeline but not JIT-ing. -- PiperOrigin-RevId: 242614380
This commit is contained in:
parent
c4dee61c0e
commit
6c6ed466a6
|
@ -238,6 +238,7 @@ int dumpLLVMIR() {
|
|||
// Initialize LLVM targets.
|
||||
llvm::InitializeNativeTarget();
|
||||
llvm::InitializeNativeTargetAsmPrinter();
|
||||
mlir::ExecutionEngine::setupTargetTriple(llvmModule.get());
|
||||
auto optPipeline = mlir::makeOptimizingTransformer(
|
||||
/* optLevel=*/EnableOpt ? 3 : 0, /* sizeLevel=*/0);
|
||||
if (auto err = optPipeline(llvmModule.get())) {
|
||||
|
|
|
@ -87,6 +87,10 @@ public:
|
|||
/// the templated `invoke`.
|
||||
llvm::Error invoke(StringRef name, MutableArrayRef<void *> args);
|
||||
|
||||
/// Set the target triple on the module. This is implicitly done when creating
|
||||
/// the engine.
|
||||
static bool setupTargetTriple(llvm::Module *llvmModule);
|
||||
|
||||
private:
|
||||
// Ordering of llvmContext and jit is important for destruction purposes: the
|
||||
// jit must be destroyed before the context.
|
||||
|
|
|
@ -187,7 +187,7 @@ static void getDefaultPasses(
|
|||
}
|
||||
|
||||
// Setup LLVM target triple from the current machine.
|
||||
static bool setupTargetTriple(llvm::Module *llvmModule) {
|
||||
bool ExecutionEngine::setupTargetTriple(llvm::Module *llvmModule) {
|
||||
// Setup the machine properties from the current architecture.
|
||||
auto targetTriple = llvm::sys::getDefaultTargetTriple();
|
||||
std::string errorMessage;
|
||||
|
|
Loading…
Reference in New Issue