Patch for "no_instrument_function" attribute

Will Cohen wcohen@redhat.com
Thu Jan 3 07:48:00 GMT 2002


Richard Henderson wrote:
> 
> On Tue, Dec 18, 2001 at 11:59:40AM -0500, Will Cohen wrote:
> >       * function.h (struct function): Add profile.
> >       (current_function_profile): New.
> >       * function.c (expand_function_start): Add check to disable
> >       function profiling.
> >       * final.c (final_start_function): Check on per function basis.
> >       (profile_after_prologue): Likewise.
> >       (leaf_function_p): Likewise.
> 
> You would additionally require changes to many backends to
> make this work.  E.g. alpha.c alpha_expand_prologue:
> 
>   if (TARGET_PROFILING_NEEDS_GP && profile_flag)
>     emit_insn (gen_prologue_mcount ());
> 
> r~


I have made the associated changes in the configuration files and tested
that the compiler still bootstraps on x86 and alpha. The checks of
profile_flag remain in config/m88k/m8.c, config/rs6000/lynx.h,
config/sparc/sparc.c, and config/sparc/sparc.h because they are not
referring to a particular function. Is this patch reasonable now?

-Will
-- 
Will Cohen, GCC Engineer                         ------    ,__o
Red Hat, 2600 Meridian pkwy, Durham, NC 27713   ------   _-\_<,
Office (919)-547-0012 x390  Fax (919)-547-0024 ------   (*)/'(*)
-------------- next part --------------
I check that the patched "make bootstrap" worked on i686-pc-linux-gnu,
alphaev6-unknown-linux-gnu, and powerpc-unknown-linux-gnu.

Test results on i686-pc-linux-gnu

		=== gcc Summary ===

# of expected passes		16604
# of unexpected failures	2
# of expected failures		47
# of unsupported tests		29

FAIL: gcc.dg/20011130-1.c (test for excess errors)
FAIL: gcc.dg/c99-intconst-1.c (test for excess errors)

		=== g++ Summary ===

# of expected passes		6749
# of unexpected failures	3
# of unexpected successes	2
# of expected failures		97
# of untested testcases		9

FAIL: g++.dg/eh/omit-frame-pointer.C execution test
FAIL: g++.eh/badalloc1.C  Execution test
FAIL: g++.ext/instantiate2.C not instantiated (test for errors, line 19)

		=== g77 Summary ===

# of expected passes		1360

		=== objc Summary ===

# of expected passes		216
# of unexpected failures	2

FAIL: objc/execute/formal_protocol-6.m execution,  -O 
FAIL: unclaimed-category-1a.o

-------------------------

Test results on alphaev6-unknown-linux-gnu

		=== gcc Summary ===

# of expected passes		16542
# of unexpected failures	5
# of expected failures		47
# of unsupported tests		62

FAIL: gcc.c-torture/execute/20011008-3.c execution,  -O3 -fomit-frame-pointer 
FAIL: gcc.c-torture/execute/20011008-3.c execution,  -O3 -fomit-frame-pointer -funroll-loops 
FAIL: gcc.c-torture/execute/20011008-3.c execution,  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions 
FAIL: gcc.c-torture/execute/20011008-3.c execution,  -O3 -g 
FAIL: gcc.dg/20011130-1.c (test for excess errors)

A systematic problem with the C++ and fortran testing prevented
getting reasonable test results.


		=== objc Summary ===

# of expected passes		216
# of unexpected failures	2

FAIL: objc/execute/formal_protocol-6.m execution,  -O
FAIL: unclaimed-category-1a.o

------------------------
Test results on powerpc-unknown-linux-gnu
-------------- next part --------------
	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/linux64.h (ASM_DECLARE_FUNCTION_NAME): 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.
