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:
@@ -84,6 +84,7 @@
|
||||
(type OptionWritableReg (primitive OptionWritableReg))
|
||||
(type VecReg extern (enum))
|
||||
(type VecWritableReg extern (enum))
|
||||
(type PReg (primitive PReg))
|
||||
|
||||
;; Construct a `ValueRegs` of one register.
|
||||
(decl value_reg (Reg) ValueRegs)
|
||||
@@ -196,6 +197,10 @@
|
||||
(let ((regs ValueRegs (put_in_regs val)))
|
||||
(value_regs_get regs 0)))
|
||||
|
||||
;; Convert a `PReg` into a `Reg`
|
||||
(decl preg_to_reg (PReg) Reg)
|
||||
(extern constructor preg_to_reg preg_to_reg)
|
||||
|
||||
;;;; Common Mach Types ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(type MachLabel (primitive MachLabel))
|
||||
@@ -293,6 +298,12 @@
|
||||
(decl lane_type (Type) Type)
|
||||
(extern constructor lane_type lane_type)
|
||||
|
||||
;;;; `cranelift_codegen::ir::MemFlags ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; `MemFlags::trusted`
|
||||
(decl mem_flags_trusted () MemFlags)
|
||||
(extern constructor mem_flags_trusted mem_flags_trusted)
|
||||
|
||||
;;;; Helper Clif Extractors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; An extractor that only matches types that can fit in 16 bits.
|
||||
@@ -887,3 +898,4 @@
|
||||
(convert Value InstOutput output_value)
|
||||
(convert Offset32 u32 offset32_to_u32)
|
||||
(convert ExternalName BoxExternalName box_external_name)
|
||||
(convert PReg Reg preg_to_reg)
|
||||
|
||||
Reference in New Issue
Block a user