+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.
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 *));
/* 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 ();
}
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. */
/* 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. */
#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,