This is the mail archive of the gcc-help@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: optimization


> What do you think about that?

Hi Andrey,

indeed, I agree that, in principle, a compiler should be able to optimize this.
Perhaps soon GCC will do better than now: all the work being done on the AST
branch (http://gcc.gnu.org/projects/ast-optimizer.html) and cfg/mid level RTL
branch (http://gcc.gnu.org/projects/cfg.html) should lead to new optmization
passes, working at abstraction levels different from those currently involved
(basically, at the tree-level today is done only inlining and everything else at
the low RTL level)

If you want to understand more of such issues I suggest you to begin studying at
least a couple of books:

S.S. Muchnick
Advanced Compiler Desing and Implementation
Morgan Kaufmann, 1997.

K. Czarnecki and U.W. Eisenecker
Generative Programming
Addison Wesley, 2000.

The former deals with advanced compiler optimizations, the latter with "static
metaprogramming" (among other things), which can allow to write a templatized
maxRpkLen() equivalent which *today's*  compiler will evaluate to a constant at
compile time, as part of the standard template instantiation mechanism.

>From a practical point of view, it would be nice if you could track how new
versions of GCC will optimize the testcase you presented, for instance posting
and discussing the corresponding assembler produced.

Cheers,
Paolo.


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