[ARM][Thumb] Command-line option to ensure AAPCS compliant Frame Records
authorLucas Prates <lucas.prates@arm.com>
Fri, 6 May 2022 09:31:11 +0000 (10:31 +0100)
committerLucas Prates <lucas.prates@arm.com>
Tue, 14 Jun 2022 12:37:51 +0000 (13:37 +0100)
commit7625e01d661644a560884057755d48a0da8b77b4
tree2d2dfed6ec4de3fd6e47f036b73c81628bae99f7
parente5c4308ba121cb6b1c2bbdd2684acff9eb13ffc8
[ARM][Thumb] Command-line option to ensure AAPCS compliant Frame Records

Currently the a AAPCS compliant frame record is not always created for
functions when it should. Although a consistent frame record might not
be required in some cases, there are still scenarios where applications
may want to make use of the call hierarchy made available trough it.

In order to enable the use of AAPCS compliant frame records whilst keep
backwards compatibility, this patch introduces a new command-line option
(`-mframe-chain=[none|aapcs|aapcs+leaf]`) for Aarch32 and Thumb backends.
The option allows users to explicitly select when to use it, and is also
useful to ensure the extra overhead introduced by the frame records is
only introduced when necessary, in particular for Thumb targets.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D125094
16 files changed:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/ARM.cpp
llvm/lib/Target/ARM/ARM.td
llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
llvm/lib/Target/ARM/ARMCallingConv.td
llvm/lib/Target/ARM/ARMFrameLowering.cpp
llvm/lib/Target/ARM/ARMFrameLowering.h
llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
llvm/lib/Target/ARM/ARMSubtarget.h
llvm/lib/Target/ARM/Thumb1FrameLowering.cpp
llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
llvm/test/CodeGen/ARM/frame-chain-reserved-fp.ll [new file with mode: 0644]
llvm/test/CodeGen/ARM/frame-chain.ll [new file with mode: 0644]
llvm/test/CodeGen/Thumb/frame-access.ll
llvm/test/CodeGen/Thumb/frame-chain-reserved-fp.ll [new file with mode: 0644]
llvm/test/CodeGen/Thumb/frame-chain.ll [new file with mode: 0644]