From 196c1f56f7982d4558f4eff82394918ed96ccd98 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 18 Dec 2024 15:53:15 -0800 Subject: [PATCH] pulley: Remove unwind metadata from Cranelift backend This is a copy/paste from the riscv64 backend originally but there's no need to integrate with native unwinders on Pulley so there's no need to track this information. This removes the `Unwind` pseudo-inst entirely. --- .../codegen/src/isa/pulley_shared/abi.rs | 42 ++----------------- .../codegen/src/isa/pulley_shared/inst.isle | 3 -- .../src/isa/pulley_shared/inst/emit.rs | 2 +- .../codegen/src/isa/pulley_shared/inst/mod.rs | 4 +- 4 files changed, 5 insertions(+), 46 deletions(-) diff --git a/cranelift/codegen/src/isa/pulley_shared/abi.rs b/cranelift/codegen/src/isa/pulley_shared/abi.rs index 43a9ce7b789f..5893460461df 100644 --- a/cranelift/codegen/src/isa/pulley_shared/abi.rs +++ b/cranelift/codegen/src/isa/pulley_shared/abi.rs @@ -4,7 +4,7 @@ use super::{inst::*, PulleyFlags, PulleyTargetKind}; use crate::isa::pulley_shared::{PointerWidth, PulleyBackend}; use crate::{ ir::{self, types::*, MemFlags, Signature}, - isa::{self, unwind::UnwindInst}, + isa::{self}, machinst::*, settings, CodegenResult, }; @@ -290,7 +290,7 @@ where fn gen_prologue_frame_setup( _call_conv: isa::CallConv, - flags: &settings::Flags, + _flags: &settings::Flags, _isa_flags: &PulleyFlags, frame_layout: &FrameLayout, ) -> SmallInstVec { @@ -298,16 +298,6 @@ where if frame_layout.setup_area_size > 0 { insts.push(RawInst::PushFrame.into()); - if flags.unwind_info() { - insts.push( - Inst::Unwind { - inst: UnwindInst::PushFrameRegs { - offset_upward_to_caller_sp: frame_layout.setup_area_size, - }, - } - .into(), - ); - } } insts @@ -350,7 +340,7 @@ where fn gen_clobber_save( _call_conv: isa::CallConv, - flags: &settings::Flags, + _flags: &settings::Flags, frame_layout: &FrameLayout, ) -> SmallVec<[Self::I; 16]> { let mut insts = SmallVec::new(); @@ -379,20 +369,6 @@ where } } - if flags.unwind_info() && setup_frame { - // The *unwind* frame (but not the actual frame) starts at the - // clobbers, just below the saved FP/LR pair. - insts.push( - Inst::Unwind { - inst: UnwindInst::DefineNewFrame { - offset_downward_to_clobbers: frame_layout.clobber_size, - offset_upward_to_caller_sp: frame_layout.setup_area_size, - }, - } - .into(), - ); - } - // Adjust the stack pointer downward for clobbers, the function fixed // frame (spillslots and storage slots), and outgoing arguments. let stack_size = frame_layout.clobber_size @@ -424,18 +400,6 @@ where .into(), ); - if flags.unwind_info() { - insts.push( - Inst::Unwind { - inst: UnwindInst::SaveReg { - clobber_offset: frame_layout.clobber_size - cur_offset, - reg: r_reg, - }, - } - .into(), - ); - } - cur_offset += 8 } } diff --git a/cranelift/codegen/src/isa/pulley_shared/inst.isle b/cranelift/codegen/src/isa/pulley_shared/inst.isle index 2f2539917a92..5c2babb05270 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst.isle +++ b/cranelift/codegen/src/isa/pulley_shared/inst.isle @@ -18,9 +18,6 @@ ;; A pseudo-instruction that moves vregs to return registers. (Rets (rets VecRetPair)) - ;; A pseudo-instruction to update unwind info. - (Unwind (inst UnwindInst)) - ;; Implementation of `br_table`, uses `idx` to jump to one of `targets` or ;; jumps to `default` if it's out-of-bounds. (BrTable diff --git a/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs b/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs index 642662eb8e43..ce80539a1761 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs +++ b/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs @@ -130,7 +130,7 @@ fn pulley_emit

( { match inst { // Pseduo-instructions that don't actually encode to anything. - Inst::Args { .. } | Inst::Rets { .. } | Inst::Unwind { .. } => {} + Inst::Args { .. } | Inst::Rets { .. } => {} Inst::TrapIf { cond, code } => { let trap = sink.defer_trap(*code); diff --git a/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs b/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs index e94df98065e9..ec95bdbe53e5 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs +++ b/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs @@ -129,7 +129,7 @@ fn pulley_get_operands(inst: &mut Inst, collector: &mut impl OperandVisitor) { } } - Inst::Unwind { .. } | Inst::Nop => {} + Inst::Nop => {} Inst::TrapIf { cond, code: _ } => { cond.get_operands(collector); @@ -578,8 +578,6 @@ impl Inst { s } - Inst::Unwind { inst } => format!("unwind {inst:?}"), - Inst::TrapIf { cond, code } => { format!("trap_{cond} // code = {code:?}") }