This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] empty_stmt_nodes, deleted statements, iterators, and gsi_step_bb
On Fri, 29 Nov 2002, Daniel Berlin wrote:
>
> On Friday, November 29, 2002, at 12:50 PM, Diego Novillo wrote:
>
> >On Fri, 29 Nov 2002, Andrew Macleod wrote:
> >
> >>So why does the builder do this? why doesn't it do something such as
> >>link a compound statement into the tree, hang an empty_stmt node off
> >>it,
> >>and then point to that?
> >>
> >Because the CFG builder is not particularly bright. Your
> >suggestion sounds good to me. Care to implement it? :)
>
> You have to hang two, no?
> :)
>
Hmm, maybe, but I wouldn't have thought it to be necessary. I
really haven't given much thought to it yet. In principle,
inserting a statement is a matter of
1- Create a COMPOUND_EXPR containing the new statement (N) and
the old statement (O). The relative order between N and O
depends on whether you want to insert before or after.
2- Replace O with the new COMPOUND_EXPR.
You can then call one of the gimplifier functions to re-chain the
function (rationalize_compound_expr) so that the chain is
made right associative.
Diego.