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]
Other format: [Raw text]

RE: Short Displacement Problems.


Hi,

> > An obvious problem ( as I mentioned in my previous mail)
> > I could see is that  most of stack allocations are called 
> from reload.
> > While stack offset assignments would be most   beneficial  
> before register
> > allocation, the picture of the stack isn't clear untill reload.
> > I want that register allocation should benefit from  offset 
> assignments.
> > 
> > If I do stack offset assignment after register allocation,
> > I might get reduction in code size but that would be not be as good
> > as it won't reduce register pressure during register 
> allocation/reload.
> > 
> > Thoughts and ideas ??
> 
> In general, the most important subproblem is to find the best 
> stack slots for
> register spills.  -O2 is notoriously bad at this, because the 
> registers that
> are spilled last get the largest offsets.  -O2 
> -fomit-frame-pointer, OTOH,
> gives the last stilled registers the smallest offset.
> If you want to get any better than that, your optimization 
> has to run inside
> of or alongside to or instead of reload.

One problem with this strategy is that
reshuffling stack during reload is expensive because

1. There would be lot of stack variable references that we will have to
   fix up in insn chain while allocating  "each" stack slot.
   The entire logic will increase compilation  time.

e.g consider this scenario, we have some "n" number of variables on stack.
    relaod phase calls assign_stack_local for some pseudo, and from access
    data of that pseudo, we decide to put it somewhere between 1 .. n
    at positon "i".The offsets of i+1 .. n variables are effected and 
    all references to them fixed up.

But it seems there might be a tradeoff involved here.Let me see 
how people view this problem.

Would the performance increase justify increase in 
compilation time.

Best regards,
  Naveen Sharma.


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