OSDN Git Service

[ARM] Fix access to stack arguments when re-aligning SP in Armv6m
authorMomchil Velikov <momchil.velikov@arm.com>
Fri, 2 Mar 2018 15:47:14 +0000 (15:47 +0000)
committerMomchil Velikov <momchil.velikov@arm.com>
Fri, 2 Mar 2018 15:47:14 +0000 (15:47 +0000)
commit435d2bb58b607fda18e4fe1b4ba56064c6385994
treec6c2c7eed63aca8f9d52f50b693ff6c7b51c442f
parentc2b8dd7e70bf43ce89244e80a5cc43f5c02da3ce
[ARM] Fix access to stack arguments when re-aligning SP in Armv6m

When an Armv6m function dynamically re-aligns the stack, access to incoming
stack arguments (and to stack area, allocated for register varargs) is done via
SP, which is incorrect, as the SP is offset by an unknown amount relative to the
value of SP upon function entry.

This patch fixes it, by making access to "fixed" frame objects be done via FP
when the function needs stack re-alignment.  It also changes the access to
"fixed" frame objects be done via FP (instead of using R6/BP) also for the case
when the stack frame contains variable sized objects. This should allow more
objects to fit within the immediate offset of the load instruction.

All of the above via a small refactoring to reuse the existing
`ARMFrameLowering::ResolveFrameIndexReference.`

Differential Revision: https://reviews.llvm.org/D43566

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326584 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMFrameLowering.cpp
lib/Target/ARM/ThumbRegisterInfo.cpp
test/CodeGen/Thumb/frame-access.ll [new file with mode: 0644]