This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Trivial cleanup


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:

Variable Definitions

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 C90.

Variables may be simultaneously defined and tested in control expressions.





  - 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.
If the objects have the same type and disjoint lifetimes, they can be easily shared.

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.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]