Commit 7b19209f by Steven Bosscher

bitmap.h (bitmap_and_into): Update prototype.

	* bitmap.h (bitmap_and_into): Update prototype.
	* bitmap.c (bitmap_and_into): Return true if the target bitmap
	changed, false otherwise.

	* df.h (df_dump_insn_problem_function): New function type.
	(struct df_problem): Add two functions, to dump just before and
	just after an insn.
	(DF_RD_PRUNE_DEAD_DEFS): New changable flag.
	(df_dump_insn_top, df_dump_insn_bottom): New prototypes.
	* df-core (df_dump_region): Use dump_bb.
	(df_dump_bb_problem_data): New function.
	(df_dump_top, df_dump_bottom): Rewrite using df_dump_bb_problem_data.
	(df_dump_insn_problem_data): New function.
	(df_dump_insn_top, df_dump_insn_bottom): New functions.
	* df-scan.c (problem_SCAN): Add NULL fields for new members.
	* df-problems.c (df_rd_local_compute): Ignore hard registers if
	DF_NO_HARD_REGS is in effect.
	(df_rd_transfer_function): If DF_RD_PRUNE_DEAD_DEFS is in effect,
	prune reaching defs using the LR problem.
	(df_rd_start_dump): Fix dumping of DEFs map.
	(df_rd_dump_defs_set): New function.
	(df_rd_top_dump, df_rd_bottom_dump): Use it.
	(problem_RD): Add NULL fields for new members.
	(problem_LR, problem_LIVE): Likewise.
	(df_chain_bb_dump): New function.
	(df_chain_top_dump): Dump only for artificial DEFs and USEs,
	using df_chain_bb_dump.
	(df_chain_bottom_dump): Likewise.
	(df_chain_insn_top_dump, df_chain_insn_bottom_dump): New functions.
	(problem_CHAIN): Add them as new members.
	(problem_WORD_LR, problem_NOTE): Add NULL fields for new members.
	(problem_MD): Likewise.
	* cfgrtl.c (rtl_dump_bb): Use df_dump_insn_top and df_dump_insn_bottom.
	(print_rtl_with_bb): Likewise.

	* dce.c (init_dce): Use DF_RD_PRUNE_DEAD_DEFS.
	* loop-invariant.c (find_defs): Likewise.
	* loop-iv.c (iv_analysis_loop_init): Likewise.
	* ree.c (find_and_remove_re): Likewise.
	* web.c (web_main): Likewise.

