diff options
38 files changed, 115 insertions, 3596 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b026518..3dde901 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,89 @@ +Thu Dec 6 12:45:33 CET 2001 Jan Hubicka <jh@suse.cz> + + * final.c (count_basic_block, add_bb, add_bb_string): + Kill. + (end_final, final_start_function, final, final_scan_insn, + leaf_function_p): Kill BB profiler related code. + * flags.h (profile_block_flag): Kill. + * libgcc2.c (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE, + BB_BUCKETS, BBINBUFSIZE, bb_edge, bb_func_mode, bb_func, + __bb, bb_src, bb_dst, bb_tracefile, bb_hashbuckets, + bb_func_head, bb_callcount, bb_mode, bb_stack, bb_stacksize + reported, GOPENDECOMPRESS, GOPENCOMPRESS, gopen, gclose, + __bb_exit_trace_func, __bb_init_prg, __bb_trace_func, + __bb_trace_func_ret, __bb_init_file, __bb_trace_ret, + __bb_init_trace_func): Kill. + * toplev.c (profile_block_flag): Kill. + (indepdendent_decode_option, process_options): Kill -a related code. + * alpha.c (direct_call_operand): Likewise. + * arm.c (arm_expand_prologue, thumb_expand_prologue, + thumb_expand_epilogue): Likewise. + * c4x.c (c4x_expand_prologue, c4x_null_epilogue_p): Likewise. + * c4x.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * d30v.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * fr30.c (fr30_expand_prologue): Kill BB profiler related code. + * i386.c (ix86_can_use_return_insn_p, ix86_expand_prologue, + ix86_expand_epilogue, ix86_expand_epilogue): Kill BB profiler related + code. + (ix86_output_function_block_profiler, ix86_output_block_profiler): Kill. + * i386.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * fr30.c (fr30_expand_prologue): Kill BB profiler related code. + * i960.c (i960_output_function_prologue): Kill BB profiler related + code. + * ia64.c (ia64_compute_frame_size): Likewise. + * ia64.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * m32r.c (m32r_expand_prolofue): Kill BB profiler related code. + * m68hc11.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * m68k.c (m68k_output_function_epilogue): Kill BB profiler related code. + * m68k.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * m88k.c (output_options, m88k_layout_frame, m88k_expand_prologue): + Kill BB profiler related code. + * m88k.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * mips.c (mips_expand_prologue): Kill BB profiler related code. + * mmix.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * rs6000.c (rs6000_override_options): Kill BB profiler related code. + * s960.c (s390_function_prologue): Kill BB profiler related code. + * s960.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * linux-aout.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Kill. + * linux.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Kill. + * linux64.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Kill. + * sol2.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Kill. + * sparc.c (sparc_override_options, eligible_for_sibcall_delay, + sparc_nonflat_function_epilogue): Kill BB profiler related code. + (sparc_function_block_profiler, sparc_block_profiler, + sparc_function_block_profiler_exit): Kill. + * sparc.h (OVERRIDE_OPTIONS): Kill BB profiler related code. + (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * sun4o3.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Kill. + * sunos4.h (MACHINE_STATE_SAVE, MACHINE_STATE_RESTORE): Kill. + * stormy16.h (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + * doc/invoke.texi: Kill documentation of -a and -ax. + * tm.texi (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER, + FUNCTION_BLOCK_PROFILER_EXIT, MACHINE_STATE_SAVE, + MACHINE_STATE_RESTORE): Kill. + 2001-10-26 Steve Christiansen <smc@us.ibm.com> * doc/rtl.texi: Use a table to display RTL format characters. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index d0c8b21..db5f943 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -875,7 +875,7 @@ direct_call_operand (op, mode) but is approximately correct for the OSF ABIs. Don't know what to do for VMS, NT, or UMK. */ if (! TARGET_PROFILING_NEEDS_GP - && ! profile_flag && ! profile_block_flag) + && ! profile_flag) return 0; return 1; diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index bd6e699..b7058b4 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -8302,7 +8302,7 @@ arm_expand_prologue () /* If we are profiling, make sure no instructions are scheduled before the call to mcount. Similarly if the user has requested no scheduling in the prolog. */ - if (profile_flag || profile_block_flag || TARGET_NO_SCHED_PRO) + if (profile_flag || TARGET_NO_SCHED_PRO) emit_insn (gen_blockage ()); /* If the link register is being kept alive, with the return address in it, @@ -10079,7 +10079,7 @@ thumb_expand_prologue () } } - if (profile_flag || profile_block_flag || TARGET_NO_SCHED_PRO) + if (profile_flag || TARGET_NO_SCHED_PRO) emit_insn (gen_blockage ()); } @@ -10116,7 +10116,7 @@ thumb_expand_epilogue () the stack adjustment will not be deleted. */ emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx)); - if (profile_flag || profile_block_flag || TARGET_NO_SCHED_PRO) + if (profile_flag || TARGET_NO_SCHED_PRO) emit_insn (gen_blockage ()); } diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index a20fb95..3559652 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -851,13 +851,6 @@ c4x_expand_prologue () return; } -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - if (profile_block_flag == 2) - { - FUNCTION_BLOCK_PROFILER_EXIT - } -#endif - /* For __interrupt__ function build specific prologue. */ if (c4x_interrupt_function_p ()) { @@ -1239,7 +1232,6 @@ c4x_null_epilogue_p () && ! c4x_interrupt_function_p () && ! current_function_calls_alloca && ! current_function_args_size - && ! (profile_block_flag == 2) && ! (optimize < 2) && ! get_frame_size ()) { diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 012d4d9..5dd4a12 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1194,269 +1194,6 @@ CUMULATIVE_ARGS; fprintf (FILE, "\tpop\tar2\n"); \ } -/* There are three profiling modes for basic blocks available. - The modes are selected at compile time by using the options - -a or -ax of the gnu compiler. - The variable `profile_block_flag' will be set according to the - selected option. - - profile_block_flag == 0, no option used: - - No profiling done. - - profile_block_flag == 1, -a option used. - - Count frequency of execution of every basic block. - - profile_block_flag == 2, -ax option used. - - Generate code to allow several different profiling modes at run time. - Available modes are: - Produce a trace of all basic blocks. - Count frequency of jump instructions executed. - In every mode it is possible to start profiling upon entering - certain functions and to disable profiling of some other functions. - - The result of basic-block profiling will be written to a file `bb.out'. - If the -ax option is used parameters for the profiling will be read - from file `bb.in'. - -*/ - -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCKNO) \ - if (profile_block_flag == 2) \ - { \ - if (! TARGET_C3X) \ - { \ - fprintf (FILE, "\tpush\tst\n"); \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tr2\n"); \ - fprintf (FILE, "\tldhi\t^LPBX0,ar2\n"); \ - fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ - if (BLOCKNO > 32767) \ - { \ - fprintf (FILE, "\tldhi\t%d,r2\n", (BLOCKNO) >> 16); \ - fprintf (FILE, "\tor\t%d,r2\n", (BLOCKNO)); \ - } \ - else \ - { \ - fprintf (FILE, "\tldiu\t%d,r2\n", (BLOCKNO)); \ - } \ - fprintf (FILE, "\tcall\t___bb_init_trace_func\n"); \ - fprintf (FILE, "\tpop\tr2\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - fprintf (FILE, "\tpop\tst\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tpush\tst\n"); \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tr2\n"); \ - fprintf (FILE, "\tldiu\t^LPBX0,ar2\n"); \ - fprintf (FILE, "\tlsh\t16,ar2\n"); \ - fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ - if (BLOCKNO > 32767) \ - { \ - fprintf (FILE, "\tldi\t%d,r2\n", (BLOCKNO) >> 16); \ - fprintf (FILE, "\tlsh\t16,r2\n"); \ - fprintf (FILE, "\tor\t%d,r2\n", (BLOCKNO)); \ - } \ - else \ - { \ - fprintf (FILE, "\tldiu\t%d,r2\n", (BLOCKNO)); \ - } \ - fprintf (FILE, "\tcall\t___bb_init_trace_func\n"); \ - fprintf (FILE, "\tpop\tr2\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - fprintf (FILE, "\tpop\tst\n"); \ - } \ - } \ - else \ - { \ - if (! TARGET_C3X) \ - { \ - fprintf (FILE, "\tpush\tst\n"); \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tldhi\t^LPBX0,ar2\n"); \ - fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ - fprintf (FILE, "\tcmpi\t0,*ar2\n"); \ - fprintf (FILE, "\tbne\t$+2\n"); \ - fprintf (FILE, "\tcall\t___bb_init_func\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - fprintf (FILE, "\tpop\tst\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tpush\tst\n"); \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tr2\n"); \ - fprintf (FILE, "\tldiu\t^LPBX0,ar2\n"); \ - fprintf (FILE, "\tlsh\t16,ar2\n"); \ - fprintf (FILE, "\tor\t#LPBX0,ar2\n"); \ - fprintf (FILE, "\tldi\t*ar2,r2\n"); \ - fprintf (FILE, "\tbne\t$+2\n"); \ - fprintf (FILE, "\tcall\t___bb_init_func\n"); \ - fprintf (FILE, "\tpop\tr2\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - fprintf (FILE, "\tpop\tst\n"); \ - } \ - } - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - if (profile_block_flag == 2) \ - { \ - if (! TARGET_C3X) \ - { \ - fprintf (FILE, "\tpush\tst\n"); \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tar0\n"); \ - fprintf (FILE, "\tldhi\t^___bb,ar2\n"); \ - fprintf (FILE, "\tor\t#___bb,ar2\n"); \ - if (BLOCKNO > 32767) \ - { \ - fprintf (FILE, "\tldhi\t%d,ar0\n", (BLOCKNO) >> 16);\ - fprintf (FILE, "\tor\t%d,ar0\n", (BLOCKNO)); \ - } \ - else \ - { \ - fprintf (FILE, "\tldiu\t%d,ar0\n", (BLOCKNO)); \ - } \ - fprintf (FILE, "\tsti\tar0,*ar2\n"); \ - fprintf (FILE, "\tldhi\t^LPBX0,ar0\n"); \ - fprintf (FILE, "\tor\t#LPBX0,ar0\n"); \ - fprintf (FILE, "\tsti\tar0,*+ar2(1)\n"); \ - fprintf (FILE, "\tcall\t___bb_trace_func\n"); \ - fprintf (FILE, "\tpop\tar0\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - fprintf (FILE, "\tpop\tst\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tpush\tst\n"); \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tar0\n"); \ - fprintf (FILE, "\tldiu\t^___bb,ar2\n"); \ - fprintf (FILE, "\tlsh\t16,ar2\n"); \ - fprintf (FILE, "\tor\t#___bb,ar2\n"); \ - if (BLOCKNO > 32767) \ - { \ - fprintf (FILE, "\tldi\t%d,ar0\n", (BLOCKNO) >> 16); \ - fprintf (FILE, "\tlsh\t16,ar0\n"); \ - fprintf (FILE, "\tor\t%d,ar0\n", (BLOCKNO)); \ - } \ - else \ - { \ - fprintf (FILE, "\tldiu\t%d,ar0\n", (BLOCKNO)); \ - } \ - fprintf (FILE, "\tsti\tar0,*ar2\n"); \ - fprintf (FILE, "\tldiu\t^LPBX0,ar0\n"); \ - fprintf (FILE, "\tlsh\t16,ar0\n"); \ - fprintf (FILE, "\tor\t#LPBX0,ar0\n"); \ - fprintf (FILE, "\tsti\tar0,*+ar2(1)\n"); \ - fprintf (FILE, "\tcall\t___bb_trace_func\n"); \ - fprintf (FILE, "\tpop\tar0\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - fprintf (FILE, "\tpop\tst\n"); \ - } \ - } \ - else \ - { \ - if (! TARGET_C3X) \ - { \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tar0\n"); \ - fprintf (FILE, "\tldhi\t^LPBX2+%d,ar2\n", (BLOCKNO)); \ - fprintf (FILE, "\tor\t#LPBX2+%d,ar2\n", (BLOCKNO)); \ - fprintf (FILE, "\taddi3\t1,*ar2,ar0\n"); \ - fprintf (FILE, "\tsti\tar0,*ar2\n"); \ - fprintf (FILE, "\tpop\tar0\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tpush\tar2\n"); \ - fprintf (FILE, "\tpush\tar0\n"); \ - fprintf (FILE, "\tldiu\t^LPBX2+%d,ar2\n", (BLOCKNO)); \ - fprintf (FILE, "\tlsh\t16,ar2\n"); \ - fprintf (FILE, "\tor\t#LPBX2+%d,ar2\n", (BLOCKNO)); \ - fprintf (FILE, "\tldiu\t*ar2,ar0\n"); \ - fprintf (FILE, "\taddi\t1,ar0\n"); \ - fprintf (FILE, "\tsti\tar0,*ar2\n"); \ - fprintf (FILE, "\tpop\tar0\n"); \ - fprintf (FILE, "\tpop\tar2\n"); \ - } \ - } - -#define FUNCTION_BLOCK_PROFILER_EXIT \ - { \ - emit_insn (gen_push_st ()); \ - emit_insn (gen_pushqi ( \ - gen_rtx_REG (QImode, AR2_REGNO))); \ - emit_call_insn (gen_nodb_call ( \ - gen_rtx_SYMBOL_REF (QImode, "__bb_trace_ret")));\ - emit_insn (gen_popqi_unspec ( \ - gen_rtx_REG (QImode, AR2_REGNO))); \ - emit_insn (gen_pop_st ()); \ - } - -#define MACHINE_STATE_SAVE(ID) \ - asm(" push r0"); \ - asm(" pushf r0"); \ - asm(" push r1"); \ - asm(" pushf r1"); \ - asm(" push r2"); \ - asm(" pushf r2"); \ - asm(" push r3"); \ - asm(" pushf r3"); \ - asm(" push ar0"); \ - asm(" push ar1"); \ - asm(" .if .BIGMODEL"); \ - asm(" push dp"); \ - asm(" .endif"); \ - asm(" push ir0"); \ - asm(" push ir1"); \ - asm(" push bk"); \ - asm(" push rs"); \ - asm(" push re"); \ - asm(" push rc"); \ - asm(" .if .tms320C40"); \ - asm(" push r9"); \ - asm(" pushf r9"); \ - asm(" push r10"); \ - asm(" pushf r10"); \ - asm(" push r11"); \ - asm(" pushf r11"); \ - asm(" .endif"); - -#define MACHINE_STATE_RESTORE(ID) \ - asm(" .if .tms320C40"); \ - asm(" popf r11"); \ - asm(" pop r11"); \ - asm(" popf r10"); \ - asm(" pop r10"); \ - asm(" popf r9"); \ - asm(" pop r9"); \ - asm(" .endif"); \ - asm(" pop rc"); \ - asm(" pop re"); \ - asm(" pop rs"); \ - asm(" pop bk"); \ - asm(" pop ir1"); \ - asm(" pop ir0"); \ - asm(" .if .BIGMODEL"); \ - asm(" pop dp"); \ - asm(" .endif"); \ - asm(" pop ar1"); \ - asm(" pop ar0"); \ - asm(" popf r3"); \ - asm(" pop r3"); \ - asm(" popf r2"); \ - asm(" pop r2"); \ - asm(" popf r1"); \ - asm(" pop r1"); \ - asm(" popf r0"); \ - asm(" pop r0"); \ - /* Implicit Calls to Library Routines. */ #define MULQI3_LIBCALL "__mulqi3" diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index 3133a51..af641b3 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -2735,137 +2735,6 @@ typedef struct machine_function function prologue. Normally, the profiling code comes after. */ /* #define PROFILE_BEFORE_PROLOGUE */ -/* A C statement or compound statement to output to FILE some assembler code to - initialize basic-block profiling for the current object module. The global - compile flag `profile_block_flag' distingishes two profile modes. - - profile_block_flag != 2' - Output code to call the subroutine `__bb_init_func' once per - object module, passing it as its sole argument the address of - a block allocated in the object module. - - The name of the block is a local symbol made with this - statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, - you can take a short cut in the definition of this macro and - use the name that you know will result. - - The first word of this block is a flag which will be nonzero - if the object module has already been initialized. So test - this word first, and do not call `__bb_init_func' if the flag - is nonzero. BLOCK_OR_LABEL contains a unique number which - may be used to generate a label as a branch destination when - `__bb_init_func' will not be called. - - Described in assembler language, the code to be output looks - like: - - cmp (LPBX0),0 - bne local_label - parameter1 <- LPBX0 - call __bb_init_func - local_label: - - profile_block_flag == 2' - Output code to call the subroutine `__bb_init_trace_func' and - pass two parameters to it. The first parameter is the same as - for `__bb_init_func'. The second parameter is the number of - the first basic block of the function as given by - BLOCK_OR_LABEL. Note that `__bb_init_trace_func' has to be - called, even if the object module has been initialized - already. - - Described in assembler language, the code to be output looks - like: - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func */ -/* #define FUNCTION_BLOCK_PROFILER (FILE, LABELNO) */ - -/* A C statement or compound statement to output to FILE some assembler code to - increment the count associated with the basic block number BLOCKNO. The - global compile flag `profile_block_flag' distingishes two profile modes. - - profile_block_flag != 2' - Output code to increment the counter directly. Basic blocks - are numbered separately from zero within each compilation. - The count associated with block number BLOCKNO is at index - BLOCKNO in a vector of words; the name of this array is a - local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, - you can take a short cut in the definition of this macro and - use the name that you know will result. - - Described in assembler language, the code to be output looks - like: - - inc (LPBX2+4*BLOCKNO) - - profile_block_flag == 2' - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func', which will increment the - counter. - - `__bb' consists of two words. In the first word, the current - basic block number, as given by BLOCKNO, has to be stored. In - the second word, the address of a block allocated in the - object module has to be stored. The address is given by the - label created with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Described in assembler language, the code to be output looks - like: - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func */ -/* #define BLOCK_PROFILER(FILE, BLOCKNO) */ - -/* A C statement or compound statement to output to FILE assembler - code to call function `__bb_trace_ret'. The assembler code should - only be output if the global compile flag `profile_block_flag' == - 2. This macro has to be used at every place where code for - returning from a function is generated (e.g. output_function_epilogue()). - Although you have to write the definition of output_function_epilogue() - as well, you have to define this macro to tell the compiler, that - the proper call to `__bb_trace_ret' is produced. */ -/* #define FUNCTION_BLOCK_PROFILER_EXIT(FILE) */ - -/* A C statement or compound statement to save all registers, which may be - clobbered by a function call, including condition codes. The `asm' - statement will be mostly likely needed to handle this task. Local labels in - the assembler code can be concatenated with the string ID, to obtain a - unique lable name. - - Registers or condition codes clobbered by output_function_prologue() - or output_function_epilogue() must be saved in the macros - `FUNCTION_BLOCK_PROFILER', FUNCTION_BLOCK_PROFILER_EXIT' and - `BLOCK_PROFILER' prior calling `__bb_init_trace_func', `__bb_trace_ret' - and `__bb_trace_func' respectively. */ -/* #define MACHINE_STATE_SAVE(ID) */ - -/* A C statement or compound statement to restore all registers, including - condition codes, saved by `MACHINE_STATE_SAVE'. - - Registers or condition codes clobbered by output_function_prologue() - or output_function_epilogue() must be restored in the macros - `FUNCTION_BLOCK_PROFILER', `FUNCTION_BLOCK_PROFILER_EXIT' and - `BLOCK_PROFILER' after calling `__bb_init_trace_func', `__bb_trace_ret' and - `__bb_trace_func' respectively. */ -/* #define MACHINE_STATE_RESTORE(ID) */ - -/* A C function or functions which are needed in the library to support block - profiling. */ -/* #define BLOCK_PROFILER_CODE */ - /* Implementing the Varargs Macros. */ diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index 1a6cb31..eb90c6b 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -330,7 +330,7 @@ fr30_expand_prologue () RTX_FRAME_RELATED_P (insn) = 1; } - if (profile_flag || profile_block_flag) + if (profile_flag) emit_insn (gen_blockage ()); } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f0126df..760a15c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3401,10 +3401,6 @@ ix86_can_use_return_insn_p () if (NON_SAVING_SETJMP && current_function_calls_setjmp) return 0; #endif -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - if (profile_block_flag == 2) - return 0; -#endif if (! reload_completed || frame_pointer_needed) return 0; @@ -4029,7 +4025,7 @@ ix86_expand_prologue () /* If we are profiling, make sure no instructions are scheduled before the call to mcount. However, if -fpic, the above call will have done that. */ - if ((profile_flag || profile_block_flag) && ! pic_reg_used) + if (profile_flag && ! pic_reg_used) emit_insn (gen_blockage ()); } @@ -4075,13 +4071,6 @@ ix86_expand_epilogue (style) offset -= 2; offset *= -UNITS_PER_WORD; -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - if (profile_block_flag == 2) - { - FUNCTION_BLOCK_PROFILER_EXIT; - } -#endif - /* If we're only restoring one register and sp is not valid then using a move instruction to restore the register since it's less work than reloading sp and popping the register. @@ -6406,252 +6395,6 @@ output_fp_compare (insn, operands, eflags_p, unordered_p) } } -/* Output assembler code to FILE to initialize basic-block profiling. - - If profile_block_flag == 2 - - Output code to call the subroutine `__bb_init_trace_func' - and pass two parameters to it. The first parameter is - the address of a block allocated in the object module. - The second parameter is the number of the first basic block - of the function. - - The name of the block is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - The number of the first basic block of the function is - passed to the macro in BLOCK_OR_LABEL. - - If described in a virtual assembler language the code to be - output looks like: - - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func - - else if profile_block_flag != 0 - - Output code to call the subroutine `__bb_init_func' - and pass one single parameter to it, which is the same - as the first parameter to `__bb_init_trace_func'. - - The first word of this parameter is a flag which will be nonzero if - the object module has already been initialized. So test this word - first, and do not call `__bb_init_func' if the flag is nonzero. - Note: When profile_block_flag == 2 the test need not be done - but `__bb_init_trace_func' *must* be called. - - BLOCK_OR_LABEL may be used to generate a label number as a - branch destination in case `__bb_init_func' will not be called. - - If described in a virtual assembler language the code to be - output looks like: - - cmp (LPBX0),0 - jne local_label - parameter1 <- LPBX0 - call __bb_init_func - local_label: -*/ - -void -ix86_output_function_block_profiler (file, block_or_label) - FILE *file; - int block_or_label; -{ - static int num_func = 0; - rtx xops[8]; - char block_table[80], false_label[80]; - - ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); - - xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); - xops[5] = stack_pointer_rtx; - xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ - - CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; - - switch (profile_block_flag) - { - case 2: - xops[2] = GEN_INT (block_or_label); - xops[3] = gen_rtx_MEM (Pmode, - gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_trace_func")); - xops[6] = GEN_INT (8); - - output_asm_insn ("push{l}\t%2", xops); - if (!flag_pic) - output_asm_insn ("push{l}\t%1", xops); - else - { - output_asm_insn ("lea{l}\t{%a1, %7|%7, %a1}", xops); - output_asm_insn ("push{l}\t%7", xops); - } - output_asm_insn ("call\t%P3", xops); - output_asm_insn ("add{l}\t{%6, %5|%5, %6}", xops); - break; - - default: - ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); - - xops[0] = const0_rtx; - xops[2] = gen_rtx_MEM (Pmode, - gen_rtx_SYMBOL_REF (VOIDmode, false_label)); - xops[3] = gen_rtx_MEM (Pmode, - gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_func")); - xops[4] = gen_rtx_MEM (Pmode, xops[1]); - xops[6] = GEN_INT (4); - - CONSTANT_POOL_ADDRESS_P (xops[2]) = TRUE; - - output_asm_insn ("cmp{l}\t{%0, %4|%4, %0}", xops); - output_asm_insn ("jne\t%2", xops); - - if (!flag_pic) - output_asm_insn ("push{l}\t%1", xops); - else - { - output_asm_insn ("lea{l}\t{%a1, %7|%7, %a2}", xops); - output_asm_insn ("push{l}\t%7", xops); - } - output_asm_insn ("call\t%P3", xops); - output_asm_insn ("add{l}\t{%6, %5|%5, %6}", xops); - ASM_OUTPUT_INTERNAL_LABEL (file, "LPBZ", num_func); - num_func++; - break; - } -} - -/* Output assembler code to FILE to increment a counter associated - with basic block number BLOCKNO. - - If profile_block_flag == 2 - - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func' which will increment the - counter. - - `__bb' consists of two words. In the first word the number - of the basic block has to be stored. In the second word - the address of a block allocated in the object module - has to be stored. - - The basic block number is given by BLOCKNO. - - The address of the block is given by the label created with - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - by FUNCTION_BLOCK_PROFILER. - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func - - Note that function `__bb_trace_func' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE - and MACHINE_STATE_RESTORE. The last two macros will be - used in the function `__bb_trace_func', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE. - - else if profile_block_flag != 0 - - Output code to increment the counter directly. - Basic blocks are numbered separately from zero within each - compiled object module. The count associated with block number - BLOCKNO is at index BLOCKNO in an array of words; the name of - this array is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - inc (LPBX2+4*BLOCKNO) -*/ - -void -ix86_output_block_profiler (file, blockno) - FILE *file ATTRIBUTE_UNUSED; - int blockno; -{ - rtx xops[8], cnt_rtx; - char counts[80]; - char *block_table = counts; - - switch (profile_block_flag) - { - case 2: - ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); - - xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); - xops[2] = GEN_INT (blockno); - xops[3] = gen_rtx_MEM (Pmode, - gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_func")); - xops[4] = gen_rtx_SYMBOL_REF (VOIDmode, "__bb"); - xops[5] = plus_constant (xops[4], 4); - xops[0] = gen_rtx_MEM (SImode, xops[4]); - xops[6] = gen_rtx_MEM (SImode, xops[5]); - - CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; - - output_asm_insn ("pushf", xops); - output_asm_insn ("mov{l}\t{%2, %0|%0, %2}", xops); - if (flag_pic) - { - xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ - output_asm_insn ("push{l}\t%7", xops); - output_asm_insn ("lea{l}\t{%a1, %7|%7, %a1}", xops); - output_asm_insn ("mov{l}\t{%7, %6|%6, %7}", xops); - output_asm_insn ("pop{l}\t%7", xops); - } - else - output_asm_insn ("mov{l}\t{%1, %6|%6, %1}", xops); - output_asm_insn ("call\t%P3", xops); - output_asm_insn ("popf", xops); - - break; - - default: - ASM_GENERATE_INTERNAL_LABEL (counts, "LPBX", 2); - cnt_rtx = gen_rtx_SYMBOL_REF (VOIDmode, counts); - SYMBOL_REF_FLAG (cnt_rtx) = TRUE; - - if (blockno) - cnt_rtx = plus_constant (cnt_rtx, blockno*4); - - if (flag_pic) - cnt_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, cnt_rtx); - - xops[0] = gen_rtx_MEM (SImode, cnt_rtx); - output_asm_insn ("inc{l}\t%0", xops); - - break; - } -} - void ix86_output_addr_vec_elt (file, value) FILE *file; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index d4abbbf..a7d7702 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1678,124 +1678,6 @@ typedef struct ix86_args { } \ } - -/* There are three profiling modes for basic blocks available. - The modes are selected at compile time by using the options - -a or -ax of the gnu compiler. - The variable `profile_block_flag' will be set according to the - selected option. - - profile_block_flag == 0, no option used: - - No profiling done. - - profile_block_flag == 1, -a option used. - - Count frequency of execution of every basic block. - - profile_block_flag == 2, -ax option used. - - Generate code to allow several different profiling modes at run time. - Available modes are: - Produce a trace of all basic blocks. - Count frequency of jump instructions executed. - In every mode it is possible to start profiling upon entering - certain functions and to disable profiling of some other functions. - - The result of basic-block profiling will be written to a file `bb.out'. - If the -ax option is used parameters for the profiling will be read - from file `bb.in'. - -*/ - -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. */ - -#undef FUNCTION_BLOCK_PROFILER -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ - ix86_output_function_block_profiler (FILE, BLOCK_OR_LABEL) - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. */ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - ix86_output_block_profiler (FILE, BLOCKNO) - -/* The following macro shall output rtl for the epilogue - to indicate a return from function during basic-block profiling. - - If profiling_block_flag == 2: - - Output assembler code to call function `__bb_trace_ret'. - - Note that function `__bb_trace_ret' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE - and MACHINE_STATE_RESTORE. The last two macros will be - used in the function `__bb_trace_ret', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE. - - else if profiling_block_flag != 0: - - The macro will not be used, so it need not distinguish - these cases. -*/ - -#define FUNCTION_BLOCK_PROFILER_EXIT \ -emit_call_insn (gen_call (gen_rtx_MEM (QImode, \ - gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")), \ - const0_rtx, constm1_rtx)) - -/* The function `__bb_trace_func' is called in every basic block - and is not allowed to change the machine state. Saving (restoring) - the state can either be done in the BLOCK_PROFILER macro, - before calling function (rsp. after returning from function) - `__bb_trace_func', or it can be done inside the function by - defining the macros: - - MACHINE_STATE_SAVE(ID) - MACHINE_STATE_RESTORE(ID) - - In the latter case care must be taken, that the prologue code - of function `__bb_trace_func' does not already change the - state prior to saving it with MACHINE_STATE_SAVE. - - The parameter `ID' is a string identifying a unique macro use. - - On the i386 the initialization code at the begin of - function `__bb_trace_func' contains a `sub' instruction - therefore we handle save and restore of the flag register - in the BLOCK_PROFILER macro. - - Note that ebx, esi, and edi are callee-save, so we don't have to - preserve them explicitly. */ - -#define MACHINE_STATE_SAVE(ID) \ -do { \ - register int eax_ __asm__("eax"); \ - register int ecx_ __asm__("ecx"); \ - register int edx_ __asm__("edx"); \ - __asm__ __volatile__ ("\ -push{l} %0\n\t\ -push{l} %1\n\t\ -push{l} %2" \ - : : "r"(eax_), "r"(ecx_), "r"(edx_)); \ -} while (0); - -#define MACHINE_STATE_RESTORE(ID) \ -do { \ - register int eax_ __asm__("eax"); \ - register int ecx_ __asm__("ecx"); \ - register int edx_ __asm__("edx"); \ - __asm__ __volatile__ ("\ -pop{l} %2\n\t\ -pop{l} %1\n\t\ -pop{l} %0" \ - : "=r"(eax_), "=r"(ecx_), "=r"(edx_)); \ -} while (0); - /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. The value is tested only in functions that have frame pointers. @@ -2315,7 +2197,7 @@ while (0) #define FINALIZE_PIC \ do \ { \ - current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \ + current_function_uses_pic_offset_table |= profile_flag; \ } \ while (0) diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index bea61c4..68d9eda 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -1308,7 +1308,7 @@ i960_output_function_prologue (file, size) epilogue_string[0] = '\0'; - if (profile_flag || profile_block_flag) + if (profile_flag) { /* When profiling, we may use registers 20 to 27 to save arguments, so they can't be used here for saving globals. J is the number of diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 11bac13..52b3ba6 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -1433,10 +1433,8 @@ ia64_compute_frame_size (size) Likwise for -a profiling for the bb_init_func argument. For -ax profiling, we need two output registers for the two bb_init_trace_func arguments. */ - if (profile_flag || profile_block_flag == 1) + if (profile_flag) i = MAX (i, 1); - else if (profile_block_flag == 2) - i = MAX (i, 2); current_frame_info.n_output_regs = i; /* ??? No rotating register support yet. */ diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index af1d52b..49e50a4 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1554,106 +1554,6 @@ do { \ fputs ("\tmov out2 = b0\n", FILE); \ fputs ("\tbr.call.sptk.many b0 = _mcount;;\n", FILE); \ } while (0) - -/* A C statement or compound statement to output to FILE some assembler code to - initialize basic-block profiling for the current object module. */ - -/* ??? Unclear if this will actually work. No way to test this currently. */ - -#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ -do { \ - int labelno = LABELNO; \ - switch (profile_block_flag) \ - { \ - case 2: \ - fputs ("\taddl r16 = @ltoff(LPBX0), gp\n", FILE); \ - fprintf (FILE, "\tmov out1 = %d;;\n", labelno); \ - fputs ("\tld8 out0 = [r16]\n", FILE); \ - fputs ("\tmov r17 = r1\n", FILE); \ - fputs ("\tmov r18 = b0\n", FILE); \ - fputs ("\tbr.call.sptk.many rp = __bb_init_trace_func;;\n", FILE);\ - fputs ("\tmov r1 = r17\n", FILE); \ - fputs ("\tmov b0 = r18;;\n", FILE); \ - break; \ - default: \ - fputs ("\taddl r16 = @ltoff(LPBX0), gp;;\n", FILE); \ - fputs ("\tld8 out0 = [r16];;\n", FILE); \ - fputs ("\tld8 r17 = [out0];;\n", FILE); \ - fputs ("\tcmp.eq p6, p0 = r0, r17;;\n", FILE); \ - fputs ("(p6)\tmov r16 = r1\n", FILE); \ - fputs ("(p6)\tmov r17 = b0\n", FILE); \ - fputs ("(p6)\tbr.call.sptk.many rp = __bb_init_func;;\n", FILE); \ - fputs ("(p6)\tmov r1 = r16\n", FILE); \ - fputs ("(p6)\tmov b0 = r17;;\n", FILE); \ - break; \ - } \ -} while (0) - -/* A C statement or compound statement to output to FILE some assembler code to - increment the count associated with the basic block number BLOCKNO. */ - -/* ??? This can't work unless we mark some registers as fixed, so that we - can use them as temporaries in this macro. We need two registers for -a - profiling and 4 registers for -ax profiling. */ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ -do { \ - int blockn = BLOCKNO; \ - switch (profile_block_flag) \ - { \ - case 2: \ - fputs ("\taddl r2 = @ltoff(__bb), gp\n", FILE); \ - fputs ("\taddl r3 = @ltoff(LPBX0), gp;;\n", FILE); \ - fprintf (FILE, "\tmov r9 = %d\n", blockn); \ - fputs ("\tld8 r2 = [r2]\n", FILE); \ - fputs ("\tld8 r3 = [r3];;\n", FILE); \ - fputs ("\tadd r8 = 8, r2\n", FILE); \ - fputs ("\tst8 [r2] = r9;;\n", FILE); \ - fputs ("\tst8 [r8] = r3\n", FILE); \ - fputs ("\tbr.call.sptk.many rp = __bb_trace_func\n", FILE); \ - break; \ - \ - default: \ - fputs ("\taddl r2 = @ltoff(LPBX2), gp;;\n", FILE); \ - fputs ("\tld8 r2 = [r2];;\n", FILE); \ - fprintf (FILE, "\taddl r2 = %d, r2;;\n", 8 * blockn); \ - fputs ("\tld8 r3 = [r2];;\n", FILE); \ - fputs ("\tadd r3 = 1, r3;;\n", FILE); \ - fputs ("\tst8 [r2] = r3;;\n", FILE); \ - break; \ - } \ -} while(0) - -/* A C statement or compound statement to output to FILE assembler - code to call function `__bb_trace_ret'. */ - -/* ??? Unclear if this will actually work. No way to test this currently. */ - -/* ??? This needs to be emitted into the epilogue. Perhaps rewrite to emit - rtl and call from ia64_expand_epilogue? */ - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ - fputs ("\tbr.call.sptk.many rp = __bb_trace_ret\n", FILE); -#undef FUNCTION_BLOCK_PROFILER_EXIT - -/* A C statement or compound statement to save all registers, which may be - clobbered by a function call, including condition codes. */ - -/* ??? We would have to save 20 GRs, 106 FRs, 10 PRs, 2 BRs, and possibly - other things. This is not practical. Perhaps leave this feature (-ax) - unsupported by undefining above macros? */ - -/* #define MACHINE_STATE_SAVE(ID) */ - -/* A C statement or compound statement to restore all registers, including - condition codes, saved by `MACHINE_STATE_SAVE'. */ - -/* ??? We would have to restore 20 GRs, 106 FRs, 10 PRs, 2 BRs, and possibly - other things. This is not practical. Perhaps leave this feature (-ax) - unsupported by undefining above macros? */ - -/* #define MACHINE_STATE_RESTORE(ID) */ - /* Implementing the Varargs Macros. */ diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 7c84821..cdb3f25 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -2013,7 +2013,7 @@ m32r_expand_prologue () if (frame_pointer_needed) emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx)); - if (profile_flag || profile_block_flag) + if (profile_flag) emit_insn (gen_blockage ()); } diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 8ac2f98..73b38fb 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1131,44 +1131,6 @@ typedef struct m68hc11_args for profiling a function entry. */ #define FUNCTION_PROFILER(FILE, LABELNO) \ asm_fprintf (FILE, "\tldy\t.LP%d\n\tjsr mcount\n", (LABELNO)) - -/* Output assembler code to FILE to initialize this source file's - basic block profiling info, if that has not already been done. */ -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ - m68hc11_function_block_profiler(FILE, BLOCK_OR_LABEL) - -/* Output assembler code to FILE to increment the counter for - the BLOCKNO'th basic block in this source file. */ -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - m68hc11_block_profiler(FILE, BLOCKNO) - -/* Output assembler code to FILE to indicate return from - a function during basic block profiling. */ -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ - asm_fprintf (FILE, "\tjsr %U__bb_trace_ret\n"); - -/* Save all registers which may be clobbered by a function call. - MACHINE_STATE_SAVE and MACHINE_STATE_RESTORE are target-code macros, - used in libgcc2.c. They may not refer to TARGET_* macros !!! - - We don't need to save the CCR nor the soft registers because - they will be saved by gcc. */ -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("pshy"); \ - asm ("pshx"); \ - asm ("psha"); \ - asm ("pshb"); \ - } - -#define MACHINE_STATE_RESTORE(id) \ - { \ - asm ("pulb"); \ - asm ("pula"); \ - asm ("pulx"); \ - asm ("puly"); \ - } - /* Length in units of the trampoline for entering a nested function. */ #define TRAMPOLINE_SIZE (TARGET_M6811 ? 11 : 9) diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 38475f7..f893203 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1185,13 +1185,6 @@ m68k_output_function_epilogue (stream, size) return; } -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - if (profile_block_flag == 2) - { - FUNCTION_BLOCK_PROFILER_EXIT (stream); - } -#endif - #ifdef FUNCTION_EXTRA_EPILOGUE FUNCTION_EXTRA_EPILOGUE (stream, size); #endif diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index b0e0e25..65a34ee 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -1092,168 +1092,6 @@ extern enum reg_class regno_reg_class[]; #define FUNCTION_PROFILER(FILE, LABELNO) \ asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO)) -/* Output assembler code to FILE to initialize this source file's - basic block profiling info, if that has not already been done. */ - -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ -do \ - { \ - switch (profile_block_flag) \ - { \ - case 2: \ - asm_fprintf (FILE, "\tpea %d\n\tpea %LLPBX0\n\tjsr %U__bb_init_trace_func\n\taddql %I8,%Rsp\n", \ - (BLOCK_OR_LABEL)); \ - break; \ - \ - default: \ - asm_fprintf (FILE, "\ttstl %LLPBX0\n\tbne %LLPI%d\n\tpea %LLPBX0\n\tjsr %U__bb_init_func\n\taddql %I4,%Rsp\n%LLPI%d:\n", \ - (BLOCK_OR_LABEL), (BLOCK_OR_LABEL)); \ - break; \ - } \ - } \ -while(0) - -/* Output assembler code to FILE to increment the counter for - the BLOCKNO'th basic block in this source file. */ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ -do \ - { \ - switch (profile_block_flag) \ - { \ - case 2: \ - asm_fprintf (FILE, "\tmovel %Ra1,%Rsp@-\n\tlea ___bb,%Ra1\n\tmovel %I%d,%Ra1@(0)\n\tmovel %I%LLPBX0,%Ra1@(4)\n\tmovel %Rsp@+,%Ra1\n\tjsr %U__bb_trace_func\n", \ - BLOCKNO); \ - break; \ - \ - default: \ - asm_fprintf (FILE, "\taddql %I1,%LLPBX2+%d\n", 4 * BLOCKNO); \ - break; \ - } \ - } \ -while(0) - -/* Output assembler code to FILE to indicate return from - a function during basic block profiling. */ - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ - asm_fprintf (FILE, "\tjsr %U__bb_trace_ret\n"); - -/* Save all registers which may be clobbered by a function call. - MACHINE_STATE_SAVE and MACHINE_STATE_RESTORE are target-code macros, - used in libgcc2.c. They may not refer to TARGET_* macros !!! */ -#if defined (__mc68010__) || defined(mc68010) \ - || defined(__mc68020__) || defined(mc68020) \ - || defined(__mc68030__) || defined(mc68030) \ - || defined(__mc68040__) || defined(mc68040) \ - || defined(__mcpu32__) || defined(mcpu32) -#define MACHINE_STATE_m68010_up -#endif - -#ifdef MOTOROLA -#if defined(__mcf5200__) -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("sub.l 20,%sp"); \ - asm ("movm.l &0x0303,4(%sp)"); \ - asm ("move.w %ccr,%d0"); \ - asm ("movm.l &0x0001,(%sp)"); \ - } -#else /* !__mcf5200__ */ -#if defined(MACHINE_STATE_m68010_up) -#ifdef __HPUX_ASM__ -/* HPUX assembler does not accept %ccr. */ -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("move.w %cc,-(%sp)"); \ - asm ("movm.l &0xc0c0,-(%sp)"); \ - } -#else /* ! __HPUX_ASM__ */ -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("move.w %ccr,-(%sp)"); \ - asm ("movm.l &0xc0c0,-(%sp)"); \ - } -#endif /* __HPUX_ASM__ */ -#else /* !MACHINE_STATE_m68010_up */ -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("move.w %sr,-(%sp)"); \ - asm ("movm.l &0xc0c0,-(%sp)"); \ - } -#endif /* MACHINE_STATE_m68010_up */ -#endif /* __mcf5200__ */ -#else /* !MOTOROLA */ -#if defined(__mcf5200__) -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("subl %#20,%/sp" : ); \ - asm ("movml %/d0/%/d1/%/a0/%/a1,%/sp@(4)" : ); \ - asm ("movew %/cc,%/d0" : ); \ - asm ("movml %/d0,%/sp@" : ); \ - } -#else /* !__mcf5200__ */ -#if defined(MACHINE_STATE_m68010_up) -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("movew %/cc,%/sp@-" : ); \ - asm ("moveml %/d0/%/d1/%/a0/%/a1,%/sp@-" : ); \ - } -#else /* !MACHINE_STATE_m68010_up */ -#define MACHINE_STATE_SAVE(id) \ - { \ - asm ("movew %/sr,%/sp@-" : ); \ - asm ("moveml %/d0/%/d1/%/a0/%/a1,%/sp@-" : ); \ - } -#endif /* MACHINE_STATE_m68010_up */ -#endif /* __mcf5200__ */ -#endif /* MOTOROLA */ - -/* Restore all registers saved by MACHINE_STATE_SAVE. */ - -#ifdef MOTOROLA -#if defined(__mcf5200__) -#define MACHINE_STATE_RESTORE(id) \ - { \ - asm ("movm.l (%sp),&0x0001"); \ - asm ("move.w %d0,%ccr"); \ - asm ("movm.l 4(%sp),&0x0303"); \ - asm ("add.l 20,%sp"); \ - } -#else /* !__mcf5200__ */ -#ifdef __HPUX_ASM__ -/* HPUX assembler does not accept %ccr. */ -#define MACHINE_STATE_RESTORE(id) \ - { \ - asm ("movm.l (%sp)+,&0x0303"); \ - asm ("move.w (%sp)+,%cc"); \ - } -#else /* ! __HPUX_ASM__ */ -#define MACHINE_STATE_RESTORE(id) \ - { \ - asm ("movm.l (%sp)+,&0x0303"); \ - asm ("move.w (%sp)+,%ccr"); \ - } -#endif /* __HPUX_ASM__ */ -#endif /* __mcf5200__ */ -#else /* !MOTOROLA */ -#if defined(__mcf5200__) -#define MACHINE_STATE_RESTORE(id) \ - { \ - asm ("movml %/sp@,%/d0" : ); \ - asm ("movew %/d0,%/cc" : ); \ - asm ("movml %/sp@(4),%/d0/%/d1/%/a0/%/a1" : ); \ - asm ("addl %#20,%/sp" : ); \ - } -#else /* !__mcf5200__ */ -#define MACHINE_STATE_RESTORE(id) \ - { \ - asm ("moveml %/sp@+,%/d0/%/d1/%/a0/%/a1" : ); \ - asm ("movew %/sp@+,%/cc" : ); \ - } -#endif /* __mcf5200__ */ -#endif /* MOTOROLA */ - /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. The value is tested only in functions that have frame pointers. diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 6dc4340..05a22f7 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -1560,9 +1560,6 @@ output_options (file, f_options, f_len, W_options, W_len, pos = output_option (file, sep, "-traditional", "", indent, pos, max); if (profile_flag) pos = output_option (file, sep, "-p", "", indent, pos, max); - if (profile_block_flag) - pos = output_option (file, sep, "-a", "", indent, pos, max); - for (j = 0; j < f_len; j++) if (*f_options[j].variable == f_options[j].on_value) pos = output_option (file, sep, "-f", f_options[j].string, @@ -1820,7 +1817,7 @@ m88k_layout_frame () frame_size = get_frame_size (); /* Since profiling requires a call, make sure r1 is saved. */ - if (profile_flag || profile_block_flag) + if (profile_flag) save_regs[1] = 1; /* If we are producing debug information, store r1 and r30 where the @@ -2031,7 +2028,7 @@ m88k_expand_prologue () if (! save_regs[1]) emit_move_insn (return_reg, temp_reg); } - if (profile_flag || profile_block_flag) + if (profile_flag) emit_insn (gen_blockage ()); } diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 698f4b8..c47619d 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1555,19 +1555,10 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, else if (GET_CODE (RTX) == NOTE \ && NOTE_LINE_NUMBER (RTX) == NOTE_INSN_PROLOGUE_END) \ { \ - if (profile_block_flag) \ - LENGTH += FUNCTION_BLOCK_PROFILER_LENGTH; \ if (profile_flag) \ LENGTH += (FUNCTION_PROFILER_LENGTH + REG_PUSH_LENGTH \ + REG_POP_LENGTH); \ } \ - else if (profile_block_flag \ - && (GET_CODE (RTX) == CODE_LABEL \ - || GET_CODE (RTX) == JUMP_INSN \ - || (GET_CODE (RTX) == INSN \ - && GET_CODE (PATTERN (RTX)) == SEQUENCE \ - && GET_CODE (XVECEXP (PATTERN (RTX), 0, 0)) == JUMP_INSN)))\ - LENGTH += BLOCK_PROFILER_LENGTH; /* Track the state of the last volatile memory reference. Clear the state with CC_STATUS_INIT for now. */ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index ac29ac9..1d79f8e 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -7505,7 +7505,7 @@ mips_expand_prologue () /* If we are profiling, make sure no instructions are scheduled before the call to mcount. */ - if (profile_flag || profile_block_flag) + if (profile_flag) emit_insn (gen_blockage ()); } diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 6f76793..4fcc27e 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -771,26 +771,6 @@ typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS; #define FUNCTION_PROFILER(FILE, LABELNO) \ mmix_function_profiler (FILE, LABELNO) -#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ - mmix_function_block_profiler (FILE, LABELNO) - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - mmix_block_profiler (FILE, BLOCKNO) - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ - mmix_function_block_profiler_exit PARAMS ((FILE *)); - -#define MACHINE_STATE_SAVE(ID) \ - __asm__ ("SAVE $255,0 \n\t" \ - "SUBU $254,$254,8 \n\t" \ - "STOU $255,$254,0") - -#define MACHINE_STATE_RESTORE(ID) \ - __asm__ ("LDOU $255,$254,0 \n\t" \ - "UNSAVE $255,0") - - - /* Node: Varargs */ /* For the moment, let's stick to pushing argument registers on the stack. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index bbc0294..fe358c0 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -52,8 +52,6 @@ Boston, MA 02111-1307, USA. */ #define TARGET_NO_PROTOTYPE 0 #endif -extern int profile_block_flag; - #define min(A,B) ((A) < (B) ? (A) : (B)) #define max(A,B) ((A) > (B) ? (A) : (B)) @@ -380,8 +378,6 @@ rs6000_override_options (default_cpu) /* Save current -mstring/-mno-string status. */ int string = TARGET_STRING; - profile_block_flag = 0; - /* Identify the processor type. */ rs6000_select[0].string = default_cpu; rs6000_cpu = TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT; diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 42c1a5d..34945b0 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -2495,17 +2495,6 @@ s390_function_prologue (file, lsize) /* Profile code (-p, -a, -ax needs some literals). */ - if (profile_block_flag && !TARGET_64BIT) - { - s390_profile[0] = s390_force_const_mem_symbol ("__bb_init_func", 1, 1); - s390_profile[1] = s390_force_const_mem_symbol ("__bb_init_trace_func", 1, 1); - s390_profile[2] = s390_force_const_mem_symbol ("__bb_trace_func", 1, 1); - s390_profile[3] = s390_force_const_mem_symbol ("__bb_trace_ret", 1, 1); - s390_profile[5] = s390_force_const_mem_symbol ("__bb", 0, 1); - s390_profile[6] = s390_force_const_mem_symbol (".LPBX0", 0, 0); - s390_profile[7] = s390_force_const_mem_symbol (".LPBX2", 0, 0); - } - if (profile_flag && !TARGET_64BIT) { static char label[128]; diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index c4fd6fb..12ebceb 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -855,451 +855,6 @@ do { \ /* #define PROFILE_BEFORE_PROLOGUE */ -/* There are three profiling modes for basic blocks available. - The modes are selected at compile time by using the options - -a or -ax of the gnu compiler. - The variable `profile_block_flag' will be set according to the - selected option. - - profile_block_flag == 0, no option used: - - No profiling done. - - profile_block_flag == 1, -a option used. - - Count frequency of execution of every basic block. - - profile_block_flag == 2, -ax option used. - - Generate code to allow several different profiling modes at run time. - Available modes are: - Produce a trace of all basic blocks. - Count frequency of jump instructions executed. - In every mode it is possible to start profiling upon entering - certain functions and to disable profiling of some other functions. - - The result of basic-block profiling will be written to a file `bb.out'. - If the -ax option is used parameters for the profiling will be read - from file `bb.in'. - -*/ - -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. - - If profile_block_flag == 2 - - Output code to call the subroutine `__bb_init_trace_func' - and pass two parameters to it. The first parameter is - the address of a block allocated in the object module. - The second parameter is the number of the first basic block - of the function. - - The name of the block is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - The number of the first basic block of the function is - passed to the macro in BLOCK_OR_LABEL. - - If described in a virtual assembler language the code to be - output looks like: - - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func - - else if profile_block_flag != 0 - - Output code to call the subroutine `__bb_init_func' - and pass one single parameter to it, which is the same - as the first parameter to `__bb_init_trace_func'. - - The first word of this parameter is a flag which will be nonzero if - the object module has already been initialized. So test this word - first, and do not call `__bb_init_func' if the flag is nonzero. - Note: When profile_block_flag == 2 the test need not be done - but `__bb_init_trace_func' *must* be called. - - BLOCK_OR_LABEL may be used to generate a label number as a - branch destination in case `__bb_init_func' will not be called. - - If described in a virtual assembler language the code to be - output looks like: - - cmp (LPBX0),0 - jne local_label - parameter1 <- LPBX0 - call __bb_init_func -local_label: - -*/ - -#undef FUNCTION_BLOCK_PROFILER -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ -do \ - { \ - if (TARGET_64BIT) \ - { \ - rtx tmp[1]; \ - fprintf (FILE, "# function block profiler %d \n", profile_block_flag); \ - output_asm_insn ("ipm 0", tmp); \ - output_asm_insn ("aghi 15,-224", tmp); \ - output_asm_insn ("stmg 14,5,160(15)", tmp); \ - output_asm_insn ("larl 2,.LPBX0", tmp); \ - switch (profile_block_flag) \ - { \ - case 2: \ - if (BLOCK_OR_LABEL < 0x10000) { \ - tmp[0] = gen_rtx_CONST_INT (Pmode, (BLOCK_OR_LABEL)); \ - output_asm_insn ("llill 3,%x0", tmp); \ - } else { \ - int bo = BLOCK_OR_LABEL; \ - tmp[0] = gen_rtx_CONST_INT (Pmode, bo&0x7fff); \ - output_asm_insn ("llill 3,%x0", tmp); \ - tmp[0] = gen_rtx_CONST_INT (Pmode, (bo&0xffff0000)>>16); \ - output_asm_insn ("iilh 3,%x0", tmp); \ - } \ - tmp[0] = gen_rtx_SYMBOL_REF (Pmode, "__bb_init_trace_func"); \ - if (flag_pic) \ - { \ - tmp[0] = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, tmp[0]), 113); \ - tmp[0] = gen_rtx_CONST (Pmode, tmp[0]); \ - } \ - output_asm_insn ("brasl\t14,%0", tmp); \ - break; \ - default: \ - output_asm_insn ("cli 7(2),0", tmp); \ - output_asm_insn ("jne 2f", tmp); \ - tmp[0] = gen_rtx_SYMBOL_REF (Pmode, "__bb_init_func"); \ - if (flag_pic) \ - { \ - tmp[0] = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, tmp[0]), 113); \ - tmp[0] = gen_rtx_CONST (Pmode, tmp[0]); \ - } \ - output_asm_insn ("brasl\t14,%0", tmp); \ - break; \ - } \ - output_asm_insn ("2:", tmp); \ - output_asm_insn ("lmg 14,5,160(15)", tmp); \ - output_asm_insn ("aghi 15,224", tmp); \ - output_asm_insn ("spm 0", tmp); \ - } \ - else \ - { \ - extern rtx s390_profile[]; \ - fprintf (FILE, "# function block profiler %d \n", profile_block_flag); \ - output_asm_insn ("ipm 0", s390_profile); \ - output_asm_insn ("ahi 15,-128", s390_profile); \ - output_asm_insn ("stm 14,5,96(15)", s390_profile); \ - output_asm_insn ("l 2,%6", s390_profile); \ - if (flag_pic) \ - output_asm_insn ("ar 2,13", s390_profile); \ - switch (profile_block_flag) \ - { \ - case 2: \ - output_asm_insn ("l 4,%1", s390_profile); \ - if (BLOCK_OR_LABEL < 0x8000) { \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, (BLOCK_OR_LABEL)); \ - output_asm_insn ("lhi 3,%8", s390_profile); \ - } else { \ - int bo = BLOCK_OR_LABEL; \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, (bo&0xffff8000)>>15); \ - output_asm_insn ("lhi 3,%8", s390_profile); \ - output_asm_insn ("sll 3,15", s390_profile); \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, bo&0x7fff); \ - output_asm_insn ("ahi 3,%8", s390_profile); \ - } \ - break; \ - default: \ - output_asm_insn ("l 4,%0", s390_profile); \ - output_asm_insn ("cli 3(2),0", s390_profile); \ - output_asm_insn ("jne 2f", s390_profile); \ - break; \ - } \ - if (flag_pic) \ - output_asm_insn ("bas 14,0(4,13)", s390_profile); \ - else \ - output_asm_insn ("basr 14,4", s390_profile); \ - output_asm_insn ("2:", s390_profile); \ - output_asm_insn ("lm 14,5,96(15)", s390_profile); \ - output_asm_insn ("ahi 15,128", s390_profile); \ - output_asm_insn ("spm 0", s390_profile); \ - } \ - } while (0) - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. - - If profile_block_flag == 2 - - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func' which will increment the - counter. - - `__bb' consists of two words. In the first word the number - of the basic block has to be stored. In the second word - the address of a block allocated in the object module - has to be stored. - - The basic block number is given by BLOCKNO. - - The address of the block is given by the label created with - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - by FUNCTION_BLOCK_PROFILER. - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func - - Note that function `__bb_trace_func' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE - and MACHINE_STATE_RESTORE. The last two macros will be - used in the function `__bb_trace_func', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE. - - else if profile_block_flag != 0 - - Output code to increment the counter directly. - Basic blocks are numbered separately from zero within each - compiled object module. The count associated with block number - BLOCKNO is at index BLOCKNO in an array of words; the name of - this array is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - inc (LPBX2+4*BLOCKNO) - -*/ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ -do \ - { \ - if (TARGET_64BIT) \ - { \ - rtx tmp[1]; \ - fprintf (FILE, "# block profiler %d block %d \n", \ - profile_block_flag, BLOCKNO); \ - output_asm_insn ("ipm 14", tmp); \ - output_asm_insn ("aghi 15,-224", tmp); \ - output_asm_insn ("stmg 14,5,160(15)", tmp); \ - output_asm_insn ("larl 2,_bb", tmp); \ - if ((BLOCKNO*8) < 0x10000) { \ - tmp[0] = gen_rtx_CONST_INT (Pmode, (BLOCKNO*8)); \ - output_asm_insn ("llill 3,%x0", tmp); \ - } else { \ - int bo = BLOCKNO*8; \ - tmp[0] = gen_rtx_CONST_INT (Pmode, bo&0xffff); \ - output_asm_insn ("llill 3,%x0", tmp); \ - tmp[0] = gen_rtx_CONST_INT (Pmode, (bo&0xffff0000)>>16); \ - output_asm_insn ("iilh 3,%x0", tmp); \ - } \ - switch (profile_block_flag) \ - { \ - case 2: \ - output_asm_insn ("stg 3,0(2)", tmp); \ - output_asm_insn ("larl 3,.LPBX0", tmp); \ - output_asm_insn ("stg 3,0(2)", tmp); \ - tmp[0] = gen_rtx_SYMBOL_REF (Pmode, "__bb_trace_func"); \ - if (flag_pic) \ - { \ - tmp[0] = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, tmp[0]), 113); \ - tmp[0] = gen_rtx_CONST (Pmode, tmp[0]); \ - } \ - output_asm_insn ("brasl\t14,%0", tmp); \ - break; \ - default: \ - output_asm_insn ("larl 2,.LPBX2", tmp); \ - output_asm_insn ("la 2,0(2,3)", tmp); \ - output_asm_insn ("lg 3,0(2)", tmp); \ - output_asm_insn ("aghi 3,1", tmp); \ - output_asm_insn ("stg 3,0(2)", tmp); \ - break; \ - } \ - output_asm_insn ("lmg 14,5,160(15)", tmp); \ - output_asm_insn ("ahi 15,224", tmp); \ - output_asm_insn ("spm 14", tmp); \ - } \ - else \ - { \ - extern rtx s390_profile[]; \ - fprintf (FILE, "# block profiler %d block %d \n", \ - profile_block_flag,BLOCKNO); \ - output_asm_insn ("ipm 14", s390_profile); \ - output_asm_insn ("ahi 15,-128", s390_profile); \ - output_asm_insn ("stm 14,5,96(15)", s390_profile); \ - switch (profile_block_flag) \ - { \ - case 2: \ - output_asm_insn ("l 4,%2", s390_profile); \ - output_asm_insn ("l 2,%5", s390_profile); \ - if (flag_pic) \ - output_asm_insn ("ar 2,13", s390_profile); \ - if (BLOCKNO < 0x8000) { \ - s390_profile[7] = gen_rtx_CONST_INT (Pmode, (BLOCKNO)*4); \ - output_asm_insn ("lhi 3,%8", s390_profile); \ - } else { \ - int bo = BLOCKNO; \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, (bo&0xffff8000)>>15); \ - output_asm_insn ("lhi 3,%8", s390_profile); \ - output_asm_insn ("sll 3,15", s390_profile); \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, bo&0x7fff); \ - output_asm_insn ("ahi 3,%7", s390_profile); \ - } \ - output_asm_insn ("st 3,0(2)", s390_profile); \ - output_asm_insn ("mvc 0(4,2),%5", s390_profile); \ - if (flag_pic) \ - output_asm_insn ("bas 14,0(4,13)", s390_profile); \ - else \ - output_asm_insn ("basr 14,4", s390_profile); \ - break; \ - default: \ - if (BLOCKNO < 0x2000) { \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, (BLOCKNO)*4); \ - output_asm_insn ("lhi 2,%8", s390_profile); \ - } else { \ - int bo = BLOCKNO*4; \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, (bo&0xffff8000)>>15); \ - output_asm_insn ("lhi 2,%8", s390_profile); \ - output_asm_insn ("sll 2,15", s390_profile); \ - s390_profile[8] = gen_rtx_CONST_INT (Pmode, bo&0x7fff); \ - output_asm_insn ("ahi 2,%8", s390_profile); \ - } \ - output_asm_insn ("a 2,%7", s390_profile); \ - if (flag_pic) \ - output_asm_insn ("l 3,0(2,13)", s390_profile); \ - else \ - output_asm_insn ("l 3,0(2)", s390_profile); \ - output_asm_insn ("ahi 3,1", s390_profile); \ - if (flag_pic) \ - output_asm_insn ("st 3,0(2,13)", s390_profile); \ - else \ - output_asm_insn ("st 3,0(2)", s390_profile); \ - break; \ - } \ - output_asm_insn ("lm 14,5,96(15)", s390_profile); \ - output_asm_insn ("ahi 15,128", s390_profile); \ - output_asm_insn ("spm 14", s390_profile); \ - } \ - } while (0) - - -/* The following macro shall output assembler code to FILE - to indicate a return from function during basic-block profiling. - - If profiling_block_flag == 2: - - Output assembler code to call function `__bb_trace_ret'. - - Note that function `__bb_trace_ret' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE_RET - and MACHINE_STATE_RESTORE_RET. The last two macros will be - used in the function `__bb_trace_ret', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE_RET. - - else if profiling_block_flag != 0: - - The macro will not be used, so it need not distinguish - these cases. -*/ - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ -do { \ - if (TARGET_64BIT) \ - { \ - rtx tmp[1]; \ - fprintf (FILE, "# block profiler exit \n"); \ - output_asm_insn ("ipm 14", tmp); \ - output_asm_insn ("aghi 15,-224", tmp); \ - output_asm_insn ("stmg 14,5,160(15)", tmp); \ - tmp[0] = gen_rtx_SYMBOL_REF (Pmode, "__bb_trace_ret"); \ - if (flag_pic) \ - { \ - tmp[0] = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, tmp[0]), 113); \ - tmp[0] = gen_rtx_CONST (Pmode, tmp[0]); \ - } \ - output_asm_insn ("brasl 14,%0", tmp); \ - output_asm_insn ("lmg 14,5,160(15)", tmp); \ - output_asm_insn ("aghi 15,224", tmp); \ - output_asm_insn ("spm 14", tmp); \ - } \ - else \ - { \ - extern rtx s390_profile[]; \ - fprintf (FILE, "# block profiler exit \n"); \ - output_asm_insn ("ipm 14", s390_profile); \ - output_asm_insn ("ahi 15,-128", s390_profile); \ - output_asm_insn ("stm 14,5,96(15)", s390_profile); \ - output_asm_insn ("l 4,%3", s390_profile); \ - if (flag_pic) \ - output_asm_insn ("bas 14,0(4,13)", s390_profile); \ - else \ - output_asm_insn ("basr 14,4", s390_profile); \ - output_asm_insn ("lm 14,5,96(15)", s390_profile); \ - output_asm_insn ("ahi 15,128", s390_profile); \ - output_asm_insn ("spm 14", s390_profile); \ - } \ - } while (0) - -/* The function `__bb_trace_func' is called in every basic block - and is not allowed to change the machine state. Saving (restoring) - the state can either be done in the BLOCK_PROFILER macro, - before calling function (rsp. after returning from function) - `__bb_trace_func', or it can be done inside the function by - defining the macros: - - MACHINE_STATE_SAVE(ID) - MACHINE_STATE_RESTORE(ID) - - In the latter case care must be taken, that the prologue code - of function `__bb_trace_func' does not already change the - state prior to saving it with MACHINE_STATE_SAVE. - - The parameter `ID' is a string identifying a unique macro use. - - On the s390 all save/restore is done in macros above -*/ - -/* -#define MACHINE_STATE_SAVE(ID) \ - fprintf (FILE, "\tahi 15,-128 # save state\n"); \ - fprintf (FILE, "\tstm 14,5,96(15)\n"); \ - -#define MACHINE_STATE_RESTORE(ID) \ - fprintf (FILE, "\tlm 14,5,96(15) # restore state\n"); \ - fprintf (FILE, "\tahi 15,128\n"); \ -*/ - - /* Define EXIT_IGNORE_STACK if, when returning from a function, the stack pointer does not matter (provided there is a frame pointer). */ diff --git a/gcc/config/sparc/linux-aout.h b/gcc/config/sparc/linux-aout.h index 04ebb8c..55c833f 100644 --- a/gcc/config/sparc/linux-aout.h +++ b/gcc/config/sparc/linux-aout.h @@ -96,21 +96,3 @@ Boston, MA 02111-1307, USA. */ #define ASM_SPEC \ "%{V} %{v:%{!V:-V}} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}" -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index 53fbf7f..dff005b 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -243,21 +243,3 @@ do { \ #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 #endif -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index 9785869..62f0c74 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -368,23 +368,3 @@ do { \ /* #define DWARF_OFFSET_SIZE PTR_SIZE */ -#if TARGET_ARCH32 -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); -#endif /* sparc32 */ diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index aeb5f7e..9f6e38c 100644 --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -225,27 +225,6 @@ Boston, MA 02111-1307, USA. */ #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_EPILOGUE + MASK_FPU + MASK_V8PLUS + MASK_LONG_DOUBLE_128) -#if TARGET_ARCH32 -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); -#endif /* sparc32 */ - /* * Attempt to turn on access permissions for the stack. * diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 541bb8b..4f9070f 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -404,7 +404,7 @@ sparc_override_options () /* Do various machine dependent initializations. */ sparc_init_modes (); - if ((profile_flag || profile_block_flag) + if ((profile_flag) && sparc_cmodel != CM_32 && sparc_cmodel != CM_MEDLOW) { error ("profiling does not support code models other than medlow"); @@ -2525,7 +2525,7 @@ eligible_for_sibcall_delay (trial) if (GET_CODE (trial) != INSN || GET_CODE (PATTERN (trial)) != SET) return 0; - if (get_attr_length (trial) != 1 || profile_block_flag == 2) + if (get_attr_length (trial) != 1) return 0; pat = PATTERN (trial); @@ -3645,14 +3645,7 @@ sparc_nonflat_function_epilogue (file, size, leaf_function) final_scan_insn (get_last_insn (), file, 0, 0, 1); } -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - else if (profile_block_flag == 2) - { - FUNCTION_BLOCK_PROFILER_EXIT(file); - } -#endif - - else if (current_function_epilogue_delay_list == 0) + if (current_function_epilogue_delay_list == 0) { /* If code does not drop into the epilogue, we need do nothing except output pending case vectors. */ @@ -8433,281 +8426,6 @@ sparc_function_profiler (file, labelno) } -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. - - If profile_block_flag == 2 - - Output code to call the subroutine `__bb_init_trace_func' - and pass two parameters to it. The first parameter is - the address of a block allocated in the object module. - The second parameter is the number of the first basic block - of the function. - - The name of the block is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - The number of the first basic block of the function is - passed to the macro in BLOCK_OR_LABEL. - - If described in a virtual assembler language the code to be - output looks like: - - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func - - else if profile_block_flag != 0 - - Output code to call the subroutine `__bb_init_func' - and pass one single parameter to it, which is the same - as the first parameter to `__bb_init_trace_func'. - - The first word of this parameter is a flag which will be nonzero if - the object module has already been initialized. So test this word - first, and do not call `__bb_init_func' if the flag is nonzero. - Note: When profile_block_flag == 2 the test need not be done - but `__bb_init_trace_func' *must* be called. - - BLOCK_OR_LABEL may be used to generate a label number as a - branch destination in case `__bb_init_func' will not be called. - - If described in a virtual assembler language the code to be - output looks like: - - cmp (LPBX0),0 - jne local_label - parameter1 <- LPBX0 - call __bb_init_func - local_label: - -*/ - -void -sparc_function_block_profiler(file, block_or_label) - FILE *file; - int block_or_label; -{ - char LPBX[32]; - ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0); - - if (profile_block_flag == 2) - { - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fputs ("), %o0\n", file); - - fprintf (file, "\tsethi\t%%hi(%d), %%o1\n", block_or_label); - - fputs ("\tor\t%o0, %lo(", file); - assemble_name (file, LPBX); - fputs ("), %o0\n", file); - - fprintf (file, "\tcall\t%s__bb_init_trace_func\n", user_label_prefix); - - fprintf (file, "\t or\t%%o1, %%lo(%d), %%o1\n", block_or_label); - } - else if (profile_block_flag != 0) - { - char LPBY[32]; - ASM_GENERATE_INTERNAL_LABEL (LPBY, "LPBY", block_or_label); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fputs ("), %o0\n", file); - - fputs ("\tld\t[%lo(", file); - assemble_name (file, LPBX); - fputs (")+%o0], %o1\n", file); - - fputs ("\ttst\t%o1\n", file); - - if (TARGET_V9) - { - fputs ("\tbne,pn\t%icc,", file); - assemble_name (file, LPBY); - putc ('\n', file); - } - else - { - fputs ("\tbne\t", file); - assemble_name (file, LPBY); - putc ('\n', file); - } - - fputs ("\t or\t%o0, %lo(", file); - assemble_name (file, LPBX); - fputs ("), %o0\n", file); - - fprintf (file, "\tcall\t%s__bb_init_func\n\t nop\n", user_label_prefix); - - ASM_OUTPUT_INTERNAL_LABEL (file, "LPBY", block_or_label); - } -} - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. - - If profile_block_flag == 2 - - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func' which will increment the - counter. - - `__bb' consists of two words. In the first word the number - of the basic block has to be stored. In the second word - the address of a block allocated in the object module - has to be stored. - - The basic block number is given by BLOCKNO. - - The address of the block is given by the label created with - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - by FUNCTION_BLOCK_PROFILER. - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func - - Note that function `__bb_trace_func' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE - and MACHINE_STATE_RESTORE. The last two macros will be - used in the function `__bb_trace_func', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE. - - else if profile_block_flag != 0 - - Output code to increment the counter directly. - Basic blocks are numbered separately from zero within each - compiled object module. The count associated with block number - BLOCKNO is at index BLOCKNO in an array of words; the name of - this array is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language, the code to be - output looks like: - - inc (LPBX2+4*BLOCKNO) - -*/ - -void -sparc_block_profiler(file, blockno) - FILE *file; - int blockno; -{ - char LPBX[32]; - int bbreg = TARGET_ARCH64 ? 4 : 2; - - if (profile_block_flag == 2) - { - ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0); - - fprintf (file, "\tsethi\t%%hi(%s__bb), %%g1\n", user_label_prefix); - fprintf (file, "\tsethi\t%%hi(%d), %%g%d\n", blockno, bbreg); - fprintf (file, "\tor\t%%g1, %%lo(%s__bb), %%g1\n", user_label_prefix); - fprintf (file, "\tor\t%%g%d, %%lo(%d), %%g%d\n", bbreg, blockno, bbreg); - - fprintf (file, "\tst\t%%g%d, [%%g1]\n", bbreg); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fprintf (file, "), %%g%d\n", bbreg); - - fputs ("\tor\t%o2, %lo(", file); - assemble_name (file, LPBX); - fprintf (file, "), %%g%d\n", bbreg); - - fprintf (file, "\tst\t%%g%d, [%%g1 + 4]\n", bbreg); - fprintf (file, "\tmov\t%%o7, %%g%d\n", bbreg); - - fprintf (file, "\tcall\t%s__bb_trace_func\n\t nop\n", user_label_prefix); - - fprintf (file, "\tmov\t%%g%d, %%o7\n", bbreg); - } - else if (profile_block_flag != 0) - { - ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 2); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fprintf (file, "+%d), %%g1\n", blockno*4); - - fputs ("\tld\t[%g1+%lo(", file); - assemble_name (file, LPBX); - if (TARGET_ARCH64 && USE_AS_OFFSETABLE_LO10) - fprintf (file, ")+%d], %%g%d\n", blockno*4, bbreg); - else - fprintf (file, "+%d)], %%g%d\n", blockno*4, bbreg); - - fprintf (file, "\tadd\t%%g%d, 1, %%g%d\n", bbreg, bbreg); - - fprintf (file, "\tst\t%%g%d, [%%g1+%%lo(", bbreg); - assemble_name (file, LPBX); - if (TARGET_ARCH64 && USE_AS_OFFSETABLE_LO10) - fprintf (file, ")+%d]\n", blockno*4); - else - fprintf (file, "+%d)]\n", blockno*4); - } -} - -/* The following macro shall output assembler code to FILE - to indicate a return from function during basic-block profiling. - - If profile_block_flag == 2: - - Output assembler code to call function `__bb_trace_ret'. - - Note that function `__bb_trace_ret' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE_RET - and MACHINE_STATE_RESTORE_RET. The last two macros will be - used in the function `__bb_trace_ret', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE_RET. - - else if profile_block_flag != 0: - - The macro will not be used, so it need not distinguish - these cases. -*/ - -void -sparc_function_block_profiler_exit(file) - FILE *file; -{ - if (profile_block_flag == 2) - fprintf (file, "\tcall\t%s__bb_trace_ret\n\t nop\n", user_label_prefix); - else - abort (); -} - /* 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 310942f..e287a7c 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -388,7 +388,7 @@ Unrecognized value in TARGET_CPU_DEFAULT. #define OVERRIDE_OPTIONS \ do { \ - if (profile_flag || profile_block_flag || profile_arc_flag) \ + if (profile_flag || profile_arc_flag) \ { \ if (flag_pic) \ { \ @@ -1071,13 +1071,6 @@ do \ /* Disable leaf functions */ \ memset (sparc_leaf_regs, 0, FIRST_PSEUDO_REGISTER); \ } \ - if (profile_block_flag) \ - { \ - /* %g1 and %g2 (sparc32) resp. %g4 (sparc64) must be \ - fixed, because BLOCK_PROFILER uses them. */ \ - fixed_regs[1] = 1; \ - fixed_regs[TARGET_ARCH64 ? 4 : 2] = 1; \ - } \ } \ while (0) @@ -1869,165 +1862,6 @@ do { \ /* Set the name of the mcount function for the system. */ #define MCOUNT_FUNCTION "*mcount" - -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. */ - -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ - sparc_function_block_profiler(FILE, BLOCK_OR_LABEL) - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. */ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - sparc_block_profiler (FILE, BLOCKNO) - -/* The following macro shall output assembler code to FILE - to indicate a return from function during basic-block profiling. */ - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ - sparc_function_block_profiler_exit(FILE) - -#ifdef IN_LIBGCC2 - -/* The function `__bb_trace_func' is called in every basic block - and is not allowed to change the machine state. Saving (restoring) - the state can either be done in the BLOCK_PROFILER macro, - before calling function (rsp. after returning from function) - `__bb_trace_func', or it can be done inside the function by - defining the macros: - - MACHINE_STATE_SAVE(ID) - MACHINE_STATE_RESTORE(ID) - - In the latter case care must be taken, that the prologue code - of function `__bb_trace_func' does not already change the - state prior to saving it with MACHINE_STATE_SAVE. - - The parameter `ID' is a string identifying a unique macro use. - - On sparc it is sufficient to save the psw register to memory. - Unfortunately the psw register can be read in supervisor mode only, - so we read only the condition codes by using branch instructions - and hope that this is enough. - - On V9, life is much sweater: there is a user accessible %ccr - register, but we use it for 64bit libraries only. */ - -#if TARGET_ARCH32 - -#define MACHINE_STATE_SAVE(ID) \ - int ms_flags, ms_saveret; \ - asm volatile( \ - "mov %%g2,%1\n\ - mov %%g0,%0\n\ - be,a LFLGNZ"ID"\n\ - or %0,4,%0\n\ -LFLGNZ"ID":\n\ - bcs,a LFLGNC"ID"\n\ - or %0,1,%0\n\ -LFLGNC"ID":\n\ - bvs,a LFLGNV"ID"\n\ - or %0,2,%0\n\ -LFLGNV"ID":\n\ - bneg,a LFLGNN"ID"\n\ - or %0,8,%0\n\ -LFLGNN"ID":" \ - : "=r"(ms_flags), "=r"(ms_saveret)); - -#else - -#define MACHINE_STATE_SAVE(ID) \ - unsigned long ms_flags, ms_saveret; \ - asm volatile( \ - "mov %%g4,%1\n\ - rd %%ccr,%0" \ - : "=r"(ms_flags), "=r"(ms_saveret)); - -#endif - -/* On sparc MACHINE_STATE_RESTORE restores the psw register from memory. - The psw register can be written in supervisor mode only, - which is true even for simple condition codes. - We use some combination of instructions to produce the - proper condition codes, but some flag combinations can not - be generated in this way. If this happens an unimplemented - instruction will be executed to abort the program. */ - -#if TARGET_ARCH32 - -#define MACHINE_STATE_RESTORE(ID) \ -{ extern char flgtab[] __asm__("LFLGTAB"ID); \ - int scratch; \ - asm volatile ( \ - "jmpl %2+%1,%%g0\n\ - ! Do part of VC in the delay slot here, as it needs 3 insns.\n\ - addcc 2,%3,%%g0\n\ -LFLGTAB" ID ":\n\ - ! 0\n\ - ba LFLGRET"ID"\n\ - orcc 1,%%g0,%%g0\n\ - ! C\n\ - ba LFLGRET"ID"\n\ - addcc 2,%3,%%g0\n\ - ! V\n\ - unimp\n\ - nop\n\ - ! VC\n\ - ba LFLGRET"ID"\n\ - addxcc %4,%4,%0\n\ - ! Z\n\ - ba LFLGRET"ID"\n\ - subcc %%g0,%%g0,%%g0\n\ - ! ZC\n\ - ba LFLGRET"ID"\n\ - addcc 1,%3,%0\n\ - ! ZVC\n\ - ba LFLGRET"ID"\n\ - addcc %4,%4,%0\n\ - ! N\n\ - ba LFLGRET"ID"\n\ - orcc %%g0,-1,%%g0\n\ - ! NC\n\ - ba LFLGRET"ID"\n\ - addcc %%g0,%3,%%g0\n\ - ! NV\n\ - unimp\n\ - nop\n\ - ! NVC\n\ - unimp\n\ - nop\n\ - ! NZ\n\ - unimp\n\ - nop\n\ - ! NZC\n\ - unimp\n\ - nop\n\ - ! NZV\n\ - unimp\n\ - nop\n\ - ! NZVC\n\ - unimp\n\ - nop\n\ -LFLGRET"ID":\n\ - mov %5,%%g2" \ - : "=r"(scratch) \ - : "r"(ms_flags*8), "r"(flgtab), "r"(-1), \ - "r"(0x80000000), "r"(ms_saveret) \ - : "cc", "g2"); } - -#else - -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile ( \ - "wr %0,0,%%ccr\n\ - mov %1,%%g4" \ - : : "r"(ms_flags), "r"(ms_saveret) \ - : "cc", "g4"); - -#endif - -#endif /* IN_LIBGCC2 */ /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, the stack pointer does not matter. The value is tested only in diff --git a/gcc/config/sparc/sun4o3.h b/gcc/config/sparc/sun4o3.h index 891e329..e79a4c8 100644 --- a/gcc/config/sparc/sun4o3.h +++ b/gcc/config/sparc/sun4o3.h @@ -9,22 +9,3 @@ /* LINK_SPEC is needed only for SunOS 4. */ #undef LINK_SPEC - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/gcc/config/sparc/sunos4.h b/gcc/config/sparc/sunos4.h index 2f12cc6..e5ec1ee 100644 --- a/gcc/config/sparc/sunos4.h +++ b/gcc/config/sparc/sunos4.h @@ -30,25 +30,6 @@ Boston, MA 02111-1307, USA. */ /* The Sun as doesn't like unaligned data. */ #define DWARF2_UNWIND_INFO 0 -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); - /* SunOS has on_exit instead of atexit. */ /* The man page says it returns int. */ extern int on_exit PARAMS ((void *, void *)); diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 4a889cc..5d3d90f 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -2451,139 +2451,6 @@ typedef int CUMULATIVE_ARGS; function prologue. Normally, the profiling code comes after. */ /* #define PROFILE_BEFORE_PROLOGUE */ -/* A C statement or compound statement to output to FILE some assembler code to - initialize basic-block profiling for the current object module. The global - compile flag `profile_block_flag' distingishes two profile modes. - - profile_block_flag != 2' - Output code to call the subroutine `__bb_init_func' once per - object module, passing it as its sole argument the address of - a block allocated in the object module. - - The name of the block is a local symbol made with this - statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, - you can take a short cut in the definition of this macro and - use the name that you know will result. - - The first word of this block is a flag which will be nonzero - if the object module has already been initialized. So test - this word first, and do not call `__bb_init_func' if the flag - is nonzero. BLOCK_OR_LABEL contains a unique number which - may be used to generate a label as a branch destination when - `__bb_init_func' will not be called. - - Described in assembler language, the code to be output looks - like: - - cmp (LPBX0),0 - bne local_label - parameter1 <- LPBX0 - call __bb_init_func - local_label: - - profile_block_flag == 2' - Output code to call the subroutine `__bb_init_trace_func' and - pass two parameters to it. The first parameter is the same as - for `__bb_init_func'. The second parameter is the number of - the first basic block of the function as given by - BLOCK_OR_LABEL. Note that `__bb_init_trace_func' has to be - called, even if the object module has been initialized - already. - - Described in assembler language, the code to be output looks - like: - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func */ -/* #define FUNCTION_BLOCK_PROFILER (FILE, LABELNO) */ - -/* A C statement or compound statement to output to FILE some assembler code to - increment the count associated with the basic block number BLOCKNO. The - global compile flag `profile_block_flag' distingishes two profile modes. - - profile_block_flag != 2' - Output code to increment the counter directly. Basic blocks - are numbered separately from zero within each compilation. - The count associated with block number BLOCKNO is at index - BLOCKNO in a vector of words; the name of this array is a - local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, - you can take a short cut in the definition of this macro and - use the name that you know will result. - - Described in assembler language, the code to be output looks - like: - - inc (LPBX2+4*BLOCKNO) - - profile_block_flag == 2' - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func', which will increment the - counter. - - `__bb' consists of two words. In the first word, the current - basic block number, as given by BLOCKNO, has to be stored. In - the second word, the address of a block allocated in the - object module has to be stored. The address is given by the - label created with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Described in assembler language, the code to be output looks - like: - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func */ -/* #define BLOCK_PROFILER(FILE, BLOCKNO) */ - -/* A C statement or compound statement to output to FILE assembler - code to call function `__bb_trace_ret'. The assembler code should - only be output if the global compile flag `profile_block_flag' == - 2. This macro has to be used at every place where code for - returning from a function is generated - (e.g. `TARGET_ASM_FUNCTION_EPILOGUE'). Although you have to write - the definition of `TARGET_ASM_FUNCTION_EPILOGUE' as well, you have - to define this macro to tell the compiler, that the proper call to - `__bb_trace_ret' is produced. */ -/* #define FUNCTION_BLOCK_PROFILER_EXIT(FILE) */ - -/* A C statement or compound statement to save all registers, which may be - clobbered by a function call, including condition codes. The `asm' - statement will be mostly likely needed to handle this task. Local labels in - the assembler code can be concatenated with the string ID, to obtain a - unique lable name. - - Registers or condition codes clobbered by - `TARGET_ASM_FUNCTION_PROLOGUE' or `TARGET_ASM_FUNCTION_EPILOGUE' - must be saved in the macros `FUNCTION_BLOCK_PROFILER', - `FUNCTION_BLOCK_PROFILER_EXIT' and `BLOCK_PROFILER' prior calling - `__bb_init_trace_func', `__bb_trace_ret' and `__bb_trace_func' - respectively. */ -/* #define MACHINE_STATE_SAVE(ID) */ - -/* A C statement or compound statement to restore all registers, including - condition codes, saved by `MACHINE_STATE_SAVE'. - - Registers or condition codes clobbered by `TARGET_ASM_FUNCTION_PROLOGUE' or - `TARGET_ASM_FUNCTION_EPILOGUE' must be restored in the macros - `FUNCTION_BLOCK_PROFILER', `FUNCTION_BLOCK_PROFILER_EXIT' and - `BLOCK_PROFILER' after calling `__bb_init_trace_func', `__bb_trace_ret' and - `__bb_trace_func' respectively. */ -/* #define MACHINE_STATE_RESTORE(ID) */ - -/* A C function or functions which are needed in the library to support block - profiling. */ -/* #define BLOCK_PROFILER_CODE */ - /* If the target has particular reasons why a function cannot be inlined, it may define the TARGET_CANNOT_INLINE_P. This macro takes one argument, diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a6b02a4..e9175ec 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -240,7 +240,7 @@ in the following sections. @item Debugging Options @xref{Debugging Options,,Options for Debugging Your Program or GCC}. @gccoptlist{ --a -ax -d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol +-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol -fdump-unnumbered -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol -fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol @@ -2753,80 +2753,6 @@ pass when it finishes. Makes the compiler print some statistics about permanent memory allocation when it finishes. -@item -ax -@opindex ax -Generate extra code to profile basic blocks. Your executable will -produce output that is a superset of that produced when @option{-a} is -used. Additional output is the source and target address of the basic -blocks where a jump takes place, the number of times a jump is executed, -and (optionally) the complete sequence of basic blocks being executed. -The output is appended to file @file{bb.out}. - -You can examine different profiling aspects without recompilation. Your -executable will read a list of function names from file @file{bb.in}. -Profiling starts when a function on the list is entered and stops when -that invocation is exited. To exclude a function from profiling, prefix -its name with @samp{-}. If a function name is not unique, you can -disambiguate it by writing it in the form -@samp{/path/filename.d:functionname}. Your executable will write the -available paths and filenames in file @file{bb.out}. - -Several function names have a special meaning: -@table @code -@item __bb_jumps__ -Write source, target and frequency of jumps to file @file{bb.out}. -@item __bb_hidecall__ -Exclude function calls from frequency count. -@item __bb_showret__ -Include function returns in frequency count. -@item __bb_trace__ -Write the sequence of basic blocks executed to file @file{bbtrace.gz}. -The file will be compressed using the program @samp{gzip}, which must -exist in your @env{PATH}. On systems without the @samp{popen} -function, the file will be named @file{bbtrace} and will not be -compressed. @strong{Profiling for even a few seconds on these systems -will produce a very large file.} Note: @code{__bb_hidecall__} and -@code{__bb_showret__} will not affect the sequence written to -@file{bbtrace.gz}. -@end table - -Here's a short example using different profiling parameters -in file @file{bb.in}. Assume function @code{foo} consists of basic blocks -1 and 2 and is called twice from block 3 of function @code{main}. After -the calls, block 3 transfers control to block 4 of @code{main}. - -With @code{__bb_trace__} and @code{main} contained in file @file{bb.in}, -the following sequence of blocks is written to file @file{bbtrace.gz}: -0 3 1 2 1 2 4. The return from block 2 to block 3 is not shown, because -the return is to a point inside the block and not to the top. The -block address 0 always indicates, that control is transferred -to the trace from somewhere outside the observed functions. With -@samp{-foo} added to @file{bb.in}, the blocks of function -@code{foo} are removed from the trace, so only 0 3 4 remains. - -With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in}, -jump frequencies will be written to file @file{bb.out}. The -frequencies are obtained by constructing a trace of blocks -and incrementing a counter for every neighbouring pair of blocks -in the trace. The trace 0 3 1 2 1 2 4 displays the following -frequencies: - -@example -Jump from block 0x0 to block 0x3 executed 1 time(s) -Jump from block 0x3 to block 0x1 executed 1 time(s) -Jump from block 0x1 to block 0x2 executed 2 time(s) -Jump from block 0x2 to block 0x1 executed 1 time(s) -Jump from block 0x2 to block 0x4 executed 1 time(s) -@end example - -With @code{__bb_hidecall__}, control transfer due to call instructions -is removed from the trace, that is the trace is cut into three parts: 0 -3 4, 0 1 2 and 0 1 2. With @code{__bb_showret__}, control transfer due -to return instructions is added to the trace. The trace becomes: 0 3 1 -2 3 1 2 3 4. Note, that this trace is not the same, as the sequence -written to @file{bbtrace.gz}. It is solely used for counting jump -frequencies. - @item -fprofile-arcs @opindex fprofile-arcs Instrument @dfn{arcs} during compilation to generate coverage data diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 7932811..67b78e6 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4039,175 +4039,6 @@ must not use the @var{labelno} argument to @code{FUNCTION_PROFILER}. Define this macro if the code for function profiling should come before the function prologue. Normally, the profiling code comes after. -@findex FUNCTION_BLOCK_PROFILER -@vindex profile_block_flag -@item FUNCTION_BLOCK_PROFILER (@var{file}, @var{labelno}) -A C statement or compound statement to output to @var{file} some -assembler code to initialize basic-block profiling for the current -object module. The global compile flag @code{profile_block_flag} -distinguishes two profile modes. - -@table @code -@findex __bb_init_func -@item profile_block_flag != 2 -Output code to call the subroutine @code{__bb_init_func} once per -object module, passing it as its sole argument the address of a block -allocated in the object module. - -The name of the block is a local symbol made with this statement: - -@smallexample -ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0); -@end smallexample - -Of course, since you are writing the definition of -@code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you -can take a short cut in the definition of this macro and use the name -that you know will result. - -The first word of this block is a flag which will be nonzero if the -object module has already been initialized. So test this word first, -and do not call @code{__bb_init_func} if the flag is -nonzero. @var{labelno} contains a unique number which may be used to -generate a label as a branch destination when @code{__bb_init_func} -will not be called. - -Described in assembler language, the code to be output looks like: - -@example - cmp (LPBX0),0 - bne local_label - parameter1 <- LPBX0 - call __bb_init_func -local_label: -@end example - -@findex __bb_init_trace_func -@item profile_block_flag == 2 -Output code to call the subroutine @code{__bb_init_trace_func} -and pass two parameters to it. The first parameter is the same as -for @code{__bb_init_func}. The second parameter is the number of the -first basic block of the function as given by @var{labelno}. Note -that @code{__bb_init_trace_func} has to be called, even if the object -module has been initialized already. - -Described in assembler language, the code to be output looks like: -@example -parameter1 <- LPBX0 -parameter2 <- @var{labelno} -call __bb_init_trace_func -@end example -@end table - -@findex BLOCK_PROFILER -@vindex profile_block_flag -@item BLOCK_PROFILER (@var{file}, @var{blockno}) -A C statement or compound statement to output to @var{file} some -assembler code to increment the count associated with the basic -block number @var{blockno}. The global compile flag -@code{profile_block_flag} distinguishes two profile modes. - -@table @code -@item profile_block_flag != 2 -Output code to increment the counter directly. Basic blocks are -numbered separately from zero within each compilation. The count -associated with block number @var{blockno} is at index -@var{blockno} in a vector of words; the name of this array is a local -symbol made with this statement: - -@smallexample -ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 2); -@end smallexample - -@c This paragraph is the same as one a few paragraphs up. -@c That is not an error. -Of course, since you are writing the definition of -@code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you -can take a short cut in the definition of this macro and use the name -that you know will result. - -Described in assembler language, the code to be output looks like: - -@smallexample -inc (LPBX2+4*@var{blockno}) -@end smallexample - -@vindex __bb -@findex __bb_trace_func -@item profile_block_flag == 2 -Output code to initialize the global structure @code{__bb} and -call the function @code{__bb_trace_func}, which will increment the -counter. - -@code{__bb} consists of two words. In the first word, the current -basic block number, as given by @var{blockno}, has to be stored. In -the second word, the address of a block allocated in the object -module has to be stored. The address is given by the label created -with this statement: - -@smallexample -ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0); -@end smallexample - -Described in assembler language, the code to be output looks like: -@example -move @var{blockno} -> (__bb) -move LPBX0 -> (__bb+4) -call __bb_trace_func -@end example -@end table - -@findex FUNCTION_BLOCK_PROFILER_EXIT -@findex __bb_trace_ret -@vindex profile_block_flag -@item FUNCTION_BLOCK_PROFILER_EXIT (@var{file}) -A C statement or compound statement to output to @var{file} assembler -code to call function @code{__bb_trace_ret}. The assembler code should -only be output if the global compile flag @code{profile_block_flag} == -2. This macro has to be used at every place where code for returning -from a function is generated (e.g.@: -@code{TARGET_ASM_FUNCTION_EPILOGUE}). Although you have to write the -definition of @code{TARGET_ASM_FUNCTION_EPILOGUE} as well, you have to -define this macro to tell the compiler, that the proper call to -@code{__bb_trace_ret} is produced. - -@findex MACHINE_STATE_SAVE -@findex __bb_init_trace_func -@findex __bb_trace_func -@findex __bb_trace_ret -@item MACHINE_STATE_SAVE (@var{id}) -A C statement or compound statement to save all registers, which may -be clobbered by a function call, including condition codes. The -@code{asm} statement will be mostly likely needed to handle this -task. Local labels in the assembler code can be concatenated with the -string @var{id}, to obtain a unique label name. - -Registers or condition codes clobbered by -@code{TARGET_ASM_FUNCTION_PROLOGUE} or -@code{TARGET_ASM_FUNCTION_EPILOGUE} must be saved in the macros -@code{FUNCTION_BLOCK_PROFILER}, @code{FUNCTION_BLOCK_PROFILER_EXIT} and -@code{BLOCK_PROFILER} prior calling @code{__bb_init_trace_func}, -@code{__bb_trace_ret} and @code{__bb_trace_func} respectively. - -@findex MACHINE_STATE_RESTORE -@findex __bb_init_trace_func -@findex __bb_trace_func -@findex __bb_trace_ret -@item MACHINE_STATE_RESTORE (@var{id}) -A C statement or compound statement to restore all registers, including -condition codes, saved by @code{MACHINE_STATE_SAVE}. - -Registers or condition codes clobbered by -@code{TARGET_ASM_FUNCTION_PROLOGUE} or -@code{TARGET_ASM_FUNCTION_EPILOGUE} must be restored in the macros -@code{FUNCTION_BLOCK_PROFILER}, @code{FUNCTION_BLOCK_PROFILER_EXIT} and -@code{BLOCK_PROFILER} after calling @code{__bb_init_trace_func}, -@code{__bb_trace_ret} and @code{__bb_trace_func} respectively. - -@findex BLOCK_PROFILER_CODE -@item BLOCK_PROFILER_CODE -A C function or functions which are needed in the library to -support block profiling. @findex TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER @item TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER diff --git a/gcc/final.c b/gcc/final.c index fc93d83..9725c0b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -114,10 +114,6 @@ static int high_function_linenum; /* Filename of last NOTE. */ static const char *last_filename; -/* Number of basic blocks seen so far; - used if profile_block_flag is set. */ -static int count_basic_blocks; - /* Number of instrumented arcs when profile_arc_flag is set. */ extern int count_instrumented_edges; @@ -240,8 +236,6 @@ static int asm_insn_count PARAMS ((rtx)); #endif static void profile_function PARAMS ((FILE *)); static void profile_after_prologue PARAMS ((FILE *)); -static void add_bb PARAMS ((FILE *)); -static int add_bb_string PARAMS ((const char *, int)); static void notice_source_line PARAMS ((rtx)); static rtx walk_alter_subreg PARAMS ((rtx *)); static void output_asm_name PARAMS ((void)); @@ -284,7 +278,7 @@ end_final (filename) { int i; - if (profile_block_flag || profile_arc_flag) + if (profile_arc_flag) { char name[20]; int align = exact_log2 (BIGGEST_ALIGNMENT / BITS_PER_UNIT); @@ -296,10 +290,7 @@ end_final (filename) int pointer_bytes = POINTER_SIZE / BITS_PER_UNIT; unsigned int align2 = LONG_TYPE_SIZE; - if (profile_block_flag) - size = long_bytes * count_basic_blocks; - else - size = gcov_type_bytes * count_instrumented_edges; + size = gcov_type_bytes * count_instrumented_edges; rounded = size; rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1; @@ -347,53 +338,24 @@ end_final (filename) assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes, align2, 1); - /* Count of the # of basic blocks or # of instrumented arcs. */ - assemble_integer (GEN_INT (profile_block_flag - ? count_basic_blocks - : count_instrumented_edges), + /* Count of the # of instrumented arcs. */ + assemble_integer (GEN_INT (count_instrumented_edges), long_bytes, align2, 1); /* Zero word (link field). */ assemble_integer (const0_rtx, pointer_bytes, align2, 1); - /* address of basic block start address table */ - if (profile_block_flag) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } - else - assemble_integer (const0_rtx, pointer_bytes, align2, 1); + assemble_integer (const0_rtx, pointer_bytes, align2, 1); /* Byte count for extended structure. */ assemble_integer (GEN_INT (11 * UNITS_PER_WORD), long_bytes, align2, 1); /* Address of function name table. */ - if (profile_block_flag) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 4); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } - else - assemble_integer (const0_rtx, pointer_bytes, align2, 1); + assemble_integer (const0_rtx, pointer_bytes, align2, 1); /* Address of line number and filename tables if debugging. */ - if (write_symbols != NO_DEBUG && profile_block_flag) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 5); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 6); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } - else - { - assemble_integer (const0_rtx, pointer_bytes, align2, 1); - assemble_integer (const0_rtx, pointer_bytes, align2, 1); - } + assemble_integer (const0_rtx, pointer_bytes, align2, 1); + assemble_integer (const0_rtx, pointer_bytes, align2, 1); /* Space for extension ptr (link field). */ assemble_integer (const0_rtx, UNITS_PER_WORD, align2, 1); @@ -410,10 +372,7 @@ end_final (filename) strcat (data_file, "/"); strcat (data_file, filename); strip_off_ending (data_file, len); - if (profile_block_flag) - strcat (data_file, ".d"); - else - strcat (data_file, ".da"); + strcat (data_file, ".da"); assemble_string (data_file, strlen (data_file) + 1); } @@ -446,95 +405,6 @@ end_final (filename) #endif #endif } - - /* Output any basic block strings */ - if (profile_block_flag) - { - readonly_data_section (); - if (sbb_head) - { - ASM_OUTPUT_ALIGN (asm_out_file, align); - for (sptr = sbb_head; sptr != 0; sptr = sptr->next) - { - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBC", - sptr->label_num); - assemble_string (sptr->string, sptr->length); - } - } - } - - /* Output the table of addresses. */ - if (profile_block_flag) - { - /* Realign in new section */ - ASM_OUTPUT_ALIGN (asm_out_file, align); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 3); - for (i = 0; i < count_basic_blocks; i++) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPB", i); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } - } - - /* Output the table of function names. */ - if (profile_block_flag) - { - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 4); - for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++) - { - if (ptr->func_label_num >= 0) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPBC", - ptr->func_label_num); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } - else - assemble_integer (const0_rtx, pointer_bytes, align2, 1); - } - - for (; i < count_basic_blocks; i++) - assemble_integer (const0_rtx, pointer_bytes, align2, 1); - } - - if (write_symbols != NO_DEBUG && profile_block_flag) - { - /* Output the table of line numbers. */ - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 5); - for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++) - assemble_integer (GEN_INT (ptr->line_num), long_bytes, align2, 1); - - for (; i < count_basic_blocks; i++) - assemble_integer (const0_rtx, long_bytes, align2, 1); - - /* Output the table of file names. */ - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LPBX", 6); - for ((ptr = bb_head), (i = 0); ptr != 0; (ptr = ptr->next), i++) - { - if (ptr->file_label_num >= 0) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPBC", - ptr->file_label_num); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } - else - assemble_integer (const0_rtx, pointer_bytes, align2, 1); - } - - for (; i < count_basic_blocks; i++) - assemble_integer (const0_rtx, pointer_bytes, align2, 1); - } - - /* End with the address of the table of addresses, - so we can find it easily, as the last word in the file's text. */ - if (profile_block_flag) - { - ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), - pointer_bytes, align2, 1); - } } } @@ -1729,28 +1599,12 @@ final_start_function (first, file, optimize) profile_after_prologue (file); profile_label_no++; - - /* If we are doing basic block profiling, remember a printable version - of the function name. */ - if (profile_block_flag) - { - bb_func_label_num = - add_bb_string ((*decl_printable_name) (current_function_decl, 2), - FALSE); - } } static void profile_after_prologue (file) FILE *file ATTRIBUTE_UNUSED; { -#ifdef FUNCTION_BLOCK_PROFILER - if (profile_block_flag) - { - FUNCTION_BLOCK_PROFILER (file, count_basic_blocks); - } -#endif /* FUNCTION_BLOCK_PROFILER */ - #ifndef PROFILE_BEFORE_PROLOGUE if (profile_flag) profile_function (file); @@ -1860,89 +1714,6 @@ final_end_function () bb_func_label_num = -1; /* not in function, nuke label # */ } -/* Add a block to the linked list that remembers the current line/file/function - for basic block profiling. Emit the label in front of the basic block and - the instructions that increment the count field. */ - -static void -add_bb (file) - FILE *file; -{ - struct bb_list *ptr = - (struct bb_list *) permalloc (sizeof (struct bb_list)); - - /* Add basic block to linked list. */ - ptr->next = 0; - ptr->line_num = last_linenum; - ptr->file_label_num = bb_file_label_num; - ptr->func_label_num = bb_func_label_num; - *bb_tail = ptr; - bb_tail = &ptr->next; - - /* Enable the table of basic-block use counts - to point at the code it applies to. */ - ASM_OUTPUT_INTERNAL_LABEL (file, "LPB", count_basic_blocks); - - /* Before first insn of this basic block, increment the - count of times it was entered. */ -#ifdef BLOCK_PROFILER - BLOCK_PROFILER (file, count_basic_blocks); -#endif -#ifdef HAVE_cc0 - CC_STATUS_INIT; -#endif - - new_block = 0; - count_basic_blocks++; -} - -/* Add a string to be used for basic block profiling. */ - -static int -add_bb_string (string, perm_p) - const char *string; - int perm_p; -{ - int len; - struct bb_str *ptr = 0; - - if (!string) - { - string = "<unknown>"; - perm_p = TRUE; - } - - /* Allocate a new string if the current string isn't permanent. If - the string is permanent search for the same string in other - allocations. */ - - len = strlen (string) + 1; - if (!perm_p) - { - char *p = (char *) permalloc (len); - memcpy (p, string, len); - string = p; - } - else - for (ptr = sbb_head; ptr != (struct bb_str *) 0; ptr = ptr->next) - if (ptr->string == string) - break; - - /* Allocate a new string block if we need to. */ - if (!ptr) - { - ptr = (struct bb_str *) permalloc (sizeof (*ptr)); - ptr->next = 0; - ptr->length = len; - ptr->label_num = sbb_label_num++; - ptr->string = string; - *sbb_tail = ptr; - sbb_tail = &ptr->next; - } - - return ptr->label_num; -} - /* Output assembler code for some insns: all or part of a function. For description of args, see `final_start_function', above. @@ -2051,11 +1822,6 @@ final (first, file, optimize, prescan) insn = final_scan_insn (insn, file, optimize, prescan, 0); } - /* Do basic-block profiling here - if the last insn was a conditional branch. */ - if (profile_block_flag && new_block) - add_bb (file); - free (line_note_exists); line_note_exists = NULL; } @@ -2490,11 +2256,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) break; } - /* Do basic-block profiling when we reach a new block. - Done here to avoid jump tables. */ - if (profile_block_flag && new_block) - add_bb (file); - if (GET_CODE (body) == ASM_INPUT) { const char *string = XSTR (body, 0); @@ -2601,22 +2362,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) { CC_STATUS_INIT; } - - /* Following a conditional branch sequence, we have a new basic - block. */ - if (profile_block_flag) - { - rtx insn = XVECEXP (body, 0, 0); - rtx body = PATTERN (insn); - - if ((GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == SET - && GET_CODE (SET_SRC (body)) != LABEL_REF) - || (GET_CODE (insn) == JUMP_INSN - && GET_CODE (body) == PARALLEL - && GET_CODE (XVECEXP (body, 0, 0)) == SET - && GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) != LABEL_REF)) - new_block = 1; - } break; } @@ -2675,17 +2420,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) } #endif - /* Following a conditional branch, we have a new basic block. - But if we are inside a sequence, the new block starts after the - last insn of the sequence. */ - if (profile_block_flag && final_sequence == 0 - && ((GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == SET - && GET_CODE (SET_SRC (body)) != LABEL_REF) - || (GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == PARALLEL - && GET_CODE (XVECEXP (body, 0, 0)) == SET - && GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) != LABEL_REF))) - new_block = 1; - #ifndef STACK_REGS /* Don't bother outputting obvious no-ops, even without -O. This optimization is fast and doesn't interfere with debugging. @@ -2990,14 +2724,6 @@ notice_source_line (insn) { const char *filename = NOTE_SOURCE_FILE (insn); - /* Remember filename for basic block profiling. - Filenames are allocated on the permanent obstack - or are passed in ARGV, so we don't have to save - the string. */ - - if (profile_block_flag && last_filename != filename) - bb_file_label_num = add_bb_string (filename, TRUE); - last_filename = filename; last_linenum = NOTE_LINE_NUMBER (insn); high_block_linenum = MAX (last_linenum, high_block_linenum); @@ -4123,7 +3849,7 @@ leaf_function_p () rtx insn; rtx link; - if (profile_flag || profile_block_flag || profile_arc_flag) + if (profile_flag || profile_arc_flag) return 0; for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) diff --git a/gcc/flags.h b/gcc/flags.h index af1d860..b5933a6 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -173,10 +173,6 @@ extern int warn_disabled_optimization; extern int profile_flag; -/* Nonzero if generating code to do profiling on the basis of basic blocks. */ - -extern int profile_block_flag; - /* Nonzero if generating code to profile program flow graph arcs. */ extern int profile_arc_flag; diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index bf675ec..cece1c0 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -1640,725 +1640,6 @@ __bb_fork_func (void) } } -#ifndef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) -#endif -#ifndef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) -#endif - -/* Number of buckets in hashtable of basic block addresses. */ - -#define BB_BUCKETS 311 - -/* Maximum length of string in file bb.in. */ - -#define BBINBUFSIZE 500 - -struct bb_edge -{ - struct bb_edge *next; - unsigned long src_addr; - unsigned long dst_addr; - unsigned long count; -}; - -enum bb_func_mode -{ - TRACE_KEEP = 0, TRACE_ON = 1, TRACE_OFF = 2 -}; - -struct bb_func -{ - struct bb_func *next; - char *funcname; - char *filename; - enum bb_func_mode mode; -}; - -/* This is the connection to the outside world. - The BLOCK_PROFILER macro must set __bb.blocks - and __bb.blockno. */ - -struct { - unsigned long blockno; - struct bb *blocks; -} __bb; - -/* Vars to store addrs of source and destination basic blocks - of a jump. */ - -static unsigned long bb_src = 0; -static unsigned long bb_dst = 0; - -static FILE *bb_tracefile = (FILE *) 0; -static struct bb_edge **bb_hashbuckets = (struct bb_edge **) 0; -static struct bb_func *bb_func_head = (struct bb_func *) 0; -static unsigned long bb_callcount = 0; -static int bb_mode = 0; - -static unsigned long *bb_stack = (unsigned long *) 0; -static size_t bb_stacksize = 0; - -static int reported = 0; - -/* Trace modes: -Always : Print execution frequencies of basic blocks - to file bb.out. -bb_mode & 1 != 0 : Dump trace of basic blocks to file bbtrace[.gz] -bb_mode & 2 != 0 : Print jump frequencies to file bb.out. -bb_mode & 4 != 0 : Cut call instructions from basic block flow. -bb_mode & 8 != 0 : Insert return instructions in basic block flow. -*/ - -#ifdef HAVE_POPEN - -/*#include <sys/types.h>*/ -#include <sys/stat.h> -/*#include <malloc.h>*/ - -/* Commands executed by gopen. */ - -#define GOPENDECOMPRESS "gzip -cd " -#define GOPENCOMPRESS "gzip -c >" - -/* Like fopen but pipes through gzip. mode may only be "r" or "w". - If it does not compile, simply replace gopen by fopen and delete - '.gz' from any first parameter to gopen. */ - -static FILE * -gopen (char *fn, char *mode) -{ - int use_gzip; - char *p; - - if (mode[1]) - return (FILE *) 0; - - if (mode[0] != 'r' && mode[0] != 'w') - return (FILE *) 0; - - p = fn + strlen (fn)-1; - use_gzip = ((p[-1] == '.' && (p[0] == 'Z' || p[0] == 'z')) - || (p[-2] == '.' && p[-1] == 'g' && p[0] == 'z')); - - if (use_gzip) - { - if (mode[0]=='r') - { - FILE *f; - char *s = (char *) malloc (sizeof (char) * strlen (fn) - + sizeof (GOPENDECOMPRESS)); - strcpy (s, GOPENDECOMPRESS); - strcpy (s + (sizeof (GOPENDECOMPRESS)-1), fn); - f = popen (s, mode); - free (s); - return f; - } - - else - { - FILE *f; - char *s = (char *) malloc (sizeof (char) * strlen (fn) - + sizeof (GOPENCOMPRESS)); - strcpy (s, GOPENCOMPRESS); - strcpy (s + (sizeof (GOPENCOMPRESS)-1), fn); - if (!(f = popen (s, mode))) - f = fopen (s, mode); - free (s); - return f; - } - } - - else - return fopen (fn, mode); -} - -static int -gclose (FILE *f) -{ - struct stat buf; - - if (f != 0) - { - if (!fstat (fileno (f), &buf) && S_ISFIFO (buf.st_mode)) - return pclose (f); - - return fclose (f); - } - return 0; -} - -#endif /* HAVE_POPEN */ - -/* Called once per program. */ - -static void -__bb_exit_trace_func (void) -{ - FILE *file = fopen ("bb.out", "a"); - struct bb_func *f; - struct bb *b; - - if (!file) - perror ("bb.out"); - - if (bb_mode & 1) - { - if (!bb_tracefile) - perror ("bbtrace"); - else -#ifdef HAVE_POPEN - gclose (bb_tracefile); -#else - fclose (bb_tracefile); -#endif /* HAVE_POPEN */ - } - - /* Check functions in `bb.in'. */ - - if (file) - { - long time_value; - const struct bb_func *p; - int printed_something = 0; - struct bb *ptr; - long blk; - - /* This is somewhat type incorrect. */ - time ((void *) &time_value); - - for (p = bb_func_head; p != (struct bb_func *) 0; p = p->next) - { - for (ptr = bb_head; ptr != (struct bb *) 0; ptr = ptr->next) - { - if (!ptr->filename || (p->filename != (char *) 0 && strcmp (p->filename, ptr->filename))) - continue; - for (blk = 0; blk < ptr->ncounts; blk++) - { - if (!strcmp (p->funcname, ptr->functions[blk])) - goto found; - } - } - - if (!printed_something) - { - fprintf (file, - "Functions in `bb.in' not executed during basic block profiling on %s\n", - ctime ((void *) &time_value)); - printed_something = 1; - } - - fprintf (file, "\tFunction %s", p->funcname); - if (p->filename) - fprintf (file, " of file %s", p->filename); - fprintf (file, "\n" ); - -found: ; - } - - if (printed_something) - fprintf (file, "\n"); - - } - - if (bb_mode & 2) - { - if (!bb_hashbuckets) - { - if (!reported) - { - fprintf (stderr, "Profiler: out of memory\n"); - reported = 1; - } - return; - } - - else if (file) - { - long time_value; - int i; - unsigned long addr_max = 0; - unsigned long cnt_max = 0; - int cnt_len; - int addr_len; - - /* This is somewhat type incorrect, but it avoids worrying about - exactly where time.h is included from. It should be ok unless - a void * differs from other pointer formats, or if sizeof (long) - is < sizeof (time_t). It would be nice if we could assume the - use of rationale standards here. */ - - time ((void *) &time_value); - fprintf (file, "Basic block jump tracing"); - - switch (bb_mode & 12) - { - case 0: - fprintf (file, " (with call)"); - break; - - case 4: - /* Print nothing. */ - break; - - case 8: - fprintf (file, " (with call & ret)"); - break; - - case 12: - fprintf (file, " (with ret)"); - break; - } - - fprintf (file, " finished on %s\n", ctime ((void *) &time_value)); - - for (i = 0; i < BB_BUCKETS; i++) - { - struct bb_edge *bucket = bb_hashbuckets[i]; - for ( ; bucket; bucket = bucket->next ) - { - if (addr_max < bucket->src_addr) - addr_max = bucket->src_addr; - if (addr_max < bucket->dst_addr) - addr_max = bucket->dst_addr; - if (cnt_max < bucket->count) - cnt_max = bucket->count; - } - } - addr_len = num_digits (addr_max, 16); - cnt_len = num_digits (cnt_max, 10); - - for ( i = 0; i < BB_BUCKETS; i++) - { - struct bb_edge *bucket = bb_hashbuckets[i]; - for ( ; bucket; bucket = bucket->next ) - { - fprintf (file, - "Jump from block 0x%.*lx to block 0x%.*lx executed %*lu time(s)\n", - addr_len, bucket->src_addr, - addr_len, bucket->dst_addr, - cnt_len, bucket->count); - } - } - - fprintf (file, "\n"); - - } - } - - if (file) - fclose (file); - - /* Free allocated memory. */ - - f = bb_func_head; - while (f) - { - struct bb_func *old = f; - - f = f->next; - if (old->funcname) free (old->funcname); - if (old->filename) free (old->filename); - free (old); - } - - if (bb_stack) - free (bb_stack); - - if (bb_hashbuckets) - { - int i; - - for (i = 0; i < BB_BUCKETS; i++) - { - struct bb_edge *old, *bucket = bb_hashbuckets[i]; - - while (bucket) - { - old = bucket; - bucket = bucket->next; - free (old); - } - } - free (bb_hashbuckets); - } - - for (b = bb_head; b; b = b->next) - if (b->flags) free (b->flags); -} - -/* Called once per program. */ - -static void -__bb_init_prg (void) -{ - FILE *file; - char buf[BBINBUFSIZE]; - const char *p; - const char *pos; - enum bb_func_mode m; - int i; - - /* Initialize destructor. */ - atexit (__bb_exit_func); - - if (!(file = fopen ("bb.in", "r"))) - return; - - while(fgets (buf, BBINBUFSIZE, file) != 0) - { - i = strlen (buf); - if (buf[i] == '\n') - buf[i--] = '\0'; - - p = buf; - if (*p == '-') - { - m = TRACE_OFF; - p++; - } - else - { - m = TRACE_ON; - } - if (!strcmp (p, "__bb_trace__")) - bb_mode |= 1; - else if (!strcmp (p, "__bb_jumps__")) - bb_mode |= 2; - else if (!strcmp (p, "__bb_hidecall__")) - bb_mode |= 4; - else if (!strcmp (p, "__bb_showret__")) - bb_mode |= 8; - else - { - struct bb_func *f = (struct bb_func *) malloc (sizeof (struct bb_func)); - if (f) - { - unsigned long l; - f->next = bb_func_head; - if ((pos = strchr (p, ':'))) - { - if (!(f->funcname = (char *) malloc (strlen (pos+1)+1))) - continue; - strcpy (f->funcname, pos+1); - l = pos-p; - if ((f->filename = (char *) malloc (l+1))) - { - strncpy (f->filename, p, l); - f->filename[l] = '\0'; - } - else - f->filename = (char *) 0; - } - else - { - if (!(f->funcname = (char *) malloc (strlen (p)+1))) - continue; - strcpy (f->funcname, p); - f->filename = (char *) 0; - } - f->mode = m; - bb_func_head = f; - } - } - } - fclose (file); - -#ifdef HAVE_POPEN - - if (bb_mode & 1) - bb_tracefile = gopen ("bbtrace.gz", "w"); - -#else - - if (bb_mode & 1) - bb_tracefile = fopen ("bbtrace", "w"); - -#endif /* HAVE_POPEN */ - - if (bb_mode & 2) - { - bb_hashbuckets = (struct bb_edge **) - malloc (BB_BUCKETS * sizeof (struct bb_edge *)); - if (bb_hashbuckets) - /* Use a loop here rather than calling bzero to avoid having to - conditionalize its existence. */ - for (i = 0; i < BB_BUCKETS; i++) - bb_hashbuckets[i] = 0; - } - - if (bb_mode & 12) - { - bb_stacksize = 10; - bb_stack = (unsigned long *) malloc (bb_stacksize * sizeof (*bb_stack)); - } - - /* Initialize destructor. */ - atexit (__bb_exit_trace_func); -} - -/* Called upon entering a basic block. */ - -void -__bb_trace_func (void) -{ - struct bb_edge *bucket; - - MACHINE_STATE_SAVE("1") - - if (!bb_callcount || (__bb.blocks->flags && (__bb.blocks->flags[__bb.blockno] & TRACE_OFF))) - goto skip; - - bb_dst = __bb.blocks->addresses[__bb.blockno]; - __bb.blocks->counts[__bb.blockno]++; - - if (bb_tracefile) - { - fwrite (&bb_dst, sizeof (unsigned long), 1, bb_tracefile); - } - - if (bb_hashbuckets) - { - struct bb_edge **startbucket, **oldnext; - - oldnext = startbucket - = & bb_hashbuckets[ (((int) bb_src*8) ^ (int) bb_dst) % BB_BUCKETS ]; - bucket = *startbucket; - - for (bucket = *startbucket; bucket; - oldnext = &(bucket->next), bucket = *oldnext) - { - if (bucket->src_addr == bb_src - && bucket->dst_addr == bb_dst) - { - bucket->count++; - *oldnext = bucket->next; - bucket->next = *startbucket; - *startbucket = bucket; - goto ret; - } - } - - bucket = (struct bb_edge *) malloc (sizeof (struct bb_edge)); - - if (!bucket) - { - if (!reported) - { - fprintf (stderr, "Profiler: out of memory\n"); - reported = 1; - } - } - - else - { - bucket->src_addr = bb_src; - bucket->dst_addr = bb_dst; - bucket->next = *startbucket; - *startbucket = bucket; - bucket->count = 1; - } - } - -ret: - bb_src = bb_dst; - -skip: - ; - - MACHINE_STATE_RESTORE("1") - -} - -/* Called when returning from a function and `__bb_showret__' is set. */ - -static void -__bb_trace_func_ret (void) -{ - struct bb_edge *bucket; - - if (!bb_callcount || (__bb.blocks->flags && (__bb.blocks->flags[__bb.blockno] & TRACE_OFF))) - goto skip; - - if (bb_hashbuckets) - { - struct bb_edge **startbucket, **oldnext; - - oldnext = startbucket - = & bb_hashbuckets[ (((int) bb_dst * 8) ^ (int) bb_src) % BB_BUCKETS ]; - bucket = *startbucket; - - for (bucket = *startbucket; bucket; - oldnext = &(bucket->next), bucket = *oldnext) - { - if (bucket->src_addr == bb_dst - && bucket->dst_addr == bb_src) - { - bucket->count++; - *oldnext = bucket->next; - bucket->next = *startbucket; - *startbucket = bucket; - goto ret; - } - } - - bucket = (struct bb_edge *) malloc (sizeof (struct bb_edge)); - - if (!bucket) - { - if (!reported) - { - fprintf (stderr, "Profiler: out of memory\n"); - reported = 1; - } - } - - else - { - bucket->src_addr = bb_dst; - bucket->dst_addr = bb_src; - bucket->next = *startbucket; - *startbucket = bucket; - bucket->count = 1; - } - } - -ret: - bb_dst = bb_src; - -skip: - ; - -} - -/* Called upon entering the first function of a file. */ - -static void -__bb_init_file (struct bb *blocks) -{ - - const struct bb_func *p; - long blk, ncounts = blocks->ncounts; - const char **functions = blocks->functions; - - /* Set up linked list. */ - blocks->zero_word = 1; - blocks->next = bb_head; - bb_head = blocks; - - blocks->flags = 0; - if (!bb_func_head - || !(blocks->flags = (char *) malloc (sizeof (char) * blocks->ncounts))) - return; - - for (blk = 0; blk < ncounts; blk++) - blocks->flags[blk] = 0; - - for (blk = 0; blk < ncounts; blk++) - { - for (p = bb_func_head; p; p = p->next) - { - if (!strcmp (p->funcname, functions[blk]) - && (!p->filename || !strcmp (p->filename, blocks->filename))) - { - blocks->flags[blk] |= p->mode; - } - } - } - -} - -/* Called when exiting from a function. */ - -void -__bb_trace_ret (void) -{ - - MACHINE_STATE_SAVE("2") - - if (bb_callcount) - { - if ((bb_mode & 12) && bb_stacksize > bb_callcount) - { - bb_src = bb_stack[bb_callcount]; - if (bb_mode & 8) - __bb_trace_func_ret (); - } - - bb_callcount -= 1; - } - - MACHINE_STATE_RESTORE("2") - -} - -/* Called when entering a function. */ - -void -__bb_init_trace_func (struct bb *blocks, unsigned long blockno) -{ - static int trace_init = 0; - - MACHINE_STATE_SAVE("3") - - if (!blocks->zero_word) - { - if (!trace_init) - { - trace_init = 1; - __bb_init_prg (); - } - __bb_init_file (blocks); - } - - if (bb_callcount) - { - - bb_callcount += 1; - - if (bb_mode & 12) - { - if (bb_callcount >= bb_stacksize) - { - size_t newsize = bb_callcount + 100; - - bb_stack = (unsigned long *) realloc (bb_stack, newsize); - if (! bb_stack) - { - if (!reported) - { - fprintf (stderr, "Profiler: out of memory\n"); - reported = 1; - } - bb_stacksize = 0; - goto stack_overflow; - } - bb_stacksize = newsize; - } - bb_stack[bb_callcount] = bb_src; - - if (bb_mode & 4) - bb_src = 0; - - } - -stack_overflow:; - - } - - else if (blocks->flags && (blocks->flags[blockno] & TRACE_ON)) - { - bb_callcount = 1; - bb_src = 0; - - if (bb_stack) - bb_stack[bb_callcount] = bb_src; - } - - MACHINE_STATE_RESTORE("3") -} - #endif /* not inhibit_libc */ #endif /* not BLOCK_PROFILER_CODE */ #endif /* L_bb */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 5680275..6661500 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -408,10 +408,6 @@ int flag_eliminate_dwarf2_dups = 0; int profile_flag = 0; -/* Nonzero if generating code to do profiling on a line-by-line basis. */ - -int profile_block_flag; - /* Nonzero if generating code to profile program flow graph arcs. */ int profile_arc_flag = 0; @@ -4238,47 +4234,6 @@ independent_decode_option (argc, argv) return decode_W_option (arg + 1); break; - case 'a': - if (arg[1] == 0) - { -#if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER) - warning ("`-a' option (basic block profile) not supported"); -#else - profile_block_flag = (profile_block_flag < 2) ? 1 : 3; -#endif - } - else if (!strcmp (arg, "ax")) - { -#if !defined (FUNCTION_BLOCK_PROFILER_EXIT) || !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER) - warning ("`-ax' option (jump profiling) not supported"); -#else - profile_block_flag = (!profile_block_flag - || profile_block_flag == 2) ? 2 : 3; -#endif - } - else if (!strncmp (arg, "aux-info", 8)) - { - if (arg[8] == '\0') - { - if (argc == 1) - return 0; - - aux_info_file_name = argv[1]; - flag_gen_aux_info = 1; - return 2; - } - else if (arg[8] == '=') - { - aux_info_file_name = arg + 9; - flag_gen_aux_info = 1; - } - else - return 0; - } - else - return 0; - break; - case 'o': if (arg[1] == 0) { @@ -4837,12 +4792,6 @@ process_options () if (align_functions <= 0) align_functions = 1; align_functions_log = floor_log2 (align_functions * 2 - 1); - if (profile_block_flag == 3) - { - warning ("`-ax' and `-a' are conflicting options. `-a' ignored"); - profile_block_flag = 2; - } - /* Unrolling all loops implies that standard loop unrolling must also be done. */ if (flag_unroll_all_loops) @@ -4913,7 +4862,6 @@ process_options () { write_symbols = NO_DEBUG; profile_flag = 0; - profile_block_flag = 0; } /* Now we know write_symbols, set up the debug hooks based on it. @@ -4967,8 +4915,7 @@ process_options () } } - if (flag_function_sections - && (profile_flag || profile_block_flag)) + if (flag_function_sections && profile_flag) { warning ("-ffunction-sections disabled; it makes profiling impossible"); flag_function_sections = 0; |