Commit 738ed977 by Zdenek Dvorak Committed by Zdenek Dvorak

* dominance.c (recount_dominator): Handle postdominators.

From-SVN: r78734
parent 27c10211
2004-03-02 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* dominance.c (recount_dominator): Handle postdominators.
2004-03-01 Richard Sandiford <rsandifo@redhat.com> 2004-03-01 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips-protos.h (enum mips_symbol_type): Move from mips.h. * config/mips/mips-protos.h (enum mips_symbol_type): Move from mips.h.
......
...@@ -769,23 +769,38 @@ verify_dominators (enum cdi_direction dir) ...@@ -769,23 +769,38 @@ verify_dominators (enum cdi_direction dir)
abort (); abort ();
} }
/* Recount dominator of BB. */ /* Determine immediate dominator (or postdominator, according to DIR) of BB,
assuming that dominators of other blocks are correct. We also use it to
recompute the dominators in a restricted area, by iterating it until it
reaches a fixpoint. */
basic_block basic_block
recount_dominator (enum cdi_direction dir, basic_block bb) recount_dominator (enum cdi_direction dir, basic_block bb)
{ {
basic_block dom_bb = NULL; basic_block dom_bb = NULL;
edge e; edge e;
if (!dom_computed[dir]) if (!dom_computed[dir])
abort (); abort ();
for (e = bb->pred; e; e = e->pred_next) if (dir == CDI_DOMINATORS)
{ {
if (!dominated_by_p (dir, e->src, bb)) for (e = bb->pred; e; e = e->pred_next)
dom_bb = nearest_common_dominator (dir, dom_bb, e->src); {
} if (!dominated_by_p (dir, e->src, bb))
dom_bb = nearest_common_dominator (dir, dom_bb, e->src);
}
}
else
{
for (e = bb->succ; e; e = e->succ_next)
{
if (!dominated_by_p (dir, e->dest, bb))
dom_bb = nearest_common_dominator (dir, dom_bb, e->dest);
}
}
return dom_bb; return dom_bb;
} }
/* Iteratively recount dominators of BBS. The change is supposed to be local /* Iteratively recount dominators of BBS. The change is supposed to be local
......
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