From 767f5a9000a5fcd34bf5dfec6ee504c3db588056 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sun, 13 Dec 2020 10:11:02 +0100 Subject: [PATCH] Expose wasmer::LLVMOptLevel --- lib/api/src/lib.rs | 2 +- lib/compiler-llvm/src/config.rs | 8 ++++---- lib/compiler-llvm/src/lib.rs | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/api/src/lib.rs b/lib/api/src/lib.rs index 81f0f9cd082..20bd95806dc 100644 --- a/lib/api/src/lib.rs +++ b/lib/api/src/lib.rs @@ -358,7 +358,7 @@ pub use wasmer_compiler_singlepass::Singlepass; pub use wasmer_compiler_cranelift::{Cranelift, CraneliftOptLevel}; #[cfg(feature = "llvm")] -pub use wasmer_compiler_llvm::LLVM; +pub use wasmer_compiler_llvm::{LLVMOptLevel, LLVM}; #[cfg(feature = "jit")] pub use wasmer_engine_jit::{JITArtifact, JITEngine, JIT}; diff --git a/lib/compiler-llvm/src/config.rs b/lib/compiler-llvm/src/config.rs index 1d1d5224dec..bd51f3613c8 100644 --- a/lib/compiler-llvm/src/config.rs +++ b/lib/compiler-llvm/src/config.rs @@ -3,7 +3,7 @@ use inkwell::targets::{ CodeModel, InitializationConfig, RelocMode, Target as InkwellTarget, TargetMachine, TargetTriple, }; -use inkwell::OptimizationLevel; +use inkwell::OptimizationLevel as LLVMOptLevel; use itertools::Itertools; use std::fmt::Debug; use std::sync::Arc; @@ -41,7 +41,7 @@ pub trait LLVMCallbacks: Debug + Send + Sync { pub struct LLVM { pub(crate) enable_nan_canonicalization: bool, pub(crate) enable_verifier: bool, - pub(crate) opt_level: OptimizationLevel, + pub(crate) opt_level: LLVMOptLevel, is_pic: bool, pub(crate) callbacks: Option>, /// The middleware chain. @@ -55,7 +55,7 @@ impl LLVM { Self { enable_nan_canonicalization: false, enable_verifier: false, - opt_level: OptimizationLevel::Aggressive, + opt_level: LLVMOptLevel::Aggressive, is_pic: false, callbacks: None, middlewares: vec![], @@ -72,7 +72,7 @@ impl LLVM { } /// The optimization levels when optimizing the IR. - pub fn opt_level(&mut self, opt_level: OptimizationLevel) -> &mut Self { + pub fn opt_level(&mut self, opt_level: LLVMOptLevel) -> &mut Self { self.opt_level = opt_level; self } diff --git a/lib/compiler-llvm/src/lib.rs b/lib/compiler-llvm/src/lib.rs index a640d360577..db2503e9c9b 100644 --- a/lib/compiler-llvm/src/lib.rs +++ b/lib/compiler-llvm/src/lib.rs @@ -22,4 +22,6 @@ mod trampoline; mod translator; pub use crate::compiler::LLVMCompiler; -pub use crate::config::{CompiledKind, InkwellMemoryBuffer, InkwellModule, LLVMCallbacks, LLVM}; +pub use crate::config::{ + CompiledKind, InkwellMemoryBuffer, InkwellModule, LLVMCallbacks, LLVMOptLevel, LLVM, +};