Add clif-util compile option to output object file (#5493)

* add clif-util compile option to output object file

* switch from a box to a borrow

* update objectmodule tests to use borrowed isa

* put targetisa into an arc
This commit is contained in:
Sam Sartor
2023-01-06 13:53:48 -07:00
committed by GitHub
parent 9156cca8ca
commit 1efa3d6f8b
15 changed files with 114 additions and 62 deletions

View File

@@ -10,7 +10,7 @@ use anyhow::{Context as _, Result};
use cranelift_codegen::ir::{
self, ExternalName, Function, InstBuilder, MemFlags, UserExternalName, UserFuncName, Value,
};
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::isa::{OwnedTargetIsa, TargetIsa};
use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::Context;
use cranelift_codegen::{settings, MachReloc, MachTrap};
@@ -68,7 +68,7 @@ impl Default for CompilerContext {
/// the Wasm to Compiler IR, optimizing it and then translating to assembly.
pub(crate) struct Compiler {
contexts: Mutex<Vec<CompilerContext>>,
isa: Box<dyn TargetIsa>,
isa: OwnedTargetIsa,
linkopts: LinkOptions,
cache_store: Option<Arc<dyn CacheStore>>,
}
@@ -103,7 +103,7 @@ impl Drop for Compiler {
impl Compiler {
pub(crate) fn new(
isa: Box<dyn TargetIsa>,
isa: OwnedTargetIsa,
cache_store: Option<Arc<dyn CacheStore>>,
linkopts: LinkOptions,
) -> Compiler {