-------------- next part --------------
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.234
diff -c -2 -p -r1.234 final.c
*** final.c	2001/12/17 15:05:21	1.234
--- final.c	2002/01/03 14:45:24
*************** final_start_function (first, file, optim
*** 1548,1552 ****
       if the profiling code comes after the prologue.  */
  #ifdef PROFILE_BEFORE_PROLOGUE
!   if (profile_flag)
      profile_function (file);
  #endif /* PROFILE_BEFORE_PROLOGUE */
--- 1548,1552 ----
       if the profiling code comes after the prologue.  */
  #ifdef PROFILE_BEFORE_PROLOGUE
!   if (current_function_profile)
      profile_function (file);
  #endif /* PROFILE_BEFORE_PROLOGUE */
*************** profile_after_prologue (file)
*** 1594,1598 ****
  {
  #ifndef PROFILE_BEFORE_PROLOGUE
!   if (profile_flag)
      profile_function (file);
  #endif /* not PROFILE_BEFORE_PROLOGUE */
--- 1594,1598 ----
  {
  #ifndef PROFILE_BEFORE_PROLOGUE
!   if (current_function_profile)
      profile_function (file);
  #endif /* not PROFILE_BEFORE_PROLOGUE */
*************** leaf_function_p ()
*** 3840,3844 ****
    rtx link;
  
!   if (profile_flag || profile_arc_flag)
      return 0;
  
--- 3840,3844 ----
    rtx link;
  
!   if (current_function_profile || profile_arc_flag)
      return 0;
  
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.336
diff -c -2 -p -r1.336 function.c
*** function.c	2001/12/09 20:13:04	1.336
--- function.c	2002/01/03 14:45:25
*************** expand_function_start (subr, parms_have_
*** 6353,6356 ****
--- 6353,6360 ----
         && ! 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));
*************** expand_function_start (subr, parms_have_
*** 6531,6535 ****
  
  #ifdef PROFILE_HOOK
!   if (profile_flag)
      PROFILE_HOOK (profile_label_no);
  #endif
--- 6535,6539 ----
  
  #ifdef PROFILE_HOOK
!   if (current_function_profile)
      PROFILE_HOOK (profile_label_no);
  #endif
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.73
diff -c -2 -p -r1.73 function.h
*** function.h	2001/12/05 22:37:28	1.73
--- function.h	2002/01/03 14:45:25
*************** struct function
*** 435,438 ****
--- 435,441 ----
    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.  */
*************** extern int virtuals_instantiated;
*** 505,508 ****
--- 508,512 ----
  #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)
Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.215
diff -c -2 -p -r1.215 alpha.c
*** alpha.c	2001/12/17 15:05:26	1.215
--- alpha.c	2002/01/03 14:45:26
*************** direct_call_operand (op, mode)
*** 892,896 ****
       what to do for VMS, NT, or UMK.  */
    if (! TARGET_PROFILING_NEEDS_GP
!       && ! profile_flag)
      return 0;
  
--- 892,896 ----
       what to do for VMS, NT, or UMK.  */
    if (! TARGET_PROFILING_NEEDS_GP
!       && ! current_function_profile)
      return 0;
  
*************** alpha_does_function_need_gp ()
*** 5846,5850 ****
      return 0;
  
!   if (TARGET_PROFILING_NEEDS_GP && profile_flag)
      return 1;
  
--- 5846,5850 ----
      return 0;
  
!   if (TARGET_PROFILING_NEEDS_GP && current_function_profile)
      return 1;
  
*************** alpha_expand_prologue ()
*** 5991,5995 ****
       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)
      emit_insn (gen_prologue_mcount ());
  
--- 5991,5995 ----
       magically in response to -pg.  Since _mcount has special linkage,
       don't represent the call as a call.  */
!   if (TARGET_PROFILING_NEEDS_GP && current_function_profile)
      emit_insn (gen_prologue_mcount ());
  
Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.180
diff -c -2 -p -r1.180 arm.c
*** arm.c	2001/12/17 15:05:27	1.180
--- arm.c	2002/01/03 14:45:27
*************** arm_expand_prologue ()
*** 8309,8313 ****
       the call to mcount.  Similarly if the user has requested no
       scheduling in the prolog.  */
!   if (profile_flag || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
  
--- 8309,8313 ----
       the call to mcount.  Similarly if the user has requested no
       scheduling in the prolog.  */
!   if (current_function_profile || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
  
*************** thumb_expand_prologue ()
*** 10102,10106 ****
      }
    
!   if (profile_flag || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
  }
--- 10102,10106 ----
      }
    
!   if (current_function_profile || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
  }
*************** thumb_expand_epilogue ()
*** 10139,10143 ****
    emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
  
!   if (profile_flag || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
  }
--- 10139,10143 ----
    emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
  
!   if (current_function_profile || TARGET_NO_SCHED_PRO)
      emit_insn (gen_blockage ());
  }
Index: config/d30v/d30v.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/d30v/d30v.c,v
retrieving revision 1.19
diff -c -2 -p -r1.19 d30v.c
*** d30v.c	2001/12/17 15:05:28	1.19
--- d30v.c	2002/01/03 14:45:28
*************** d30v_stack_info ()
*** 1715,1719 ****
    info = zero_info;
  
!   if (profile_flag)
      regs_ever_live[GPR_LINK] = 1;
  
--- 1715,1719 ----
    info = zero_info;
  
!   if (current_function_profile)
      regs_ever_live[GPR_LINK] = 1;
  
Index: config/fr30/fr30.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/fr30/fr30.c,v
retrieving revision 1.20
diff -c -2 -p -r1.20 fr30.c
*** fr30.c	2001/12/17 15:05:32	1.20
--- fr30.c	2002/01/03 14:45:28
*************** static rtx fr30_pass_by_value PARAMS ((t
*** 135,139 ****
  
  #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)
  
  #if UNITS_PER_WORD == 4
--- 135,139 ----
  
  #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] || current_function_profile)
  
  #if UNITS_PER_WORD == 4
*************** fr30_expand_prologue ()
*** 335,339 ****
      }
  
!   if (profile_flag)
      emit_insn (gen_blockage ());
  }
--- 335,339 ----
      }
  
