Re: metaprograms in gcc

Douglas Gregor <gregod@cs.rpi.edu>
20 Sep 2001 00:29:13 -0400

          From comp.compilers

Related articles
metaprograms in gcc aktappetla@hotmail.com (2001-09-11)
Re: metaprograms in gcc srineet@veritas.com (Srineet) (2001-09-11)
Re: metaprograms in gcc aarongray@beeb.net (Aaron Gray) (2001-09-11)
Re: metaprograms in gcc gregod@cs.rpi.edu (Douglas Gregor) (2001-09-20)
| List of all articles for this month |
From: Douglas Gregor <gregod@cs.rpi.edu>
Newsgroups: comp.compilers
Date: 20 Sep 2001 00:29:13 -0400
Organization: RPI
References: 01-09-032
Keywords: GCC, optimize
Posted-Date: 20 Sep 2001 00:29:13 EDT

Anil Kumar Tappetla wrote:


> Hi, does gcc use template programs to unroll loops in c++. which all
> compilers DONOT use metaprograms for loop unrolling. also, does gcc
> implement constant folding (it should,i guess).thanks.. anil.


Optimizations such as loop unrolling that are implemented via template
metaprogramming are generally not implemented by a compiler. Instead,
they are implemented in C++ library code: when the compiler evaluates
the metaprogram it ends up generating the unrolled code after
performing a large amount of inlining.


I haven't seen any production compilers that internally use template
metaprograms for optimization. We have been experimenting with such a
system (which uses a user-extensible template metaprogram for a
generic simplification component), but currently I know of no other
research projects that do this.


                Doug


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.