aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorcollison <collison@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-10 07:41:54 +0000
committercollison <collison@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-10 07:41:54 +0000
commitcf8bfc4cb14c14e451e98e3601381a355e237a04 (patch)
treea159db7c95cac44168b5d00449adc5984f7189b1 /gcc/config
parent4e869f67516a3afad8d73aab5ec8e70ebf03c743 (diff)
2015-02-10 Michael Collison <michael.collison@linaro.org>
Backport from trunk r217431. 2014-11-12 Jiong Wang <jiong.wang@arm.com> * config/aarch64/aarch64.h (CALL_USED_REGISTERS): Mark LR as caller-save. (EPILOGUE_USES): Guard the check by epilogue_completed. * config/aarch64/aarch64.c (aarch64_layout_frame): Explictly check for LR. (aarch64_can_eliminate): Check LR_REGNUM liveness. 2015-02-10 Michael Collison <michael.collison@linaro.org> Backport from trunk r217431. 2014-11-12 Jiong Wang <jiong.wang@arm.com> * gcc.target/aarch64/lr_free_1.c: New testcase for -fomit-frame-pointer. * gcc.target/aarch64/lr_free_2.c: New testcase for leaf -fno-omit-frame-pointer. git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@220569 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/aarch64/aarch64.c13
-rw-r--r--gcc/config/aarch64/aarch64.h4
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f8b7152f4d1..d26630bb481 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1951,7 +1951,8 @@ aarch64_layout_frame (void)
/* ... and any callee saved register that dataflow says is live. */
for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++)
if (df_regs_ever_live_p (regno)
- && !call_used_regs[regno])
+ && (regno == R30_REGNUM
+ || !call_used_regs[regno]))
cfun->machine->frame.reg_offset[regno] = SLOT_REQUIRED;
for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++)
@@ -4429,6 +4430,16 @@ aarch64_can_eliminate (const int from, const int to)
return false;
}
+ else
+ {
+ /* If we decided that we didn't need a leaf frame pointer but then used
+ LR in the function, then we'll want a frame pointer after all, so
+ prevent this elimination to ensure a frame pointer is used. */
+ if (to == STACK_POINTER_REGNUM
+ && flag_omit_leaf_frame_pointer
+ && df_regs_ever_live_p (LR_REGNUM))
+ return false;
+ }
return true;
}
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 7fb40b0540d..5b6ee214b1f 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -283,7 +283,7 @@ extern unsigned long aarch64_tune_flags;
1, 1, 1, 1, 1, 1, 1, 1, /* R0 - R7 */ \
1, 1, 1, 1, 1, 1, 1, 1, /* R8 - R15 */ \
1, 1, 1, 0, 0, 0, 0, 0, /* R16 - R23 */ \
- 0, 0, 0, 0, 0, 1, 0, 1, /* R24 - R30, SP */ \
+ 0, 0, 0, 0, 0, 1, 1, 1, /* R24 - R30, SP */ \
1, 1, 1, 1, 1, 1, 1, 1, /* V0 - V7 */ \
0, 0, 0, 0, 0, 0, 0, 0, /* V8 - V15 */ \
1, 1, 1, 1, 1, 1, 1, 1, /* V16 - V23 */ \
@@ -342,7 +342,7 @@ extern unsigned long aarch64_tune_flags;
considered live at the start of the called function. */
#define EPILOGUE_USES(REGNO) \
- ((REGNO) == LR_REGNUM)
+ (epilogue_completed && (REGNO) == LR_REGNUM)
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
the stack pointer does not matter. The value is tested only in