This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PRE iteration in PR40761
- From: Michael Matz <matz at suse dot de>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 4 Mar 2010 16:02:35 +0100 (CET)
- Subject: Re: [PATCH] Fix PRE iteration in PR40761
- References: <alpine.LNX.2.00.1003031727510.4650@zhemvz.fhfr.qr>
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.