AArch64: Fix frame record chain
authorLogan Chien <tzuhsiang.chien@gmail.com>
Thu, 28 Nov 2019 06:56:34 +0000 (22:56 -0800)
committerLogan Chien <tzuhsiang.chien@gmail.com>
Sat, 14 Dec 2019 18:23:20 +0000 (10:23 -0800)
commitd4e10e6adb1b629b3fc1b78f7e281fbcec392edb
treeef2210c30ca6feb97a1153a29cacf5460d2b376b
parent2c59c4ffb9c111f8d87a65839697d03fc485c51c
AArch64: Fix frame record chain

The commit r369122 may keep LR and FP register (aka. frame record) in
the middle of a frame, thus we must add the offsets to ensure the FP
register always points to innermost frame record on the stack.

According to AAPCS64[1], a conforming code shall construct a linked list
of stack frames that can be traversed with frame records.  This commit
is also essential to frame-pointer-based stack unwinder (e.g.  the stack
unwinder in linx-perf-tools.)

[1] https://github.com/ARM-software/software-standards/blob/master/abi/aapcs64/aapcs64.rst#the-frame-pointer

Test: llvm-lit ${LLVM_SRC}/test/CodeGen/AArch64/framelayout-frame-record.ll
Test: llvm-lit ${LLVM_SRC}/test/CodeGen/AArch64

Differential Revision: https://reviews.llvm.org/D70800
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
llvm/test/CodeGen/AArch64/framelayout-frame-record.mir [new file with mode: 0644]