This is the mail archive of the gcc@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]

Re: MEM flags and stack temps


>>>>> "law" == law  <law@redhat.com> writes:

    >> Any thoughts here?

    law> I don't think it's a major problem.  The only area where
    law> (IMHO) it causes problems is the ability to share space for
    law> large arrays in different (disjoint) scopes.

We went around on this a little bit once before.  I remember a couple
of reasonable approaches:

  - Move some of the sharing code into the front-ends/AST->RTL
    conversion machinery.
      
    In other words, just reuse the same DECLs in some cases.

  - 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.  In the long run, we
want to do CSE, etc., on structures too.  If I write:

  struct S a, b, c;

  a.x = 3;
  a.y = 4;
  b = a;
  c = b;

It would be great if the compiler knew that `c' was a struct whose `x'
field was `3' and whose `y' field was `4'.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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