HomePhabricator

[ARM] Fix access to stack arguments when re-aligning SP in Armv6m

Authored by chill on Mar 2 2018, 7:47 AM.

Description

[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

llvm-svn: 326584