[PATCH] Fix PRE iteration in PR40761
Michael Matz
matz@suse.de
Thu Mar 4 15:53:00 GMT 2010
Hi,
On Wed, 3 Mar 2010, Richard Guenther wrote:
> Bootstrap and regtest running on x86_64-unknown-linux-gnu (I wonder
> which other users of postorder_compute rather want pre-order on the
> reverse flowgraph ...).
>
> If someone can suggest a more proper name for the function I'll move it
> to cfganal.
pre_order_rcfg_compute?
I find the _compute suffix of all these functions mildly irritating,
perhaps instead rename them all to get_xxx? In which case it would be
possible to include "cfg_" or "rcfg_" as a second prefix:
get_cfg_post_order, get_rcfg_pre_order, and the like.
> + /* Compute a reverse post-order in *POST_ORDER. If INCLUDE_ENTRY_EXIT is
> + true, then then ENTRY_BLOCK and EXIT_BLOCK are included. Returns
> + the number of visited blocks. */
The comment doesn't match now anymore. And the function as now only works
correctly if there aren't any reverse-unreachable blocks, that should
probably be documented (or even gcc_asserted) or fixed.
Shouldn't this rather be factored with the current code in cfganal.c,
where it then would be enough to have
workhorse (int *pre, int *post, bool on_rcfg)
...
> + /* Look at the edge on the top of the stack. */
> + ei = stack[sp - 1];
> + src = ei_edge (ei)->src;
> + dest = ei_edge (ei)->dest;
if (on_rcfg)
src = ei_edge (ei)->dest, dest = ei_edge (ei)->src;
else
src = ei_edge (ei)->src, dest = ei_edge (ei)->dest;
...
and the rest of the code could be used as is? (plus the obvious wrappers
then).
Ciao,
Michael.
More information about the Gcc-patches
mailing list