Cranelift: Add instructions for getting the current stack/frame/return pointers (#4573)
* Cranelift: Add instructions for getting the current stack/frame pointers and return address This is the initial part of https://github.com/bytecodealliance/wasmtime/issues/4535 * x64: Remove `Amode::RbpOffset` and use `Amode::ImmReg` instead We just special case getting operands from `Amode`s now. * Fix s390x `get_return_address`; require `preserve_frame_pointers=true` * Assert that `Amode::ImmRegRegShift` doesn't use rbp/rsp * Handle non-allocatable registers in Amode::with_allocs * Use "stack" instead of "r15" on s390x * r14 is an allocatable register on s390x, so it shouldn't be used with `MovPReg`
This commit is contained in:
@@ -144,6 +144,7 @@ impl Inst {
|
||||
| Inst::StoreMultiple64 { .. }
|
||||
| Inst::Mov32 { .. }
|
||||
| Inst::Mov64 { .. }
|
||||
| Inst::MovPReg { .. }
|
||||
| Inst::Mov32Imm { .. }
|
||||
| Inst::Mov32SImm16 { .. }
|
||||
| Inst::Mov64SImm16 { .. }
|
||||
@@ -623,6 +624,11 @@ fn s390x_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandC
|
||||
collector.reg_def(rd);
|
||||
collector.reg_use(rm);
|
||||
}
|
||||
&Inst::MovPReg { rd, rm } => {
|
||||
debug_assert!([regs::gpr(14), regs::gpr(15)].contains(&rm.into()));
|
||||
debug_assert!(rd.to_reg().is_virtual());
|
||||
collector.reg_def(rd);
|
||||
}
|
||||
&Inst::Mov32 { rd, rm } => {
|
||||
collector.reg_def(rd);
|
||||
collector.reg_use(rm);
|
||||
@@ -1778,6 +1784,11 @@ impl Inst {
|
||||
let rm = pretty_print_reg(rm, allocs);
|
||||
format!("lgr {}, {}", rd, rm)
|
||||
}
|
||||
&Inst::MovPReg { rd, rm } => {
|
||||
let rd = pretty_print_reg(rd.to_reg(), allocs);
|
||||
let rm = show_reg(rm.into());
|
||||
format!("lgr {}, {}", rd, rm)
|
||||
}
|
||||
&Inst::Mov32 { rd, rm } => {
|
||||
let rd = pretty_print_reg(rd.to_reg(), allocs);
|
||||
let rm = pretty_print_reg(rm, allocs);
|
||||
|
||||
Reference in New Issue
Block a user