[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>
Mon, 27 Jun 2022 13:08:48 +0000 (14:08 +0100)
commit70a5c525349be3ce9ad2bfdf9c995355ba07c864
treed3953d29bb3d0fd7d0266eb6642ab9d1d8ea355e
parentbd90155df4a4634be7e49594f35315df3772a942
[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]