!   if (current_function_profile)
      emit_insn (gen_blockage ());
  }
Index: config/i386/cygwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/cygwin.h,v
retrieving revision 1.60
diff -c -2 -p -r1.60 cygwin.h
*** cygwin.h	2001/12/14 23:38:18	1.60
--- cygwin.h	2002/01/03 14:45:28
*************** extern void i386_pe_unique_section PARAM
*** 428,432 ****
  
  #define SUBTARGET_PROLOGUE						\
!   if (profile_flag 							\
        && MAIN_NAME_P (DECL_NAME (current_function_decl)))		\
       {									\
--- 428,432 ----
  
  #define SUBTARGET_PROLOGUE						\
!   if (current_function_profile						\
        && MAIN_NAME_P (DECL_NAME (current_function_decl)))		\
       {									\
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.348
diff -c -2 -p -r1.348 i386.c
*** i386.c	2001/12/17 15:05:32	1.348
--- i386.c	2002/01/03 14:45:29
*************** ix86_osf_output_function_prologue (file,
*** 1317,1321 ****
      prefix = "_";
  
!   if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)
      {
        if (!flag_pic && !HALF_PIC_P ())
--- 1317,1321 ----
      prefix = "_";
  
!   if (current_function_profile && OSF_PROFILE_BEFORE_PROLOGUE)
      {
        if (!flag_pic && !HALF_PIC_P ())
*************** ix86_osf_output_function_prologue (file,
*** 1357,1361 ****
  #else  /* !OSF_OS */
  
!   if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE)
      {
        if (!flag_pic)
--- 1357,1361 ----
  #else  /* !OSF_OS */
  
!   if (current_function_profile && OSF_PROFILE_BEFORE_PROLOGUE)
      {
        if (!flag_pic)
*************** ix86_expand_prologue ()
*** 4144,4148 ****
       the call to mcount.  However, if -fpic, the above call will have
       done that.  */
!   if (profile_flag && ! pic_reg_used)
      emit_insn (gen_blockage ());
  }
--- 4144,4148 ----
       the call to mcount.  However, if -fpic, the above call will have
       done that.  */
!   if (current_function_profile && ! pic_reg_used)
      emit_insn (gen_blockage ());
  }
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.226
diff -c -2 -p -r1.226 i386.h
*** i386.h	2001/12/17 15:05:32	1.226
--- i386.h	2002/01/03 14:45:29
*************** while (0)
*** 2283,2287 ****
  do									\
    {									\
!     current_function_uses_pic_offset_table |= profile_flag; \
    }									\
  while (0)
--- 2283,2287 ----
  do									\
    {									\
!     current_function_uses_pic_offset_table |= current_function_profile; \
    }									\
  while (0)
Index: config/i386/win32.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/win32.h,v
retrieving revision 1.20
diff -c -2 -p -r1.20 win32.h
*** win32.h	2001/10/31 14:32:30	1.20
--- win32.h	2002/01/03 14:45:29
*************** extern void i386_pe_unique_section ();
*** 206,210 ****
  
  #define SUBTARGET_PROLOGUE						\
!   if (profile_flag 							\
        && MAIN_NAME_P (DECL_NAME (current_function_decl))		\
       {									\
--- 206,210 ----
  
  #define SUBTARGET_PROLOGUE						\
!   if (current_function_profile						\
        && MAIN_NAME_P (DECL_NAME (current_function_decl))		\
       {									\
Index: config/i960/i960.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i960/i960.c,v
retrieving revision 1.34
diff -c -2 -p -r1.34 i960.c
*** i960.c	2001/12/17 15:05:33	1.34
--- i960.c	2002/01/03 14:45:29
*************** i960_output_function_prologue (file, siz
*** 1312,1316 ****
    epilogue_string[0] = '\0';
  
!   if (profile_flag)
      {
        /* When profiling, we may use registers 20 to 27 to save arguments, so
--- 1312,1316 ----
    epilogue_string[0] = '\0';
  
!   if (current_function_profile)
      {
        /* When profiling, we may use registers 20 to 27 to save arguments, so
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.133
diff -c -2 -p -r1.133 ia64.c
*** ia64.c	2001/12/17 15:05:33	1.133
--- ia64.c	2002/01/03 14:45:30
*************** ia64_compute_frame_size (size)
*** 1452,1456 ****
       profiling, we need two output registers for the two bb_init_trace_func
       arguments.  */
!   if (profile_flag)
      i = MAX (i, 1);
    current_frame_info.n_output_regs = i;
--- 1452,1456 ----
       profiling, we need two output registers for the two bb_init_trace_func
       arguments.  */
!   if (current_function_profile)
      i = MAX (i, 1);
    current_frame_info.n_output_regs = i;
Index: config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.39
diff -c -2 -p -r1.39 m32r.c
*** m32r.c	2001/12/17 15:05:33	1.39
--- m32r.c	2002/01/03 14:45:31
*************** static struct m32r_frame_info zero_frame
*** 1865,1869 ****
  
  #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 SHORT_INSN_SIZE 2	/* size of small instructions */
--- 1865,1869 ----
  
  #define MUST_SAVE_FRAME_POINTER (regs_ever_live[FRAME_POINTER_REGNUM])
! #define MUST_SAVE_RETURN_ADDR (regs_ever_live[RETURN_ADDR_REGNUM] || current_function_profile)
  
  #define SHORT_INSN_SIZE 2	/* size of small instructions */
*************** m32r_expand_prologue ()
*** 2019,2023 ****
      emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
  
!   if (profile_flag)
      emit_insn (gen_blockage ());
  }
--- 2019,2023 ----
      emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
  
!   if (current_function_profile)
      emit_insn (gen_blockage ());
  }
Index: config/m88k/m88k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m88k/m88k.c,v
retrieving revision 1.54
diff -c -2 -p -r1.54 m88k.c
*** m88k.c	2001/12/17 15:05:34	1.54
--- m88k.c	2002/01/03 14:45:31
*************** m88k_layout_frame ()
*** 1829,1833 ****
  
    /* Since profiling requires a call, make sure r1 is saved.  */
!   if (profile_flag)
      save_regs[1] = 1;
  
--- 1829,1833 ----
  
    /* Since profiling requires a call, make sure r1 is saved.  */
!   if (current_function_profile)
      save_regs[1] = 1;
  
*************** m88k_expand_prologue ()
*** 2040,2044 ****
  	emit_move_insn (return_reg, temp_reg);
      }
!   if (profile_flag)
      emit_insn (gen_blockage ());
  }
--- 2040,2044 ----
  	emit_move_insn (return_reg, temp_reg);
      }
!   if (current_function_profile)
      emit_insn (gen_blockage ());
  }
Index: config/m88k/m88k.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m88k/m88k.h,v
retrieving revision 1.46
diff -c -2 -p -r1.46 m88k.h
*** m88k.h	2001/12/17 15:05:34	1.46
--- m88k.h	2002/01/03 14:45:31
*************** enum reg_class { NO_REGS, AP_REG, XRF_RE
*** 1556,1560 ****
  	   && NOTE_LINE_NUMBER (RTX) == NOTE_INSN_PROLOGUE_END)		\
      {									\
!       if (profile_flag)							\
  	LENGTH += (FUNCTION_PROFILER_LENGTH + REG_PUSH_LENGTH		\
  		   + REG_POP_LENGTH);					\
--- 1556,1560 ----
  	   && NOTE_LINE_NUMBER (RTX) == NOTE_INSN_PROLOGUE_END)		\
      {									\
!       if (current_function_profile)					\
  	LENGTH += (FUNCTION_PROFILER_LENGTH + REG_PUSH_LENGTH		\
  		   + REG_POP_LENGTH);					\
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.171
diff -c -2 -p -r1.171 mips.c
*** mips.c	2001/12/17 15:05:34	1.171
--- mips.c	2002/01/03 14:45:32
*************** compute_frame_size (size)
*** 6503,6507 ****
    if (total_size == extra_size
        && (mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI)
!       && ! profile_flag)
      total_size = extra_size = 0;
    else if (TARGET_ABICALLS)
--- 6503,6507 ----
    if (total_size == extra_size
        && (mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI)
!       && ! current_function_profile)
      total_size = extra_size = 0;
    else if (TARGET_ABICALLS)
*************** mips_expand_prologue ()
*** 7543,7547 ****
       the call to mcount.  */
  
!   if (profile_flag)
      emit_insn (gen_blockage ());
  }
--- 7543,7547 ----
       the call to mcount.  */
  
!   if (current_function_profile)
      emit_insn (gen_blockage ());
  }
*************** mips_can_use_return_insn ()
*** 7777,7781 ****
      return 0;
  
!   if (regs_ever_live[31] || profile_flag)
      return 0;
  
--- 7777,7781 ----
      return 0;
  
!   if (regs_ever_live[31] || current_function_profile)
      return 0;
  
Index: config/pa/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/elf.h,v
retrieving revision 1.10
diff -c -2 -p -r1.10 elf.h
*** elf.h	2001/12/12 01:52:17	1.10
--- elf.h	2002/01/03 14:45:32
*************** do {  \
*** 42,46 ****
       else \
         fputs("\t.LEVEL 1.0\n", FILE); \
!      if (profile_flag)\
         fprintf (FILE, "\t.IMPORT _mcount, ENTRY\n");\
       if (write_symbols != NO_DEBUG) \
--- 42,46 ----
       else \
         fputs("\t.LEVEL 1.0\n", FILE); \
!      if (current_function_profile)\
         fprintf (FILE, "\t.IMPORT _mcount, ENTRY\n");\
       if (write_symbols != NO_DEBUG) \
Index: config/pa/pa-linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa-linux.h,v
retrieving revision 1.8
diff -c -2 -p -r1.8 pa-linux.h
*** pa-linux.h	2001/11/11 17:45:02	1.8
--- pa-linux.h	2002/01/03 14:45:32
*************** Boston, MA 02111-1307, USA.  */
*** 100,104 ****
        else							\
  	fputs("\t.LEVEL 1.0\n", FILE);				\
!       if (profile_flag)						\
  	fputs ("\t.IMPORT _mcount, CODE\n", FILE);		\
      }								\
--- 100,104 ----
        else							\
  	fputs("\t.LEVEL 1.0\n", FILE);				\
!       if (current_function_profile)				\
  	fputs ("\t.IMPORT _mcount, CODE\n", FILE);		\
      }								\
Index: config/pa/pa64-hpux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/pa64-hpux.h,v
retrieving revision 1.6
diff -c -2 -p -r1.6 pa64-hpux.h
*** pa64-hpux.h	2001/11/15 17:55:27	1.6
--- pa64-hpux.h	2002/01/03 14:45:32
*************** do {  \
*** 69,73 ****
       else \
         fputs("\t.LEVEL 1.0\n", FILE); \
!      if (profile_flag)\
         fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
       if (write_symbols != NO_DEBUG) \
--- 69,73 ----
       else \
         fputs("\t.LEVEL 1.0\n", FILE); \
!      if (current_function_profile)\
         fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
       if (write_symbols != NO_DEBUG) \
Index: config/pa/som.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pa/som.h,v
retrieving revision 1.27
diff -c -2 -p -r1.27 som.h
*** som.h	2001/11/11 17:45:02	1.27
--- som.h	2002/01/03 14:45:32
*************** do {  \
*** 234,238 ****
  \t.IMPORT $global$,DATA\n\
  \t.IMPORT $$dyncall,MILLICODE\n", FILE);\
!      if (profile_flag)\
         fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
       if (write_symbols != NO_DEBUG) \
--- 234,238 ----
  \t.IMPORT $global$,DATA\n\
  \t.IMPORT $$dyncall,MILLICODE\n", FILE);\
!      if (current_function_profile)\
         fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
       if (write_symbols != NO_DEBUG) \
Index: config/romp/romp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/romp/romp.c,v
retrieving revision 1.18
diff -c -2 -p -r1.18 romp.c
*** romp.c	2001/10/08 21:55:05	1.18
--- romp.c	2002/01/03 14:45:32
*************** romp_using_r14 ()
*** 1060,1065 ****
    /* 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 ());
  }
  
--- 1060,1065 ----
    /* If we are debugging, profiling, have a non-empty constant pool, or
       call a function, we need r14.  */
!   return (write_symbols != NO_DEBUG || current_function_profile
! 	  || get_pool_size () != 0 || romp_makes_calls ());
  }
  
Index: config/rs6000/linux64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/linux64.h,v
retrieving revision 1.7
diff -c -2 -p -r1.7 linux64.h
*** linux64.h	2001/12/17 15:05:37	1.7
--- linux64.h	2002/01/03 14:45:32
*************** do {						\
*** 204,209 ****
  #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
    do {									\
!     if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag)	\
! 	&& uses_TOC())							\
        {									\
  	char buf[256];							\
--- 204,209 ----
  #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
    do {									\
!     if (TARGET_RELOCATABLE && (get_pool_size () != 0			\
! 	|| current_function_profile) && uses_TOC())			\
        {									\
  	char buf[256];							\
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.265
diff -c -2 -p -r1.265 rs6000.c
*** rs6000.c	2001/12/17 22:33:39	1.265
--- rs6000.c	2002/01/03 14:45:33
*************** first_reg_to_save ()
*** 6532,6536 ****
        break;
  
!   if (profile_flag)
      {
        /* AIX must save/restore every register that contains a parameter
--- 6532,6536 ----
        break;
  
!   if (current_function_profile)
      {
        /* AIX must save/restore every register that contains a parameter
*************** rs6000_stack_info ()
*** 6817,6821 ****
    /* Determine if we need to save the link register.  */
    if (rs6000_ra_ever_killed ()
!       || (DEFAULT_ABI == ABI_AIX && profile_flag)
  #ifdef TARGET_RELOCATABLE
        || (TARGET_RELOCATABLE && (get_pool_size () != 0))
--- 6817,6821 ----
    /* Determine if we need to save the link register.  */
    if (rs6000_ra_ever_killed ()
!       || (DEFAULT_ABI == ABI_AIX && current_function_profile)
  #ifdef TARGET_RELOCATABLE
        || (TARGET_RELOCATABLE && (get_pool_size () != 0))
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.78
diff -c -2 -p -r1.78 sysv4.h
*** sysv4.h	2001/12/17 15:05:38	1.78
--- sysv4.h	2002/01/03 14:45:33
*************** extern int rs6000_pic_labelno;
*** 626,630 ****
      const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long";	\
  									\
!     if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag)	\
  	&& uses_TOC())							\
        {									\
--- 626,631 ----
      const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long";	\
  									\
!     if (TARGET_RELOCATABLE 						\
! 	&& (get_pool_size () != 0 || current_function_profile)		\
  	&& uses_TOC())							\
        {									\
Index: config/rs6000/xcoff.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/xcoff.h,v
retrieving revision 1.14
diff -c -2 -p -r1.14 xcoff.h
*** xcoff.h	2001/12/17 15:05:38	1.14
--- xcoff.h	2002/01/03 14:45:33
*************** toc_section ()						\
*** 308,312 ****
      private_data_section ();					\
    text_section ();						\
!   if (profile_flag)						\
      fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT);		\
    rs6000_file_start (FILE, TARGET_CPU_DEFAULT);			\
--- 308,312 ----
      private_data_section ();					\
    text_section ();						\
!   if (current_function_profile)					\
      fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT);		\
    rs6000_file_start (FILE, TARGET_CPU_DEFAULT);			\
Index: config/v850/v850.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.c,v
retrieving revision 1.52
diff -c -2 -p -r1.52 v850.c
*** v850.c	2001/12/17 15:05:39	1.52
--- v850.c	2002/01/03 14:45:34
*************** compute_register_save_size (p_reg_saved)
*** 1393,1397 ****
  
    /* Count the return pointer if we need to save it.  */
!   if (profile_flag && !call_p)
      regs_ever_live [LINK_POINTER_REGNUM] = call_p = 1;
   
--- 1393,1397 ----
  
    /* Count the return pointer if we need to save it.  */
!   if (current_function_profile && !call_p)
      regs_ever_live [LINK_POINTER_REGNUM] = call_p = 1;
   
Index: doc/extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/extend.texi,v
retrieving revision 1.49
diff -c -2 -p -r1.49 extend.texi
*** extend.texi	2001/12/17 19:19:57	1.49
--- extend.texi	2002/01/03 14:45:34
*************** Controlling C Dialect}.
*** 2096,2102 ****
  @cindex @code{no_instrument_function} function attribute
  @opindex finstrument-functions
! If @option{-finstrument-functions} is given, profiling function calls will
! be generated at entry and exit of most user-compiled functions.
! Functions with this attribute will not be so instrumented.
  
  @item section ("@var{section-name}")
--- 2096,2104 ----
  @cindex @code{no_instrument_function} function attribute
  @opindex finstrument-functions
! If @option{-finstrument-functions} is given, profiling function calls
! will be generated at entry and exit of most user-compiled functions.
! Functions with this attribute will not be so instrumented. This
! attribute also disables the instrumentation of the function caused by
! the @option{-pg} and @option{-p} options.
  
  @item section ("@var{section-name}")


More information about the Gcc-patches mailing list