public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "christophe dot guillon at st dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/23756] Missed optimization for PIC code with internal visibility
Date: Thu, 28 Jan 2010 14:55:00 -0000	[thread overview]
Message-ID: <20100128145535.24939.qmail@sourceware.org> (raw)
In-Reply-To: <bug-23756-7904@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from christophe dot guillon at st dot com  2010-01-28 14:55 -------
This enhancement is still pending on gcc 4.4.3 on x86.
A function declared internal sets the GOT pointer while it could be avoided in
a callee-set-GOT model as on x86 ABI.
By defintion an internal function can only be accessed through functions of the
same module and thus, if the ABI forces the GOT pointer to be in ebx - which I
think is the case -, it does not have to be rematerialized.

See the original description also.
Compile the attached internal.c file with:
$ gcc -O3 -S -fpic internal.c

Check the .s file:
        .type   f, @function
f:
        call    __i686.get_pc_thunk.cx
        addl    $_GLOBAL_OFFSET_TABLE_, %ecx

The GOT pointer is materialized in ecx while it is guaranteed to be available
in ebx as soon as f is actually internal.


-- 

christophe dot guillon at st dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |christophe dot guillon at st
                   |                            |dot com


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


  parent reply	other threads:[~2010-01-28 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23756-7904@http.gcc.gnu.org/bugzilla/>
2010-01-28 14:54 ` christophe dot guillon at st dot com
2010-01-28 14:55 ` christophe dot guillon at st dot com [this message]
2010-01-28 15:37 ` jakub at gcc dot gnu dot org
2010-01-28 16:20 ` christophe dot guillon at st dot com
     [not found] <bug-23756-4@http.gcc.gnu.org/bugzilla/>
2012-01-11 14:30 ` rguenth at gcc dot gnu.org
2005-09-06 20:41 [Bug c/23756] New: " guillaume dot melquiond at ens-lyon dot fr
2005-09-06 22:43 ` [Bug middle-end/23756] " pinskia at gcc dot gnu dot 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=20100128145535.24939.qmail@sourceware.org \
    --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).