From: Jason Merrill <jason@redhat.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: Richard Henderson <rth@redhat.com>, Per Bothner <per@bothner.com>,
Diego Novillo <dnovillo@redhat.com>,
"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
Jason Merrill <jason@redhat.com>
Subject: Re: Language-independent functions-as-trees representation
Date: Sun, 21 Jul 2002 20:30:00 -0000 [thread overview]
Message-ID: <wvlznwkhh9u.fsf@prospero.cambridge.redhat.com> (raw)
In-Reply-To: <21910000.1027285094@warlock.codesourcery.com> (Mark Mitchell's message of "Sun, 21 Jul 2002 13:58:14 -0700")
>>>>> "Mark" == Mark Mitchell <mark@codesourcery.com> writes:
> My disagreement with Per is closer to the front end; I would really
> like the internal representation produced from C++ semantic analysis
> to look like C++ -- with various implicit things made explict (like
> default arguments, choice of overloaded function, choice of template
> specialization, action to take on cleanup of object, etc.)
I don't have a problem with this, except that it makes lowering more
complicated.
> In SIMPLE, one place where I would like the statement/expression to come
> in to play is the following:
> If two expressions are "the same", i.e., both are "x + y", then they
> are actually the same pointer.
Why? We don't currently share expressions in RTL; why would we want to do
so in SIMPLE?
The current simplification code explicitly unshares all the trees to avoid
SAVE_EXPR-like problems with shared expressions. For example, this code
from cppexpr.c:
prio = optab[op].prio - ((optab[op].flags & LEFT_ASSOC) != 0);
gets folded to:
prio = ((int)optab[(unsigned int)op].flags & 2) != 0
? (unsigned int)((int)optab[(unsigned int)op].prio - 1)
: (unsigned int)(int)optab[(unsigned int)op].prio;
where the "optab[op].prio" is shared. If we don't unshare before
simplifying, we get something like (only partially simplified):
T.1 = ((int)optab[(unsigned int)op].flags & 2);
if (T.1 != 0)
{
T.2 = optab[(unsigned int)op].prio;
prio = (unsigned int)((int)T.2 - 1);
}
else
{
prio = (unsigned int)(int)T.2;
}
Oops.
> In other words, statements are the control flow glue that holds
> computations together. The computations don't care about where they
> are in the control flow. This makes some optimizations easier and
> more efficient, and it's a very appealing view of the world.
Sorry, I don't follow. Most computations care very much about where they
are in the control flow; if I move computations about arbitrarily, their
values will tend to change. The value of "x + y" is different before and
after I increment x. It's the job of CSE to recognize when we can share
values between multiple instances of an expression.
Jason
next prev parent reply other threads:[~2002-07-21 22:05 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-20 19:47 Jason Merrill
2002-07-20 13:58 ` Per Bothner
2002-07-21 22:04 ` Jason Merrill
2002-07-20 22:17 ` Steven Bosscher
2002-07-21 6:20 ` Richard Henderson
2002-07-21 9:43 ` Steven Bosscher
2002-07-21 14:31 ` Richard Henderson
2002-07-21 15:07 ` Daniel Berlin
2002-07-21 15:15 ` Steven Bosscher
2002-07-21 0:09 ` Neil Booth
2002-07-21 0:41 ` Richard Henderson
2002-07-21 0:13 ` Richard Henderson
2002-07-21 7:06 ` Andreas Jaeger
2002-07-21 11:09 ` Pop Sébastian
2002-07-21 11:44 ` Andreas Jaeger
2002-07-21 23:20 ` Phil Edwards
2002-07-22 2:24 ` Daniel Berlin
2002-07-22 6:23 ` Phil Edwards
2002-07-22 7:10 ` where is tree dump utility Sathiskanna
2002-07-22 13:25 ` Diego Novillo
2002-07-21 17:03 ` Language-independent functions-as-trees representation Mark Mitchell
2002-07-21 20:30 ` Jason Merrill [this message]
2002-07-21 22:44 ` Mark Mitchell
2002-07-21 23:06 ` Jason Merrill
2002-07-21 23:53 ` Mark Mitchell
2002-07-22 0:13 ` Jason Merrill
2002-07-22 3:17 ` Daniel Berlin
2002-07-22 5:11 ` Daniel Berlin
2002-07-22 7:18 ` Jason Merrill
2002-07-22 13:11 ` Daniel Berlin
2002-07-23 18:20 ` Jason Merrill
2002-07-27 14:10 ` Pop Sébastian
2002-07-30 9:02 ` Jason Merrill
2002-07-22 21:09 ` Diego Novillo
2002-07-22 2:42 ` where is the data Sathiskanna
2002-07-22 19:04 ` Language-independent functions-as-trees representation Diego Novillo
2002-07-23 10:21 ` Fergus Henderson
2002-07-23 11:26 ` Diego Novillo
2002-07-23 11:34 ` Toon Moene
2002-07-23 12:01 ` Diego Novillo
2002-07-23 17:48 ` Pop Sébastian
2002-07-26 15:56 ` Jason Merrill
2002-07-23 17:48 ` Jason Merrill
2002-07-23 18:29 ` Andrew Haley
2002-07-23 19:07 ` Richard Henderson
2002-07-23 23:40 ` Jason Merrill
2002-07-24 3:01 ` Richard Henderson
2002-07-24 11:34 ` Jason Merrill
2002-07-23 21:57 ` Fergus Henderson
2002-07-24 0:22 ` Jason Merrill
2002-08-23 5:41 ` Jason Merrill
2002-08-23 6:00 ` Gabriel Dos Reis
2002-08-23 7:41 ` Jason Merrill
2002-08-23 8:22 ` Pop Sébastian
2002-08-23 8:46 ` Jason Merrill
2002-08-23 8:23 ` Jason Merrill
2002-08-23 12:16 ` Diego Novillo
2002-08-23 15:42 ` Daniel Berlin
2002-08-23 17:26 ` Jason Merrill
2002-08-23 17:42 ` Zack Weinberg
2002-08-23 22:25 ` Per Bothner
2002-08-26 0:07 ` Zack Weinberg
2002-08-26 3:07 ` Neil Booth
2002-08-26 3:18 ` Gabriel Dos Reis
2002-08-28 6:50 ` Jason Merrill
2002-08-28 16:42 ` Per Bothner
2002-08-23 22:31 ` Per Bothner
2002-08-26 19:56 ` Diego Novillo
2002-08-29 14:35 ` Richard Henderson
2002-09-03 5:38 ` Jason Merrill
2002-08-26 16:58 ` Paul Brook
2002-08-29 14:21 ` Richard Henderson
2002-08-23 13:01 ` Neil Booth
2002-08-28 4:44 ` Jason Merrill
2002-08-28 5:17 ` Gabriel Dos Reis
2002-08-28 7:10 ` Jason Merrill
2002-08-28 8:02 ` Diego Novillo
2002-08-28 8:32 ` Gabriel Dos Reis
2002-08-28 14:06 ` Jason Merrill
2002-09-10 17:08 ` Gerald Pfeifer
2002-08-29 14:10 ` Richard Henderson
2002-09-03 5:16 ` Jason Merrill
2002-09-04 10:20 ` Paul Brook
2002-08-23 13:53 Robert Dewar
2002-08-23 14:10 ` Neil Booth
2002-08-23 14:14 Robert Dewar
2002-08-23 14:14 ` Neil Booth
2002-08-23 14:35 Robert Dewar
2002-08-23 15:21 ` Neil Booth
2002-08-24 7:59 ` Michael S. Zick
2002-08-23 15:25 Richard Kenner
2002-08-23 15:33 ` Neil Booth
2002-08-23 18:20 Robert Dewar
2002-08-24 12:47 Robert Dewar
2002-08-28 5:03 Robert Dewar
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=wvlznwkhh9u.fsf@prospero.cambridge.redhat.com \
--to=jason@redhat.com \
--cc=dnovillo@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=mark@codesourcery.com \
--cc=per@bothner.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).