[ARM] Fix handling of thumb1 out-of-range frame offsets
authorJohn Brawn <john.brawn@arm.com>
Fri, 20 Mar 2015 17:20:07 +0000 (17:20 +0000)
committerJohn Brawn <john.brawn@arm.com>
Fri, 20 Mar 2015 17:20:07 +0000 (17:20 +0000)
commit151a5da53468b9bed75151b51d0250c82dcca10b
tree318fca52f887aa811c2ef09a8f6d2e9899d25387
parent45f61bfec3f768594e9bbf08fb423ea34f7d5fc1
[ARM] Fix handling of thumb1 out-of-range frame offsets

LocalStackSlotPass assumes that isFrameOffsetLegal doesn't change its
answer when the base register changes. Unfortunately this isn't true
in thumb1, where SP-based loads allow a larger offset than
non-SP-based loads, and this causes the base register reuse code to
generate instructions that are unencodable, causing an assertion
failure.

Solve this by adding a BaseReg parameter to isFrameOffsetLegal, which
ARMBaseRegisterInfo can then make use of to give the correct answer.

Differential Revision: http://reviews.llvm.org/D8419

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232825 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetRegisterInfo.h
lib/CodeGen/LocalStackSlotAllocation.cpp
lib/Target/AArch64/AArch64RegisterInfo.cpp
lib/Target/AArch64/AArch64RegisterInfo.h
lib/Target/ARM/ARMBaseRegisterInfo.cpp
lib/Target/ARM/ARMBaseRegisterInfo.h
lib/Target/PowerPC/PPCRegisterInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.h
test/CodeGen/Thumb/stack-access.ll