This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix g++.law/profile1.C regression


On Thu, May 30, 2002 at 05:50:41AM +0000, GCC regression checker wrote:
> native g++.sum g++.law/profile1.C

The error check in toplev.c conflicts with -momit-leaf-frame-pointer,
since the later sets flag_omit_frame_pointer and then modifies the
effect after the fact in ix86_frame_pointer_required.

I also fail to see the point in issuing an error message here for a
single port when it's easier to turn the frame pointer back on.


r~


        * defaults.h (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): Kill.
        * toplev.c (process_options): Don't check it.
        * doc/tm.texi: Don't document it.
        * config/i386/linux.h (SUBTARGET_FRAME_POINTER_REQUIRED): New.
        (TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER): Kill.
        * config/i386/i386.c (ix86_frame_pointer_required): Suppress leaf
        frame pointer optimization if current_function_profile.

Index: defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.75
diff -c -p -d -r1.75 defaults.h
*** defaults.h	17 May 2002 23:25:19 -0000	1.75
--- defaults.h	30 May 2002 19:16:16 -0000
*************** do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNA
*** 397,409 ****
     ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
  #endif
  
- /* True if it is possible to profile code that does not have a frame
-    pointer.  */
- 
- #ifndef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
- #define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true
- #endif
- 
  #ifndef DEFAULT_GDB_EXTENSIONS
  #define DEFAULT_GDB_EXTENSIONS 1
  #endif
--- 397,402 ----
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.637
diff -c -p -d -r1.637 toplev.c
*** toplev.c	25 May 2002 18:02:14 -0000	1.637
--- toplev.c	30 May 2002 19:16:16 -0000
*************** process_options ()
*** 4893,4908 ****
      warning ("this target machine does not have delayed branches");
  #endif
  
-   /* Some operating systems do not allow profiling without a frame
-      pointer.  */
-   if (!TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
-       && profile_flag
-       && flag_omit_frame_pointer)
-     {
-       error ("profiling does not work without a frame pointer");
-       flag_omit_frame_pointer = 0;
-     }
- 
    user_label_prefix = USER_LABEL_PREFIX;
    if (flag_leading_underscore != -1)
      {
--- 4893,4898 ----
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.415
diff -c -p -d -r1.415 i386.c
*** config/i386/i386.c	30 May 2002 00:28:14 -0000	1.415
--- config/i386/i386.c	30 May 2002 19:16:17 -0000
*************** ix86_frame_pointer_required ()
*** 3885,3891 ****
    /* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER 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 && ! leaf_function_p ())
      return 1;
  
    return 0;
--- 3885,3892 ----
    /* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER 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 || current_function_profile))
      return 1;
  
    return 0;
Index: config/i386/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/linux.h,v
retrieving revision 1.37
diff -c -p -d -r1.37 linux.h
*** config/i386/linux.h	15 Apr 2002 20:35:12 -0000	1.37
--- config/i386/linux.h	30 May 2002 19:16:17 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 62,75 ****
      fprintf (FILE, "\tcall\tmcount\n");					\
  }
  
! /* True if it is possible to profile code that does not have a frame
!    pointer.  
! 
!    The GLIBC version of mcount for the x86 assumes that there is a
     frame, so we cannot allow profiling without a frame pointer.  */
  
! #undef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
! #define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER false
  
  #undef SIZE_TYPE
  #define SIZE_TYPE "unsigned int"
--- 62,72 ----
      fprintf (FILE, "\tcall\tmcount\n");					\
  }
  
! /* The GLIBC version of mcount for the x86 assumes that there is a
     frame, so we cannot allow profiling without a frame pointer.  */
  
! #undef SUBTARGET_FRAME_POINTER_REQUIRED
! #define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
  
  #undef SIZE_TYPE
  #define SIZE_TYPE "unsigned int"
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.134
diff -c -p -d -r1.134 tm.texi
*** doc/tm.texi	25 May 2002 22:01:54 -0000	1.134
--- doc/tm.texi	30 May 2002 19:16:17 -0000
*************** must not use the @var{labelno} argument 
*** 4160,4181 ****
  @item PROFILE_BEFORE_PROLOGUE
  Define this macro if the code for function profiling should come before
  the function prologue.  Normally, the profiling code comes after.
- 
- 
- @findex TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
- @item TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
- On some targets, it is impossible to use profiling when the frame
- pointer has been omitted.  For example, on x86 GNU/Linux systems,
- the @code{mcount} routine provided by the GNU C Library finds the
- address of the routine that called the routine that called @code{mcount}
- by looking in the immediate caller's stack frame.  If the immediate
- caller has no frame pointer, this lookup will fail.
- 
- By default, GCC assumes that the target does allow profiling when the
- frame pointer is omitted.  This macro should be defined to a C
- expression that evaluates to @code{false} if the target does not allow
- profiling when the frame pointer is omitted.
- 
  @end table
  
  @node Tail Calls
--- 4160,4165 ----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]