From 8456b95a5af348aa220ad0adc2101835f221f5d3 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 6 Dec 2001 12:49:46 +0100 Subject: final.c (count_basic_block, [...]): Kill. * 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. From-SVN: r47712 --- gcc/config/alpha/alpha.c | 2 +- gcc/config/arm/arm.c | 6 +- gcc/config/c4x/c4x.c | 8 - gcc/config/c4x/c4x.h | 263 ------------------------ gcc/config/d30v/d30v.h | 131 ------------ gcc/config/fr30/fr30.c | 2 +- gcc/config/i386/i386.c | 259 +----------------------- gcc/config/i386/i386.h | 120 +---------- gcc/config/i960/i960.c | 2 +- gcc/config/ia64/ia64.c | 4 +- gcc/config/ia64/ia64.h | 100 --------- gcc/config/m32r/m32r.c | 2 +- gcc/config/m68hc11/m68hc11.h | 38 ---- gcc/config/m68k/m68k.c | 7 - gcc/config/m68k/m68k.h | 162 --------------- gcc/config/m88k/m88k.c | 7 +- gcc/config/m88k/m88k.h | 9 - gcc/config/mips/mips.c | 2 +- gcc/config/mmix/mmix.h | 20 -- gcc/config/rs6000/rs6000.c | 4 - gcc/config/s390/s390.c | 11 - gcc/config/s390/s390.h | 445 ----------------------------------------- gcc/config/sparc/linux-aout.h | 18 -- gcc/config/sparc/linux.h | 18 -- gcc/config/sparc/linux64.h | 20 -- gcc/config/sparc/sol2.h | 21 -- gcc/config/sparc/sparc.c | 288 +------------------------- gcc/config/sparc/sparc.h | 168 +--------------- gcc/config/sparc/sun4o3.h | 19 -- gcc/config/sparc/sunos4.h | 19 -- gcc/config/stormy16/stormy16.h | 133 ------------ 31 files changed, 17 insertions(+), 2291 deletions(-) (limited to 'gcc/config') 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, -- cgit v1.1