Add reference types R32 and R64
-Add resumable_trap, safepoint, isnull, and null instructions -Add Stackmap struct and StackmapSink trait Co-authored-by: Mir Ahmed <mirahmed753@gmail.com> Co-authored-by: Dan Gohman <sunfish@mozilla.com>
This commit is contained in:
39
cranelift/filetests/src/test_safepoint.rs
Normal file
39
cranelift/filetests/src/test_safepoint.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
|
||||
use cranelift_codegen::ir::Function;
|
||||
use cranelift_codegen::print_errors::pretty_error;
|
||||
use cranelift_reader::TestCommand;
|
||||
use std::borrow::Cow;
|
||||
|
||||
struct TestSafepoint;
|
||||
|
||||
pub fn subtest(parsed: &TestCommand) -> SubtestResult<Box<SubTest>> {
|
||||
assert_eq!(parsed.command, "safepoint");
|
||||
if !parsed.options.is_empty() {
|
||||
Err(format!("No options allowed on {}", parsed))
|
||||
} else {
|
||||
Ok(Box::new(TestSafepoint))
|
||||
}
|
||||
}
|
||||
|
||||
impl SubTest for TestSafepoint {
|
||||
fn name(&self) -> &'static str {
|
||||
"safepoint"
|
||||
}
|
||||
|
||||
fn run(&self, func: Cow<Function>, context: &Context) -> SubtestResult<()> {
|
||||
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
|
||||
|
||||
let isa = context.isa.expect("register allocator needs an ISA");
|
||||
comp_ctx.compute_cfg();
|
||||
comp_ctx
|
||||
.legalize(isa)
|
||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
||||
comp_ctx.compute_domtree();
|
||||
comp_ctx
|
||||
.regalloc(isa)
|
||||
.map_err(|e| pretty_error(&comp_ctx.func, context.isa, e))?;
|
||||
|
||||
let text = comp_ctx.func.display(context.isa).to_string();
|
||||
run_filecheck(&text, context)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user