diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3cfed7fd65e..230f511de85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2002-03-30 Richard Henderson + + 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 PR optimization/6086 @@ -7,12 +21,14 @@ Sat Mar 30 14:08:55 CET 2002 Jan Hubicka - * 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. diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index d7433d49037..8c5c7ff75a2 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -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 *)); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index a6a99c74ba3..ec5340416f4 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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); } -/* 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]; + rtx lab, fun; + 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 ("\tst\t%g2, [%fp-4]\n", file); - - 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); - - if (! TARGET_ARCH64) - fputs ("\tld\t[%fp-4], %g2\n", file); + emit_library_call (fun, 0, VOIDmode, 1, lab, Pmode); } - - + /* Mark ARG, which is really a struct ultrasparc_pipline_state *, for GC. */ diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index e8b9cc38796..fba2cc696e6 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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 -/* 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" /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,