This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Experiences using struct gcc_target
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: Experiences using struct gcc_target
- From: Stan Shebs <shebs at apple dot com>
- Date: Fri, 06 Jul 2001 12:12:06 -0700
- CC: gcc at gcc dot gnu dot org
- References: <20010705074533.B2837@daikokuya.demon.co.uk>
Neil Booth wrote:
>
> > 1a. Because expand_builtin gets rtxes as args, and because
> > target.h is included in tree.c, I had to include rtl.h in tree.c.
> > Although I don't think this is Evil(tm), it's certainly
> > counterintuitive.
>
> You shouldn't need to. Your problem is rtx is a typedef. Use a
> (possibly predeclared) union rtx_def * (or whatever rtx really is).
> You just have a pointer to the type, and not the type itself, so you
> shouldn't need rtl.h.
I switched to struct rtx_def *, and added a forward definition
of struct rtx_def to target.h.
> > 2. There are lots and lots of local variables named "target"
> > in the sources, and every one of them is going to mask the global
> > "target" that is the function vector. I don't know whether it
> > makes more sense to change the global's name or to adjust each
> > function as conflicts occur.
>
> Ugh. I've changed one I hit in cp/decl2.c to tgt. I'm open on what
> to do in general here too. If we rename "target" from target.h, I
> request we keep the name short, otherwise we'll cause lots of stuff
> that accesses it to line wrap.
I dug a bit more, and "target" is used by absolutely everything from
expand_expr on down, so I think we want to tweak the 30-40 global name
refs rather than hundreds of lines in expr.c etc. How about "gtarget"?
Not the most graceful, but it's a contraction of gcc_target, and doesn't
occur anywhere else in the sources.
Stan