MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / compile_testfile

Function compile_testfile

cranelift/filetests/src/test_run.rs:145–174  ·  view source on GitHub ↗
(
    testfile: &TestFile,
    flags: &Flags,
    isa: &dyn TargetIsa,
)

Source from the content-addressed store, hash-verified

143}
144
145fn compile_testfile(
146 testfile: &TestFile,
147 flags: &Flags,
148 isa: &dyn TargetIsa,
149) -> anyhow::Result<CompiledTestFile> {
150 let isa = match isa.triple().architecture {
151 // Convert `&dyn TargetIsa` to `OwnedTargetIsa` by re-making the ISA and
152 // applying pulley flags/etc.
153 Architecture::Pulley32
154 | Architecture::Pulley64
155 | Architecture::Pulley32be
156 | Architecture::Pulley64be => {
157 let mut builder = cranelift_codegen::isa::lookup(isa.triple().clone())?;
158 for value in isa.isa_flags() {
159 builder.set(value.name, &value.value_string()).unwrap();
160 }
161 builder.finish(flags.clone())?
162 }
163
164 // We can't use the requested ISA directly since it does not contain info
165 // about the operating system / calling convention / etc..
166 //
167 // Copy the requested ISA flags into the host ISA and use that.
168 _ => build_host_isa(false, flags.clone(), isa.isa_flags()).unwrap(),
169 };
170
171 let mut tfc = TestFileCompiler::new(isa);
172 tfc.add_testfile(testfile)?;
173 Ok(tfc.compile()?)
174}
175
176fn run_test(
177 testfile: &CompiledTestFile,

Callers 1

run_targetMethod · 0.85

Calls 13

build_host_isaFunction · 0.85
OkFunction · 0.85
value_stringMethod · 0.80
add_testfileMethod · 0.80
lookupFunction · 0.50
newFunction · 0.50
tripleMethod · 0.45
cloneMethod · 0.45
isa_flagsMethod · 0.45
unwrapMethod · 0.45
setMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected