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:
@@ -1334,6 +1334,15 @@ impl MachInstEmit for Inst {
|
||||
}
|
||||
}
|
||||
}
|
||||
&Inst::MovPReg { rd, rm } => {
|
||||
let rd = allocs.next_writable(rd);
|
||||
let rm: Reg = rm.into();
|
||||
debug_assert!([regs::fp_reg(), regs::stack_reg(), regs::link_reg()].contains(&rm));
|
||||
assert!(rm.class() == RegClass::Int);
|
||||
assert!(rd.to_reg().class() == rm.class());
|
||||
let size = OperandSize::Size64;
|
||||
Inst::Mov { size, rd, rm }.emit(&[], sink, emit_info, state);
|
||||
}
|
||||
&Inst::MovWide { op, rd, imm, size } => {
|
||||
let rd = allocs.next_writable(rd);
|
||||
sink.put4(enc_move_wide(op, rd, imm, size));
|
||||
|
||||
Reference in New Issue
Block a user