Cranelift: Add .wat to assembly test support and generate Wasm load/store tests for all ISAs (#5439)

* cranelift-filetest: Add the ability to test `.wat` to assembly

* Make the load/store test case generator script use `.wat` tests

And generate tests that exercise both Wasm-to-CLIF lowering and Wasm all the way
to assembly.

* Remove old versions of generated load/store tests

* Add new generated load/store tests

* Fix filename reference in script
This commit is contained in:
Nick Fitzgerald
2022-12-14 13:13:43 -08:00
committed by GitHub
parent 9dc4f1a83c
commit be710df237
502 changed files with 34040 additions and 760 deletions

View File

@@ -15,6 +15,9 @@ pub struct TestConfig {
#[serde(default)]
pub target: String,
#[serde(default)]
pub compile: bool,
#[serde(default)]
pub settings: Vec<String>,

View File

@@ -7,7 +7,10 @@ use std::collections::{BTreeMap, HashSet};
use super::config::TestConfig;
use cranelift::prelude::EntityRef;
use cranelift_codegen::{ir, isa::TargetFrontendConfig};
use cranelift_codegen::{
ir,
isa::{TargetFrontendConfig, TargetIsa},
};
use cranelift_wasm::{
DummyEnvironment, FuncEnvironment, FuncIndex, ModuleEnvironment, TargetEnvironment,
};
@@ -15,12 +18,19 @@ use cranelift_wasm::{
pub struct ModuleEnv {
pub inner: DummyEnvironment,
pub config: TestConfig,
pub heap_access_spectre_mitigation: bool,
}
impl ModuleEnv {
pub fn new(frontend_config: TargetFrontendConfig, config: TestConfig) -> Self {
let inner = DummyEnvironment::new(frontend_config, config.debug_info);
Self { inner, config }
pub fn new(target_isa: &dyn TargetIsa, config: TestConfig) -> Self {
let inner = DummyEnvironment::new(target_isa.frontend_config(), config.debug_info);
Self {
inner,
config,
heap_access_spectre_mitigation: target_isa
.flags()
.enable_heap_access_spectre_mitigation(),
}
}
}
@@ -67,6 +77,14 @@ impl<'data> ModuleEnvironment<'data> for ModuleEnv {
Ok(())
}
fn wasm_features(&self) -> wasmparser::WasmFeatures {
wasmparser::WasmFeatures {
memory64: true,
multi_memory: true,
..self.inner.wasm_features()
}
}
// ================================================================
// ====== Everything below here is delegated to `self.inner` ======
// ================================================================