This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] move superblock formation to Tree-SSA
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Robert Kidd <rkidd at crhc dot uiuc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 26 Dec 2006 23:09:32 +0100
- Subject: Re: [PATCH] move superblock formation to Tree-SSA
- References: <7CA33963-EED3-4025-A2BA-1AA881F8F060@crhc.uiuc.edu>
Hello,
> +/* Makes a copy of ORIG and redirects the edge BB->ORIG to the copy. This
> + function fixes up the PHI nodes in the copy's successors. The copy
> + of ORIG is returned. */
> +
> +static basic_block
> +copy_block_and_fix_phi (basic_block bb, basic_block orig)
> +{
> + edge e, e2;
> + edge_iterator ei2;
> + basic_block copy;
> + tree phi;
> +
> + e = find_edge (bb, orig);
> +
> + copy = duplicate_block (orig, e, bb);
> + flush_pending_stmts (e);
> + FOR_EACH_EDGE (e2, ei2, copy->succs)
> + {
> + e = find_edge (orig, e2->dest);
> +
> + for (phi = phi_nodes (e2->dest); phi; phi = PHI_CHAIN (phi))
> + add_phi_arg (phi, PHI_ARG_DEF_FROM_EDGE (phi, e), e2);
> + }
> +
> + return copy;
> +}
this can be simplified using tree-cfg.c:add_phi_args_after_copy.
Zdenek