This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Dataflow branch review #2


On 5/31/07, Richard Sandiford <richard@codesourcery.com> wrote:
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.

Interesting, when i wrote this macro, i actually copied it from GCSE (or somewhere). If you think the
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.)

Ya, we should rename it to TMP or something :)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]