This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Remove DUP_PASS macro
- From: Richard Henderson <rth at redhat dot com>
- To: Brian Booth <bbooth at redhat dot com>
- Cc: GCC-Patches <gcc-patches at gcc dot gnu dot org>, Diego <dnovillo at redhat dot com>
- Date: Fri, 23 Jul 2004 13:40:45 -0700
- Subject: Re: [PATCH] Remove DUP_PASS macro
- References: <1090603941.8134.155.camel@toss-off.toronto.redhat.com>
On Fri, Jul 23, 2004 at 01:32:22PM -0400, Brian Booth wrote:
> * tree-pass.h (tree_opt_pass): Add in_pass_list flag.
Hmm. I would think that you could use static_pass_number to
tell whether or not this pass has been added before. That
means adjusting the arithmetic inside dup_pass_1, but should
be simple enough. Something like
0 not added
-1 added, no duplicates
-2 added, one duplicate
...
1 n/a
2 added, is second instance of the pass (dup number 1)
3 added, is third instance
...
So
#define NEXT_PASS(PASS) \
(*p = (PASS.static_pass_number \
? dup_pass_1 (&PASS) \
: PASS.static_pass_number = -1, &PASS), \
p = &(*p)->next)
and in dup_pass_1,
pass->static_pass_number -= 1;
new->static_pass_number = -pass->static_pass_number;
Although my NEXT_PASS implementation is ugly enough that the
guts should all be moved into the function call, resulting in
#define NEXT_PASS(PASS) (p = next_pass_1 (p, &PASS))
r~