From-SVN: r192213
parent 76cee070
2012-10-08 Steven Bosscher <steven@gcc.gnu.org>
* bitmap.h (bitmap_and_into): Update prototype.
* bitmap.c (bitmap_and_into): Return true if the target bitmap
changed, false otherwise.
* df.h (df_dump_insn_problem_function): New function type.
(struct df_problem): Add two functions, to dump just before and
just after an insn.
(DF_RD_PRUNE_DEAD_DEFS): New changable flag.
(df_dump_insn_top, df_dump_insn_bottom): New prototypes.
* df-core (df_dump_region): Use dump_bb.
(df_dump_bb_problem_data): New function.
(df_dump_top, df_dump_bottom): Rewrite using df_dump_bb_problem_data.
(df_dump_insn_problem_data): New function.
(df_dump_insn_top, df_dump_insn_bottom): New functions.
* df-scan.c (problem_SCAN): Add NULL fields for new members.
* df-problems.c (df_rd_local_compute): Ignore hard registers if
DF_NO_HARD_REGS is in effect.
(df_rd_transfer_function): If DF_RD_PRUNE_DEAD_DEFS is in effect,
prune reaching defs using the LR problem.
(df_rd_start_dump): Fix dumping of DEFs map.
(df_rd_dump_defs_set): New function.
(df_rd_top_dump, df_rd_bottom_dump): Use it.
(problem_RD): Add NULL fields for new members.
(problem_LR, problem_LIVE): Likewise.
(df_chain_bb_dump): New function.
(df_chain_top_dump): Dump only for artificial DEFs and USEs,
using df_chain_bb_dump.
(df_chain_bottom_dump): Likewise.
(df_chain_insn_top_dump, df_chain_insn_bottom_dump): New functions.
(problem_CHAIN): Add them as new members.
(problem_WORD_LR, problem_NOTE): Add NULL fields for new members.
(problem_MD): Likewise.
* cfgrtl.c (rtl_dump_bb): Use df_dump_insn_top and df_dump_insn_bottom.
(print_rtl_with_bb): Likewise.
* dce.c (init_dce): Use DF_RD_PRUNE_DEAD_DEFS.
* loop-invariant.c (find_defs): Likewise.
* loop-iv.c (iv_analysis_loop_init): Likewise.
* ree.c (find_and_remove_re): Likewise.
* web.c (web_main): Likewise.
2012-10-08 Jason Merrill <jason@redhat.com> 2012-10-08 Jason Merrill <jason@redhat.com>
* config/rs6000/rs6000.c (rs6000_code_end): Protect the use of * config/rs6000/rs6000.c (rs6000_code_end): Protect the use of
...@@ -319,7 +362,7 @@ ...@@ -319,7 +362,7 @@
2012-10-04 Jeff Law <law@redhat.com> 2012-10-04 Jeff Law <law@redhat.com>
* PR target/50356 PR target/50356
* config/h8300/h8300.c (h8300_rtx_costs): Fix typo in CONST_INT case. * config/h8300/h8300.c (h8300_rtx_costs): Fix typo in CONST_INT case.
2012-10-04 Jason Merrill <jason@redhat.com> 2012-10-04 Jason Merrill <jason@redhat.com>
......
...@@ -916,17 +916,18 @@ bitmap_and (bitmap dst, const_bitmap a, const_bitmap b) ...@@ -916,17 +916,18 @@ bitmap_and (bitmap dst, const_bitmap a, const_bitmap b)
dst->indx = dst->current->indx; dst->indx = dst->current->indx;
} }
/* A &= B. */ /* A &= B. Return true if A changed. */
void bool
bitmap_and_into (bitmap a, const_bitmap b) bitmap_and_into (bitmap a, const_bitmap b)
{ {
bitmap_element *a_elt = a->first; bitmap_element *a_elt = a->first;
const bitmap_element *b_elt = b->first; const bitmap_element *b_elt = b->first;
bitmap_element *next; bitmap_element *next;
bool changed = false;
if (a == b) if (a == b)
return; return false;
while (a_elt && b_elt) while (a_elt && b_elt)
{ {
...@@ -935,6 +936,7 @@ bitmap_and_into (bitmap a, const_bitmap b) ...@@ -935,6 +936,7 @@ bitmap_and_into (bitmap a, const_bitmap b)
next = a_elt->next; next = a_elt->next;
bitmap_element_free (a, a_elt); bitmap_element_free (a, a_elt);
a_elt = next; a_elt = next;
changed = true;
} }
else if (b_elt->indx < a_elt->indx) else if (b_elt->indx < a_elt->indx)
b_elt = b_elt->next; b_elt = b_elt->next;
...@@ -947,7 +949,8 @@ bitmap_and_into (bitmap a, const_bitmap b) ...@@ -947,7 +949,8 @@ bitmap_and_into (bitmap a, const_bitmap b)
for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++) for (ix = 0; ix < BITMAP_ELEMENT_WORDS; ix++)
{ {
BITMAP_WORD r = a_elt->bits[ix] & b_elt->bits[ix]; BITMAP_WORD r = a_elt->bits[ix] & b_elt->bits[ix];
if (a_elt->bits[ix] != r)
changed = true;
a_elt->bits[ix] = r; a_elt->bits[ix] = r;
ior |= r; ior |= r;
} }
...@@ -958,9 +961,17 @@ bitmap_and_into (bitmap a, const_bitmap b) ...@@ -958,9 +961,17 @@ bitmap_and_into (bitmap a, const_bitmap b)
b_elt = b_elt->next; b_elt = b_elt->next;
} }
} }
if (a_elt)
{
changed = true;
bitmap_elt_clear_from (a, a_elt); bitmap_elt_clear_from (a, a_elt);
}
gcc_checking_assert (!a->current == !a->first gcc_checking_assert (!a->current == !a->first
&& (!a->current || a->indx == a->current->indx)); && (!a->current || a->indx == a->current->indx));
return changed;
} }
......
...@@ -224,7 +224,7 @@ extern unsigned long bitmap_count_bits (const_bitmap); ...@@ -224,7 +224,7 @@ extern unsigned long bitmap_count_bits (const_bitmap);
are three operand versions that to not destroy the source bitmaps. are three operand versions that to not destroy the source bitmaps.
The operations supported are &, & ~, |, ^. */ The operations supported are &, & ~, |, ^. */
extern void bitmap_and (bitmap, const_bitmap, const_bitmap); extern void bitmap_and (bitmap, const_bitmap, const_bitmap);
extern void bitmap_and_into (bitmap, const_bitmap); extern bool bitmap_and_into (bitmap, const_bitmap);
extern bool bitmap_and_compl (bitmap, const_bitmap, const_bitmap); extern bool bitmap_and_compl (bitmap, const_bitmap, const_bitmap);
extern bool bitmap_and_compl_into (bitmap, const_bitmap); extern bool bitmap_and_compl_into (bitmap, const_bitmap);
#define bitmap_compl_and(DST, A, B) bitmap_and_compl (DST, B, A) #define bitmap_compl_and(DST, A, B) bitmap_and_compl (DST, B, A)
......
...@@ -1856,11 +1856,14 @@ rtl_dump_bb (FILE *outf, basic_block bb, int indent, int flags) ...@@ -1856,11 +1856,14 @@ rtl_dump_bb (FILE *outf, basic_block bb, int indent, int flags)
for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb)); insn != last; for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb)); insn != last;
insn = NEXT_INSN (insn)) insn = NEXT_INSN (insn))
{ {
if (flags & TDF_DETAILS)
df_dump_insn_top (insn, outf);
if (! (flags & TDF_SLIM)) if (! (flags & TDF_SLIM))
print_rtl_single (outf, insn); print_rtl_single (outf, insn);
else else
dump_insn_slim (outf, insn); dump_insn_slim (outf, insn);
if (flags & TDF_DETAILS)
df_dump_insn_bottom (insn, outf);
} }
if (df && (flags & TDF_DETAILS)) if (df && (flags & TDF_DETAILS))
...@@ -1941,10 +1944,14 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags) ...@@ -1941,10 +1944,14 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)
fprintf (outf, ";; Insn is in multiple basic blocks\n"); fprintf (outf, ";; Insn is in multiple basic blocks\n");
} }
if (flags & TDF_DETAILS)
df_dump_insn_top (tmp_rtx, outf);
if (! (flags & TDF_SLIM)) if (! (flags & TDF_SLIM))
print_rtl_single (outf, tmp_rtx); print_rtl_single (outf, tmp_rtx);
else else
dump_insn_slim (outf, tmp_rtx); dump_insn_slim (outf, tmp_rtx);
if (flags & TDF_DETAILS)
df_dump_insn_bottom (tmp_rtx, outf);
if (flags & TDF_BLOCKS) if (flags & TDF_BLOCKS)
{ {
......
...@@ -704,7 +704,10 @@ init_dce (bool fast) ...@@ -704,7 +704,10 @@ init_dce (bool fast)
if (!df_in_progress) if (!df_in_progress)
{ {
if (!fast) if (!fast)
{
df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
df_chain_add_problem (DF_UD_CHAIN); df_chain_add_problem (DF_UD_CHAIN);
}
df_analyze (); df_analyze ();
} }
......
...@@ -1994,10 +1994,7 @@ df_dump_region (FILE *file) ...@@ -1994,10 +1994,7 @@ df_dump_region (FILE *file)
EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, bb_index, bi) EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, bb_index, bi)
{ {
basic_block bb = BASIC_BLOCK (bb_index); basic_block bb = BASIC_BLOCK (bb_index);
dump_bb (file, bb, 0, TDF_DETAILS);
df_print_bb_index (bb, file);
df_dump_top (bb, file);
df_dump_bottom (bb, file);
} }
fprintf (file, "\n"); fprintf (file, "\n");
} }
...@@ -2035,10 +2032,9 @@ df_dump_start (FILE *file) ...@@ -2035,10 +2032,9 @@ df_dump_start (FILE *file)
} }
/* Dump the top of the block information for BB. */ /* Dump the top or bottom of the block information for BB. */
static void
void df_dump_bb_problem_data (basic_block bb, FILE *file, bool top)
df_dump_top (basic_block bb, FILE *file)
{ {
int i; int i;
...@@ -2050,19 +2046,40 @@ df_dump_top (basic_block bb, FILE *file) ...@@ -2050,19 +2046,40 @@ df_dump_top (basic_block bb, FILE *file)
struct dataflow *dflow = df->problems_in_order[i]; struct dataflow *dflow = df->problems_in_order[i];
if (dflow->computed) if (dflow->computed)
{ {
df_dump_bb_problem_function bbfun = dflow->problem->dump_top_fun; df_dump_bb_problem_function bbfun;
if (top)
bbfun = dflow->problem->dump_top_fun;
else
bbfun = dflow->problem->dump_bottom_fun;
if (bbfun) if (bbfun)
bbfun (bb, file); bbfun (bb, file);
} }
} }
} }
/* Dump the top of the block information for BB. */
void
df_dump_top (basic_block bb, FILE *file)
{
df_dump_bb_problem_data (bb, file, /*top=*/true);
}
/* Dump the bottom of the block information for BB. */ /* Dump the bottom of the block information for BB. */
void void
df_dump_bottom (basic_block bb, FILE *file) df_dump_bottom (basic_block bb, FILE *file)
{ {
df_dump_bb_problem_data (bb, file, /*top=*/false);
}
/* Dump information about INSN just before or after dumping INSN itself. */
static void
df_dump_insn_problem_data (const_rtx insn, FILE *file, bool top)
{
int i; int i;
if (!df || !file) if (!df || !file)
...@@ -2073,13 +2090,35 @@ df_dump_bottom (basic_block bb, FILE *file) ...@@ -2073,13 +2090,35 @@ df_dump_bottom (basic_block bb, FILE *file)
struct dataflow *dflow = df->problems_in_order[i]; struct dataflow *dflow = df->problems_in_order[i];
if (dflow->computed) if (dflow->computed)
{ {
df_dump_bb_problem_function bbfun = dflow->problem->dump_bottom_fun; df_dump_insn_problem_function insnfun;
if (bbfun)
bbfun (bb, file); if (top)
insnfun = dflow->problem->dump_insn_top_fun;
else
insnfun = dflow->problem->dump_insn_bottom_fun;
if (insnfun)
insnfun (insn, file);
} }
} }
} }
/* Dump information about INSN before dumping INSN itself. */
void
df_dump_insn_top (const_rtx insn, FILE *file)
{
df_dump_insn_problem_data (insn, file, /*top=*/true);
}
/* Dump information about INSN after dumping INSN itself. */
void
df_dump_insn_bottom (const_rtx insn, FILE *file)
{
df_dump_insn_problem_data (insn, file, /*top=*/false);
}
static void static void
df_ref_dump (df_ref ref, FILE *file) df_ref_dump (df_ref ref, FILE *file)
......
...@@ -510,6 +510,8 @@ static struct df_problem problem_SCAN = ...@@ -510,6 +510,8 @@ static struct df_problem problem_SCAN =
df_scan_start_dump, /* Debugging. */ df_scan_start_dump, /* Debugging. */
df_scan_start_block, /* Debugging start block. */ df_scan_start_block, /* Debugging start block. */
NULL, /* Debugging end block. */ NULL, /* Debugging end block. */
NULL, /* Debugging start insn. */
NULL, /* Debugging end insn. */
NULL, /* Incremental solution verify start. */ NULL, /* Incremental solution verify start. */
NULL, /* Incremental solution verify end. */ NULL, /* Incremental solution verify end. */
NULL, /* Dependent problem. */ NULL, /* Dependent problem. */
......
...@@ -239,6 +239,9 @@ typedef void (*df_dump_problem_function) (FILE *); ...@@ -239,6 +239,9 @@ typedef void (*df_dump_problem_function) (FILE *);
/* Function to dump top or bottom of basic block results to FILE. */ /* Function to dump top or bottom of basic block results to FILE. */
typedef void (*df_dump_bb_problem_function) (basic_block, FILE *); typedef void (*df_dump_bb_problem_function) (basic_block, FILE *);
/* Function to dump before or after an insn to FILE. */
typedef void (*df_dump_insn_problem_function) (const_rtx, FILE *);
/* Function to dump top or bottom of basic block results to FILE. */ /* Function to dump top or bottom of basic block results to FILE. */
typedef void (*df_verify_solution_start) (void); typedef void (*df_verify_solution_start) (void);
...@@ -268,6 +271,8 @@ struct df_problem { ...@@ -268,6 +271,8 @@ struct df_problem {
df_dump_problem_function dump_start_fun; df_dump_problem_function dump_start_fun;
df_dump_bb_problem_function dump_top_fun; df_dump_bb_problem_function dump_top_fun;
df_dump_bb_problem_function dump_bottom_fun; df_dump_bb_problem_function dump_bottom_fun;
df_dump_insn_problem_function dump_insn_top_fun;
df_dump_insn_problem_function dump_insn_bottom_fun;
df_verify_solution_start verify_start_fun; df_verify_solution_start verify_start_fun;
df_verify_solution_end verify_end_fun; df_verify_solution_end verify_end_fun;
struct df_problem *dependent_problem; struct df_problem *dependent_problem;
...@@ -463,7 +468,12 @@ enum df_changeable_flags ...@@ -463,7 +468,12 @@ enum df_changeable_flags
rescans to be batched. */ rescans to be batched. */
DF_DEFER_INSN_RESCAN = 1 << 5, DF_DEFER_INSN_RESCAN = 1 << 5,
DF_VERIFY_SCHEDULED = 1 << 6 /* Compute the reaching defs problem as "live and reaching defs" (LR&RD).
A DEF is reaching and live at insn I if DEF reaches I and REGNO(DEF)
is in LR_IN of the basic block containing I. */
DF_RD_PRUNE_DEAD_DEFS = 1 << 6,
DF_VERIFY_SCHEDULED = 1 << 7
}; };
/* Two of these structures are inline in df, one for the uses and one /* Two of these structures are inline in df, one for the uses and one
...@@ -773,7 +783,9 @@ struct df_scan_bb_info ...@@ -773,7 +783,9 @@ struct df_scan_bb_info
/* Reaching definitions. All bitmaps are indexed by the id field of /* Reaching definitions. All bitmaps are indexed by the id field of
the ref except sparse_kill which is indexed by regno. */ the ref except sparse_kill which is indexed by regno. For the
LR&RD problem, the kill set is not complete: It does not contain
DEFs killed because the set register has died in the LR set. */
struct df_rd_bb_info struct df_rd_bb_info
{ {
/* Local sets to describe the basic blocks. */ /* Local sets to describe the basic blocks. */
...@@ -918,6 +930,8 @@ extern void df_dump_region (FILE *); ...@@ -918,6 +930,8 @@ extern void df_dump_region (FILE *);
extern void df_dump_start (FILE *); extern void df_dump_start (FILE *);
extern void df_dump_top (basic_block, FILE *); extern void df_dump_top (basic_block, FILE *);
extern void df_dump_bottom (basic_block, FILE *); extern void df_dump_bottom (basic_block, FILE *);
extern void df_dump_insn_top (const_rtx, FILE *);
extern void df_dump_insn_bottom (const_rtx, FILE *);
extern void df_refs_chain_dump (df_ref *, bool, FILE *); extern void df_refs_chain_dump (df_ref *, bool, FILE *);
extern void df_regs_chain_dump (df_ref, FILE *); extern void df_regs_chain_dump (df_ref, FILE *);
extern void df_insn_debug (rtx, bool, FILE *); extern void df_insn_debug (rtx, bool, FILE *);
......
...@@ -659,20 +659,28 @@ find_defs (struct loop *loop, basic_block *body) ...@@ -659,20 +659,28 @@ find_defs (struct loop *loop, basic_block *body)
for (i = 0; i < loop->num_nodes; i++) for (i = 0; i < loop->num_nodes; i++)
bitmap_set_bit (blocks, body[i]->index); bitmap_set_bit (blocks, body[i]->index);
if (dump_file)
{
fprintf (dump_file,
"*****starting processing of loop %d ******\n",
loop->num);
}
df_remove_problem (df_chain); df_remove_problem (df_chain);
df_process_deferred_rescans (); df_process_deferred_rescans ();
df_chain_add_problem (DF_UD_CHAIN); df_chain_add_problem (DF_UD_CHAIN);
df_set_blocks (blocks); df_set_blocks (blocks);
df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
df_analyze (); df_analyze ();
check_invariant_table_size ();
if (dump_file) if (dump_file)
{ {
df_dump_region (dump_file); df_dump_region (dump_file);
fprintf (dump_file, "*****starting processing of loop ******\n"); fprintf (dump_file,
print_rtl_with_bb (dump_file, get_insns (), dump_flags); "*****ending processing of loop %d ******\n",
fprintf (dump_file, "*****ending processing of loop ******\n"); loop->num);
} }
check_invariant_table_size ();
BITMAP_FREE (blocks); BITMAP_FREE (blocks);
} }
......
...@@ -293,6 +293,7 @@ iv_analysis_loop_init (struct loop *loop) ...@@ -293,6 +293,7 @@ iv_analysis_loop_init (struct loop *loop)
the problem back. */ the problem back. */
df_remove_problem (df_chain); df_remove_problem (df_chain);
df_process_deferred_rescans (); df_process_deferred_rescans ();
df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
df_chain_add_problem (DF_UD_CHAIN); df_chain_add_problem (DF_UD_CHAIN);
df_note_add_problem (); df_note_add_problem ();
df_set_blocks (blocks); df_set_blocks (blocks);
......
...@@ -868,6 +868,7 @@ find_and_remove_re (void) ...@@ -868,6 +868,7 @@ find_and_remove_re (void)
/* Construct DU chain to get all reaching definitions of each /* Construct DU chain to get all reaching definitions of each
extension instruction. */ extension instruction. */
df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
df_chain_add_problem (DF_UD_CHAIN + DF_DU_CHAIN); df_chain_add_problem (DF_UD_CHAIN + DF_DU_CHAIN);
df_analyze (); df_analyze ();
df_set_flags (DF_DEFER_INSN_RESCAN); df_set_flags (DF_DEFER_INSN_RESCAN);
......
...@@ -313,6 +313,7 @@ web_main (void) ...@@ -313,6 +313,7 @@ web_main (void)
rtx insn; rtx insn;
df_set_flags (DF_NO_HARD_REGS + DF_EQ_NOTES); df_set_flags (DF_NO_HARD_REGS + DF_EQ_NOTES);
df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
df_chain_add_problem (DF_UD_CHAIN); df_chain_add_problem (DF_UD_CHAIN);
df_analyze (); df_analyze ();
df_set_flags (DF_DEFER_INSN_RESCAN); df_set_flags (DF_DEFER_INSN_RESCAN);
......
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