aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2004-08-09 16:58:42 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2004-08-09 16:58:42 +0000
commit27fb79ad58913a5a6e7f65013c027bb13ad9b36b (patch)
tree6acad3c2863017816a499859e6818fdc7225e212 /gcc/gcse.c
parent883c9d4d1237863941b95b3e7b8dba71fb49a78e (diff)
downloadgcc-27fb79ad58913a5a6e7f65013c027bb13ad9b36b.zip
gcc-27fb79ad58913a5a6e7f65013c027bb13ad9b36b.tar.gz
gcc-27fb79ad58913a5a6e7f65013c027bb13ad9b36b.tar.bz2
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
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c54
1 files changed, 37 insertions, 17 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index b99fc41..b9a7874 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -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)