[llvm] r249804 - ARM: tweak WoA frame lowering
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 20:19:04 PDT 2015
Author: compnerd
Date: Thu Oct 8 22:19:03 2015
New Revision: 249804
URL: http://llvm.org/viewvc/llvm-project?rev=249804&view=rev
Log:
ARM: tweak WoA frame lowering
Accept r11 when targeting Windows on ARM rather than just low registers.
Because we are in a thumb-2 only mode, this may be slightly more expensive in
code size, but results in better code for the environment since it spills the
frame register, which is generally desired for fast stack walking as per the
ABI.
Added:
llvm/trunk/test/CodeGen/ARM/Windows/no-frame-register.ll
Modified:
llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=249804&r1=249803&r2=249804&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Thu Oct 8 22:19:03 2015
@@ -1605,13 +1605,11 @@ void ARMFrameLowering::determineCalleeSa
// FIXME: We could add logic to be more precise about negative offsets
// and which instructions will need a scratch register for them. Is it
// worth the effort and added fragility?
- bool BigStack =
- (RS &&
- (MFI->estimateStackSize(MF) +
- ((hasFP(MF) && AFI->hasStackFrame()) ? 4:0) >=
- estimateRSStackSizeLimit(MF, this)))
- || MFI->hasVarSizedObjects()
- || (MFI->adjustsStack() && !canSimplifyCallFramePseudos(MF));
+ bool BigStack = (RS && (MFI->estimateStackSize(MF) +
+ ((hasFP(MF) && AFI->hasStackFrame()) ? 4 : 0) >=
+ estimateRSStackSizeLimit(MF, this))) ||
+ MFI->hasVarSizedObjects() ||
+ (MFI->adjustsStack() && !canSimplifyCallFramePseudos(MF));
bool ExtraCSSpill = false;
if (BigStack || !CanEliminateFrame || RegInfo->cannotEliminateFrame(MF)) {
@@ -1649,8 +1647,10 @@ void ARMFrameLowering::determineCalleeSa
if (CS1Spilled && !UnspilledCS1GPRs.empty()) {
for (unsigned i = 0, e = UnspilledCS1GPRs.size(); i != e; ++i) {
unsigned Reg = UnspilledCS1GPRs[i];
- // Don't spill high register if the function is thumb
+ // Don't spill high register if the function is thumb. In the case of
+ // Windows on ARM, accept R11 (frame pointer)
if (!AFI->isThumbFunction() ||
+ (STI.isTargetWindows() && Reg == ARM::R11) ||
isARMLowRegister(Reg) || Reg == ARM::LR) {
SavedRegs.set(Reg);
if (!MRI.isReserved(Reg))
Added: llvm/trunk/test/CodeGen/ARM/Windows/no-frame-register.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/Windows/no-frame-register.ll?rev=249804&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/Windows/no-frame-register.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/Windows/no-frame-register.ll Thu Oct 8 22:19:03 2015
@@ -0,0 +1,22 @@
+; RUN: llc -mtriple thumbv7-windows -filetype asm -o - %s | FileCheck %s
+
+declare void @callee(i32)
+
+define i32 @calleer(i32 %i) {
+entry:
+ %i.addr = alloca i32, align 4
+ %j = alloca i32, align 4
+ store i32 %i, i32* %i.addr, align 4
+ %0 = load i32, i32* %i.addr, align 4
+ %add = add nsw i32 %0, 1
+ store i32 %add, i32* %j, align 4
+ %1 = load i32, i32* %j, align 4
+ call void @callee(i32 %1)
+ %2 = load i32, i32* %j, align 4
+ %add1 = add nsw i32 %2, 1
+ ret i32 %add1
+}
+
+; CHECK-NOT: push.w {r7, lr}
+; CHECK: push.w {r11, lr}
+
More information about the llvm-commits
mailing list