public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* MEM flags and stack temps
@ 2000-11-15  5:59 Richard Kenner
  2000-11-15  8:37 ` law
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Kenner @ 2000-11-15  5:59 UTC (permalink / raw)
  To: gcc

We have code to not reuse stack temps for a temporary of a different alias
set.  I think we also need to do the same thing to not reuse for differnt
values of volatile, unchanging, scalar, and in_struct.

But if we do that, we're essentially not sharing anymore.

Any thoughts here?

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: MEM flags and stack temps
@ 2000-11-16  3:25 Jan Hubicka
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Hubicka @ 2000-11-16  3:25 UTC (permalink / raw)
  To: mark, law, kenner, gcc

> 
>   - 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've done some experiments in this area - my approach was to always use
ADDRESSOF to generate stack slots in early pass, so I've got instantly
the ability to eliminate dead memory alocations entirely and the
ADDRESSOF pass can be definitly tweaked to be more smart about stack
frame allocations.

To get real benefits from such code we need safe way to eliminate dead
stores - current gcc does this partly because of Richard's patch and
with my hack it seemed to work well (producing shorter code).

Before Kenner's patch, the hack was enlarging code size slightly. I believe
that because of non-functional rtx-cost calculations.  After the patch,
code was slight win.

So perhaps ADDRESSOF is easy way to go.  BTW why it requires the pointer
to tree representation of type? It would be easier if it just contained
the size field and identifier at least from the RTL point of view.

Honza

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: MEM flags and stack temps
@ 2000-11-16  3:27 Richard Kenner
  2000-11-16 14:01 ` Joe Buck
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Kenner @ 2000-11-16  3:27 UTC (permalink / raw)
  To: jbuck; +Cc: gcc

    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).

The problem is timing: you also want to be able to do CSE and loop
optimizations on the addresss of temporaries that aren't eliminated if they
are outside the addressable range of the machine.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: MEM flags and stack temps
@ 2000-11-16 14:04 Richard Kenner
  2000-11-16 14:24 ` Joe Buck
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Kenner @ 2000-11-16 14:04 UTC (permalink / raw)
  To: jbuck; +Cc: gcc

    You seem to be thinking of a completely different problem.  Is this an
    issue with the ordering of the passes?

Yes.  The idea is that you want to keep stack slots as RTL objects as
long as possible to do optimizations on *them*.  But when you actually find
you *do* need them, you have to address them.  If the offset to address them
is large enough, that offset calculation itself would need to be cse'd
and moved out of loops.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: MEM flags and stack temps
@ 2000-11-16 14:25 Richard Kenner
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Kenner @ 2000-11-16 14:25 UTC (permalink / raw)
  To: jbuck; +Cc: gcc

    This is possibly naive, since I'm not familiar enough with the
    relevant back end structures.  But what if the offset calculation
    showed up as its own RTL object, computing an address-register-like
    pseudo which is in turn "read" by the addressof(stack slot) construct?
    It would then be cse'd, and if all of the addressof's for that stack
    slot are removed, these offsets would then be dead, and eliminated by
    dce.

But you can't know if the offset is too large enough.  Most of them won't be.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2000-11-16 14:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-15  5:59 MEM flags and stack temps Richard Kenner
2000-11-15  8:37 ` law
2000-11-15  8:47   ` Mark Mitchell
2000-11-15 17:00     ` Joe Buck
2000-11-16  3:25 Jan Hubicka
2000-11-16  3:27 Richard Kenner
2000-11-16 14:01 ` Joe Buck
2000-11-16 14:04 Richard Kenner
2000-11-16 14:24 ` Joe Buck
2000-11-16 14:25 Richard Kenner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).