public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How can INITIAL_FRAME_POINTER_OFFSET be made correct?
@ 2004-03-19 16:46 Dave Korn
  2004-03-19 16:59 ` Joern Rennecke
  2004-03-19 21:02 ` Richard Henderson
  0 siblings, 2 replies; 11+ messages in thread
From: Dave Korn @ 2004-03-19 16:46 UTC (permalink / raw)
  To: gcc


  Erm.  Bit confused here.  

  INITIAL_FRAME_POINTER_OFFSET is supposed to be "the difference between the
frame pointer and the stack pointer values immediately after the function
prologue", according to gccint.  It goes on to suggest

"  The value would be computed from information such as the result of
`get_frame_size ()' and the tables of registers `regs_ever_live' and
`call_used_regs'.  "

  INITIAL_FRAME_POINTER_OFFSET is called before the md emit prologue
function has has a chance to run.  So it has to duplicate the exact
calculations that the prologue function does when it's deciding on the stack
frame layout for the current function.

  In the particular port I'm working with, we decide whether or not to
allocate a stack slot for saving the link register according to whether or
not we ever use it - i.e. we use code that looks like:

    info->lr_save_size = !current_function_is_leaf ||
regs_ever_live[LINK_REGNUM] ? 4 : 0;

[info is just a struct where I'm keeping the sizes and offsets of the
various areas of the stack frame].

  There's a bit of a problem, however.  regs_ever_live[LINK_REGNUM] is zero
when INITIAL_FRAME_POINTER_OFFSET is called, but something has set it to one
by the time we get to the emit prologue function.  The result is that the
two of them disagree about the size and layout of my stackframes, and I get
a lot of FAILs in the varargs tests.

  Is it valid that regs_ever_live[] changes between IFPO and emit_prologue?
If so, the documentation should warn *against* using it in IFPO.  If not,
I've got to get finding out why it changes when it shouldn't.......


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

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

end of thread, other threads:[~2004-03-22 18:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-19 16:46 How can INITIAL_FRAME_POINTER_OFFSET be made correct? Dave Korn
2004-03-19 16:59 ` Joern Rennecke
2004-03-19 17:55   ` Dave Korn
2004-03-19 18:31     ` Joern Rennecke
2004-03-19 18:41       ` Dave Korn
2004-03-19 18:57         ` Joern Rennecke
2004-03-19 19:49           ` Dave Korn
2004-03-21 18:08     ` Hans-Peter Nilsson
2004-03-19 21:02 ` Richard Henderson
2004-03-22 17:31   ` Dave Korn
2004-03-22 23:09     ` 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).