public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* stack height reduction in tree-SSA
@ 2004-09-01  6:10 Rakesh Kumar, Noida
  2004-09-01 10:23 ` Giovanni Bajo
  2004-09-01 17:57 ` Mike Stump
  0 siblings, 2 replies; 10+ messages in thread
From: Rakesh Kumar, Noida @ 2004-09-01  6:10 UTC (permalink / raw)
  To: gcc, rakeshku

Hi,

  Sharing stack space for objects with disjoint
lifetimes is a well known problem with GCC (especially
for the kernel people). Consider the code

  if (i)
    {
      char a[100];
      use (a);
    }
  else
    {
      char b[100];
      use (b);
    }

Apparantly, 'a' and 'b' can share same stack slot. I feel
that this problem could have been fixed in tree-SSA, but
exactly opposite is done. During 'lower' pass, record_vars
saves the variable declarations in a link list, which are
later expanded to RTL during RTL generation pass in expand_vars.
Below is the dump of 'lower' pass for the above test case.

foo (i)
{
  char b[100];
  char a[100];

  if (i != 0) goto <D1052>; else goto <D1053>;
  <D1052>:;
  use (&a);
  goto <D1054>;
  <D1053>:;
  use (&b);
  <D1054>:;
  return;
}

Is it that good to forget the scope of variable and allocate each
one a new stack slot? I'm unable to get any reasons why the stack
slots can't be shared. Please make me aware of the issues involved.

Thanks and Regards,
Rakesh Kumar

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

end of thread, other threads:[~2004-09-08 12:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-01  6:10 stack height reduction in tree-SSA Rakesh Kumar, Noida
2004-09-01 10:23 ` Giovanni Bajo
2004-09-01 10:40   ` Joseph S. Myers
2004-09-01 10:50     ` Giovanni Bajo
2004-09-01 16:49     ` Jeffrey A Law
2004-09-01 17:18       ` Dale Johannesen
2004-09-01 17:38         ` Jeffrey A Law
2004-09-08 12:00         ` tm_gccmail
2004-09-01 17:57 ` Mike Stump
2004-09-01 20:06   ` Richard Henderson

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