MEM flags and stack temps

Joe Buck jbuck@synopsys.COM
Wed Nov 15 17:00:00 GMT 2000


Mark Mitchell writes:

[ #1 deleted ]

#2:
>   - Treat stack slots like registers, and allocate them in a 
>     "stack allocator".  In other words, have (MEM (STACK_SLOT x))
>     for a while, and then resolve them to hard slots late
>     in the game.
> 
> I actually think both approaches are good ideas.  The second is
> appealing in that it helps blur the boundary between things that fit
> in a machine register, and things that don't.

Yes!  With the second approach, it will then be straightforward to get rid of
the huge number of dead stores we get on C++ code (currently once an
object is assigned to the stack and we write it, the compiler is incapable
of seeing that the value is not needed).  All (ok, big "all") we need to
do is extend dead code elimination to work on stack slots where addresses
are not taken (currently the dead code eliminator in dce.c believes that
all writes to memory are necessary under all conditions).


More information about the Gcc mailing list