]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sparc.h (OVERRIDE_OPTIONS): Don't override -fpic or -fomit-frame-pointer with profiling.
authorRichard Henderson <rth@gcc.gnu.org>
Sat, 30 Mar 2002 21:01:19 +0000 (13:01 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 30 Mar 2002 21:01:19 +0000 (13:01 -0800)
        * config/sparc/sparc.h (OVERRIDE_OPTIONS): Don't override -fpic
        or -fomit-frame-pointer with profiling.
        (SUBTARGET_OVERRIDE_OPTIONS): Remove.
        (FUNCTION_PROFILER): Do nothing.
        (PROFILE_HOOK): New.
        * config/sparc/sparc.c (sparc_override_options): Don't check
        code models for profiling.
        (sparc_function_profiler): Remove.
        (sparc_profile_hook): New.
        * config/sparc/sparc-protos.h: Update.

From-SVN: r51610

gcc/ChangeLog
gcc/config/sparc/sparc-protos.h
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h

index 3cfed7fd65eb74c6b184e3dda1dd738bd5c44342..230f511de85e81d55a27f33d1ab2c355ed05ffe2 100644 (file)
@@ -1,3 +1,17 @@
+2002-03-30  Richard Henderson  <rth@redhat.com>
+
+       PR target/6032
+       * config/sparc/sparc.h (OVERRIDE_OPTIONS): Don't override -fpic
+       or -fomit-frame-pointer with profiling.
+       (SUBTARGET_OVERRIDE_OPTIONS): Remove.
+       (FUNCTION_PROFILER): Do nothing.
+       (PROFILE_HOOK): New.
+       * config/sparc/sparc.c (sparc_override_options): Don't check
+       code models for profiling.
+       (sparc_function_profiler): Remove.
+       (sparc_profile_hook): New.
+       * config/sparc/sparc-protos.h: Update.
+
 2002-03-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR optimization/6086
 
 Sat Mar 30 14:08:55 CET 2002  Jan Hubicka  <jh@suse.cz>
 
-       * local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing.
+       * local-alloc.c (local_alloc): Avoid call of update_equiv_regs
+       when not optimizing.
 
        * toplev.c (rest_of_compilation): Cann mark_constant_function
        only when optimizing.
 
-       * flow.c (calculate_global_regs_live): Ensure that all AUX fields are NULL.
+       * flow.c (calculate_global_regs_live): Ensure that all AUX fields
+       are NULL.
 
        * cfgcleanup.c (bb_flags): Add BB_NONTHREADABLE_BLOCK.
        (thread_jump): Set BB_NONTHREADABLE_BLOCK, check it.
index d7433d49037235118d981355d90b68c4625fbff7..8c5c7ff75a2db9036ef163dd379286856fc775aa 100644 (file)
@@ -57,10 +57,7 @@ extern int check_pic PARAMS ((int));
 extern int short_branch PARAMS ((int, int));
 extern int sparc_flat_epilogue_delay_slots PARAMS ((void));
 extern unsigned long sparc_flat_compute_frame_size PARAMS ((int));
-extern void sparc_function_profiler PARAMS ((FILE *, int));
-extern void sparc_function_block_profiler PARAMS ((FILE *, int));
-extern void sparc_block_profiler PARAMS ((FILE *, int));
-extern void sparc_function_block_profiler_exit PARAMS ((FILE *));
+extern void sparc_profile_hook PARAMS ((int));
 extern void sparc_override_options PARAMS ((void));
 extern int leaf_return_peephole_ok PARAMS ((void));
 extern void sparc_output_scratch_registers PARAMS ((FILE *));
index a6a99c74ba31d6efa8979c2fbd49fb48876da1d9..ec5340416f4ece89ce4fde57660b3efe0cda7b82 100644 (file)
@@ -432,12 +432,6 @@ sparc_override_options ()
   /* Do various machine dependent initializations.  */
   sparc_init_modes ();
 
-  if ((profile_flag)
-      && sparc_cmodel != CM_32 && sparc_cmodel != CM_MEDLOW)
-    {
-      error ("profiling does not support code models other than medlow");
-    }
-
   /* Register global variables with the garbage collector.  */
   sparc_add_gc_roots ();
 }
