This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Not using VAR_DECLs for temporary variables
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 15 Jan 2006 16:33:55 -0800
- Subject: Re: [RFC] Not using VAR_DECLs for temporary variables
- References: <20051221153722.GA20730@atrey.karlin.mff.cuni.cz>
Zdenek Dvorak wrote:
> Hello,
>
> during expansion of expressions, gimplification creates a lot of temporary
> variables. VAR_DECLs are fairly large (88 bytes on i686), and
> additionally an annotation (44 bytes on i686) are allocated for each of
> them (some of them even get names, for additional ~50 bytes of memory
> each). This is quite wasteful.
Indeed; this is something I've been hoping we could fix for some time.
> Basic observation is that these temporaries have exactly one definition.
> It is therefore possible to generate directly SSA_NAMEs for them,
> setting SSA_NAME_VAR to NULL (and be careful to never rewrite them out
> of ssa). Theoretically, it should need only a few changes to gimplification,
> into- and out-of-ssa, and expand, and everything should work. Unfortunately,
> lot of SSA passes looks on SSA_NAME_VAR. This seems wrong to me, but
> changing all the places would be very hard.
>
> However, if we instead put a really minimal DECL node (we allocate only
> one per type, and consisting just of struct tree_common -- 16 bytes) as
> a SSA_NAME_VAR, things are much easier to get working.
I think we should do the complete patch. I know it's going to be
tedious to fix the uses of SSA_NAME_VAR, but I think that would be much
cleaner, and will also avoid problems where we have a DECL (GVAR_DECL)
that is missing fields that other parts of the compiler might expect a
DECL to have.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713