(current_function_profile): New.
doc/extend.texi: Update documentation.
* final.c (final_start_function): Use current_function_profile
instead of profile_flag.
(profile_after_prologue): Likewise.
* function.c (expand_function_start): Likewise.
(expand_function_start): Likewise.
* config/alpha/alpha.c (direct_call_operand):
(alpha_does_function_need_gp): Likewise.
(alpha_expand_prologue): Likewise.
* config/arm/arm.c (arm_expand_prologue): Likewise.
thumb_expand_prologue: Likewise.
* config/d30v/d30v.c (d30v_stack_info): Likewise.
* config/fr30/fr30.c (MUST_SAVE_RETURN_POINTER): Likewise.
(fr30_expand_prologue): Likewise.
* config/i386/cygwin.h (SUBTARGET_PROLOGUE): Likewise.
* config/i386/i386.c (ix86_osf_output_function_prologue): Likewise.
* config/i386/i386.h (FINALIZE_PIC): Likewise.
* config/i386/win32.h (SUBTARGET_PROLOGUE): Likewise.
* config/i960/i960.c (i960_output_function_prologue): Likewise.
* config/ia64/ia64.c (ia64_compute_frame_size): Likewise.
* config/m32r/m32r.c (MUST_SAVE_RETURN_ADDR): Likewise.
(m32r_expand_prologue): Likewise.
* config/m88k/m88k.c (m88k_layout_frame): Likewise.
(m88k_expand_prologue): Likewise.
* config/m88k/m88k.h (ADJUST_INSN_LENGTH): Likewise.
* config/mips/mips.c (compute_frame_size): Likewise.
(mips_expand_prologue): Likewise.
(mips_can_use_return_insn): Likewise.
* config/pa/elf.h (ASM_FILE_START): Likewise.
* config/pa/pa-linux.h (ASM_FILE_START): Likewise.
* config/pa/pa64-hpux.h (ASM_FILE_START): Likewise.
* config/pa/som.h (ASM_FILE_START): Likewise.
* config/romp/romp.c (romp_using_r14): Likewise.
* config/rs6000/rs6000.c (first_reg_to_save): Likewise.
(rs6000_stack_info): Likewise.
* config/rs6000/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
* config/rs6000/xcoff.h (toc_section): Likewise.
* config/v850/v850.c (compute_register_save_size): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48515
138bc75d-0d04-0410-961f-
82ee72b054a4
+2002-01-03 William Cohen <wcohen@redhat.com>
+
+ * function.h (struct function): Add profile.
+ (current_function_profile): New.
+ doc/extend.texi: Update documentation.
+ * final.c (final_start_function): Use current_function_profile
+ instead of profile_flag.
+ (profile_after_prologue): Likewise.
+ * function.c (expand_function_start): Likewise.
+ (expand_function_start): Likewise.
+ * config/alpha/alpha.c (direct_call_operand):
+ (alpha_does_function_need_gp): Likewise.
+ (alpha_expand_prologue): Likewise.
+ * config/arm/arm.c (arm_expand_prologue): Likewise.
+ thumb_expand_prologue: Likewise.
+ * config/d30v/d30v.c (d30v_stack_info): Likewise.
+ * config/fr30/fr30.c (MUST_SAVE_RETURN_POINTER): Likewise.
+ (fr30_expand_prologue): Likewise.
+ * config/i386/cygwin.h (SUBTARGET_PROLOGUE): Likewise.
+ * config/i386/i386.c (ix86_osf_output_function_prologue): Likewise.
+ * config/i386/i386.h (FINALIZE_PIC): Likewise.
+ * config/i386/win32.h (SUBTARGET_PROLOGUE): Likewise.
+ * config/i960/i960.c (i960_output_function_prologue): Likewise.
+ * config/ia64/ia64.c (ia64_compute_frame_size): Likewise.
+ * config/m32r/m32r.c (MUST_SAVE_RETURN_ADDR): Likewise.
+ (m32r_expand_prologue): Likewise.
+ * config/m88k/m88k.c (m88k_layout_frame): Likewise.
+ (m88k_expand_prologue): Likewise.
+ * config/m88k/m88k.h (ADJUST_INSN_LENGTH): Likewise.
+ * config/mips/mips.c (compute_frame_size): Likewise.
+ (mips_expand_prologue): Likewise.
+ (mips_can_use_return_insn): Likewise.
+ * config/pa/elf.h (ASM_FILE_START): Likewise.
+ * config/pa/pa-linux.h (ASM_FILE_START): Likewise.
+ * config/pa/pa64-hpux.h (ASM_FILE_START): Likewise.
+ * config/pa/som.h (ASM_FILE_START): Likewise.
+ * config/romp/romp.c (romp_using_r14): Likewise.
+ * config/rs6000/rs6000.c (first_reg_to_save): Likewise.
+ (rs6000_stack_info): Likewise.
+ * config/rs6000/sysv4.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
+ * config/rs6000/xcoff.h (toc_section): Likewise.
+ * config/v850/v850.c (compute_register_save_size): Likewise.
+
2002-01-03 Jakub Jelinek <jakub@redhat.com>
* simplify-rtx.c (simplify_binary_operation) [DIV]: If
but is approximately correct for the OSF ABIs. Don't know
what to do for VMS, NT, or UMK. */
if (! TARGET_PROFILING_NEEDS_GP
- && ! profile_flag)
+ && ! current_function_profile)
return 0;
return 1;
if (! TARGET_ABI_OSF)
return 0;
- if (TARGET_PROFILING_NEEDS_GP && profile_flag)
+ if (TARGET_PROFILING_NEEDS_GP && current_function_profile)
return 1;
#ifdef ASM_OUTPUT_MI_THUNK
the call to mcount ourselves, rather than having the linker do it
magically in response to -pg. Since _mcount has special linkage,
don't represent the call as a call. */
- if (TARGET_PROFILING_NEEDS_GP && profile_flag)
+ if (TARGET_PROFILING_NEEDS_GP && current_function_profile)
emit_insn (gen_prologue_mcount ());
if (TARGET_ABI_UNICOSMK)
/* If we are profiling, make sure no instructions are scheduled before
the call to mcount. Similarly if the user has requested no
scheduling in the prolog. */
- if (profile_flag || TARGET_NO_SCHED_PRO)
+ if (current_function_profile || TARGET_NO_SCHED_PRO)
emit_insn (gen_blockage ());
/* If the link register is being kept alive, with the return address in it,
}
}
- if (profile_flag || TARGET_NO_SCHED_PRO)
+ if (current_function_profile || TARGET_NO_SCHED_PRO)
emit_insn (gen_blockage ());
}
the stack adjustment will not be deleted. */
emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
- if (profile_flag || TARGET_NO_SCHED_PRO)
+ if (current_function_profile || TARGET_NO_SCHED_PRO)
emit_insn (gen_blockage ());
}
/* Zero all fields */
info = zero_info;
- if (profile_flag)
+ if (current_function_profile)
regs_ever_live[GPR_LINK] = 1;
/* Determine if this is a stdarg function */
&& ! call_used_regs [regno] )
#define MUST_SAVE_FRAME_POINTER (regs_ever_live [FRAME_POINTER_REGNUM] || frame_pointer_needed)
-#define MUST_SAVE_RETURN_POINTER (regs_ever_live [RETURN_POINTER_REGNUM] || profile_flag)
+#define MUST_SAVE_RETURN_POINTER (regs_ever_live [RETURN_POINTER_REGNUM] || current_function_profile)
#if UNITS_PER_WORD == 4
#define WORD_ALIGN(SIZE) (((SIZE) + 3) & ~3)
RTX_FRAME_RELATED_P (insn) = 1;
}
- if (profile_flag)
+ if (current_function_profile)
emit_insn (gen_blockage ());
}
#define NO_IMPLICIT_EXTERN_C
#define SUBTARGET_PROLOGUE \
- if (profile_flag \
+ if (current_function_profile \
&& MAIN_NAME_P (DECL_NAME (current_function_decl))) \
{ \
emit_call_insn (gen_rtx (CALL, VOIDmode, \
if (TARGET_UNDERSCORES)
prefix = "_";
- if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)
+ if (current_function_profile && OSF_PROFILE_BEFORE_PROLOGUE)
{
if (!flag_pic && !HALF_PIC_P ())
{
#else /* !OSF_OS */
- if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)
+ if (current_function_profile && OSF_PROFILE_BEFORE_PROLOGUE)
{
if (!flag_pic)
{
/* If we are profiling, make sure no instructions are scheduled before
the call to mcount. However, if -fpic, the above call will have
done that. */
- if (profile_flag && ! pic_reg_used)
+ if (current_function_profile && ! pic_reg_used)
emit_insn (gen_blockage ());
}
#define FINALIZE_PIC \
do \
{ \
- current_function_uses_pic_offset_table |= profile_flag; \
+ current_function_uses_pic_offset_table |= current_function_profile; \
} \
while (0)
#define NO_IMPLICIT_EXTERN_C
#define SUBTARGET_PROLOGUE \
- if (profile_flag \
+ if (current_function_profile \
&& MAIN_NAME_P (DECL_NAME (current_function_decl)) \
{ \
rtx xops[1]; \
epilogue_string[0] = '\0';
- if (profile_flag)
+ if (current_function_profile)
{
/* When profiling, we may use registers 20 to 27 to save arguments, so
they can't be used here for saving globals. J is the number of
Likwise for -a profiling for the bb_init_func argument. For -ax
profiling, we need two output registers for the two bb_init_trace_func
arguments. */
- if (profile_flag)
+ if (current_function_profile)
i = MAX (i, 1);
current_frame_info.n_output_regs = i;
&& (regs_ever_live[regno] && (!call_used_regs[regno] || interrupt_p)))
#define MUST_SAVE_FRAME_POINTER (regs_ever_live[FRAME_POINTER_REGNUM])
-#define MUST_SAVE_RETURN_ADDR (regs_ever_live[RETURN_ADDR_REGNUM] || profile_flag)
+#define MUST_SAVE_RETURN_ADDR (regs_ever_live[RETURN_ADDR_REGNUM] || current_function_profile)
#define SHORT_INSN_SIZE 2 /* size of small instructions */
#define LONG_INSN_SIZE 4 /* size of long instructions */
if (frame_pointer_needed)
emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
- if (profile_flag)
+ if (current_function_profile)
emit_insn (gen_blockage ());
}
frame_size = get_frame_size ();
/* Since profiling requires a call, make sure r1 is saved. */
- if (profile_flag)
+ if (current_function_profile)
save_regs[1] = 1;
/* If we are producing debug information, store r1 and r30 where the
if (! save_regs[1])
emit_move_insn (return_reg, temp_reg);
}
- if (profile_flag)
+ if (current_function_profile)
emit_insn (gen_blockage ());
}
\f
else if (GET_CODE (RTX) == NOTE \
&& NOTE_LINE_NUMBER (RTX) == NOTE_INSN_PROLOGUE_END) \
{ \
- if (profile_flag) \
+ if (current_function_profile) \
LENGTH += (FUNCTION_PROFILER_LENGTH + REG_PUSH_LENGTH \
+ REG_POP_LENGTH); \
} \
call to mcount. */
if (total_size == extra_size
&& (mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI)
- && ! profile_flag)
+ && ! current_function_profile)
total_size = extra_size = 0;
else if (TARGET_ABICALLS)
{
/* If we are profiling, make sure no instructions are scheduled before
the call to mcount. */
- if (profile_flag)
+ if (current_function_profile)
emit_insn (gen_blockage ());
}
\f
if (! reload_completed)
return 0;
- if (regs_ever_live[31] || profile_flag)
+ if (regs_ever_live[31] || current_function_profile)
return 0;
/* In mips16 mode, a function which returns a floating point value
fputs("\t.LEVEL 1.1\n", FILE); \
else \
fputs("\t.LEVEL 1.0\n", FILE); \
- if (profile_flag)\
+ if (current_function_profile)\
fprintf (FILE, "\t.IMPORT _mcount, ENTRY\n");\
if (write_symbols != NO_DEBUG) \
output_file_directive ((FILE), main_input_filename); \
fputs("\t.LEVEL 1.1\n", FILE); \
else \
fputs("\t.LEVEL 1.0\n", FILE); \
- if (profile_flag) \
+ if (current_function_profile) \
fputs ("\t.IMPORT _mcount, CODE\n", FILE); \
} \
while (0)
fputs("\t.LEVEL 1.1\n", FILE); \
else \
fputs("\t.LEVEL 1.0\n", FILE); \
- if (profile_flag)\
+ if (current_function_profile)\
fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
if (write_symbols != NO_DEBUG) \
output_file_directive ((FILE), main_input_filename); \
\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n\
\t.IMPORT $global$,DATA\n\
\t.IMPORT $$dyncall,MILLICODE\n", FILE);\
- if (profile_flag)\
+ if (current_function_profile)\
fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
if (write_symbols != NO_DEBUG) \
output_file_directive ((FILE), main_input_filename); \
{
/* If we are debugging, profiling, have a non-empty constant pool, or
call a function, we need r14. */
- return (write_symbols != NO_DEBUG || profile_flag || get_pool_size () != 0
- || romp_makes_calls ());
+ return (write_symbols != NO_DEBUG || current_function_profile
+ || get_pool_size () != 0 || romp_makes_calls ());
}
/* Return non-zero if this function needs to push space on the stack. */
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic)))))
break;
- if (profile_flag)
+ if (current_function_profile)
{
/* AIX must save/restore every register that contains a parameter
before/after the .__mcount call plus an additional register
/* Determine if we need to save the link register. */
if (rs6000_ra_ever_killed ()
- || (DEFAULT_ABI == ABI_AIX && profile_flag)
+ || (DEFAULT_ABI == ABI_AIX && current_function_profile)
#ifdef TARGET_RELOCATABLE
|| (TARGET_RELOCATABLE && (get_pool_size () != 0))
#endif
do { \
const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
\
- if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag) \
+ if (TARGET_RELOCATABLE \
+ && (get_pool_size () != 0 || current_function_profile) \
&& uses_TOC()) \
{ \
char buf[256]; \
if (write_symbols != NO_DEBUG) \
private_data_section (); \
text_section (); \
- if (profile_flag) \
+ if (current_function_profile) \
fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT); \
rs6000_file_start (FILE, TARGET_CPU_DEFAULT); \
}
long reg_saved = 0;
/* Count the return pointer if we need to save it. */
- if (profile_flag && !call_p)
+ if (current_function_profile && !call_p)
regs_ever_live [LINK_POINTER_REGNUM] = call_p = 1;
/* Count space for the register saves. */
/* The Sun386i and perhaps other machines don't work right
if the profiling code comes after the prologue. */
#ifdef PROFILE_BEFORE_PROLOGUE
- if (profile_flag)
+ if (current_function_profile)
profile_function (file);
#endif /* PROFILE_BEFORE_PROLOGUE */
FILE *file ATTRIBUTE_UNUSED;
{
#ifndef PROFILE_BEFORE_PROLOGUE
- if (profile_flag)
+ if (current_function_profile)
profile_function (file);
#endif /* not PROFILE_BEFORE_PROLOGUE */
}
rtx insn;
rtx link;
- if (profile_flag || profile_arc_flag)
+ if (current_function_profile || profile_arc_flag)
return 0;
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
= (flag_instrument_function_entry_exit
&& ! DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (subr));
+ current_function_profile
+ = (profile_flag
+ && ! DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (subr));
+
current_function_limit_stack
= (stack_limit_rtx != NULL_RTX && ! DECL_NO_LIMIT_STACK (subr));
}
#ifdef PROFILE_HOOK
- if (profile_flag)
+ if (current_function_profile)
PROFILE_HOOK (profile_label_no);
#endif
generated. */
unsigned int instrument_entry_exit : 1;
+ /* Nonzero if profiling code should be generated. */
+ unsigned int profile : 1;
+
/* Nonzero if stack limit checking should be enabled in the current
function. */
unsigned int limit_stack : 1;
#define current_function_internal_arg_pointer (cfun->internal_arg_pointer)
#define current_function_return_rtx (cfun->return_rtx)
#define current_function_instrument_entry_exit (cfun->instrument_entry_exit)
+#define current_function_profile (cfun->profile)
#define current_function_limit_stack (cfun->limit_stack)
#define current_function_uses_pic_offset_table (cfun->uses_pic_offset_table)
#define current_function_uses_const_pool (cfun->uses_const_pool)