This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Trivial cleanup
- From: Jeff Law <law at redhat dot com>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: Michael Matz <matz at suse dot de>, Paolo Carlini <paolo dot carlini at oracle dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 30 Sep 2013 10:48:19 -0600
- Subject: Re: [PATCH] Trivial cleanup
- Authentication-results: sourceware.org; auth=none
- References: <5243025E dot 8050101 at redhat dot com> <52430544 dot 8030005 at redhat dot com> <524305C3 dot 3050003 at oracle dot com> <5243086D dot 3030806 at redhat dot com> <alpine dot LNX dot 2 dot 00 dot 1309261605360 dot 11100 at wotan dot suse dot de> <524511A4 dot 4030808 at redhat dot com> <5246E84A dot 5090105 at redhat dot com>
On 09/28/13 08:31, Andrew MacLeod wrote:
temps would be OK with me, but there are a couple of concerns.
- I'd want to be able to declare the temps at the point of use, not
the top of the function. this would actually help with clarity I think.
Not sure what the current coding standard says about that.
Point of use is fine for GCC now. From our coding conventions:
Variables should be defined at the point of first use, rather than at
the top of the function. The existing code obviously does not follow
that rule, so variables may be defined at the top of the function, as in
Variables may be simultaneously defined and tested in control expressions.
If the objects have the same type and disjoint lifetimes, they can be
- the compiler better do an awesome job of sharing stack space for
user variables in a function... I wouldn't want to blow up the stack
with a bazillion unrelatd temps each wit their own location.
Things are more difficult if the types are different -- IIRC, the root
of the problem is the optimizers can interchange a load of one type with
a later store of the other -- the aliasing code says "hey, they're
different types, so they don't alias, feel free to move them around as
desired" and all hell breaks loose.