------- Comment #7 from amacleod at redhat dot com 2006-07-27 16:35 -------
There is always the danger of losing track of exceptions.
Another option is to create an inline routine in tree-flow-inline.h which does
what you lay out, and then change set_bb_for_stmt to call it, looking something
like:
Index: tree-cfg.c
===================================================================
*** tree-cfg.c (revision 114853)
--- tree-cfg.c (working copy)
*************** set_bb_for_stmt (tree t, basic_block bb)
*** 2741,2749 ****
}
else
{
- stmt_ann_t ann = get_stmt_ann (t);
- ann->bb = bb;
-
/* If the statement is a label, add the label to block-to-labels map
so that we can speed up edge creation for GOTO_EXPRs. */
if (TREE_CODE (t) == LABEL_EXPR)
--- 2741,2746 ----
*************** set_bb_for_stmt (tree t, basic_block bb)
*** 2773,2780 ****
removed it from the old block. */
gcc_assert (!bb
|| !VEC_index (basic_block, label_to_block_map, uid));
- VEC_replace (basic_block, label_to_block_map, uid, bb);
}
}
}
--- 2770,2777 ----
removed it from the old block. */
gcc_assert (!bb
|| !VEC_index (basic_block, label_to_block_map, uid));
}
+ set_bb_for_tree_stmt_raw (t, bb);
}
}
>From a quick glance it doesnt appear that changing the order like that is
significant, and then everything is still done in one place.
It'd probably be worthwhile to add gcc_assert()'s with ENABLE_CHECKING that the
tree passed to the new inline routine isn't a STMT_LIST or a PHI_NODE, and
maybe if it is a LABEL_EXPR, that the uid isn't -1... just to confirm
everything is kosher :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28480