public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@wasabisystems.com>
To: "Zack Weinberg" <zack@codesourcery.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Can we speed up the gcc_target structure?
Date: Sun, 18 Jan 2004 14:09:00 -0000	[thread overview]
Message-ID: <m3vfn9z6va.fsf@gossamer.airs.com> (raw)
In-Reply-To: <87smid8w9q.fsf@codesourcery.com>

"Zack Weinberg" <zack@codesourcery.com> writes:

> Any change along these lines loses what I think is a critical property
> of the target vector, which is that modifications to the target-specific
> code on the far side of it do *not* require recompilation of the
> entire machine-independent compiler.
> 
> I consider it a desirable and achievable goal to be able to swap out
> the entire back end without rebuilding any of the optimizers; this
> entails having *everything* go through the target vector or some other
> sort of link-time interface.  (For instance, I see no need to change
> the way recog.c interacts with insn-recog.c for this purpose.)
> 
> Furthermore, while a 3% measured speed hit is a concern, I think that
> trying to win it back by undoing the targetm transformation - in the
> object files, if not in the source code - is barking up the wrong
> tree.  Instead we should be looking for ways to avoid having targetm
> hooks in critical paths in the first place.  It's been my experience
> that that is a much more fruitful source of optimization
> opportunities.

I don't have anything against that goal, but it is in conflict with
the goal of speeding up the compiler.  Simply moving targetm hooks
obviously can not get you the full speedup.  The full speedup comes
when an optimizing compiler compiling gcc can see that certain values
are constants, such as, in my example, the various promote_* functions
in the target vector.  You can't pull those target hooks out of the
critical path.  Function calls are on the critical path for a
non-optimizing compilation of many types of C++ code, and a
non-optimizing compilation is the case where compilation speed is the
most important.

At best you can replace target hook function calls with target hook
memory references.  For example, you could somehow detect that
promote_function_args always returns false for the i386.  I'm not sure
how to do that cleanly, without adding a dependency between target
hooks which would be a source of future bugs, but it may be possible.
But even a memory reference is going to be slower than a compile-time
constant.

Also, as more and more control moves into the target vector, which I
think we all agree is a good goal, it will slow down the compiler more
and more.

As I say, your goal is a good one.  And it may trump the goal of
maximizing compiler speed.  Although I will note that your goal
benefits only compiler developers.  And maximizing compiler speed
benefits compiler users.  And obviously we could have a configure
option which forced all calls to go through the target vector, as I
discussed in my original message--that configure option could then
affect the Makefile dependencies.  That would make it easier for
developers, at the cost of possibly introducing unnoticed bugs.

Ian

  reply	other threads:[~2004-01-18 14:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-18  8:37 Ian Lance Taylor
2004-01-18  9:03 ` Zack Weinberg
2004-01-18 14:09   ` Ian Lance Taylor [this message]
2004-01-18 22:25     ` Zack Weinberg
2004-01-19  0:53       ` Ian Lance Taylor
2004-01-19  1:18       ` Geoff Keating
2004-01-18 11:30 ` Joseph S. Myers
2004-01-18 13:58 ` Kaveh R. Ghazi
2004-01-18 19:54   ` Ian Lance Taylor
2004-01-18 20:10     ` Richard Henderson
2004-01-18 20:17       ` Ian Lance Taylor
2004-01-18 21:14   ` Joseph S. Myers
2004-01-18 22:05     ` Richard Henderson
2004-01-18 22:22       ` Jan Hubicka
2004-01-18 22:37         ` Richard Henderson
2004-01-19 19:33           ` DJ Delorie
2004-01-19 20:41             ` Richard Henderson
2004-01-19  1:12 ` Geoff Keating
2004-01-19 13:51   ` Ian Lance Taylor
2004-01-18 22:18 Chris Lattner
2004-01-18 22:33 ` Jan Hubicka
2004-01-18 22:40   ` Chris Lattner
2004-01-18 22:48     ` Jan Hubicka
2004-01-18 22:50       ` Chris Lattner
2004-01-18 23:27         ` Jan Hubicka
2004-01-18 23:34           ` Jakub Jelinek
2004-01-19  1:36           ` Chris Lattner
2004-01-18 22:42   ` Joseph S. Myers
2004-01-18 22:44     ` Chris Lattner
2004-01-18 22:36 ` Richard Henderson
2004-01-18 22:42   ` Chris Lattner
2004-01-19 11:51 Richard Kenner
2004-01-19 12:01 ` Richard Guenther
2004-01-19 20:02   ` Richard Henderson
2004-01-19 14:16 ` Robert Dewar
2004-01-19 18:03 ` Zack Weinberg
2004-01-19 18:18 Richard Kenner
2004-01-19 18:26 ` Zack Weinberg
2004-01-19 19:05 Richard Kenner
2004-01-19 21:15 ` Zack Weinberg
2004-01-19 21:25 Richard Kenner
2004-01-19 23:36 ` Zack Weinberg
2004-01-19 23:42 Richard Kenner
2004-01-19 23:46 ` Zack Weinberg
2004-01-19 23:48 Richard Kenner

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=m3vfn9z6va.fsf@gossamer.airs.com \
    --to=ian@wasabisystems.com \
    --cc=gcc@gcc.gnu.org \
    --cc=zack@codesourcery.com \
    /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).