diff options
Diffstat (limited to 'gcc')
47 files changed, 252 insertions, 162 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33bc12d9268..ef1f53c175b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,119 @@ 2012-06-24 Steven Bosscher <steven@gcc.gnu.org> + * output.h: (current_function_is_leaf, + current_function_sp_is_unchanging, + current_function_uses_only_leaf_regs): Remove. + * function.c (current_function_is_leaf, + current_function_sp_is_unchanging, + current_function_uses_only_leaf_regs): Remove. + (rest_of_handle_check_leaf_regs): Set crtl->uses_only_leaf_regs + instead of current_function_uses_only_leaf_regs. + * function.h (struct rtl_data): New fields sp_is_unchanging, + is_leaf, uses_only_leaf_regs. + * resource.c (init_resource_info): Replace current_function_is_leaf, + current_function_sp_is_unchanging, and + current_function_uses_only_leaf_regs with new crtl fields. + * sdbout.c (sdbout_symbol): Likewise. + * df-core.c (rest_of_handle_df_initialize): Likewise. + * ira.c (ira): Likewise. + * final.c (final_start_function): Likewise. + * reorg.c (fill_simple_delay_slots): Likewise. + * regrename.c (check_new_reg_p): Likewise. + * stack-ptr-mod.c (notice_stack_pointer_modification_1): Likewise. + (notice_stack_pointer_modification): Likewise. + * dbxout.c (dbxout_symbol): Likewise. + (dbxout_parms): Likewise. + * sel-sched.c (init_regs_for_mode): Likewise. + * dwarf2out.c (dbx_reg_number): Likewise. + (multiple_reg_loc_descriptor): Likewise. + * config/i386/i386.c (ix86_frame_pointer_required): Likewise. + (gen_pop): Likewise. + (ix86_select_alt_pic_regnum): Likewise. + (ix86_compute_frame_layout): Likewise. + (ix86_finalize_stack_realign_flags): Likewise. + (ix86_expand_epilogue): Likewise. + * config/rs6000/rs6000.c (rs6000_stack_info): Likewise. + * config/h8300/h8300.c (byte_reg): Likewise. + * config/c6x/c6x.c (must_reload_pic_reg_p): Likewise. + (c6x_save_reg): Likewise. + (c6x_compute_frame_layout): Likewise. + * config/pa/pa.c (pa_compute_frame_size): Likewise. + (pa_output_function_prologue): Likewise. + * config/stormy16/stormy16.c (struct xstormy16_stack_layout): Likewise. + * config/sparc/sparc.md (attr "leaf_function"): Likewise. + * config/sparc/sparc.c (sparc_initial_elimination_offset): Likewise. + (sparc_expand_prologue): Likewise. + (sparc_flat_expand_prologue): Likewise. + (sparc_asm_function_prologue): Likewise. + (sparc_output_mi_thunk): Likewise. + (sparc_frame_pointer_required): Likewise. + * config/epiphany/epiphany.c (epiphany_compute_function_type): + Likewise. + (epiphany_compute_frame_size): Likewise. + * config/lm32/lm32.c (lm32_compute_frame_size): Likewise. + * config/cris/cris.c (cris_md_asm_clobbers): Likewise. + (cris_frame_pointer_required): Likewise. + * config/tilepro/tilepro.c (emit_sp_adjust): Likewise. + (tilepro_current_function_is_leaf): Likewise. + * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Likewise. + * config/pdp11/pdp11.c (pdp11_expand_epilogue): Likewise. + * config/ia64/ia64.c (find_gr_spill): Likewise. + (ia64_compute_frame_size): Likewise. + (ia64_can_eliminate): Likewise. + (ia64_initial_elimination_offset): Likewise. + * config/m68k/m68k.c (m68k_save_reg): Likewise. + (m68k_expand_epilogue): Likewise. + * config/rx/rx.c (rx_get_stack_layout): Likewise. + * config/tilegx/tilegx.c (tilegx_current_function_is_leaf): Likewise. + * config/picochip/picochip.c (picochip_can_eliminate_link_sp_save): + Likewise. + (picochip_output_frame_debug): Likewise. + * config/sh/sh.c (sh_media_register_for_return): Likewise. + (sh_allocate_initial_value): Likewise. + (sh_output_mi_thunk): Likewise. + * config/microblaze/microblaze.c (microblaze_must_save_register): + Likewise. + (compute_frame_size): Likewise. + (microblaze_initial_elimination_offset): Likewise. + (microblaze_expand_prologue): Likewise. + (microblaze_expand_epilogue): Likewise. + * config/frv/frv.c (frv_expand_epilogue): Likewise. + (frv_frame_pointer_required): Likewise. + * config/spu/spu.c (get_pic_reg): Likewise. + (direct_return): Likewise. + (spu_expand_prologue): Likewise. + (spu_expand_epilogue): Likewise. + (spu_initial_elimination_offset): Likewise. + * config/mips/mips.c (mips_global_pointer): Likewise. + (mips_cfun_might_clobber_call_saved_reg_p): Likewise. + (mips_compute_frame_info): Likewise. + * config/mep/mep.c (mep_interrupt_saved_reg): Likewise. + (mep_reload_pointer): Likewise. + * config/rl78/rl78.c (need_to_save): Likewise. + * config/cr16/cr16.c (cr16_compute_save_regs): Likewise. + * config/score/score.c (score_compute_frame_size): Likewise. + (score_function_prologue): Likewise. + * config/bfin/bfin.c (must_save_p): Likewise. + (expand_prologue_reg_save): Likewise. + (expand_epilogue_reg_restore): Likewise. + (bfin_frame_pointer_required): Likewise. + (n_regs_saved_by_prologue): Likewise. + (add_to_reg): Likewise. + (expand_interrupt_handler_prologue): Likewise. + (expand_interrupt_handler_epilogue): Likewise. + (bfin_expand_prologue): Likewise. + * config/avr/avr.c (avr_regs_to_save): Likewise. + (avr_prologue_setup_frame): Likewise. + (expand_epilogue): Likewise. + * config/s390/s390.c (s390_regs_ever_clobbered): Likewise. + (s390_register_info): Likewise. + (s390_frame_info): Likewise. + (s390_init_frame_layout): Likewise. + (s390_emit_prologue): Likewise. + + +2012-06-24 Steven Bosscher <steven@gcc.gnu.org> + * system.h: Poison ASM_BYTE_OP and ASM_OUTPUT_BYTE. * vmsdbgout: Do not undefine it if defined. Rename local ASM_BYTE_OP definition to VMS_ASM_BYTE_OP. @@ -2181,7 +2295,7 @@ * doc/invoke.texi (AVR Options): Ditto. And document related built-in macros. -2012-05-31 Diego Novillo <dnovillo@google.com> +2012-05-31 Diego Novillo <dnovillo@google.com> * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define and substitute. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index b7ae20f73ca..3913e11b50b 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -15147,7 +15147,7 @@ arm_compute_save_reg0_reg12_mask (void) for (reg = 0; reg <= max_reg; reg++) if (df_regs_ever_live_p (reg) - || (! current_function_is_leaf && call_used_regs[reg])) + || (! crtl->is_leaf && call_used_regs[reg])) save_reg_mask |= (1 << reg); /* Also save the pic base register if necessary. */ diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 70384c4ce29..8199d2e4f90 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -658,7 +658,7 @@ avr_regs_to_save (HARD_REG_SET *set) if (fixed_regs[reg]) continue; - if ((int_or_sig_p && !current_function_is_leaf && call_used_regs[reg]) + if ((int_or_sig_p && !crtl->is_leaf && call_used_regs[reg]) || (df_regs_ever_live_p (reg) && (int_or_sig_p || !call_used_regs[reg]) /* Don't record frame pointer registers here. They are treated @@ -1010,7 +1010,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set) gcc_assert (frame_pointer_needed || !isr_p - || !current_function_is_leaf); + || !crtl->is_leaf); fp = my_fp = (frame_pointer_needed ? frame_pointer_rtx @@ -1358,7 +1358,7 @@ expand_epilogue (bool sibcall_p) gcc_assert (frame_pointer_needed || !isr_p - || !current_function_is_leaf); + || !crtl->is_leaf); fp = my_fp = (frame_pointer_needed ? frame_pointer_rtx diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index a24ba9006a1..dd141ed7bb1 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -248,7 +248,7 @@ must_save_p (bool is_inthandler, unsigned regno) || (!TARGET_FDPIC && regno == PIC_OFFSET_TABLE_REGNUM && (crtl->uses_pic_offset_table - || (TARGET_ID_SHARED_LIBRARY && !current_function_is_leaf)))); + || (TARGET_ID_SHARED_LIBRARY && !crtl->is_leaf)))); } else return ((is_inthandler || !call_used_regs[regno]) @@ -346,7 +346,7 @@ expand_prologue_reg_save (rtx spreg, int saveall, bool is_inthandler) RTX_FRAME_RELATED_P (insn) = 1; for (dregno = REG_LT0; dregno <= REG_LB1; dregno++) - if (! current_function_is_leaf + if (! crtl->is_leaf || cfun->machine->has_hardware_loops || cfun->machine->has_loopreg_clobber || (ENABLE_WA_05000257 @@ -526,7 +526,7 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler) if (saveall || is_inthandler) { for (regno = REG_LB1; regno >= REG_LT0; regno--) - if (! current_function_is_leaf + if (! crtl->is_leaf || cfun->machine->has_hardware_loops || cfun->machine->has_loopreg_clobber || (ENABLE_WA_05000257 && (regno == REG_LC0 || regno == REG_LC1))) @@ -600,7 +600,7 @@ bfin_frame_pointer_required (void) /* We turn on -fomit-frame-pointer if -momit-leaf-frame-pointer is used, so we have to override it for non-leaf functions. */ - if (TARGET_OMIT_LEAF_FRAME_POINTER && ! current_function_is_leaf) + if (TARGET_OMIT_LEAF_FRAME_POINTER && ! crtl->is_leaf) return true; return false; @@ -615,7 +615,7 @@ n_regs_saved_by_prologue (void) bool is_inthandler = fkind != SUBROUTINE; tree attrs = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)); bool all = (lookup_attribute ("saveall", attrs) != NULL_TREE - || (is_inthandler && !current_function_is_leaf)); + || (is_inthandler && !crtl->is_leaf)); int ndregs = all ? 8 : n_dregs_to_save (is_inthandler, false); int npregs = all ? 6 : n_pregs_to_save (is_inthandler, false); int n = ndregs + npregs; @@ -635,7 +635,7 @@ n_regs_saved_by_prologue (void) { /* Increment once for ASTAT. */ n++; - if (! current_function_is_leaf + if (! crtl->is_leaf || cfun->machine->has_hardware_loops || cfun->machine->has_loopreg_clobber) { @@ -760,7 +760,7 @@ add_to_reg (rtx reg, HOST_WIDE_INT value, int frame, int epilogue_p) && i == PIC_OFFSET_TABLE_REGNUM && (crtl->uses_pic_offset_table || (TARGET_ID_SHARED_LIBRARY - && ! current_function_is_leaf)))) + && ! crtl->is_leaf)))) break; if (i <= REG_P5) tmpreg = gen_rtx_REG (SImode, i); @@ -956,7 +956,7 @@ expand_interrupt_handler_prologue (rtx spreg, e_funkind fkind, bool all) /* If we're calling other functions, they won't save their call-clobbered registers, so we must save everything here. */ - if (!current_function_is_leaf) + if (!crtl->is_leaf) all = true; expand_prologue_reg_save (spreg, all, true); @@ -1019,7 +1019,7 @@ expand_interrupt_handler_epilogue (rtx spreg, e_funkind fkind, bool all) /* If we're calling other functions, they won't save their call-clobbered registers, so we must save (and restore) everything here. */ - if (!current_function_is_leaf) + if (!crtl->is_leaf) all = true; expand_epilogue_reg_restore (spreg, all, true); @@ -1134,7 +1134,7 @@ bfin_expand_prologue (void) if (TARGET_ID_SHARED_LIBRARY && !TARGET_SEP_DATA && (crtl->uses_pic_offset_table - || !current_function_is_leaf)) + || !crtl->is_leaf)) bfin_load_pic_reg (pic_offset_table_rtx); } diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 6f16c6920f1..81e43ca9780 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -2537,7 +2537,7 @@ must_reload_pic_reg_p (void) i = cgraph_local_info (current_function_decl); - if ((crtl->uses_pic_offset_table || !current_function_is_leaf) && !i->local) + if ((crtl->uses_pic_offset_table || !crtl->is_leaf) && !i->local) return true; return false; } @@ -2551,7 +2551,7 @@ c6x_save_reg (unsigned int regno) && !fixed_regs[regno]) || (regno == RETURN_ADDR_REGNO && (df_regs_ever_live_p (regno) - || !current_function_is_leaf)) + || !crtl->is_leaf)) || (regno == PIC_OFFSET_TABLE_REGNUM && must_reload_pic_reg_p ())); } @@ -2642,7 +2642,7 @@ c6x_compute_frame_layout (struct c6x_frame *frame) offset += frame->nregs * 4; if (offset == 0 && size == 0 && crtl->outgoing_args_size == 0 - && !current_function_is_leaf) + && !crtl->is_leaf) /* Don't use the bottom of the caller's frame if we have no allocation of our own and call other functions. */ frame->padding0 = frame->padding1 = 4; diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c index df272600c8b..b9305701923 100644 --- a/gcc/config/cr16/cr16.c +++ b/gcc/config/cr16/cr16.c @@ -354,7 +354,7 @@ cr16_compute_save_regs (void) /* If this reg is used and not call-used (except RA), save it. */ if (cr16_interrupt_function_p ()) { - if (!current_function_is_leaf && call_used_regs[regno]) + if (!crtl->is_leaf && call_used_regs[regno]) /* This is a volatile reg in a non-leaf interrupt routine - save it for the sake of its sons. */ current_frame_info.save_regs[regno] = 1; diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 1c6769912d0..1bc998165b1 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -4098,7 +4098,7 @@ cris_md_asm_clobbers (tree outputs, tree inputs, tree in_clobbers) bool cris_frame_pointer_required (void) { - return !current_function_sp_is_unchanging; + return !crtl->sp_is_unchanging; } /* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE. diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index aca296f0152..14c96dc4a3f 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -932,7 +932,7 @@ epiphany_compute_function_type (tree decl) Don't consider them here. */ #define MUST_SAVE_REGISTER(regno, interrupt_p) \ ((df_regs_ever_live_p (regno) \ - || (interrupt_p && !current_function_is_leaf \ + || (interrupt_p && !crtl->is_leaf \ && call_used_regs[regno] && !fixed_regs[regno])) \ && (!call_used_regs[regno] || regno == GPR_LR \ || (interrupt_p && regno != GPR_SP))) @@ -1035,7 +1035,7 @@ epiphany_compute_frame_size (int size /* # of var. bytes allocated. */) reg_size = EPIPHANY_STACK_ALIGN (reg_size); if (total_size + reg_size <= (unsigned) epiphany_stack_offset && !interrupt_p - && current_function_is_leaf && !frame_pointer_needed) + && crtl->is_leaf && !frame_pointer_needed) { first_slot = -1; last_slot = -1; diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index d7a111acbbb..5e7b5d407fd 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -1895,7 +1895,7 @@ frv_expand_epilogue (bool emit_return) /* Restore the stack pointer to its original value if alloca or the like is used. */ - if (! current_function_sp_is_unchanging) + if (! crtl->sp_is_unchanging) emit_insn (gen_addsi3 (sp, fp, frv_frame_offset_rtx (-fp_offset))); /* Restore the callee-saved registers that were used in this function. */ @@ -2064,9 +2064,9 @@ frv_frame_pointer_required (void) /* If we forgoing the usual linkage requirements, we only need a frame pointer if the stack pointer might change. */ if (!TARGET_LINKED_FP) - return !current_function_sp_is_unchanging; + return !crtl->sp_is_unchanging; - if (! current_function_is_leaf) + if (! crtl->is_leaf) return true; if (get_frame_size () != 0) @@ -2075,7 +2075,7 @@ frv_frame_pointer_required (void) if (cfun->stdarg) return true; - if (!current_function_sp_is_unchanging) + if (!crtl->sp_is_unchanging) return true; if (!TARGET_FDPIC && flag_pic && crtl->uses_pic_offset_table) diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index e0784a52c0d..3dd071a63c4 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -480,7 +480,7 @@ byte_reg (rtx x, int b) handlers. */ \ || (h8300_current_function_interrupt_function_p () \ && call_used_regs[regno] \ - && !current_function_is_leaf))) + && !crtl->is_leaf))) /* We use this to wrap all emitted insns in the prologue. */ static rtx diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fc30632717e..7bcde8a2e16 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8562,7 +8562,7 @@ ix86_frame_pointer_required (void) turns off the frame pointer by default. Turn it back on now if we've not got a leaf function. */ if (TARGET_OMIT_LEAF_FRAME_POINTER - && (!current_function_is_leaf + && (!crtl->is_leaf || ix86_current_function_calls_tls_descriptor)) return true; @@ -8809,7 +8809,7 @@ gen_pop (rtx arg) static unsigned int ix86_select_alt_pic_regnum (void) { - if (current_function_is_leaf + if (crtl->is_leaf && !crtl->profile && !ix86_current_function_calls_tls_descriptor) { @@ -8973,7 +8973,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) /* 64-bit MS ABI seem to require stack alignment to be always 16 except for function prologues and leaf. */ if ((TARGET_64BIT_MS_ABI && preferred_alignment < 16) - && (!current_function_is_leaf || cfun->calls_alloca != 0 + && (!crtl->is_leaf || cfun->calls_alloca != 0 || ix86_current_function_calls_tls_descriptor)) { preferred_alignment = 16; @@ -9078,7 +9078,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) if (stack_realign_fp || offset != frame->sse_reg_save_offset || size != 0 - || !current_function_is_leaf + || !crtl->is_leaf || cfun->calls_alloca || ix86_current_function_calls_tls_descriptor) offset = (offset + stack_alignment_needed - 1) & -stack_alignment_needed; @@ -9094,7 +9094,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) expander assumes that last crtl->outgoing_args_size of stack frame are unused. */ if (ACCUMULATE_OUTGOING_ARGS - && (!current_function_is_leaf || cfun->calls_alloca + && (!crtl->is_leaf || cfun->calls_alloca || ix86_current_function_calls_tls_descriptor)) { offset += crtl->outgoing_args_size; @@ -9105,7 +9105,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame) /* Align stack boundary. Only needed if we're calling another function or using alloca. */ - if (!current_function_is_leaf || cfun->calls_alloca + if (!crtl->is_leaf || cfun->calls_alloca || ix86_current_function_calls_tls_descriptor) offset = (offset + preferred_alignment - 1) & -preferred_alignment; @@ -9120,8 +9120,8 @@ ix86_compute_frame_layout (struct ix86_frame *frame) frame->save_regs_using_mov = false; if (ix86_using_red_zone () - && current_function_sp_is_unchanging - && current_function_is_leaf + && crtl->sp_is_unchanging + && crtl->is_leaf && !ix86_current_function_calls_tls_descriptor) { frame->red_zone_size = to_allocate; @@ -10062,7 +10062,7 @@ ix86_finalize_stack_realign_flags (void) = (crtl->parm_stack_boundary > ix86_incoming_stack_boundary ? crtl->parm_stack_boundary : ix86_incoming_stack_boundary); unsigned int stack_realign = (incoming_stack_boundary - < (current_function_is_leaf + < (crtl->is_leaf ? crtl->max_used_stack_slot_alignment : crtl->stack_alignment_needed)); @@ -10081,9 +10081,9 @@ ix86_finalize_stack_realign_flags (void) if (stack_realign && !crtl->need_drap && frame_pointer_needed - && current_function_is_leaf + && crtl->is_leaf && flag_omit_frame_pointer - && current_function_sp_is_unchanging + && crtl->sp_is_unchanging && !ix86_current_function_calls_tls_descriptor && !crtl->accesses_prior_frames && !cfun->calls_alloca @@ -10792,7 +10792,7 @@ ix86_expand_epilogue (int style) ix86_compute_frame_layout (&frame); m->fs.sp_valid = (!frame_pointer_needed - || (current_function_sp_is_unchanging + || (crtl->sp_is_unchanging && !stack_realign_fp)); gcc_assert (!m->fs.sp_valid || m->fs.sp_offset == frame.stack_pointer_offset); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 108050708bd..0e5b37363cb 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -2547,7 +2547,7 @@ find_gr_spill (enum ia64_frame_regs r, int try_locals) if (regno >= LOC_REG (0) && regno < LOC_REG (80 - frame_pointer_needed) && current_frame_info.n_local_regs < regno - LOC_REG (0) + 1) current_frame_info.n_local_regs = regno - LOC_REG (0) + 1; - else if (current_function_is_leaf + else if (crtl->is_leaf && regno >= GR_REG (1) && regno <= GR_REG (31)) current_frame_info.gr_used_mask |= 1 << regno; @@ -2556,7 +2556,7 @@ find_gr_spill (enum ia64_frame_regs r, int try_locals) /* If this is a leaf function, first try an otherwise unused call-clobbered register. */ - if (current_function_is_leaf) + if (crtl->is_leaf) { for (regno = GR_REG (1); regno <= GR_REG (31); regno++) if (! df_regs_ever_live_p (regno) @@ -2770,7 +2770,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) } } - if (! current_function_is_leaf) + if (! crtl->is_leaf) { /* Emit a save of BR0 if we call other functions. Do this even if this function doesn't return, as EH depends on this to be @@ -2922,7 +2922,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) /* We always use the 16-byte scratch area provided by the caller, but if we are a leaf function, there's no one to which we need to provide a scratch area. */ - if (current_function_is_leaf) + if (crtl->is_leaf) total_size = MAX (0, total_size - 16); current_frame_info.total_size = total_size; @@ -2939,7 +2939,7 @@ ia64_compute_frame_size (HOST_WIDE_INT size) bool ia64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) { - return (to == BR_REG (0) ? current_function_is_leaf : true); + return (to == BR_REG (0) ? crtl->is_leaf : true); } /* Compute the initial difference between the specified pair of registers. */ @@ -2956,7 +2956,7 @@ ia64_initial_elimination_offset (int from, int to) switch (to) { case HARD_FRAME_POINTER_REGNUM: - if (current_function_is_leaf) + if (crtl->is_leaf) offset = -current_frame_info.total_size; else offset = -(current_frame_info.total_size @@ -2964,7 +2964,7 @@ ia64_initial_elimination_offset (int from, int to) break; case STACK_POINTER_REGNUM: - if (current_function_is_leaf) + if (crtl->is_leaf) offset = 0; else offset = 16 + crtl->outgoing_args_size; diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index 2e1cf445428..198f1e8de99 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -460,7 +460,7 @@ lm32_compute_frame_size (int size) callee_size += UNITS_PER_WORD; } } - if (df_regs_ever_live_p (RA_REGNUM) || !current_function_is_leaf + if (df_regs_ever_live_p (RA_REGNUM) || crtl->is_leaf! || !optimize) { reg_save_mask |= 1 << RA_REGNUM; diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index c6b2ce3aff3..8684d0ab0b8 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -882,7 +882,7 @@ m68k_save_reg (unsigned int regno, bool interrupt_handler) if (df_regs_ever_live_p (regno)) return true; - if (!current_function_is_leaf && call_used_regs[regno]) + if (!crtl->is_leaf && call_used_regs[regno]) return true; } @@ -1142,12 +1142,11 @@ m68k_expand_epilogue (bool sibcall_p) big = false; restore_from_sp = false; - /* FIXME : current_function_is_leaf below is too strong. + /* FIXME : crtl->is_leaf below is too strong. What we really need to know there is if there could be pending stack adjustment needed at that point. */ restore_from_sp = (!frame_pointer_needed - || (!cfun->calls_alloca - && current_function_is_leaf)); + || (!cfun->calls_alloca && crtl->is_leaf)); /* fsize_with_regs is the size we need to adjust the sp when popping the frame. */ diff --git a/gcc/config/mep/mep-pragma.c b/gcc/config/mep/mep-pragma.c index d9457ed6cd9..9f516209df6 100644 --- a/gcc/config/mep/mep-pragma.c +++ b/gcc/config/mep/mep-pragma.c @@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "c-family/c-pragma.h" #include "cpplib.h" #include "hard-reg-set.h" -#include "output.h" +#include "output.h" /* for decode_reg_name */ #include "mep-protos.h" #include "function.h" #define MAX_RECOG_OPERANDS 10 diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c index 8e6cc4d1a8c..a6615edcd0b 100644 --- a/gcc/config/mep/mep.c +++ b/gcc/config/mep/mep.c @@ -2522,16 +2522,16 @@ mep_interrupt_saved_reg (int r) || (r == RPB_REGNO || r == RPE_REGNO || r == RPC_REGNO || r == LP_REGNO) || IVC2_ISAVED_REG (r))) return true; - if (!current_function_is_leaf) + if (!crtl->is_leaf) /* Function calls mean we need to save $lp. */ if (r == LP_REGNO || IVC2_ISAVED_REG (r)) return true; - if (!current_function_is_leaf || cfun->machine->doloop_tags > 0) + if (!crtl->is_leaf || cfun->machine->doloop_tags > 0) /* The interrupt handler might use these registers for repeat blocks, or it might call a function that does so. */ if (r == RPB_REGNO || r == RPE_REGNO || r == RPC_REGNO) return true; - if (current_function_is_leaf && call_used_regs[r] && !df_regs_ever_live_p(r)) + if (crtl->is_leaf && call_used_regs[r] && !df_regs_ever_live_p(r)) return false; /* Functions we call might clobber these. */ if (call_used_regs[r] && !fixed_regs[r]) @@ -2742,7 +2742,7 @@ mep_reload_pointer (int regno, const char *symbol) { rtx reg, sym; - if (!df_regs_ever_live_p(regno) && current_function_is_leaf) + if (!df_regs_ever_live_p(regno) && crtl->is_leaf) return; reg = gen_rtx_REG (SImode, regno); diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index 31248a0b559..199d1b8d46f 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -1478,7 +1478,7 @@ microblaze_must_save_register (int regno) if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM)) return 1; - if (!current_function_is_leaf) + if (!crtl->is_leaf) { if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) return 1; @@ -1603,7 +1603,7 @@ compute_frame_size (HOST_WIDE_INT size) /* No space to be allocated for link register in leaf functions with no other stack requirements. */ - if (total_size == 0 && current_function_is_leaf) + if (total_size == 0 && crtl->is_leaf) link_debug_size = 0; else link_debug_size = UNITS_PER_WORD; @@ -1664,7 +1664,7 @@ microblaze_initial_elimination_offset (int from, int to) gcc_unreachable (); break; case RETURN_ADDRESS_POINTER_REGNUM: - if (current_function_is_leaf) + if (crtl->is_leaf) offset = 0; else offset = current_frame_info.gp_offset + @@ -2354,7 +2354,7 @@ microblaze_expand_prologue (void) RTX_FRAME_RELATED_P (insn) = 1; /* Handle SUB_RETURN_ADDR_REGNUM specially at first. */ - if (!current_function_is_leaf || interrupt_handler) + if (!crtl->is_leaf || interrupt_handler) { mem_rtx = gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, stack_pointer_rtx, @@ -2459,7 +2459,7 @@ microblaze_expand_epilogue (void) a load-use stall cycle :) This is also important to handle alloca. (See comments for if (frame_pointer_needed) below. */ - if (!current_function_is_leaf || interrupt_handler) + if (!crtl->is_leaf || interrupt_handler) { mem_rtx = gen_rtx_MEM (SImode, diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index be54abce627..7356ce541f0 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9219,7 +9219,7 @@ mips_global_pointer (void) /* If the global pointer is call-saved, try to use a call-clobbered alternative. */ - if (TARGET_CALL_SAVED_GP && current_function_is_leaf) + if (TARGET_CALL_SAVED_GP && crtl->is_leaf) for (regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++) if (!df_regs_ever_live_p (regno) && call_really_used_regs[regno] @@ -9446,7 +9446,7 @@ mips_cfun_might_clobber_call_saved_reg_p (unsigned int regno) /* If REGNO is ordinarily call-clobbered, we must assume that any called function could modify it. */ if (cfun->machine->interrupt_handler_p - && !current_function_is_leaf + && !crtl->is_leaf && mips_interrupt_extra_call_saved_reg_p (regno)) return true; @@ -9589,7 +9589,7 @@ mips_compute_frame_info (void) slot. This area isn't needed in leaf functions, but if the target-independent frame size is nonzero, we have already committed to allocating these in STARTING_FRAME_OFFSET for !FRAME_GROWS_DOWNWARD. */ - if ((size == 0 || FRAME_GROWS_DOWNWARD) && current_function_is_leaf) + if ((size == 0 || FRAME_GROWS_DOWNWARD) && crtl->is_leaf) { /* The MIPS 3.0 linker does not like functions that dynamically allocate the stack and have 0 for STACK_DYNAMIC_OFFSET, since it diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 9dee55b525d..e692e485f37 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -3673,7 +3673,7 @@ pa_compute_frame_size (HOST_WIDE_INT size, int *fregs_live) /* Allocate space for the fixed frame marker. This space must be allocated for any function that makes calls or allocates stack space. */ - if (!current_function_is_leaf || size) + if (!crtl->is_leaf || size) size += TARGET_64BIT ? 48 : 32; /* Finally, round to the preferred stack boundary. */ @@ -3711,7 +3711,7 @@ pa_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) to output the assembler directives which denote the start of a function. */ fprintf (file, "\t.CALLINFO FRAME=" HOST_WIDE_INT_PRINT_DEC, actual_fsize); - if (current_function_is_leaf) + if (crtl->is_leaf) fputs (",NO_CALLS", file); else fputs (",CALLS", file); diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 85ea46abfa7..519960e9daf 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -337,7 +337,7 @@ pdp11_expand_epilogue (void) } /* If possible, restore registers via pops. */ - if (!frame_pointer_needed || current_function_sp_is_unchanging) + if (!frame_pointer_needed || crtl->sp_is_unchanging) { /* Restore registers via pops. */ diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c index 2beddce8cc9..cef49aa8e0c 100644 --- a/gcc/config/picochip/picochip.c +++ b/gcc/config/picochip/picochip.c @@ -1136,7 +1136,7 @@ picochip_can_eliminate_link_sp_save (void) accesses become wrong. This wouldnt happen only if we were not using the stack at all. The following conditions ensures that.*/ - return (current_function_is_leaf && + return (crtl->is_leaf && !df_regs_ever_live_p(LINK_REGNUM) && !df_regs_ever_live_p(STACK_POINTER_REGNUM) && (picochip_special_save_area_byte_offset() == 0) && @@ -1816,7 +1816,7 @@ picochip_output_frame_debug (FILE * file) { int i = 0; - if (current_function_is_leaf) + if (crtl->is_leaf) fprintf (file, "\t\t// Leaf function\n"); else fprintf (file, "\t\t// Non-leaf function\n"); diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c index 17fa2b1855d..83c59b017af 100644 --- a/gcc/config/rl78/rl78.c +++ b/gcc/config/rl78/rl78.c @@ -382,7 +382,7 @@ need_to_save (int regno) return 1; /* don't know what devirt will need */ if (regno > 23) return 0; /* don't need to save interrupt registers */ - if (current_function_is_leaf) + if (crtl->is_leaf) { return df_regs_ever_live_p (regno); } diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 6bd59090541..c124c639e0d 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -17670,7 +17670,7 @@ rs6000_stack_info (void) - info_ptr->first_altivec_reg_save); /* Does this function call anything? */ - info_ptr->calls_p = (! current_function_is_leaf + info_ptr->calls_p = (! crtl->is_leaf || cfun->machine->ra_needs_full_frame); /* Determine if we need to save the condition code registers. */ diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 08b998e2a46..058f54fd80f 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -1382,7 +1382,7 @@ rx_get_stack_layout (unsigned int * lowest, be used in (non-interrupt aware) routines called from this one. */ || (call_used_regs[reg] && is_interrupt_func (NULL_TREE) - && ! current_function_is_leaf)) + && ! crtl->is_leaf)) && (! call_used_regs[reg] /* Even call clobbered registered must be pushed inside interrupt handlers. */ diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index c243329b384..ca33d4e3498 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -7124,7 +7124,7 @@ s390_regs_ever_clobbered (int *regs_ever_clobbered) /* For non-leaf functions we have to consider all call clobbered regs to be clobbered. */ - if (!current_function_is_leaf) + if (!crtl->is_leaf) { for (i = 0; i < 16; i++) regs_ever_clobbered[i] = call_really_used_regs[i]; @@ -7248,7 +7248,7 @@ s390_register_info (int clobbered_regs[]) && REGNO (cfun->machine->base_reg) == BASE_REGNUM); clobbered_regs[RETURN_REGNUM] - |= (!current_function_is_leaf + |= (!crtl->is_leaf || TARGET_TPF_PROFILING || cfun->machine->split_branches_pending_p || cfun_frame_layout.save_return_addr_p @@ -7256,7 +7256,7 @@ s390_register_info (int clobbered_regs[]) || cfun->stdarg); clobbered_regs[STACK_POINTER_REGNUM] - |= (!current_function_is_leaf + |= (!crtl->is_leaf || TARGET_TPF_PROFILING || cfun_save_high_fprs_p || get_frame_size () > 0 @@ -7432,7 +7432,7 @@ s390_frame_info (void) = cfun_frame_layout.f0_offset - cfun_gprs_save_area_size; } - if (current_function_is_leaf + if (crtl->is_leaf && !TARGET_TPF_PROFILING && cfun_frame_layout.frame_size == 0 && !cfun_save_high_fprs_p @@ -7507,7 +7507,7 @@ s390_init_frame_layout (void) as base register to avoid save/restore overhead. */ if (!base_used) cfun->machine->base_reg = NULL_RTX; - else if (current_function_is_leaf && !df_regs_ever_live_p (5)) + else if (crtl->is_leaf && !df_regs_ever_live_p (5)) cfun->machine->base_reg = gen_rtx_REG (Pmode, 5); else cfun->machine->base_reg = gen_rtx_REG (Pmode, BASE_REGNUM); @@ -7978,7 +7978,7 @@ s390_emit_prologue (void) See below for why TPF must use the register 1. */ if (!has_hard_reg_initial_val (Pmode, RETURN_REGNUM) - && !current_function_is_leaf + && !crtl->is_leaf && !TARGET_TPF_PROFILING) temp_reg = gen_rtx_REG (Pmode, RETURN_REGNUM); else diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index 3d7bf49f081..6d81cd60901 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -312,7 +312,7 @@ score_compute_frame_size (HOST_WIDE_INT size) f->var_size = SCORE_STACK_ALIGN (size); f->args_size = crtl->outgoing_args_size; f->cprestore_size = flag_pic ? UNITS_PER_WORD : 0; - if (f->var_size == 0 && current_function_is_leaf) + if (f->var_size == 0 && crtl->is_leaf) f->args_size = f->cprestore_size = 0; if (f->args_size == 0 && cfun->calls_alloca) @@ -643,7 +643,7 @@ score_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM]), tsize, reg_names[RA_REGNUM], - current_function_is_leaf ? 1 : 0, + crtl->is_leaf ? 1 : 0, f->var_size, f->num_gp, f->args_size, diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 49a69abe04a..7e0c2c17515 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -6883,7 +6883,7 @@ sh_media_register_for_return (void) int regno; int tr0_used; - if (! current_function_is_leaf) + if (! crtl->is_leaf) return -1; if (lookup_attribute ("interrupt_handler", DECL_ATTRIBUTES (current_function_decl))) @@ -10477,7 +10477,7 @@ sh_allocate_initial_value (rtx hard_reg) if (REGNO (hard_reg) == (TARGET_SHMEDIA ? PR_MEDIA_REG : PR_REG)) { - if (current_function_is_leaf + if (crtl->is_leaf && ! sh_pr_n_sets () && ! (TARGET_SHCOMPACT && ((crtl->args.info.call_cookie @@ -11763,7 +11763,7 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, reload_completed = 1; epilogue_completed = 1; - current_function_uses_only_leaf_regs = 1; + crtl->uses_only_leaf_regs = 1; emit_note (NOTE_INSN_PROLOGUE_END); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 08c9cc891b0..6835d6914c7 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -470,7 +470,7 @@ struct GTY(()) machine_function /* True if the current function is leaf and uses only leaf regs, so that the SPARC leaf function optimization can be applied. - Private version of current_function_uses_only_leaf_regs, see + Private version of crtl->uses_only_leaf_regs, see sparc_expand_prologue for the rationale. */ int leaf_function_p; @@ -4558,8 +4558,7 @@ sparc_initial_elimination_offset (int to) int offset; if (to == STACK_POINTER_REGNUM) - offset = sparc_compute_frame_size (get_frame_size (), - current_function_is_leaf); + offset = sparc_compute_frame_size (get_frame_size (), crtl->is_leaf); else offset = 0; @@ -4983,7 +4982,7 @@ sparc_expand_prologue (void) HOST_WIDE_INT size; rtx insn; - /* Compute a snapshot of current_function_uses_only_leaf_regs. Relying + /* Compute a snapshot of crtl->uses_only_leaf_regs. Relying on the final value of the flag means deferring the prologue/epilogue expansion until just before the second scheduling pass, which is too late to emit multiple epilogues or return insns. @@ -5006,7 +5005,7 @@ sparc_expand_prologue (void) example, the regrename pass has special provisions to not rename to non-leaf registers in a leaf function. */ sparc_leaf_function_p - = optimize > 0 && current_function_is_leaf && only_leaf_regs_used (); + = optimize > 0 && crtl->is_leaf && only_leaf_regs_used (); size = sparc_compute_frame_size (get_frame_size(), sparc_leaf_function_p); @@ -5108,7 +5107,7 @@ sparc_flat_expand_prologue (void) HOST_WIDE_INT size; rtx insn; - sparc_leaf_function_p = optimize > 0 && current_function_is_leaf; + sparc_leaf_function_p = optimize > 0 && crtl->is_leaf; size = sparc_compute_frame_size (get_frame_size(), sparc_leaf_function_p); @@ -5219,7 +5218,7 @@ sparc_asm_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) { /* Check that the assumption we made in sparc_expand_prologue is valid. */ if (!TARGET_FLAT) - gcc_assert (sparc_leaf_function_p == current_function_uses_only_leaf_regs); + gcc_assert (sparc_leaf_function_p == crtl->uses_only_leaf_regs); sparc_output_scratch_registers (file); } @@ -10488,7 +10487,7 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, { /* We will emit a regular sibcall below, so we need to instruct output_sibcall that we are in a leaf function. */ - sparc_leaf_function_p = current_function_uses_only_leaf_regs = 1; + sparc_leaf_function_p = crtl->uses_only_leaf_regs = 1; /* This will cause final.c to invoke leaf_renumber_regs so we must behave as if we were in a not-yet-leafified function. */ @@ -10498,7 +10497,7 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, { /* We will emit the sibcall manually below, so we will need to manually spill non-leaf registers. */ - sparc_leaf_function_p = current_function_uses_only_leaf_regs = 0; + sparc_leaf_function_p = crtl->uses_only_leaf_regs = 0; /* We really are in a leaf function. */ int_arg_first = SPARC_OUTGOING_INT_ARG_FIRST; @@ -11284,7 +11283,7 @@ sparc_frame_pointer_required (void) return false; /* Otherwise, the frame pointer is required if the function isn't leaf. */ - return !(current_function_is_leaf && only_leaf_regs_used ()); + return !(crtl->is_leaf && only_leaf_regs_used ()); } /* The way this is structured, we can't eliminate SFP in favor of SP diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index aafff5598d1..5cc6c677ccb 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -290,7 +290,7 @@ ? CALLS_EH_RETURN_TRUE : CALLS_EH_RETURN_FALSE)")) (define_attr "leaf_function" "false,true" - (symbol_ref "(current_function_uses_only_leaf_regs != 0 + (symbol_ref "(crtl->uses_only_leaf_regs != 0 ? LEAF_FUNCTION_TRUE : LEAF_FUNCTION_FALSE)")) (define_attr "delayed_branch" "false,true" diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 0aa5cf4da1a..3e0135fb592 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -1761,7 +1761,7 @@ get_pic_reg (void) "switch back" to using pic_offset_table_rtx. */ if (!cfun->machine->pic_reg) { - if (current_function_is_leaf && !df_regs_ever_live_p (LAST_ARG_REGNUM)) + if (crtl->is_leaf && !df_regs_ever_live_p (LAST_ARG_REGNUM)) cfun->machine->pic_reg = gen_rtx_REG (SImode, LAST_ARG_REGNUM); else cfun->machine->pic_reg = pic_offset_table_rtx; @@ -1963,7 +1963,7 @@ direct_return (void) + get_frame_size () + crtl->outgoing_args_size + crtl->args.pretend_args_size == 0) - && current_function_is_leaf) + && crtl->is_leaf) return 1; } return 0; @@ -2023,13 +2023,13 @@ spu_expand_prologue (void) + crtl->outgoing_args_size + crtl->args.pretend_args_size; - if (!current_function_is_leaf + if (!crtl->is_leaf || cfun->calls_alloca || total_size > 0) total_size += STACK_POINTER_OFFSET; /* Save this first because code after this might use the link register as a scratch register. */ - if (!current_function_is_leaf) + if (!crtl->is_leaf) { insn = frame_emit_store (LINK_REGISTER_REGNUM, sp_reg, 16); RTX_FRAME_RELATED_P (insn) = 1; @@ -2136,7 +2136,7 @@ spu_expand_epilogue (bool sibcall_p) + crtl->outgoing_args_size + crtl->args.pretend_args_size; - if (!current_function_is_leaf + if (!crtl->is_leaf || cfun->calls_alloca || total_size > 0) total_size += STACK_POINTER_OFFSET; @@ -2160,7 +2160,7 @@ spu_expand_epilogue (bool sibcall_p) } } - if (!current_function_is_leaf) + if (!crtl->is_leaf) frame_emit_load (LINK_REGISTER_REGNUM, sp_reg, 16); if (!sibcall_p) @@ -4055,7 +4055,7 @@ spu_initial_elimination_offset (int from, int to) { int saved_regs_size = spu_saved_regs_size (); int sp_offset = 0; - if (!current_function_is_leaf || crtl->outgoing_args_size + if (!crtl->is_leaf || crtl->outgoing_args_size || get_frame_size () || saved_regs_size) sp_offset = STACK_POINTER_OFFSET; if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM) diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index a2e6481d07b..cd7521258fc 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -917,7 +917,7 @@ struct xstormy16_stack_layout ((df_regs_ever_live_p (REGNUM) && ! call_used_regs[REGNUM]) \ || (IFUN && ! fixed_regs[REGNUM] && call_used_regs[REGNUM] \ && (REGNUM != CARRY_REGNUM) \ - && (df_regs_ever_live_p (REGNUM) || ! current_function_is_leaf))) + && (df_regs_ever_live_p (REGNUM) || ! crtl->is_leaf))) /* Compute the stack layout. */ diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index a5f48a24b22..25be30050ec 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -3675,7 +3675,7 @@ emit_sp_adjust (int offset, int *next_scratch_regno, bool frame_related, static bool tilegx_current_function_is_leaf (void) { - return current_function_is_leaf && !cfun->machine->calls_tls_get_addr; + return crtl->is_leaf && !cfun->machine->calls_tls_get_addr; } diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index ce28d9e8221..10bf7021a8c 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -3377,7 +3377,7 @@ emit_sp_adjust (int offset, int *next_scratch_regno, bool frame_related, static bool tilepro_current_function_is_leaf (void) { - return current_function_is_leaf && !cfun->machine->calls_tls_get_addr; + return crtl->is_leaf && !cfun->machine->calls_tls_get_addr; } diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 65753befa0a..e8e73bbd173 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2948,7 +2948,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) decl_rtl = eliminate_regs (decl_rtl, VOIDmode, NULL_RTX); #ifdef LEAF_REG_REMAP - if (current_function_uses_only_leaf_regs) + if (crtl->uses_only_leaf_regs) leaf_renumber_regs_insn (decl_rtl); #endif @@ -3454,7 +3454,7 @@ dbxout_parms (tree parms) SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), VOIDmode, NULL_RTX)); #ifdef LEAF_REG_REMAP - if (current_function_uses_only_leaf_regs) + if (crtl->uses_only_leaf_regs) { leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms)); leaf_renumber_regs_insn (DECL_RTL (parms)); diff --git a/gcc/df-core.c b/gcc/df-core.c index 9f3ea429562..0ca33037450 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -385,7 +385,6 @@ are write-only operations. #include "recog.h" #include "function.h" #include "regs.h" -#include "output.h" #include "alloc-pool.h" #include "flags.h" #include "hard-reg-set.h" @@ -711,7 +710,7 @@ rest_of_handle_df_initialize (void) /* Set this to a conservative value. Stack_ptr_mod will compute it correctly later. */ - current_function_sp_is_unchanging = 0; + crtl->sp_is_unchanging = 0; df_scan_add_problem (); df_scan_alloc (NULL); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 282a0e507c8..015422e1994 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9696,7 +9696,7 @@ dbx_reg_number (const_rtx rtl) gcc_assert (regno < FIRST_PSEUDO_REGISTER); #ifdef LEAF_REG_REMAP - if (current_function_uses_only_leaf_regs) + if (crtl->uses_only_leaf_regs) { int leaf_reg = LEAF_REG_REMAP (regno); if (leaf_reg != -1) @@ -9802,7 +9802,7 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs, reg = REGNO (rtl); #ifdef LEAF_REG_REMAP - if (current_function_uses_only_leaf_regs) + if (crtl->uses_only_leaf_regs) { int leaf_reg = LEAF_REG_REMAP (reg); if (leaf_reg != -1) diff --git a/gcc/final.c b/gcc/final.c index 78e9620c4fd..5326018d0bf 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1653,7 +1653,7 @@ final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file, dwarf2out_begin_prologue (0, NULL); #ifdef LEAF_REG_REMAP - if (current_function_uses_only_leaf_regs) + if (crtl->uses_only_leaf_regs) leaf_renumber_regs (first); #endif diff --git a/gcc/function.c b/gcc/function.c index 41305c8518b..518d52401c5 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -92,22 +92,6 @@ along with GCC; see the file COPYING3. If not see alignment. */ #define CEIL_ROUND(VALUE,ALIGN) (((VALUE) + (ALIGN) - 1) & ~((ALIGN)- 1)) -/* Nonzero if function being compiled doesn't contain any calls - (ignoring the prologue and epilogue). This is set prior to - local register allocation and is valid for the remaining - compiler passes. */ -int current_function_is_leaf; - -/* Nonzero if function being compiled doesn't modify the stack pointer - (ignoring the prologue and epilogue). This is only valid after - pass_stack_ptr_mod has run. */ -int current_function_sp_is_unchanging; - -/* Nonzero if the function being compiled is a leaf function which only - uses leaf registers. This is valid after reload (specifically after - sched2) and is useful only if the port defines LEAF_REGISTERS. */ -int current_function_uses_only_leaf_regs; - /* Nonzero once virtual register instantiation has been done. assign_stack_local uses frame_pointer_rtx when this is nonzero. calls.c:emit_library_call_value_1 uses it to set up @@ -6768,7 +6752,7 @@ static unsigned int rest_of_handle_check_leaf_regs (void) { #ifdef LEAF_REGISTERS - current_function_uses_only_leaf_regs + crtl->uses_only_leaf_regs = optimize > 0 && only_leaf_regs_used () && leaf_function_p (); #endif return 0; diff --git a/gcc/function.h b/gcc/function.h index 1c471d24071..58f38bd1c2b 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -440,6 +440,22 @@ struct GTY(()) rtl_data { /* True if we performed shrink-wrapping for the current function. */ bool shrink_wrapped; + /* Nonzero if function being compiled doesn't modify the stack pointer + (ignoring the prologue and epilogue). This is only valid after + pass_stack_ptr_mod has run. */ + bool sp_is_unchanging; + + /* Nonzero if function being compiled doesn't contain any calls + (ignoring the prologue and epilogue). This is set prior to + local register allocation and is valid for the remaining + compiler passes. */ + bool is_leaf; + + /* Nonzero if the function being compiled is a leaf function which only + uses leaf registers. This is valid after reload (specifically after + sched2) and is useful only if the port defines LEAF_REGISTERS. */ + bool uses_only_leaf_regs; + /* Like regs_ever_live, but 1 if a reg is set or clobbered from an asm. Unlike regs_ever_live, elements of this array corresponding to eliminable regs (like the frame pointer) are set if an asm diff --git a/gcc/ira.c b/gcc/ira.c index d477ec95803..43fb6084ca6 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -4175,7 +4175,7 @@ ira (FILE *f) /* Determine if the current function is a leaf before running IRA since this can impact optimizations done by the prologue and epilogue thus changing register elimination offsets. */ - current_function_is_leaf = leaf_function_p (); + crtl->is_leaf = leaf_function_p (); if (resize_reg_info () && flag_ira_loop_pressure) ira_set_pseudo_classes (ira_dump_file); diff --git a/gcc/output.h b/gcc/output.h index dfd6e548c2c..4a811633a44 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -1,5 +1,5 @@ -/* Declarations for insn-output.c. These functions are defined in recog.c, - final.c, and varasm.c. +/* Declarations for insn-output.c and other code to write to asm_out_file. + These functions are defined in final.c, and varasm.c. Copyright (C) 1987, 1991, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. @@ -325,25 +325,6 @@ extern const char *first_global_object_name; /* The first weak object in the file. */ extern const char *weak_global_object_name; -/* Nonzero if function being compiled doesn't contain any calls - (ignoring the prologue and epilogue). This is set prior to - local register allocation and is valid for the remaining - compiler passes. */ - -extern int current_function_is_leaf; - -/* Nonzero if function being compiled doesn't modify the stack pointer - (ignoring the prologue and epilogue). This is only valid after - pass_stack_ptr_mod has run. */ - -extern int current_function_sp_is_unchanging; - -/* Nonzero if the function being compiled is a leaf function which only - uses leaf registers. This is valid after reload (specifically after - sched2) and is useful only if the port defines LEAF_REGISTERS. */ - -extern int current_function_uses_only_leaf_regs; - /* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */ extern rtx current_insn_predicate; diff --git a/gcc/regrename.c b/gcc/regrename.c index de39e9052e7..7b71eb15280 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -323,7 +323,7 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg, #ifdef LEAF_REGISTERS /* We can't use a non-leaf register if we're in a leaf function. */ - || (current_function_is_leaf + || (crtl->is_leaf && !LEAF_REGISTERS[new_reg + i]) #endif #ifdef HARD_REGNO_RENAME_OK diff --git a/gcc/reorg.c b/gcc/reorg.c index e99fe02bd05..f4bd8685e45 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -127,7 +127,6 @@ along with GCC; see the file COPYING3. If not see #include "regs.h" #include "recog.h" #include "flags.h" -#include "output.h" #include "obstack.h" #include "insn-attr.h" #include "resource.h" @@ -2434,7 +2433,7 @@ fill_simple_delay_slots (int non_jumps_p) SET_HARD_REG_BIT (needed.regs, HARD_FRAME_POINTER_REGNUM); #endif if (! EXIT_IGNORE_STACK - || current_function_sp_is_unchanging) + || crtl->sp_is_unchanging) SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM); } else diff --git a/gcc/resource.c b/gcc/resource.c index e5fa91f778e..c47e1ab3bc0 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -1166,7 +1166,7 @@ init_resource_info (rtx epilogue_insn) if (!(frame_pointer_needed && EXIT_IGNORE_STACK && epilogue_insn - && !current_function_sp_is_unchanging)) + && !crtl->sp_is_unchanging)) SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM); if (crtl->return_rtx != 0) diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 6f24933d8df..59892ba4a20 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -741,7 +741,7 @@ sdbout_symbol (tree decl, int local) SET_DECL_RTL (decl, eliminate_regs (DECL_RTL (decl), VOIDmode, NULL_RTX)); #ifdef LEAF_REG_REMAP - if (current_function_uses_only_leaf_regs) + if (crtl->uses_only_leaf_regs) leaf_renumber_regs_insn (DECL_RTL (decl)); #endif value = DECL_RTL (decl); diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index cfecd6bc148..1052920be98 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -43,7 +43,6 @@ along with GCC; see the file COPYING3. If not see #include "vec.h" #include "langhooks.h" #include "rtlhooks-def.h" -#include "output.h" #include "emit-rtl.h" #ifdef INSN_SCHEDULING @@ -1140,7 +1139,7 @@ init_regs_for_mode (enum machine_mode mode) #ifdef LEAF_REGISTERS /* We can't use a non-leaf register if we're in a leaf function. */ - || (current_function_is_leaf + || (crtl->is_leaf && !LEAF_REGISTERS[cur_reg + i]) #endif ) diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c index e7d92a5e7b9..1b339cd45fa 100644 --- a/gcc/stack-ptr-mod.c +++ b/gcc/stack-ptr-mod.c @@ -46,7 +46,7 @@ notice_stack_pointer_modification_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, || (MEM_P (x) && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == RTX_AUTOINC && XEXP (XEXP (x, 0), 0) == stack_pointer_rtx)) - current_function_sp_is_unchanging = 0; + crtl->sp_is_unchanging = 0; } static void @@ -57,8 +57,8 @@ notice_stack_pointer_modification (void) /* Assume that the stack pointer is unchanging if alloca hasn't been used. */ - current_function_sp_is_unchanging = !cfun->calls_alloca; - if (current_function_sp_is_unchanging) + crtl->sp_is_unchanging = !cfun->calls_alloca; + if (crtl->sp_is_unchanging) FOR_EACH_BB (bb) FOR_BB_INSNS (bb, insn) { @@ -68,7 +68,7 @@ notice_stack_pointer_modification (void) note_stores (PATTERN (insn), notice_stack_pointer_modification_1, NULL); - if (! current_function_sp_is_unchanging) + if (! crtl->sp_is_unchanging) return; } } @@ -76,7 +76,7 @@ notice_stack_pointer_modification (void) /* The value coming into this pass was 0, and the exit block uses are based on this. If the value is now 1, we need to redo the exit block uses. */ - if (df && current_function_sp_is_unchanging) + if (df && crtl->sp_is_unchanging) df_update_exit_block_uses (); } |