summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwcohen <wcohen@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-03 17:40:07 +0000
committerwcohen <wcohen@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-03 17:40:07 +0000
commit7811c823909c58997876bcf82828b9972f3aa75c (patch)
tree037dbfa797702a60300fe2a9d76f987daacf4080
parent89558e8804fada5635e277c3f721f3430e285974 (diff)
downloadgcc-7811c823909c58997876bcf82828b9972f3aa75c.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48515 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog43
-rw-r--r--gcc/config/alpha/alpha.c6
-rw-r--r--gcc/config/arm/arm.c6
-rw-r--r--gcc/config/d30v/d30v.c2
-rw-r--r--gcc/config/fr30/fr30.c4
-rw-r--r--gcc/config/i386/cygwin.h2
-rw-r--r--gcc/config/i386/i386.c6
-rw-r--r--gcc/config/i386/i386.h2
-rw-r--r--gcc/config/i386/win32.h2
-rw-r--r--gcc/config/i960/i960.c2
-rw-r--r--gcc/config/ia64/ia64.c2
-rw-r--r--gcc/config/m32r/m32r.c4
-rw-r--r--gcc/config/m88k/m88k.c4
-rw-r--r--gcc/config/m88k/m88k.h2
-rw-r--r--gcc/config/mips/mips.c6
-rw-r--r--gcc/config/pa/elf.h2
-rw-r--r--gcc/config/pa/pa-linux.h2
-rw-r--r--gcc/config/pa/pa64-hpux.h2
-rw-r--r--gcc/config/pa/som.h2
-rw-r--r--gcc/config/romp/romp.c4
-rw-r--r--gcc/config/rs6000/rs6000.c4
-rw-r--r--gcc/config/rs6000/sysv4.h3
-rw-r--r--gcc/config/rs6000/xcoff.h2
-rw-r--r--gcc/config/v850/v850.c2
-rw-r--r--gcc/final.c6
-rw-r--r--gcc/function.c6
-rw-r--r--gcc/function.h4
27 files changed, 92 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ded183f2d0e..b1f202de947 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,46 @@
+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
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index f3295f0becd..dee844bb6d8 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -891,7 +891,7 @@ direct_call_operand (op, mode)
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;
@@ -5850,7 +5850,7 @@ alpha_does_function_need_gp ()
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
@@ -5995,7 +5995,7 @@ alpha_expand_prologue ()
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)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index d4a81f3d170..275eaa0575e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -8329,7 +8329,7 @@ arm_expand_prologue ()
/* 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,
@@ -10122,7 +10122,7 @@ thumb_expand_prologue ()
}
}
- if (profile_flag || TARGET_NO_SCHED_PRO)
+ if (current_function_profile || TARGET_NO_SCHED_PRO)
emit_insn (gen_blockage ());
}
@@ -10159,7 +10159,7 @@ thumb_expand_epilogue ()
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 ());
}
diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c
index f359d3d71c0..4bfd4bb9976 100644
--- a/gcc/config/d30v/d30v.c
+++ b/gcc/config/d30v/d30v.c
@@ -1714,7 +1714,7 @@ d30v_stack_info ()
/* 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 */
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index c386297a646..e804cd9dab2 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -134,7 +134,7 @@ static rtx fr30_pass_by_value PARAMS ((tree, tree));
&& ! 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)
@@ -334,7 +334,7 @@ fr30_expand_prologue ()
RTX_FRAME_RELATED_P (insn) = 1;
}
- if (profile_flag)
+ if (current_function_profile)
emit_insn (gen_blockage ());
}
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 7517c1cf7e3..c3197f60307 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -427,7 +427,7 @@ extern void i386_pe_unique_section PARAMS ((TREE, int));
#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, \
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a72bef28112..ff47fa37e2c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1329,7 +1329,7 @@ ix86_osf_output_function_prologue (file, size)
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 ())
{
@@ -1369,7 +1369,7 @@ ix86_osf_output_function_prologue (file, size)
#else /* !OSF_OS */
- if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)
+ if (current_function_profile && OSF_PROFILE_BEFORE_PROLOGUE)
{
if (!flag_pic)
{
@@ -4156,7 +4156,7 @@ ix86_expand_prologue ()
/* 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 ());
}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 41112b8b90b..b157e9d68c2 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2283,7 +2283,7 @@ while (0)
#define FINALIZE_PIC \
do \
{ \
- current_function_uses_pic_offset_table |= profile_flag; \
+ current_function_uses_pic_offset_table |= current_function_profile; \
} \
while (0)
diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h
index 86011fb6df5..0aa7a5794c4 100644
--- a/gcc/config/i386/win32.h
+++ b/gcc/config/i386/win32.h
@@ -205,7 +205,7 @@ extern void i386_pe_unique_section ();
#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]; \
diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c
index 67fef75daa0..6f29fdceea0 100644
--- a/gcc/config/i960/i960.c
+++ b/gcc/config/i960/i960.c
@@ -1311,7 +1311,7 @@ i960_output_function_prologue (file, size)
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
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 414b803cbda..f3bbb8f670a 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -1455,7 +1455,7 @@ ia64_compute_frame_size (size)
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;
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 2b1dc75d333..a3692c9af5c 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -1864,7 +1864,7 @@ static struct m32r_frame_info zero_frame_info;
&& (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 */
@@ -2018,7 +2018,7 @@ m32r_expand_prologue ()
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 ());
}
diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c
index 467d447f25c..5115c0c6e7b 100644
--- a/gcc/config/m88k/m88k.c
+++ b/gcc/config/m88k/m88k.c
@@ -1828,7 +1828,7 @@ m88k_layout_frame ()
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
@@ -2039,7 +2039,7 @@ m88k_expand_prologue ()
if (! save_regs[1])
emit_move_insn (return_reg, temp_reg);
}
- if (profile_flag)
+ if (current_function_profile)
emit_insn (gen_blockage ());
}
diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h
index 590116bd241..34e089c2c19 100644
--- a/gcc/config/m88k/m88k.h
+++ b/gcc/config/m88k/m88k.h
@@ -1555,7 +1555,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
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); \
} \
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index e433488e6c2..83df73878f5 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -6465,7 +6465,7 @@ compute_frame_size (size)
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)
{
@@ -7505,7 +7505,7 @@ mips_expand_prologue ()
/* 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 ());
}
@@ -7739,7 +7739,7 @@ mips_can_use_return_insn ()
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
diff --git a/gcc/config/pa/elf.h b/gcc/config/pa/elf.h
index db2f20fe969..89ca5e69f9b 100644
--- a/gcc/config/pa/elf.h
+++ b/gcc/config/pa/elf.h
@@ -41,7 +41,7 @@ do { \
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); \
diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h
index 49e167cf824..5367fdab6ae 100644
--- a/gcc/config/pa/pa-linux.h
+++ b/gcc/config/pa/pa-linux.h
@@ -99,7 +99,7 @@ Boston, MA 02111-1307, USA. */
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)
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index 6445c9aa27e..ec52b43d083 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -68,7 +68,7 @@ do { \
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); \
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index e6ac6fba544..53c59e17104 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -233,7 +233,7 @@ do { \
\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); \
diff --git a/gcc/config/romp/romp.c b/gcc/config/romp/romp.c
index 9a5022aa789..7f984e876d8 100644
--- a/gcc/config/romp/romp.c
+++ b/gcc/config/romp/romp.c
@@ -1059,8 +1059,8 @@ romp_using_r14 ()
{
/* 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. */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c2445522fbb..618d3d24676 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -6763,7 +6763,7 @@ first_reg_to_save ()
|| (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
@@ -7048,7 +7048,7 @@ rs6000_stack_info ()
/* 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
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 7715b082643..c20eaa0101f 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -625,7 +625,8 @@ extern int rs6000_pic_labelno;
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]; \
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index e60f3fe8282..2b3f5b9aeb2 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -307,7 +307,7 @@ toc_section () \
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); \
}
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 3c9ac92e23b..76872edd1b0 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -1392,7 +1392,7 @@ compute_register_save_size (p_reg_saved)
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. */
diff --git a/gcc/final.c b/gcc/final.c
index 60ed60960a7..ec3b1c76dd4 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1527,7 +1527,7 @@ final_start_function (first, file, optimize)
/* 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 */
@@ -1573,7 +1573,7 @@ profile_after_prologue (file)
FILE *file ATTRIBUTE_UNUSED;
{
#ifndef PROFILE_BEFORE_PROLOGUE
- if (profile_flag)
+ if (current_function_profile)
profile_function (file);
#endif /* not PROFILE_BEFORE_PROLOGUE */
}
@@ -3820,7 +3820,7 @@ leaf_function_p ()
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))
diff --git a/gcc/function.c b/gcc/function.c
index 097aea44684..86d7797f6b6 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6386,6 +6386,10 @@ expand_function_start (subr, parms_have_cleanups)
= (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));
@@ -6564,7 +6568,7 @@ expand_function_start (subr, parms_have_cleanups)
}
#ifdef PROFILE_HOOK
- if (profile_flag)
+ if (current_function_profile)
PROFILE_HOOK (profile_label_no);
#endif
diff --git a/gcc/function.h b/gcc/function.h
index 61bd0957674..5cc0948f206 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -434,6 +434,9 @@ struct function
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;
@@ -504,6 +507,7 @@ extern int virtuals_instantiated;
#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)