This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: questions about improving i386 PIC code
- To: David Edelsohn <dje at watson dot ibm dot com>
- Subject: Re: questions about improving i386 PIC code
- From: John Carr <jfc at mit dot edu>
- Date: Sun, 07 Jun 1998 11:34:08 -0400
- cc: john at feith dot com (John Wehle), egcs at cygnus dot com
> If I understand this case, I think that the rs6000 port does
> something similar for AIX where it avoids emitting a NOP after a local
> function call.
In the IBM calling convention the caller sets the GOT register (via a
linker provided "glue" function) and restores it after the call. In most
other PIC code the called function sets its own GOT. gcc knows when a
direct call is to a static function. gcc does not know when a function is
only called from the local file.
Some compilers do intra-module call optimizations, based on analysis of
the entire source file (a long standing deficiency of gcc). The latest
MIPS compilers have #pragma directives for such optimizations. For
example, one can assert that a function is only called from the same
module (i.e. from a function using the same GOT). This is useful when a
function is used in more than one file within a shared library but is not
exported by the library.