From: Wilco Dijkstra Date: Wed, 8 Nov 2017 15:34:36 +0000 (+0000) Subject: [AArch64] Remove aarch64_frame_pointer_required X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7040939b9e2cbd084e6dbe015ee6cd2761aacf46;p=gcc.git [AArch64] Remove aarch64_frame_pointer_required To implement -fomit-leaf-frame-pointer, there are 2 places where we need to check whether we have to use a frame chain (since register allocation may allocate LR in a leaf function that omits the frame pointer, but if LR is spilled we must emit a frame chain). To simplify this do not force frame_pointer_needed via aarch64_frame_pointer_required, but enable the frame chain in aarch64_layout_frame. Now aarch64_frame_pointer_required can be removed and aarch64_can_eliminate is simplified. gcc/ * config/aarch64/aarch64.c (aarch64_frame_pointer_required) Remove. (aarch64_layout_frame): Initialise emit_frame_chain. (aarch64_can_eliminate): Remove omit leaf frame pointer code. (TARGET_FRAME_POINTER_REQUIRED): Remove define. testsuite/ * gcc.target/aarch64/dwarf-cfa-reg.c: Update. From-SVN: r254533 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ba019ca7fe..d39de6b0320 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-11-08 Wilco Dijkstra + + * config/aarch64/aarch64.c (aarch64_frame_pointer_required) + Remove. + (aarch64_layout_frame): Initialise emit_frame_chain. + (aarch64_can_eliminate): Remove omit leaf frame pointer code. + (TARGET_FRAME_POINTER_REQUIRED): Remove define. + 2017-11-08 Martin Liska * gimplify.c (expand_FALLTHROUGH_r): Simplify usage diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 62ce7d69bf1..f58f192273e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -2891,21 +2891,6 @@ aarch64_output_probe_stack_range (rtx reg1, rtx reg2) return ""; } -static bool -aarch64_frame_pointer_required (void) -{ - /* Use the frame pointer if enabled and it is not a leaf function, unless - leaf frame pointer omission is disabled. If the frame pointer is enabled, - force the frame pointer in leaf functions which use LR. */ - if (flag_omit_frame_pointer == 2 - && !(flag_omit_leaf_frame_pointer - && crtl->is_leaf - && !df_regs_ever_live_p (LR_REGNUM))) - return true; - - return false; -} - /* Mark the registers that need to be saved by the callee and calculate the size of the callee-saved registers area and frame record (both FP and LR may be omitted). */ @@ -2922,6 +2907,14 @@ aarch64_layout_frame (void) cfun->machine->frame.emit_frame_chain = frame_pointer_needed || crtl->calls_eh_return; + /* Emit a frame chain if the frame pointer is enabled. + If -momit-leaf-frame-pointer is used, do not use a frame chain + in leaf functions which do not use LR. */ + if (flag_omit_frame_pointer == 2 + && !(flag_omit_leaf_frame_pointer && crtl->is_leaf + && !df_regs_ever_live_p (LR_REGNUM))) + cfun->machine->frame.emit_frame_chain = true; + #define SLOT_NOT_REQUIRED (-2) #define SLOT_REQUIRED (-1) @@ -5939,17 +5932,6 @@ 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_frame_pointer == 2 - && flag_omit_leaf_frame_pointer - && df_regs_ever_live_p (LR_REGNUM)) - return false; - } return true; } @@ -15261,9 +15243,6 @@ aarch64_run_selftests (void) #undef TARGET_FUNCTION_VALUE_REGNO_P #define TARGET_FUNCTION_VALUE_REGNO_P aarch64_function_value_regno_p -#undef TARGET_FRAME_POINTER_REQUIRED -#define TARGET_FRAME_POINTER_REQUIRED aarch64_frame_pointer_required - #undef TARGET_GIMPLE_FOLD_BUILTIN #define TARGET_GIMPLE_FOLD_BUILTIN aarch64_gimple_fold_builtin diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b42d041c12..e20309abef1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-11-08 Wilco Dijkstra + + * gcc.target/aarch64/dwarf-cfa-reg.c: Update. + 2017-11-08 Javier Miranda * gnat.dg/overriding_ops2.adb, gnat.dg/overriding_ops2.ads, diff --git a/gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c b/gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c index cce88155aca..ae5b3797021 100644 --- a/gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c +++ b/gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c @@ -3,7 +3,7 @@ /* { dg-options "-O0 -gdwarf-2" } */ /* { dg-final { scan-assembler ".cfi_restore 30" } } */ /* { dg-final { scan-assembler ".cfi_restore 29" } } */ -/* { dg-final { scan-assembler ".cfi_def_cfa 31, 0" } } */ +/* { dg-final { scan-assembler ".cfi_def_cfa_offset 0" } } */ /* { dg-final { scan-assembler "ret" } } */ int bar (unsigned int);