public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Kenneth Zadeck <Kenneth.Zadeck@NaturalBridge.com>
Cc: Richard Henderson <rth@redhat.com>,
	Mark Mitchell <mark@codesourcery.com>,
	gcc mailing list <gcc@gcc.gnu.org>
Subject: Re: Link-time optimzation
Date: Fri, 18 Nov 2005 16:31:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.58.0511181710250.7673@wotan.suse.de> (raw)
In-Reply-To: <20051117155340.0B0D674646@zadeck.dynalias.net>

Hi,

On Thu, 17 Nov 2005, Kenneth Zadeck wrote:

> A stack machine representation was chosen for the same reason.  Tree
> gimple is a series of statements each statement being a tree.

IMHO we should follow that path of thinking.  The representation of GIMPLE 
where we do most optimizations on (i.e. tree-ssa) is implemented as 
GCC trees, thats true.  But this is just an implementation detail, and one 
which somewhen in the future hopefully will be changed.  Because in 
essence GIMPLE is a rather flat intermediate form, most of the time just 
three address form.  I think it would be a mistake in the long run if we 
would now use a stack based external representation just because right now 
gimple is implemeted via trees.  For instance the gimple statement

  a = b + c

would need to be implemented ala
  push id_b
  push id_c
  add
  pop id_a

The expansion of the trivial operation into four stackops is horrible to 
read (think reading debug dumps).  Additionally the change of 
representation form might introduce hard to overcome issues due to 
mismatches in the expressiveness.  We would possibly need a mini stack 
optimizer for just reading back this form into gimple.

I think writing out gimple directly, i.e. using a register machine and 
three address code, is the better way.  I could even imagine some custom 
extensions to the three address form to easily represent nested constructs 
which still happen in gimple (e.g. type conversions, address taking etc).

> 1) Do some register allocation of the temps so that they are reused.
>    This is non trivial to undo (but truely doable), especially where
>    you wish to not adversely impact debugging.
> 
> 2) Just generate a lot of temps and hope that some other form of
>    compression will save the day.

In the above light I would go for 2) together with perhaps relatively 
trivial form of 1)  (e.g. reusing temps per gimple statements, which 
reduces the overall need for temps to the max Sethi-Ullman number for the 
statements to be converted, most of the time lower than lets say 20).

OTOH it might be a good idea to persue both strategies at first (i.e. a 
gimple writer/reader based on stack machine and one based on register 
machine), and then see which feels better.  Perhaps even a merger of both 
approaches is sensible, three address form for most simple gimple 
statements with falling back to stack encoding for deeply nested operands.


Ciao,
Michael.

  parent reply	other threads:[~2005-11-18 16:31 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 [this message]
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
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=Pine.LNX.4.58.0511181710250.7673@wotan.suse.de \
    --to=matz@suse.de \
    --cc=Kenneth.Zadeck@NaturalBridge.com \
    --cc=gcc@gcc.gnu.org \
    --cc=mark@codesourcery.com \
    --cc=rth@redhat.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).