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
This commit is contained in:
Steven Bosscher 2004-08-09 16:58:42 +00:00
parent 883c9d4d12
commit 27fb79ad58
4 changed files with 72 additions and 28 deletions

View File

@ -1,3 +1,22 @@
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>
* Makefile.in (GTFILES): Remove stmt.c
@ -152,13 +171,13 @@
2004-08-06 Roman Zippel <zippel@linux-m68k.org>
* config/m68k/m68k.c (post_inc_operand,pre_dec_operand): New.
* config/m68k/m68k.h (PREDICATE_CODES): add post_inc_operand,
pre_dec_operand.
* config/m68k/m68k.md (zero_extend*2): delay the splitting of the
pattern until reload is finished to allow better code generation
and split them completely into separate instrunctions.
(*andsi3_split): New pattern.
* config/m68k/m68k.c (post_inc_operand,pre_dec_operand): New.
* config/m68k/m68k.h (PREDICATE_CODES): add post_inc_operand,
pre_dec_operand.
* config/m68k/m68k.md (zero_extend*2): delay the splitting of the
pattern until reload is finished to allow better code generation
and split them completely into separate instrunctions.
(*andsi3_split): New pattern.
2004-08-05 Mark Mitchell <mark@codesourcery.com>

View File

@ -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) \
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) \
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 \
$(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)
@ -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)
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) \
$(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)
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)
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 \

View File

@ -168,6 +168,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "cselib.h"
#include "intl.h"
#include "obstack.h"
#include "timevar.h"
/* Propagate flow information through back edges and thus enable PRE's
moving loop invariant calculations out of loops.
@ -510,10 +511,14 @@ static int bytes_used;
static int gcse_subst_count;
/* Number of copy instructions created. */
static int gcse_create_count;
/* Number of constants propagated. */
static int const_prop_count;
/* Number of copys propagated. */
static int copy_prop_count;
/* Number of local constants propagated. */
static int local_const_prop_count;
/* Number of local copys propagated. */
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 */
static sbitmap *ae_kill, *ae_gen;
@ -746,12 +751,15 @@ gcse_main (rtx f, FILE *file)
/* Don't allow constant propagation to modify jumps
during this pass. */
timevar_push (TV_CPROP1);
changed = one_cprop_pass (pass + 1, 0, 0);
timevar_pop (TV_CPROP1);
if (optimize_size)
/* Do nothing. */ ;
else
{
timevar_push (TV_PRE);
changed |= one_pre_gcse_pass (pass + 1);
/* We may have just created new basic blocks. Release and
recompute various things which are sized on the number of
@ -766,6 +774,7 @@ gcse_main (rtx f, FILE *file)
alloc_reg_set_mem (max_reg_num ());
compute_sets (f);
run_jump_opt_after_gcse = 1;
timevar_pop (TV_PRE);
}
if (max_pass_bytes < bytes_used)
@ -783,6 +792,7 @@ gcse_main (rtx f, FILE *file)
for space, we don't run the partial redundancy algorithms). */
if (optimize_size)
{
timevar_push (TV_HOIST);
max_gcse_regno = max_reg_num ();
alloc_gcse_mem (f);
changed |= one_code_hoisting_pass ();
@ -790,6 +800,7 @@ gcse_main (rtx f, FILE *file)
if (max_pass_bytes < bytes_used)
max_pass_bytes = bytes_used;
timevar_pop (TV_HOIST);
}
if (file)
@ -808,7 +819,9 @@ gcse_main (rtx f, FILE *file)
max_gcse_regno = max_reg_num ();
alloc_gcse_mem (f);
/* This time, go ahead and allow cprop to alter jumps. */
timevar_push (TV_CPROP2);
one_cprop_pass (pass + 1, 1, 0);
timevar_pop (TV_CPROP2);
free_gcse_mem ();
if (file)
@ -827,7 +840,11 @@ gcse_main (rtx f, FILE *file)
allocate_reg_info (max_reg_num (), FALSE, FALSE);
if (!optimize_size && flag_gcse_sm)
store_motion ();
{
timevar_push (TV_LSM);
store_motion ();
timevar_pop (TV_LSM);
}
/* Record where pseudo-registers are set. */
return run_jump_opt_after_gcse;
@ -3260,11 +3277,11 @@ cprop_jump (basic_block bb, rtx setcc, rtx jump, rtx from, rtx src)
run_jump_opt_after_gcse = 1;
const_prop_count++;
global_const_prop_count++;
if (gcse_file != NULL)
{
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));
print_rtl (gcse_file, src);
fprintf (gcse_file, "\n");
@ -3366,7 +3383,7 @@ cprop_insn (rtx insn, int alter_jumps)
if (constprop_register (insn, reg_used->reg_rtx, src, alter_jumps))
{
changed = 1;
const_prop_count++;
global_const_prop_count++;
if (gcse_file != NULL)
{
fprintf (gcse_file, "GLOBAL CONST-PROP: Replacing reg %d in ", regno);
@ -3385,7 +3402,7 @@ cprop_insn (rtx insn, int alter_jumps)
if (try_replace_reg (reg_used->reg_rtx, src, insn))
{
changed = 1;
copy_prop_count++;
global_copy_prop_count++;
if (gcse_file != NULL)
{
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)
print_rtl (gcse_file, newcnst);
fprintf (gcse_file, "\n");
}
const_prop_count++;
local_const_prop_count++;
return true;
}
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)
REGNO (x), INSN_UID (insn));
fprintf (gcse_file, " with reg %d\n", REGNO (newreg));
}
copy_prop_count++;
local_copy_prop_count++;
return true;
}
}
@ -3783,8 +3800,8 @@ one_cprop_pass (int pass, int cprop_jumps, int bypass_jumps)
{
int changed = 0;
const_prop_count = 0;
copy_prop_count = 0;
global_const_prop_count = local_const_prop_count = 0;
global_copy_prop_count = local_copy_prop_count = 0;
local_cprop_pass (cprop_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, ",
current_function_name (), pass, bytes_used);
fprintf (gcse_file, "%d const props, %d copy props\n\n",
const_prop_count, copy_prop_count);
fprintf (gcse_file, "%d local const props, %d local copy props\n\n",
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. */
if (changed && cprop_jumps)
@ -4034,7 +4053,8 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
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));
print_rtl (gcse_file, SET_SRC (set->expr));
fprintf (gcse_file, "\nBypass edge from %d->%d to %d\n",
@ -6865,7 +6885,7 @@ bypass_jumps (FILE *file)
max_gcse_regno = max_reg_num ();
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 ();
if (file)

View File

@ -98,8 +98,13 @@ DEFTIMEVAR (TV_EXPAND , "expand")
DEFTIMEVAR (TV_VARCONST , "varconst")
DEFTIMEVAR (TV_JUMP , "jump")
DEFTIMEVAR (TV_CSE , "CSE")
DEFTIMEVAR (TV_GCSE , "global CSE")
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_TRACER , "tracer")
DEFTIMEVAR (TV_WEB , "web")