Files
wasmtime/cranelift/filetests/filetests/isa/aarch64/fp_sp_pc.clif
Anton Kirilov dd07e354b4 Cranelift AArch64: Fix the get_return_address lowering (#4851)
The previous implementation assumed that nothing had clobbered the
LR register since the current function had started executing, so
it would be incorrect for a non-leaf function, for example, that
contains the `get_return_address` operation right after a call.
The operation is valid only if the `preserve_frame_pointers` flag
is enabled, which implies that the presence of a frame record on
the stack is guaranteed.

Copyright (c) 2022, Arm Limited.
2022-09-07 11:09:22 -07:00

43 lines
644 B
Plaintext

test compile precise-output
set preserve_frame_pointers=true
target aarch64
function %fp() -> i64 {
block0:
v0 = get_frame_pointer.i64
return v0
}
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x0, fp
; ldp fp, lr, [sp], #16
; ret
function %sp() -> i64 {
block0:
v0 = get_stack_pointer.i64
return v0
}
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; mov x0, sp
; ldp fp, lr, [sp], #16
; ret
function %return_address() -> i64 {
block0:
v0 = get_return_address.i64
return v0
}
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; ldr x0, [fp, #8]
; ldp fp, lr, [sp], #16
; ret