This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Dataflow branch review #2
- From: Richard Sandiford <richard at codesourcery dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: zadeck at naturalbridge dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 31 May 2007 12:25:55 +0100
- Subject: Re: Dataflow branch review #2
- References: <m3myzlx1po.fsf@localhost.localdomain>
Ian Lance Taylor <iant@google.com> writes:
> +/* For iterating over insns in basic block when we might remove the
> + current insn. */
> +#define FOR_BB_INSNS_SAFE(BB, INSN, CURR) \
> + for ((INSN) = BB_HEAD (BB), (CURR)=(INSN) ? NEXT_INSN ((INSN)): NULL; \
> + (INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \
> + (INSN) = (CURR), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL)
Would:
for ((INSN) = BB_HEAD (BB); \
(INSN) \
&& (INSN) != NEXT_INSN (BB_END (BB)) \
&& ((CURR) = NEXT_INSN (INSN), true); \
(INSN) = (CURR))
be any better? It's the construct I'm more used to seeing when the
loop is written by hand, albeit with the CURR assignment at the
beginning of the loop body. Similarly for the reverse version.
CURR seems a little misnamed really. It sounds like it ought to be
the current instruction, but it's not. (Indeed, without a comment
saying what CURR is, you might even think CURR is the thing you're
supposed to use.)
Richard