Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cranelift/codegen/src/isa/pulley_shared/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
;; A pseudo-instruction that moves vregs to return registers.
(Rets (rets VecRetPair))

(DummyUse (reg Reg))

;; Implementation of `br_table`, uses `idx` to jump to one of `targets` or
;; jumps to `default` if it's out-of-bounds.
(BrTable
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/pulley_shared/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn pulley_emit<P>(
{
match inst {
// Pseduo-instructions that don't actually encode to anything.
Inst::Args { .. } | Inst::Rets { .. } => {}
Inst::Args { .. } | Inst::Rets { .. } | Inst::DummyUse { .. } => {}

Inst::TrapIf { cond, code } => {
let trap = sink.defer_trap(*code);
Expand Down
13 changes: 11 additions & 2 deletions cranelift/codegen/src/isa/pulley_shared/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ fn pulley_get_operands(inst: &mut Inst, collector: &mut impl OperandVisitor) {
}
}

Inst::DummyUse { reg } => {
collector.reg_use(reg);
}

Inst::Nop => {}

Inst::TrapIf { cond, code: _ } => {
Expand Down Expand Up @@ -373,8 +377,8 @@ where

const TRAP_OPCODE: &'static [u8] = TRAP_OPCODE;

fn gen_dummy_use(_reg: Reg) -> Self {
todo!()
fn gen_dummy_use(reg: Reg) -> Self {
Inst::DummyUse { reg }.into()
}

fn canonical_type_for_rc(rc: RegClass) -> Type {
Expand Down Expand Up @@ -598,6 +602,11 @@ impl Inst {
s
}

Inst::DummyUse { reg } => {
let reg = format_reg(*reg);
format!("dummy_use {reg}")
}

Inst::TrapIf { cond, code } => {
format!("trap_{cond} // code = {code:?}")
}
Expand Down
10 changes: 10 additions & 0 deletions tests/all/pulley.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,13 @@ fn pulley_provenance_test() -> Result<()> {

Ok(())
}

#[test]
#[cfg(not(miri))]
fn enabling_debug_info_doesnt_break_anything() -> Result<()> {
let mut config = pulley_config();
config.debug_info(true);
let engine = Engine::new(&config)?;
assert!(Module::from_file(&engine, "./tests/all/cli_tests/greeter_command.wat").is_err());
Ok(())
}