public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kkojima at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/12306] GOT pointer (r12) reloaded unnecessarily
Date: Sun, 24 Nov 2013 23:02:00 -0000	[thread overview]
Message-ID: <bug-12306-4-XCb2chSghr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-12306-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12306

--- Comment #4 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #3)
> If I understand correctly, rebuilding the GOT pointer in r12 is necessary at
> function entry, since it is generally not known if r12 is a valid GOT
> pointer at function entry when mixing PIC code and non-PIC code.  Calling a
> PIC function from a non-PIC function could result in a clobbered GOT > 

Yep.  If a pic function is called from a pic function, that
save&restore can be removed.  The case like

non_pic_function:
    mov.l    r12,@-r15
    sts.l    pr,@-r15

    <use r12 as a variable x>

    <call PIC function here (r12 should not be clobbered)>

    <use r12 as a variable x>

    lds.l    @r15+,pr
    rts    
    mov.l    @r15+,r12

needs it.  If we knew that that pic function can't be called from
any non-pic functions by some additional information, we could
optimize the code with removing that save&restore r12.


  parent reply	other threads:[~2013-11-24 23:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-12306-4@http.gcc.gnu.org/bugzilla/>
2012-07-18 19:25 ` olegendo at gcc dot gnu.org
2013-11-24 17:16 ` olegendo at gcc dot gnu.org
2013-11-24 23:02 ` kkojima at gcc dot gnu.org [this message]
2013-11-25 12:39 ` chrbr at gcc dot gnu.org
2013-11-25 16:22 ` olegendo at gcc dot gnu.org
2013-11-26  6:05 ` kkojima at gcc dot gnu.org

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=bug-12306-4-XCb2chSghr@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).