This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: Code gen question




  In message <3.0.6.32.19990212203311.0083e6d0@pop.netaddress.com>you write:
  > It won't? So it will observe that j is never modified making copying
  > unnecessary?
The copy will initially appear, then be optimized away if at all possible
by local and global copy propagation.


  > >The difference is that the latter refers to its
  > >arguments address, which impairs optimization (though not as much as it
  > >used to).
  > 
  > It does? If the address isn't used except to dereference, I'd expect the
  > compiler to turn
It will try, but it may not always succeed.  When you take the address of an
object you generally make analysis more difficult on the compiler and sometimes
it will be unable to decipher the result.

In general you are better off writing the code in the most natural and
straightforward way instead of trying to micro-optimize too much.  Instead
spend your time writing goot algorithms.


  > >Absolutely pass scalars by value.
  > 
  > Does this also apply to stock GCC? PGCC? Most of the differences among
  > these three gccs, except for namespace support (and extern inline behavior
  > :-)), are optimization differences.
Yes.  This generally applies to any compiler.  As a general rule compilers are
a lot better at optimizing scalars than pointers to scalars.

jeff