Commit d630245f by Steven Bosscher

bitmap.c (bitmap_last_set_bit): Rewrite to return the correct bit.

	* bitmap.c (bitmap_last_set_bit): Rewrite to return the correct bit.

	* graphite.c (print_global_statistics): Use EDGE_COUNT instead
	of VEC_length.
	(print_graphite_scop_statistics): Likewise.
	* graphite-scop-detection.c (get_bb_type): Use single_succ_p.
	(print_graphite_scop_statistics): Use EDGE_COUNT, not VEC_length.
	(canonicalize_loop_closed_ssa): Use single_pred_p.

	* alias.c (reg_seen): Make this an sbitmap.
	(record_set, init_alias_analysis): Update.

	* tree-ssa-coalesce.c (ssa_conflicts_dump): Fix dumping.

From-SVN: r191063
parent 183c7727
2012-09-07 Steven Bosscher <steven@gcc.gnu.org>
* bitmap.c (bitmap_last_set_bit): Rewrite to return the correct bit.
* graphite.c (print_global_statistics): Use EDGE_COUNT instead
of VEC_length.
(print_graphite_scop_statistics): Likewise.
* graphite-scop-detection.c (get_bb_type): Use single_succ_p.
(print_graphite_scop_statistics): Use EDGE_COUNT, not VEC_length.
(canonicalize_loop_closed_ssa): Use single_pred_p.
* alias.c (reg_seen): Make this an sbitmap.
(record_set, init_alias_analysis): Update.
* tree-ssa-coalesce.c (ssa_conflicts_dump): Fix dumping.
2012-09-07 Tom de Vries <tom@codesourcery.com> 2012-09-07 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/53986 PR tree-optimization/53986
......
...@@ -1220,7 +1220,7 @@ find_base_value (rtx src) ...@@ -1220,7 +1220,7 @@ find_base_value (rtx src)
/* While scanning insns to find base values, reg_seen[N] is nonzero if /* While scanning insns to find base values, reg_seen[N] is nonzero if
register N has been set in this function. */ register N has been set in this function. */
static char *reg_seen; static sbitmap reg_seen;
static void static void
record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED) record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
...@@ -1246,7 +1246,7 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED) ...@@ -1246,7 +1246,7 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
{ {
while (--n >= 0) while (--n >= 0)
{ {
reg_seen[regno + n] = 1; SET_BIT (reg_seen, regno + n);
new_reg_base_value[regno + n] = 0; new_reg_base_value[regno + n] = 0;
} }
return; return;
...@@ -1267,12 +1267,12 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED) ...@@ -1267,12 +1267,12 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
else else
{ {
/* There's a REG_NOALIAS note against DEST. */ /* There's a REG_NOALIAS note against DEST. */
if (reg_seen[regno]) if (TEST_BIT (reg_seen, regno))
{ {
new_reg_base_value[regno] = 0; new_reg_base_value[regno] = 0;
return; return;
} }
reg_seen[regno] = 1; SET_BIT (reg_seen, regno);
new_reg_base_value[regno] = unique_base_value (unique_id++); new_reg_base_value[regno] = unique_base_value (unique_id++);
return; return;
} }
...@@ -1328,10 +1328,10 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED) ...@@ -1328,10 +1328,10 @@ record_set (rtx dest, const_rtx set, void *data ATTRIBUTE_UNUSED)
} }
/* If this is the first set of a register, record the value. */ /* If this is the first set of a register, record the value. */
else if ((regno >= FIRST_PSEUDO_REGISTER || ! fixed_regs[regno]) else if ((regno >= FIRST_PSEUDO_REGISTER || ! fixed_regs[regno])
&& ! reg_seen[regno] && new_reg_base_value[regno] == 0) && ! TEST_BIT (reg_seen, regno) && new_reg_base_value[regno] == 0)
new_reg_base_value[regno] = find_base_value (src); new_reg_base_value[regno] = find_base_value (src);
reg_seen[regno] = 1; SET_BIT (reg_seen, regno);
} }
/* Return REG_BASE_VALUE for REGNO. Selective scheduler uses this to avoid /* Return REG_BASE_VALUE for REGNO. Selective scheduler uses this to avoid
...@@ -2789,7 +2789,7 @@ init_alias_analysis (void) ...@@ -2789,7 +2789,7 @@ init_alias_analysis (void)
VEC_safe_grow_cleared (rtx, gc, reg_base_value, maxreg); VEC_safe_grow_cleared (rtx, gc, reg_base_value, maxreg);
new_reg_base_value = XNEWVEC (rtx, maxreg); new_reg_base_value = XNEWVEC (rtx, maxreg);
reg_seen = XNEWVEC (char, maxreg); reg_seen = sbitmap_alloc (maxreg);
/* The basic idea is that each pass through this loop will use the /* The basic idea is that each pass through this loop will use the
"constant" information from the previous pass to propagate alias "constant" information from the previous pass to propagate alias
...@@ -2834,7 +2834,7 @@ init_alias_analysis (void) ...@@ -2834,7 +2834,7 @@ init_alias_analysis (void)
memset (new_reg_base_value, 0, maxreg * sizeof (rtx)); memset (new_reg_base_value, 0, maxreg * sizeof (rtx));
/* Wipe the reg_seen array clean. */ /* Wipe the reg_seen array clean. */
memset (reg_seen, 0, maxreg); sbitmap_zero (reg_seen);
/* Mark all hard registers which may contain an address. /* Mark all hard registers which may contain an address.
The stack, frame and argument pointers may contain an address. The stack, frame and argument pointers may contain an address.
...@@ -2957,7 +2957,7 @@ init_alias_analysis (void) ...@@ -2957,7 +2957,7 @@ init_alias_analysis (void)
/* Clean up. */ /* Clean up. */
free (new_reg_base_value); free (new_reg_base_value);
new_reg_base_value = 0; new_reg_base_value = 0;
free (reg_seen); sbitmap_free (reg_seen);
reg_seen = 0; reg_seen = 0;
timevar_pop (TV_ALIAS_ANALYSIS); timevar_pop (TV_ALIAS_ANALYSIS);
} }
......
...@@ -837,32 +837,23 @@ bitmap_last_set_bit (const_bitmap a) ...@@ -837,32 +837,23 @@ bitmap_last_set_bit (const_bitmap a)
gcc_unreachable (); gcc_unreachable ();
found_bit: found_bit:
bit_no += ix * BITMAP_WORD_BITS; bit_no += ix * BITMAP_WORD_BITS;
/* Binary search for the last set bit. */
#if GCC_VERSION >= 3004 #if GCC_VERSION >= 3004
gcc_assert (sizeof(long) == sizeof (word)); gcc_assert (sizeof(long) == sizeof (word));
bit_no += sizeof (long) * 8 - __builtin_ctzl (word); bit_no += BITMAP_WORD_BITS - __builtin_clzl (word) - 1;
#else #else
#if BITMAP_WORD_BITS > 64 /* Hopefully this is a twos-complement host... */
#error "Fill out the table." BITMAP_WORD x = word;
#endif x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
#if BITMAP_WORD_BITS > 32 #if BITMAP_WORD_BITS > 32
if ((word & 0xffffffff00000000)) x |= (x >> 32);
word >>= 32, bit_no += 32;
#endif #endif
if (word & 0xffff0000) bit_no += bitmap_popcount (x) - 1;
word >>= 16, bit_no += 16;
if (!(word & 0xff00))
word >>= 8, bit_no += 8;
if (!(word & 0xf0))
word >>= 4, bit_no += 4;
if (!(word & 12))
word >>= 2, bit_no += 2;
if (!(word & 2))
word >>= 1, bit_no += 1;
#endif #endif
gcc_checking_assert (word & 1);
return bit_no; return bit_no;
} }
......
...@@ -67,7 +67,7 @@ static gbb_type ...@@ -67,7 +67,7 @@ static gbb_type
get_bb_type (basic_block bb, struct loop *last_loop) get_bb_type (basic_block bb, struct loop *last_loop)
{ {
VEC (basic_block, heap) *dom; VEC (basic_block, heap) *dom;
int nb_dom, nb_suc; int nb_dom;
struct loop *loop = bb->loop_father; struct loop *loop = bb->loop_father;
/* Check, if we entry into a new loop. */ /* Check, if we entry into a new loop. */
...@@ -88,9 +88,7 @@ get_bb_type (basic_block bb, struct loop *last_loop) ...@@ -88,9 +88,7 @@ get_bb_type (basic_block bb, struct loop *last_loop)
if (nb_dom == 0) if (nb_dom == 0)
return GBB_LAST; return GBB_LAST;
nb_suc = VEC_length (edge, bb->succs); if (nb_dom == 1 && single_succ_p (bb))
if (nb_dom == 1 && nb_suc == 1)
return GBB_SIMPLE; return GBB_SIMPLE;
return GBB_COND_HEADER; return GBB_COND_HEADER;
...@@ -1114,7 +1112,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) ...@@ -1114,7 +1112,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
n_bbs++; n_bbs++;
n_p_bbs += bb->count; n_p_bbs += bb->count;
if (VEC_length (edge, bb->succs) > 1) if (EDGE_COUNT (bb->succs) > 1)
{ {
n_conditions++; n_conditions++;
n_p_conditions += bb->count; n_p_conditions += bb->count;
...@@ -1299,7 +1297,7 @@ canonicalize_loop_closed_ssa (loop_p loop) ...@@ -1299,7 +1297,7 @@ canonicalize_loop_closed_ssa (loop_p loop)
bb = e->dest; bb = e->dest;
if (VEC_length (edge, bb->preds) == 1) if (single_pred_p (bb))
{ {
e = split_block_after_labels (bb); e = split_block_after_labels (bb);
make_close_phi_nodes_unique (e->src); make_close_phi_nodes_unique (e->src);
......
...@@ -97,7 +97,7 @@ print_global_statistics (FILE* file) ...@@ -97,7 +97,7 @@ print_global_statistics (FILE* file)
n_p_loops += bb->count; n_p_loops += bb->count;
} }
if (VEC_length (edge, bb->succs) > 1) if (EDGE_COUNT (bb->succs) > 1)
{ {
n_conditions++; n_conditions++;
n_p_conditions += bb->count; n_p_conditions += bb->count;
...@@ -149,7 +149,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop) ...@@ -149,7 +149,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
n_bbs++; n_bbs++;
n_p_bbs += bb->count; n_p_bbs += bb->count;
if (VEC_length (edge, bb->succs) > 1) if (EDGE_COUNT (bb->succs) > 1)
{ {
n_conditions++; n_conditions++;
n_p_conditions += bb->count; n_p_conditions += bb->count;
......
...@@ -626,10 +626,10 @@ ssa_conflicts_dump (FILE *file, ssa_conflicts_p ptr) ...@@ -626,10 +626,10 @@ ssa_conflicts_dump (FILE *file, ssa_conflicts_p ptr)
fprintf (file, "\nConflict graph:\n"); fprintf (file, "\nConflict graph:\n");
FOR_EACH_VEC_ELT (bitmap, ptr->conflicts, x, b); FOR_EACH_VEC_ELT (bitmap, ptr->conflicts, x, b)
if (b) if (b)
{ {
fprintf (dump_file, "%d: ", x); fprintf (file, "%d: ", x);
dump_bitmap (file, b); dump_bitmap (file, b);
} }
} }
......
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