@@ -8617,42 +8611,23 @@ sparc_return_peephole_ok (dest, src)
   return IN_OR_GLOBAL_P (dest);
 }
 \f
-/* Output assembler code to FILE to increment profiler label # LABELNO
-   for profiling a function entry.
-
-   32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered
-   during profiling so we need to save/restore it around the call to mcount.
-   We're guaranteed that a save has just been done, and we use the space
-   allocated for intreg/fpreg value passing.  */
+/* Output rtl to increment the profiler label LABELNO
+   for profiling a function entry.  */
 
 void
-sparc_function_profiler (file, labelno)
-     FILE *file;
+sparc_profile_hook (labelno)
      int labelno;
 {
   char buf[32];
-  ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
-
-  if (! TARGET_ARCH64)
-    fputs ("\tst\t%g2, [%fp-4]\n", file);
+  rtx lab, fun;
 
-  fputs ("\tsethi\t%hi(", file);
-  assemble_name (file, buf);
-  fputs ("), %o0\n", file);
-
-  fputs ("\tcall\t", file);
-  assemble_name (file, MCOUNT_FUNCTION);
-  putc ('\n', file);
-
-  fputs ("\t or\t%o0, %lo(", file);
-  assemble_name (file, buf);
-  fputs ("), %o0\n", file);
+  ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
+  lab = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
+  fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_FUNCTION);
 
-  if (! TARGET_ARCH64)
-    fputs ("\tld\t[%fp-4], %g2\n", file);
+  emit_library_call (fun, 0, VOIDmode, 1, lab, Pmode);
 }
-
-
+\f
 /* Mark ARG, which is really a struct ultrasparc_pipline_state *, for
    GC.  */
 
index e8b9cc38796c741c89f4eef3adad083d3ee79381..fba2cc696e6593cbecdd5383387a9252bb146519 100644 (file)
@@ -373,29 +373,7 @@ Unrecognized value in TARGET_CPU_DEFAULT.
 /* Show we can debug even without a frame pointer.  */
 #define CAN_DEBUG_WITHOUT_FP
 
-/* To make profiling work with -f{pic,PIC}, we need to emit the profiling
-   code into the rtl.  Also, if we are profiling, we cannot eliminate
-   the frame pointer (because the return address will get smashed).  */
-
-#define OVERRIDE_OPTIONS \
-  do {                                                                 \
-    if (profile_flag || profile_arc_flag)                              \
-      {                                                                        \
-       if (flag_pic)                                                   \
-         {                                                             \
-           const char *const pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";\
-           warning ("%s and profiling conflict: disabling %s",         \
-                    pic_string, pic_string);                           \
-           flag_pic = 0;                                               \
-         }                                                             \
-       flag_omit_frame_pointer = 0;                                    \
-      }                                                                        \
-    sparc_override_options ();                                         \
-    SUBTARGET_OVERRIDE_OPTIONS;                                                \
-  } while (0)
-
-/* This is meant to be redefined in the host dependent files.  */
-#define SUBTARGET_OVERRIDE_OPTIONS
+#define OVERRIDE_OPTIONS  sparc_override_options ()
 
 /* Generate DBX debugging information.  */
 
@@ -1854,14 +1832,13 @@ do {                                                                    \
 #endif
 
 \f
-/* Output assembler code to FILE to increment profiler label # LABELNO
-   for profiling a function entry.  */
+/* Emit rtl for profiling.  */
+#define PROFILE_HOOK(LABEL)   sparc_profile_hook (LABEL)
 
-#define FUNCTION_PROFILER(FILE, LABELNO) \
-  sparc_function_profiler(FILE, LABELNO)
+/* All the work done in PROFILE_HOOK, but still required.  */
+#define FUNCTION_PROFILER(FILE, LABELNO) do { } while (0)
 
 /* Set the name of the mcount function for the system.  */
-
 #define MCOUNT_FUNCTION "*mcount"
 \f
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,