+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.
* 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.
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. */
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
gcc_assert (frame_pointer_needed
|| !isr_p
- || !current_function_is_leaf);
+ || !crtl->is_leaf);
fp = my_fp = (frame_pointer_needed
? frame_pointer_rtx
gcc_assert (frame_pointer_needed
|| !isr_p
- || !current_function_is_leaf);
+ || !crtl->is_leaf);
fp = my_fp = (frame_pointer_needed
? frame_pointer_rtx
|| (!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])
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
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)))
/* 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;
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;
{
/* Increment once for ASTAT. */
n++;
- if (! current_function_is_leaf
+ if (! crtl->is_leaf
|| cfun->machine->has_hardware_loops
|| cfun->machine->has_loopreg_clobber)
{
&& 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);
/* 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);
/* 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);
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);
}
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;
}
&& !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 ()));
}
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;
/* 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;
bool
cris_frame_pointer_required (void)
{
- return !current_function_sp_is_unchanging;
+ return !crtl->sp_is_unchanging;
}
/* Implement TARGET_ASM_TRAMPOLINE_TEMPLATE.
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)))
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;
/* 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. */
/* 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)
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)
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
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;
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)
{
/* 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;
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;
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;
/* 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;
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;
= (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));
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
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);
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;
/* 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)
}
}
- 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
/* 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;
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. */
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
break;
case STACK_POINTER_REGNUM:
- if (current_function_is_leaf)
+ if (crtl->is_leaf)
offset = 0;
else
offset = 16 + crtl->outgoing_args_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;
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;
}
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. */
#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
|| (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])
{
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);
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;
/* 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;
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 +
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,
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,
/* 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]
/* 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;
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
/* 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. */
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);
}
/* 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. */
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) &&
{
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");
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);
}
- 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. */
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. */
/* 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];
&& 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
|| 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
= 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
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);
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
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)
? 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,
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)))
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
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);
/* 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;
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;
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.
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);
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);
{
/* 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);
}
{
/* 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. */
{
/* 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;
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
? 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"
"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;
+ get_frame_size ()
+ crtl->outgoing_args_size
+ crtl->args.pretend_args_size == 0)
- && current_function_is_leaf)
+ && crtl->is_leaf)
return 1;
}
return 0;
+ 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;
+ 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;
}
}
- if (!current_function_is_leaf)
+ if (!crtl->is_leaf)
frame_emit_load (LINK_REGISTER_REGNUM, sp_reg, 16);
if (!sibcall_p)
{
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)
((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. */
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;
}
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;
}
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
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));
#include "recog.h"
#include "function.h"
#include "regs.h"
-#include "output.h"
#include "alloc-pool.h"
#include "flags.h"
#include "hard-reg-set.h"
/* 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);
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)
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)
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
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
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;
/* 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
/* 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);
-/* 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.
/* 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;
#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
#include "regs.h"
#include "recog.h"
#include "flags.h"
-#include "output.h"
#include "obstack.h"
#include "insn-attr.h"
#include "resource.h"
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
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)
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);
#include "vec.h"
#include "langhooks.h"
#include "rtlhooks-def.h"
-#include "output.h"
#include "emit-rtl.h"
#ifdef INSN_SCHEDULING
#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
)
|| (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
/* 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)
{
note_stores (PATTERN (insn),
notice_stack_pointer_modification_1,
NULL);
- if (! current_function_sp_is_unchanging)
+ if (! crtl->sp_is_unchanging)
return;
}
}
/* 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 ();
}