aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/flow.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-26 22:41:55 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:05:02 -0700
commit06242e217c91fd3808091c1ed119a10131c4242e (patch)
treef622732d00966fccf9ce1ba87bfacf1677f028d7 /flow.c
parentfcf778f11624e1d87f3ae241085c8ba32f5e83f9 (diff)
downloadsparse-dev-06242e217c91fd3808091c1ed119a10131c4242e.tar.gz
Be a lot more careful when re-writing branches.
Besides, the code is cleaner now - we can use our helper functions.
Diffstat (limited to 'flow.c')
-rw-r--r--flow.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/flow.c b/flow.c
index 06d54c08..25c9df23 100644
--- a/flow.c
+++ b/flow.c
@@ -29,21 +29,13 @@ static void rewrite_branch(struct basic_block *bb,
struct basic_block *old,
struct basic_block *new)
{
- struct basic_block *tmp;
-
if (*ptr != old)
return;
*ptr = new;
- FOR_EACH_PTR(new->parents, tmp) {
- if (tmp == old)
- *THIS_ADDRESS(tmp) = bb;
- } END_FOR_EACH_PTR(tmp);
-
- FOR_EACH_PTR(bb->children, tmp) {
- if (tmp == old)
- *THIS_ADDRESS(tmp) = new;
- } END_FOR_EACH_PTR(tmp);
+ replace_bb_in_list(&bb->children, old, new);
+ remove_bb_from_list(&old->parents, bb);
+ add_bb(&new->parents, bb);
}
/*