Commit 27fb79ad by Steven Bosscher

timevar.def (TV_CPROP1, [...]): New timers.

	* timevar.def (TV_CPROP1, TV_CPROP2, TV_PRE, TV_HOIST, TV_LSM):
	New timers.
	* gcse.c: Include timevar.h.
	(const_prop_count, copy_prop_count): Rename to global_const_prop_count
	and global_copy_prop_count.
	(local_const_prop_count, local_copy_prop_count): New static globals.
	(gcse_main): Set the right timevar for each pass.
	(cprop_jump): Increment global_const_prop_count when a constant is
	propagated.  Add "GLOBAL" to dump output.
	(cprop_insn): Increment global_const_prop_count when a constant is
	propagated, or global_copy_prop_count when a copy is propagated.
	(do_local_cprop): Likewise for local_const_prop_count and
	local_copy_prop_count.
	(one_cprop_pass): Initialize const/cprop counters to zero.
	Print out results of local and global const/cprop separately.
	(bypass_block): Break over-length line.

From-SVN: r85718
parent 883c9d4d
2004-08-09 Steven Bosscher <stevenb@suse.de>
* timevar.def (TV_CPROP1, TV_CPROP2, TV_PRE, TV_HOIST, TV_LSM):
New timers.
* gcse.c: Include timevar.h.
(const_prop_count, copy_prop_count): Rename to global_const_prop_count
and global_copy_prop_count.
(local_const_prop_count, local_copy_prop_count): New static globals.
(gcse_main): Set the right timevar for each pass.
(cprop_jump): Increment global_const_prop_count when a constant is
propagated. Add "GLOBAL" to dump output.
(cprop_insn): Increment global_const_prop_count when a constant is
propagated, or global_copy_prop_count when a copy is propagated.
(do_local_cprop): Likewise for local_const_prop_count and
local_copy_prop_count.
(one_cprop_pass): Initialize const/cprop counters to zero.
Print out results of local and global const/cprop separately.
(bypass_block): Break over-length line.
2004-08-09 Paolo Bonzini <bonzini@gnu.org> 2004-08-09 Paolo Bonzini <bonzini@gnu.org>
* Makefile.in (GTFILES): Remove stmt.c * Makefile.in (GTFILES): Remove stmt.c
......
...@@ -1901,7 +1901,7 @@ web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ ...@@ -1901,7 +1901,7 @@ web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(GGC_H) $(RECOG_H) $(EXPR_H) \ hard-reg-set.h $(FLAGS_H) real.h insn-config.h $(GGC_H) $(RECOG_H) $(EXPR_H) \
$(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) \ $(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) \
except.h gt-gcse.h $(TREE_H) cselib.h except.h gt-gcse.h $(TREE_H) cselib.h $(TIMEVAR_H)
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) coretypes.h \ resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) coretypes.h \
$(TM_H) $(BASIC_BLOCK_H) $(REGS_H) $(FLAGS_H) output.h $(RESOURCE_H) function.h toplev.h \ $(TM_H) $(BASIC_BLOCK_H) $(REGS_H) $(FLAGS_H) output.h $(RESOURCE_H) function.h toplev.h \
$(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H) $(INSN_ATTR_H) except.h $(PARAMS_H) $(TM_P_H)
...@@ -2106,10 +2106,10 @@ predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE ...@@ -2106,10 +2106,10 @@ predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE
$(PARAMS_H) $(TARGET_H) $(CFGLOOP_H) $(COVERAGE_H) $(PARAMS_H) $(TARGET_H) $(CFGLOOP_H) $(COVERAGE_H)
lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(RTL_H) $(GGC_H) lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(RTL_H) $(GGC_H)
bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(BASIC_BLOCK_H) $(FLAGS_H) timevar.h output.h $(CFGLAYOUT_H) $(FIBHEAP_H) \ $(RTL_H) $(BASIC_BLOCK_H) $(FLAGS_H) $(TIMEVAR_H) output.h $(CFGLAYOUT_H) $(FIBHEAP_H) \
$(TARGET_H) $(TARGET_H)
tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \ tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
$(BASIC_BLOCK_H) hard-reg-set.h output.h $(CFGLAYOUT_H) $(FLAGS_H) timevar.h \ $(BASIC_BLOCK_H) hard-reg-set.h output.h $(CFGLAYOUT_H) $(FLAGS_H) $(TIMEVAR_H) \
$(PARAMS_H) $(COVERAGE_H) $(PARAMS_H) $(COVERAGE_H)
cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h \ $(RTL_H) $(TREE_H) insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h \
......
...@@ -168,6 +168,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -168,6 +168,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "cselib.h" #include "cselib.h"
#include "intl.h" #include "intl.h"
#include "obstack.h" #include "obstack.h"
#include "timevar.h"
/* Propagate flow information through back edges and thus enable PRE's /* Propagate flow information through back edges and thus enable PRE's
moving loop invariant calculations out of loops. moving loop invariant calculations out of loops.
...@@ -510,10 +511,14 @@ static int bytes_used; ...@@ -510,10 +511,14 @@ static int bytes_used;
static int gcse_subst_count; static int gcse_subst_count;
/* Number of copy instructions created. */ /* Number of copy instructions created. */
static int gcse_create_count; static int gcse_create_count;
/* Number of constants propagated. */ /* Number of local constants propagated. */
static int const_prop_count; static int local_const_prop_count;
/* Number of copys propagated. */ /* Number of local copys propagated. */
static int copy_prop_count; static int local_copy_prop_count;
/* Number of global constants propagated. */
static int global_const_prop_count;
/* Number of global copys propagated. */
static int global_copy_prop_count;
/* For available exprs */ /* For available exprs */
static sbitmap *ae_kill, *ae_gen; static sbitmap *ae_kill, *ae_gen;
...@@ -746,12 +751,15 @@ gcse_main (rtx f, FILE *file) ...@@ -746,12 +751,15 @@ gcse_main (rtx f, FILE *file)
/* Don't allow constant propagation to modify jumps /* Don't allow constant propagation to modify jumps
during this pass. */ during this pass. */
timevar_push (TV_CPROP1);
changed = one_cprop_pass (pass + 1, 0, 0); changed = one_cprop_pass (pass + 1, 0, 0);
timevar_pop (TV_CPROP1);
if (optimize_size) if (optimize_size)
/* Do nothing. */ ; /* Do nothing. */ ;
else else
{ {
timevar_push (TV_PRE);
changed |= one_pre_gcse_pass (pass + 1); changed |= one_pre_gcse_pass (pass + 1);
/* We may have just created new basic blocks. Release and /* We may have just created new basic blocks. Release and
recompute various things which are sized on the number of recompute various things which are sized on the number of
...@@ -766,6 +774,7 @@ gcse_main (rtx f, FILE *file) ...@@ -766,6 +774,7 @@ gcse_main (rtx f, FILE *file)
alloc_reg_set_mem (max_reg_num ()); alloc_reg_set_mem (max_reg_num ());
compute_sets (f); compute_sets (f);
run_jump_opt_after_gcse = 1; run_jump_opt_after_gcse = 1;
timevar_pop (TV_PRE);
} }
if (max_pass_bytes < bytes_used) if (max_pass_bytes < bytes_used)
...@@ -783,6 +792,7 @@ gcse_main (rtx f, FILE *file) ...@@ -783,6 +792,7 @@ gcse_main (rtx f, FILE *file)
for space, we don't run the partial redundancy algorithms). */ for space, we don't run the partial redundancy algorithms). */
if (optimize_size) if (optimize_size)
{ {
timevar_push (TV_HOIST);
max_gcse_regno = max_reg_num (); max_gcse_regno = max_reg_num ();
alloc_gcse_mem (f); alloc_gcse_mem (f);
changed |= one_code_hoisting_pass (); changed |= one_code_hoisting_pass ();
...@@ -790,6 +800,7 @@ gcse_main (rtx f, FILE *file) ...@@ -790,6 +800,7 @@ gcse_main (rtx f, FILE *file)
if (max_pass_bytes < bytes_used) if (max_pass_bytes < bytes_used)
max_pass_bytes = bytes_used; max_pass_bytes = bytes_used;
timevar_pop (TV_HOIST);
} }
if (file) if (file)
...@@ -808,7 +819,9 @@ gcse_main (rtx f, FILE *file) ...@@ -808,7 +819,9 @@ gcse_main (rtx f, FILE *file)
max_gcse_regno = max_reg_num (); max_gcse_regno = max_reg_num ();
alloc_gcse_mem (f); alloc_gcse_mem (f);
/* This time, go ahead and allow cprop to alter jumps. */ /* This time, go ahead and allow cprop to alter jumps. */
timevar_push (TV_CPROP2);
one_cprop_pass (pass + 1, 1, 0); one_cprop_pass (pass + 1, 1, 0);
timevar_pop (TV_CPROP2);
free_gcse_mem (); free_gcse_mem ();
if (file) if (file)
...@@ -827,7 +840,11 @@ gcse_main (rtx f, FILE *file) ...@@ -827,7 +840,11 @@ gcse_main (rtx f, FILE *file)
allocate_reg_info (max_reg_num (), FALSE, FALSE); allocate_reg_info (max_reg_num (), FALSE, FALSE);
if (!optimize_size && flag_gcse_sm) if (!optimize_size && flag_gcse_sm)
{
timevar_push (TV_LSM);
store_motion (); store_motion ();
timevar_pop (TV_LSM);
}
/* Record where pseudo-registers are set. */ /* Record where pseudo-registers are set. */
return run_jump_opt_after_gcse; return run_jump_opt_after_gcse;
...@@ -3260,11 +3277,11 @@ cprop_jump (basic_block bb, rtx setcc, rtx jump, rtx from, rtx src) ...@@ -3260,11 +3277,11 @@ cprop_jump (basic_block bb, rtx setcc, rtx jump, rtx from, rtx src)
run_jump_opt_after_gcse = 1; run_jump_opt_after_gcse = 1;
const_prop_count++; global_const_prop_count++;
if (gcse_file != NULL) if (gcse_file != NULL)
{ {
fprintf (gcse_file, fprintf (gcse_file,
"CONST-PROP: Replacing reg %d in jump_insn %d with constant ", "GLOBAL CONST-PROP: Replacing reg %d in jump_insn %d with constant ",
REGNO (from), INSN_UID (jump)); REGNO (from), INSN_UID (jump));
print_rtl (gcse_file, src); print_rtl (gcse_file, src);
fprintf (gcse_file, "\n"); fprintf (gcse_file, "\n");
...@@ -3366,7 +3383,7 @@ cprop_insn (rtx insn, int alter_jumps) ...@@ -3366,7 +3383,7 @@ cprop_insn (rtx insn, int alter_jumps)
if (constprop_register (insn, reg_used->reg_rtx, src, alter_jumps)) if (constprop_register (insn, reg_used->reg_rtx, src, alter_jumps))
{ {
changed = 1; changed = 1;
const_prop_count++; global_const_prop_count++;
if (gcse_file != NULL) if (gcse_file != NULL)
{ {
fprintf (gcse_file, "GLOBAL CONST-PROP: Replacing reg %d in ", regno); fprintf (gcse_file, "GLOBAL CONST-PROP: Replacing reg %d in ", regno);
...@@ -3385,7 +3402,7 @@ cprop_insn (rtx insn, int alter_jumps) ...@@ -3385,7 +3402,7 @@ cprop_insn (rtx insn, int alter_jumps)
if (try_replace_reg (reg_used->reg_rtx, src, insn)) if (try_replace_reg (reg_used->reg_rtx, src, insn))
{ {
changed = 1; changed = 1;
copy_prop_count++; global_copy_prop_count++;
if (gcse_file != NULL) if (gcse_file != NULL)
{ {
fprintf (gcse_file, "GLOBAL COPY-PROP: Replacing reg %d in insn %d", fprintf (gcse_file, "GLOBAL COPY-PROP: Replacing reg %d in insn %d",
...@@ -3508,7 +3525,7 @@ do_local_cprop (rtx x, rtx insn, int alter_jumps, rtx *libcall_sp) ...@@ -3508,7 +3525,7 @@ do_local_cprop (rtx x, rtx insn, int alter_jumps, rtx *libcall_sp)
print_rtl (gcse_file, newcnst); print_rtl (gcse_file, newcnst);
fprintf (gcse_file, "\n"); fprintf (gcse_file, "\n");
} }
const_prop_count++; local_const_prop_count++;
return true; return true;
} }
else if (newreg && newreg != x && try_replace_reg (x, newreg, insn)) else if (newreg && newreg != x && try_replace_reg (x, newreg, insn))
...@@ -3521,7 +3538,7 @@ do_local_cprop (rtx x, rtx insn, int alter_jumps, rtx *libcall_sp) ...@@ -3521,7 +3538,7 @@ do_local_cprop (rtx x, rtx insn, int alter_jumps, rtx *libcall_sp)
REGNO (x), INSN_UID (insn)); REGNO (x), INSN_UID (insn));
fprintf (gcse_file, " with reg %d\n", REGNO (newreg)); fprintf (gcse_file, " with reg %d\n", REGNO (newreg));
} }
copy_prop_count++; local_copy_prop_count++;
return true; return true;
} }
} }
...@@ -3783,8 +3800,8 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps) ...@@ -3783,8 +3800,8 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps)
{ {
int changed = 0; int changed = 0;
const_prop_count = 0; global_const_prop_count = local_const_prop_count = 0;
copy_prop_count = 0; global_copy_prop_count = local_copy_prop_count = 0;
local_cprop_pass (cprop_jumps); local_cprop_pass (cprop_jumps);
...@@ -3817,8 +3834,10 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps) ...@@ -3817,8 +3834,10 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps)
{ {
fprintf (gcse_file, "CPROP of %s, pass %d: %d bytes needed, ", fprintf (gcse_file, "CPROP of %s, pass %d: %d bytes needed, ",
current_function_name (), pass, bytes_used); current_function_name (), pass, bytes_used);
fprintf (gcse_file, "%d const props, %d copy props\n\n", fprintf (gcse_file, "%d local const props, %d local copy props\n\n",
const_prop_count, copy_prop_count); local_const_prop_count, local_copy_prop_count);
fprintf (gcse_file, "%d global const props, %d global copy props\n\n",
global_const_prop_count, global_copy_prop_count);
} }
/* Global analysis may get into infinite loops for unreachable blocks. */ /* Global analysis may get into infinite loops for unreachable blocks. */
if (changed && cprop_jumps) if (changed && cprop_jumps)
...@@ -4034,7 +4053,8 @@ bypass_block (basic_block bb, rtx setcc, rtx jump) ...@@ -4034,7 +4053,8 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
if (gcse_file != NULL) if (gcse_file != NULL)
{ {
fprintf (gcse_file, "JUMP-BYPASS: Proved reg %d in jump_insn %d equals constant ", fprintf (gcse_file, "JUMP-BYPASS: Proved reg %d "
"in jump_insn %d equals constant ",
regno, INSN_UID (jump)); regno, INSN_UID (jump));
print_rtl (gcse_file, SET_SRC (set->expr)); print_rtl (gcse_file, SET_SRC (set->expr));
fprintf (gcse_file, "\nBypass edge from %d->%d to %d\n", fprintf (gcse_file, "\nBypass edge from %d->%d to %d\n",
...@@ -6865,7 +6885,7 @@ bypass_jumps (FILE *file) ...@@ -6865,7 +6885,7 @@ bypass_jumps (FILE *file)
max_gcse_regno = max_reg_num (); max_gcse_regno = max_reg_num ();
alloc_gcse_mem (get_insns ()); alloc_gcse_mem (get_insns ());
changed = one_cprop_pass (1, 1, 1); changed = one_cprop_pass (MAX_GCSE_PASSES + 2, 1, 1);
free_gcse_mem (); free_gcse_mem ();
if (file) if (file)
......
...@@ -98,8 +98,13 @@ DEFTIMEVAR (TV_EXPAND , "expand") ...@@ -98,8 +98,13 @@ DEFTIMEVAR (TV_EXPAND , "expand")
DEFTIMEVAR (TV_VARCONST , "varconst") DEFTIMEVAR (TV_VARCONST , "varconst")
DEFTIMEVAR (TV_JUMP , "jump") DEFTIMEVAR (TV_JUMP , "jump")
DEFTIMEVAR (TV_CSE , "CSE") DEFTIMEVAR (TV_CSE , "CSE")
DEFTIMEVAR (TV_GCSE , "global CSE")
DEFTIMEVAR (TV_LOOP , "loop analysis") DEFTIMEVAR (TV_LOOP , "loop analysis")
DEFTIMEVAR (TV_GCSE , "global CSE")
DEFTIMEVAR (TV_CPROP1 , "CPROP 1")
DEFTIMEVAR (TV_PRE , "PRE")
DEFTIMEVAR (TV_HOIST , "code hoisting")
DEFTIMEVAR (TV_CPROP2 , "CPROP 2")
DEFTIMEVAR (TV_LSM , "LSM")
DEFTIMEVAR (TV_BYPASS , "bypass jumps") DEFTIMEVAR (TV_BYPASS , "bypass jumps")
DEFTIMEVAR (TV_TRACER , "tracer") DEFTIMEVAR (TV_TRACER , "tracer")
DEFTIMEVAR (TV_WEB , "web") DEFTIMEVAR (TV_WEB , "web")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment