From c3e080363d46a4dab3b466b8636a3319835a5302 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Wed, 22 Apr 2015 00:44:54 +0000 Subject: [PATCH] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER gcc/ChangeLog: 2015-04-21 Trevor Saunders * alias.c (init_alias_target): Remove ifdef * HARD_FRAME_POINTER_IS_FRAME_POINTER. * df-scan.c (df_insn_refs_collect): Likewise. (df_get_regular_block_artificial_uses): Likewise. (df_get_eh_block_artificial_uses): Likewise. (df_get_entry_block_def_set): Likewise. (df_get_exit_block_use_set): Likewise. * emit-rtl.c (gen_rtx_REG): Likewise. * ira.c (ira_setup_eliminable_regset): Likewise. * reginfo.c (init_reg_sets_1): Likewise. * regrename.c (rename_chains): Likewise. * reload1.c (reload): Likewise. (eliminate_regs_in_insn): Likewise. * resource.c (mark_referenced_resources): Likewise. (init_resource_info): Likewise. From-SVN: r222300 --- gcc/ChangeLog | 18 ++++++++++++++++++ gcc/alias.c | 7 +++---- gcc/df-scan.c | 35 +++++++++++++++++------------------ gcc/emit-rtl.c | 6 +++--- gcc/ira.c | 23 ++++++++++++----------- gcc/reginfo.c | 5 ++--- gcc/regrename.c | 5 ++--- gcc/reload1.c | 10 ++++------ gcc/resource.c | 11 +++++------ 9 files changed, 66 insertions(+), 54 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acb026b1577..2f39b8ce1df 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2015-04-21 Trevor Saunders + + * alias.c (init_alias_target): Remove ifdef + * HARD_FRAME_POINTER_IS_FRAME_POINTER. + * df-scan.c (df_insn_refs_collect): Likewise. + (df_get_regular_block_artificial_uses): Likewise. + (df_get_eh_block_artificial_uses): Likewise. + (df_get_entry_block_def_set): Likewise. + (df_get_exit_block_use_set): Likewise. + * emit-rtl.c (gen_rtx_REG): Likewise. + * ira.c (ira_setup_eliminable_regset): Likewise. + * reginfo.c (init_reg_sets_1): Likewise. + * regrename.c (rename_chains): Likewise. + * reload1.c (reload): Likewise. + (eliminate_regs_in_insn): Likewise. + * resource.c (mark_referenced_resources): Likewise. + (init_resource_info): Likewise. + 2015-04-21 Trevor Saunders * defaults.h (MASK_RETURN_ADDR): New definition. diff --git a/gcc/alias.c b/gcc/alias.c index a7160f3e956..8f486600063 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -2765,10 +2765,9 @@ init_alias_target (void) = unique_base_value (UNIQUE_BASE_VALUE_ARGP); static_reg_base_value[FRAME_POINTER_REGNUM] = unique_base_value (UNIQUE_BASE_VALUE_FP); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - static_reg_base_value[HARD_FRAME_POINTER_REGNUM] - = unique_base_value (UNIQUE_BASE_VALUE_HFP); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + static_reg_base_value[HARD_FRAME_POINTER_REGNUM] + = unique_base_value (UNIQUE_BASE_VALUE_HFP); } /* Set MEMORY_MODIFIED when X modifies DATA (that is assumed diff --git a/gcc/df-scan.c b/gcc/df-scan.c index b2e2e5d9382..69332a83866 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -3247,12 +3247,11 @@ df_insn_refs_collect (struct df_collection_rec *collection_rec, regno_reg_rtx[FRAME_POINTER_REGNUM], NULL, bb, insn_info, DF_REF_REG_USE, 0); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - df_ref_record (DF_REF_BASE, collection_rec, - regno_reg_rtx[HARD_FRAME_POINTER_REGNUM], - NULL, bb, insn_info, - DF_REF_REG_USE, 0); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + df_ref_record (DF_REF_BASE, collection_rec, + regno_reg_rtx[HARD_FRAME_POINTER_REGNUM], + NULL, bb, insn_info, + DF_REF_REG_USE, 0); break; default: break; @@ -3442,9 +3441,9 @@ df_get_regular_block_artificial_uses (bitmap regular_block_artificial_uses) reference of the frame pointer. */ bitmap_set_bit (regular_block_artificial_uses, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - bitmap_set_bit (regular_block_artificial_uses, HARD_FRAME_POINTER_REGNUM); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + bitmap_set_bit (regular_block_artificial_uses, + HARD_FRAME_POINTER_REGNUM); #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM /* Pseudos with argument area equivalences may require @@ -3494,9 +3493,9 @@ df_get_eh_block_artificial_uses (bitmap eh_block_artificial_uses) if (frame_pointer_needed) { bitmap_set_bit (eh_block_artificial_uses, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - bitmap_set_bit (eh_block_artificial_uses, HARD_FRAME_POINTER_REGNUM); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + bitmap_set_bit (eh_block_artificial_uses, + HARD_FRAME_POINTER_REGNUM); } #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM if (fixed_regs[ARG_POINTER_REGNUM]) @@ -3580,11 +3579,11 @@ df_get_entry_block_def_set (bitmap entry_block_defs) /* Any reference to any pseudo before reload is a potential reference of the frame pointer. */ bitmap_set_bit (entry_block_defs, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER + /* If they are different, also mark the hard frame pointer as live. */ - if (!LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM)) + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER + && !LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM)) bitmap_set_bit (entry_block_defs, HARD_FRAME_POINTER_REGNUM); -#endif } /* These registers are live everywhere. */ @@ -3718,11 +3717,11 @@ df_get_exit_block_use_set (bitmap exit_block_uses) if ((!reload_completed) || frame_pointer_needed) { bitmap_set_bit (exit_block_uses, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER + /* If they are different, also mark the hard frame pointer as live. */ - if (!LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM)) + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER + && !LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM)) bitmap_set_bit (exit_block_uses, HARD_FRAME_POINTER_REGNUM); -#endif } /* Many architectures have a GP register even without flag_pic. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 35ecc0529cc..b48f88b5f7c 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -715,11 +715,11 @@ gen_rtx_REG (machine_mode mode, unsigned int regno) if (regno == FRAME_POINTER_REGNUM && (!reload_completed || frame_pointer_needed)) return frame_pointer_rtx; -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - if (regno == HARD_FRAME_POINTER_REGNUM + + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER + && regno == HARD_FRAME_POINTER_REGNUM && (!reload_completed || frame_pointer_needed)) return hard_frame_pointer_rtx; -#endif #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM && !HARD_FRAME_POINTER_IS_ARG_POINTER if (regno == ARG_POINTER_REGNUM) return arg_pointer_rtx; diff --git a/gcc/ira.c b/gcc/ira.c index 0750d11bbf6..9dcbc62f1d4 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -2341,19 +2341,20 @@ ira_setup_eliminable_regset (void) else df_set_regs_ever_live (eliminables[i].from, true); } -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM)) + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) { - SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM); - if (frame_pointer_needed) - SET_HARD_REG_BIT (ira_no_alloc_regs, HARD_FRAME_POINTER_REGNUM); + if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM)) + { + SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM); + if (frame_pointer_needed) + SET_HARD_REG_BIT (ira_no_alloc_regs, HARD_FRAME_POINTER_REGNUM); + } + else if (frame_pointer_needed) + error ("%s cannot be used in asm here", + reg_names[HARD_FRAME_POINTER_REGNUM]); + else + df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true); } - else if (frame_pointer_needed) - error ("%s cannot be used in asm here", - reg_names[HARD_FRAME_POINTER_REGNUM]); - else - df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true); -#endif #else if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM)) diff --git a/gcc/reginfo.c b/gcc/reginfo.c index 6678688e105..bc2f8de5d3a 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -461,10 +461,9 @@ init_reg_sets_1 (void) } else if (i == FRAME_POINTER_REGNUM) ; -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - else if (i == HARD_FRAME_POINTER_REGNUM) + else if (!HARD_FRAME_POINTER_IS_FRAME_POINTER + && i == HARD_FRAME_POINTER_REGNUM) ; -#endif #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM else if (i == ARG_POINTER_REGNUM && fixed_regs[i]) ; diff --git a/gcc/regrename.c b/gcc/regrename.c index f995ffa4cb7..147aaa89e4e 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -438,9 +438,8 @@ rename_chains (void) if (frame_pointer_needed) { add_to_hard_reg_set (&unavailable, Pmode, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - add_to_hard_reg_set (&unavailable, Pmode, HARD_FRAME_POINTER_REGNUM); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + add_to_hard_reg_set (&unavailable, Pmode, HARD_FRAME_POINTER_REGNUM); } FOR_EACH_VEC_ELT (id_to_chain, i, this_head) diff --git a/gcc/reload1.c b/gcc/reload1.c index 5a010454c8e..82b106e6bc6 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -914,10 +914,9 @@ reload (rtx_insn *first, int global) spill_hard_reg (from, 1); } -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - if (frame_pointer_needed) + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER && frame_pointer_needed) spill_hard_reg (HARD_FRAME_POINTER_REGNUM, 1); -#endif + finish_spills (global); /* From now on, we may need to generate moves differently. We may also @@ -3281,13 +3280,13 @@ eliminate_regs_in_insn (rtx_insn *insn, int replace) for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) if (ep->from_rtx == SET_DEST (old_set) && ep->can_eliminate) { -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER /* If this is setting the frame pointer register to the hardware frame pointer register and this is an elimination that will be done (tested above), this insn is really adjusting the frame pointer downward to compensate for the adjustment done before a nonlocal goto. */ - if (ep->from == FRAME_POINTER_REGNUM + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER + && ep->from == FRAME_POINTER_REGNUM && ep->to == HARD_FRAME_POINTER_REGNUM) { rtx base = SET_SRC (old_set); @@ -3347,7 +3346,6 @@ eliminate_regs_in_insn (rtx_insn *insn, int replace) goto done; } } -#endif /* In this case this insn isn't serving a useful purpose. We will delete it in reload_as_needed once we know that this diff --git a/gcc/resource.c b/gcc/resource.c index 4f71aac3752..9a013b3ec18 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -335,9 +335,8 @@ mark_referenced_resources (rtx x, struct resources *res, if (frame_pointer_needed) { SET_HARD_REG_BIT (res->regs, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - SET_HARD_REG_BIT (res->regs, HARD_FRAME_POINTER_REGNUM); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + SET_HARD_REG_BIT (res->regs, HARD_FRAME_POINTER_REGNUM); } for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) @@ -1190,9 +1189,9 @@ init_resource_info (rtx_insn *epilogue_insn) if (frame_pointer_needed) { SET_HARD_REG_BIT (end_of_function_needs.regs, FRAME_POINTER_REGNUM); -#if !HARD_FRAME_POINTER_IS_FRAME_POINTER - SET_HARD_REG_BIT (end_of_function_needs.regs, HARD_FRAME_POINTER_REGNUM); -#endif + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) + SET_HARD_REG_BIT (end_of_function_needs.regs, + HARD_FRAME_POINTER_REGNUM); } if (!(frame_pointer_needed && EXIT_IGNORE_STACK -- 2.30.2