From b8a21949fa255f9366e95c472665f7668012e1da Mon Sep 17 00:00:00 2001 From: amodra Date: Tue, 23 Apr 2002 07:20:55 +0000 Subject: [PATCH] PR target/6413 * function.h: (struct function): Add profile_label_no field. (current_function_profile_label_no): Define. * function.c: (profile_label_no): New static var. (expand_function_start): Increment it, and copy to current_function_profile_label_no. * output.h (profile_label_no): Delete. * final.c (profile_label_no): Delete. (profile_function): Use current_function_profile_label_no. (final_end_function): Don't increment profile_label_no here. * config/i386/i386.c (ix86_osf_output_function_prologue): Replace profile_label_no with current_function_profile_label_no. * config/pa/pa.c (current_function_number): Delete. (pa_output_function_prologue): Don't output profile label here. (hppa_profile_hook): Use label_no param rather than current_function_number. (FUNC_BEGIN_PROLOG_LABEL): Move to .. * config/pa/pa.h: .. here. (FUNCTION_PROFILER): Output profile label here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52656 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 22 ++++++++++++++++++++++ gcc/config/i386/i386.c | 2 +- gcc/config/pa/pa.c | 23 ++--------------------- gcc/config/pa/pa.h | 11 +++++++++-- gcc/final.c | 10 ++-------- gcc/function.c | 10 ++++++++-- gcc/function.h | 4 ++++ gcc/output.h | 3 --- 8 files changed, 48 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5135f5f265..1293bf0b7e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2002-04-23 Alan Modra + + PR target/6413 + * function.h: (struct function): Add profile_label_no field. + (current_function_profile_label_no): Define. + * function.c: (profile_label_no): New static var. + (expand_function_start): Increment it, and copy to + current_function_profile_label_no. + * output.h (profile_label_no): Delete. + * final.c (profile_label_no): Delete. + (profile_function): Use current_function_profile_label_no. + (final_end_function): Don't increment profile_label_no here. + * config/i386/i386.c (ix86_osf_output_function_prologue): Replace + profile_label_no with current_function_profile_label_no. + * config/pa/pa.c (current_function_number): Delete. + (pa_output_function_prologue): Don't output profile label here. + (hppa_profile_hook): Use label_no param rather than + current_function_number. + (FUNC_BEGIN_PROLOG_LABEL): Move to .. + * config/pa/pa.h: .. here. + (FUNCTION_PROFILER): Output profile label here. + 2002-04-22 Eric Christopher * config/mips/mips.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Revert diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 41ec025c750..f134a211769 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1335,7 +1335,7 @@ ix86_osf_output_function_prologue (file, size) { const char *prefix = ""; const char *const lprefix = LPREFIX; - int labelno = profile_label_no; + int labelno = current_function_profile_label_no; #ifdef OSF_OS diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 9163aab7898..e5259da45bb 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -57,10 +57,6 @@ Boston, MA 02111-1307, USA. */ #endif #endif -#ifndef FUNC_BEGIN_PROLOG_LABEL -#define FUNC_BEGIN_PROLOG_LABEL "LFBP" -#endif - static inline rtx force_mode PARAMS ((enum machine_mode, rtx)); static void pa_combine_instructions PARAMS ((rtx)); static int pa_can_combine_p PARAMS ((rtx, rtx, rtx, int, rtx, rtx, rtx)); @@ -103,11 +99,6 @@ const char *pa_arch_string; registers which were saved by the current function's prologue. */ static int gr_saved, fr_saved; -/* The number of the current function for which profile information - is to be collected. These numbers are used to create unique label - id's for labels emitted at the beginning of profiled functions. */ -static unsigned int current_function_number = 0; - static rtx find_addr_reg PARAMS ((rtx)); /* Keep track of the number of bytes we have output in the CODE subspaces @@ -3119,16 +3110,6 @@ pa_output_function_prologue (file, size) fputs ("\n\t.ENTRY\n", file); - /* When profiling, we need a local label at the beginning of the - prologue because GAS can't handle the difference of a global symbol - and a local symbol. */ - if (current_function_profile) - { - ASM_OUTPUT_INTERNAL_LABEL (file, FUNC_BEGIN_PROLOG_LABEL, - current_function_number); - current_function_number++; - } - /* If we're using GAS and SOM, and not using the portable runtime model, then we don't need to accumulate the total number of code bytes. */ if ((TARGET_GAS && TARGET_SOM && ! TARGET_PORTABLE_RUNTIME) @@ -3681,13 +3662,13 @@ hppa_pic_save_rtx () void hppa_profile_hook (label_no) - int label_no ATTRIBUTE_UNUSED; + int label_no; { rtx begin_label_rtx, call_insn; char begin_label_name[16]; ASM_GENERATE_INTERNAL_LABEL (begin_label_name, FUNC_BEGIN_PROLOG_LABEL, - current_function_number); + label_no); begin_label_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (begin_label_name)); if (TARGET_64BIT) diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 6977752c083..0fd97eefc2e 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -939,9 +939,16 @@ extern enum cmp_type hppa_branch_type; } /* On HPPA, we emit profiling code as rtl via PROFILE_HOOK rather than - as assembly via FUNCTION_PROFILER. */ + as assembly via FUNCTION_PROFILER. Just output a local label. + We can't use the function label because the GAS SOM target can't + handle the difference of a global symbol and a local symbol. */ -#define FUNCTION_PROFILER(FILE, LABEL) /* nothing */ +#ifndef FUNC_BEGIN_PROLOG_LABEL +#define FUNC_BEGIN_PROLOG_LABEL "LFBP" +#endif + +#define FUNCTION_PROFILER(FILE, LABEL) \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, FUNC_BEGIN_PROLOG_LABEL, LABEL) #define PROFILE_HOOK(label_no) hppa_profile_hook (label_no) void hppa_profile_hook PARAMS ((int label_no)); diff --git a/gcc/final.c b/gcc/final.c index c76f6548b78..a0adcbe70b4 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -170,10 +170,6 @@ char regs_ever_live[FIRST_PSEUDO_REGISTER]; int frame_pointer_needed; -/* Assign unique numbers to labels generated for profiling. */ - -int profile_label_no; - /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen. */ static int block_depth; @@ -1595,7 +1591,7 @@ profile_function (file) #ifndef NO_PROFILE_COUNTERS data_section (); ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT)); - ASM_OUTPUT_INTERNAL_LABEL (file, "LP", profile_label_no); + ASM_OUTPUT_INTERNAL_LABEL (file, "LP", current_function_profile_label_no); assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1); #endif @@ -1625,7 +1621,7 @@ profile_function (file) #endif #endif - FUNCTION_PROFILER (file, profile_label_no); + FUNCTION_PROFILER (file, current_function_profile_label_no); #if defined(STATIC_CHAIN_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH) if (cxt) @@ -1675,8 +1671,6 @@ final_end_function () && dwarf2out_do_frame ()) dwarf2out_end_epilogue (); #endif - - profile_label_no++; } /* Output assembler code for some insns: all or part of a function. diff --git a/gcc/function.c b/gcc/function.c index 5904919a85d..56e90147b32 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -124,6 +124,9 @@ int current_function_uses_only_leaf_regs; post-instantiation libcalls. */ int virtuals_instantiated; +/* Assign unique numbers to labels generated for profiling. */ +static int profile_label_no; + /* These variables hold pointers to functions to create and destroy target specific, per-function data structures. */ void (*init_machine_status) PARAMS ((struct function *)); @@ -6684,10 +6687,13 @@ expand_function_start (subr, parms_have_cleanups) Pmode); } -#ifdef PROFILE_HOOK if (current_function_profile) - PROFILE_HOOK (profile_label_no); + { + current_function_profile_label_no = profile_label_no++; +#ifdef PROFILE_HOOK + PROFILE_HOOK (current_function_profile_label_no); #endif + } /* After the display initializations is where the tail-recursion label should go, if we end up needing one. Ensure we have a NOTE here diff --git a/gcc/function.h b/gcc/function.h index 493543d22c1..70164f1d9fa 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -364,6 +364,9 @@ struct function /* Highest label number in current function. */ int inl_max_label_num; + /* Profile label number. */ + int profile_label_no; + /* For md files. */ /* tm.h can use this to store whatever it likes. */ @@ -508,6 +511,7 @@ extern int virtuals_instantiated; #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_profile_label_no (cfun->profile_label_no) #define current_function_limit_stack (cfun->limit_stack) #define current_function_uses_pic_offset_table (cfun->uses_pic_offset_table) #define current_function_uses_const_pool (cfun->uses_const_pool) diff --git a/gcc/output.h b/gcc/output.h index 3f8872a1c3b..b3426ce3263 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -491,9 +491,6 @@ extern const char *user_label_prefix; #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*')) #endif -/* Assign unique numbers to labels generated for profiling. */ - -extern int profile_label_no; /* Default target function prologue and epilogue assembler output. */ extern void default_function_pro_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); -- 2.11.4.GIT