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: [PATCH] Remove DUP_PASS macro


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~


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