OSDN Git Service

* function.h (struct function): Add profile.
authorwcohen <wcohen@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Jan 2002 17:40:07 +0000 (17:40 +0000)
committerwcohen <wcohen@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Jan 2002 17:40:07 +0000 (17:40 +0000)
(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

27 files changed:
gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/arm/arm.c
gcc/config/d30v/d30v.c
gcc/config/fr30/fr30.c
gcc/config/i386/cygwin.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i386/win32.h
gcc/config/i960/i960.c
gcc/config/ia64/ia64.c
gcc/config/m32r/m32r.c
gcc/config/m88k/m88k.c
gcc/config/m88k/m88k.h
gcc/config/mips/mips.c
gcc/config/pa/elf.h
gcc/config/pa/pa-linux.h
gcc/config/pa/pa64-hpux.h
gcc/config/pa/som.h
gcc/config/romp/romp.c
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/xcoff.h
gcc/config/v850/v850.c
gcc/final.c
gcc/function.c
gcc/function.h

index ded183f..b1f202d 100644 (file)
@@ -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
index f3295f0..dee844b 100644 (file)
@@ -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)
index d4a81f3..275eaa0 100644 (file)
@@ -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 ());
 }
 
index f359d3d..4bfd4bb 100644 (file)
@@ -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 */
index c386297..e804cd9 100644 (file)
@@ -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 ());
 }
 
index 7517c1c..c3197f6 100644 (file)
@@ -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,                                 \
index a72bef2..ff47fa3 100644 (file)
@@ -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 ());
 }
 
index 41112b8..b157e9d 100644 (file)
@@ -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)
 
index 86011fb..0aa7a57 100644 (file)
@@ -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];                                                     \
index 67fef75..6f29fdc 100644 (file)
@@ -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
index 414b803..f3bbb8f 100644 (file)
@@ -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;
 
index 2b1dc75..a3692c9 100644 (file)
@@ -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 ());
 }
 
index 467d447..5115c0c 100644 (file)
@@ -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 ());
 }
 \f
index 590116b..34e089c 100644 (file)
@@ -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);                                   \
     }                                                                  \
index e433488..83df738 100644 (file)
@@ -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 ());
 }
 \f
@@ -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
index db2f20f..89ca5e6 100644 (file)
@@ -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); \
index 49e167c..5367fda 100644 (file)
@@ -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)
index 6445c9a..ec52b43 100644 (file)
@@ -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); \
index e6ac6fb..53c59e1 100644 (file)
@@ -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); \
index 9a5022a..7f984e8 100644 (file)
@@ -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.  */
index c244552..618d3d2 100644 (file)
@@ -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
index 7715b08..c20eaa0 100644 (file)
@@ -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];                                                  \
index e60f3fe..2b3f5b9 100644 (file)
@@ -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);                        \
 }
index 3c9ac92..76872ed 100644 (file)
@@ -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.  */
index 60ed609..ec3b1c7 100644 (file)
@@ -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))
index 097aea4..86d7797 100644 (file)
@@ -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
 
index 61bd095..5cc0948 100644 (file)
@@ -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)