public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@airs.com>
To: gcc mailing list <gcc@gcc.gnu.org>
Subject: Re: Link-time optimzation
Date: Thu, 17 Nov 2005 05:53:00 -0000	[thread overview]
Message-ID: <m3k6f73jn0.fsf@gossamer.airs.com> (raw)
In-Reply-To: <437BB214.1070306@codesourcery.com>

Mark Mitchell <mark@codesourcery.com> writes:

>   http://gcc.gnu.org/projects/lto/lto.pdf

Section 2.2.1 (Variables and Functions) mentions C++ inline functions.
It should also mention gcc's C language "extern inline" functions.

The same section should consider common symbols.  These appear as
uninitialized definitions.  Common symbols should normally be merged.

Obviously the text referring to GNU attributes will need to be
expanded.  Some cases are not obvious; e.g., longcall.

In section 3.3 (Assembler) I'll note that the PowerPC XCOFF assembler
supports a .rename directive, which could be easily be made available
for all targets.

I'll also note that for non-GNU targets, we must be able to use the
native assembler.  Therefore, it may not always be possible to keep
symbol names the same as source code names.  That will have to be an
option, fortunately one that only affects debugging information.

In section 3.4 (Linker) I have the same comment: for non-GNU targets,
the native linker is sometimes required, so modifying the linker
should not be a requirement.  And the exact handling of .a files is
surprisingly target dependent, so while it would be easy to code an
archive searcher in gcc, it would be tedious, though doable, to get it
right for all platforms.

Conversely, I don't know much we are going to care about speed here,
but I assume that we are going to care a bit.  For the linker to
determine which files to pull in from an archive, it is going to have
to read the symbol tables of all the input objects, and it is going to
have to read the archive symbol table, and it is going to have to read
the symbols table of each object included from an archive.  It will
have to build a symbol hash table as it goes along.  This isn't fast;
it's a significant component of link time.  Since the compiler is also
going to have to build a symbol hash table, it is going to be faster
to have the compiler search the archive symbol table and decide which
objects to pull in.  Searching an archive symbol table isn't hard; the
target dependencies come in when deciding which objects to include.

In section 3.5 (Driver), although you don't discuss it, we are going
to want the driver to know whether you are generating a relocateable
object, a shared library, or an executable.  When generating a shared
library, we are going to want the driver to know the set of exported
symbols.  When generating an executable, we are going to want to know
which symbols are referenced by shared libraries included in the link.
We are going to want to know these things so that we can do things
like global dead code elimination and global parameter simplification
(i.e., function only called with certain parameters) even when linking
against shared libraries for which we do not have the source.

Link time optimization will still be useful if we don't know any of
this stuff, but it is clear that people are going to want the
optimizations which require it.  So we should plan for it from the
start.

Section 4.2 (Executable Representation) describes the GVM as a stack
machine, and mentions load, store, duplicate, and swap operations.
But it also discusses having registers which correspond to GIMPLE
local variables.  The way I put this together is that a MODIFY_EXPR
which sets a local variable, say, will be converted to something that
computes the expression using a stack and then assigns the value to a
register.  It's easy to see how to convert such a MODIFY_EXPR into a
stack machine and back.  But it's not easy to see why that stack
machine is going to need, e.g, a swap operation.  There is no GIMPLE
swap operator.  So I may still be confused about something.

Ian

  parent reply	other threads:[~2005-11-17  5:53 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-16 22:26 Mark Mitchell
2005-11-16 22:41 ` Andrew Pinski
2005-11-16 22:58 ` Andrew Pinski
2005-11-17  0:02 ` Andrew Pinski
2005-11-17  0:25 ` Andrew Pinski
2005-11-17  0:52   ` Tom Tromey
2005-11-17  0:26 ` Giovanni Bajo
2005-11-17  0:32   ` Daniel Berlin
2005-11-17  9:04     ` Giovanni Bajo
2005-11-17 16:25       ` Kenneth Zadeck
2005-11-17  1:20 ` Richard Henderson
2005-11-17  1:28   ` Mark Mitchell
2005-11-17  1:31     ` Daniel Jacobowitz
2005-11-17  3:35     ` Jeffrey A Law
2005-11-17 14:09       ` Daniel Berlin
2005-11-17 14:48         ` mathieu lacage
2005-11-17 11:41     ` Richard Earnshaw
2005-11-17 21:40       ` Ian Lance Taylor
2005-11-17 23:10         ` Robert Dewar
2005-11-17 23:42           ` Ian Lance Taylor
2005-11-18  2:13             ` Daniel Jacobowitz
2005-11-18  9:29               ` Bernd Schmidt
2005-11-18 11:19                 ` Robert Dewar
2005-11-18 11:29                 ` Richard Earnshaw
2005-11-18 11:40                   ` Directly generating binary code [Was Re: Link-time optimzation] Andrew Haley
2005-11-18 12:04                     ` Laurent GUERBY
2005-11-18 17:41                       ` Jim Blandy
2005-11-18 18:35               ` Link-time optimzation Mike Stump
2005-11-18  2:33           ` Dale Johannesen
2005-11-18  3:11             ` Geert Bosch
2005-11-18 18:43             ` Mike Stump
2005-11-18 18:30           ` Mike Stump
2005-11-17 15:54   ` Kenneth Zadeck
2005-11-17 16:41     ` Jan Hubicka
2005-11-18 16:31     ` Michael Matz
2005-11-18 17:04       ` Steven Bosscher
2005-11-18 17:29         ` Michael Matz
2005-11-18 17:24     ` Nathan Sidwell
2005-11-17  1:43 ` Gabriel Dos Reis
2005-11-17  1:53 ` Andrew Pinski
2005-11-17  2:39 ` Kean Johnston
2005-11-17  5:53 ` Ian Lance Taylor [this message]
2005-11-17 13:08   ` Ulrich Weigand
2005-11-17 21:42     ` Ian Lance Taylor
2005-11-17 16:17   ` Kenneth Zadeck
2005-11-17  0:52 Chris Lattner

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=m3k6f73jn0.fsf@gossamer.airs.com \
    --to=ian@airs.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).