public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dave Korn" <dk@artimi.com>
To: <gcc@gcc.gnu.org>
Subject: How can INITIAL_FRAME_POINTER_OFFSET be made correct?
Date: Fri, 19 Mar 2004 16:46:00 -0000	[thread overview]
Message-ID: <NUTMEGv5y4FypKsEgJX000001b6@NUTMEG.CAM.ARTIMI.COM> (raw)


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

             reply	other threads:[~2004-03-19 15:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19 16:46 Dave Korn [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NUTMEGv5y4FypKsEgJX000001b6@NUTMEG.CAM.ARTIMI.COM \
    --to=dk@artimi.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).