Re: metaprograms in gcc

Douglas Gregor <>
20 Sep 2001 00:29:13 -0400

          From comp.compilers

Related articles
metaprograms in gcc (2001-09-11)
Re: metaprograms in gcc (Srineet) (2001-09-11)
Re: metaprograms in gcc (Aaron Gray) (2001-09-11)
Re: metaprograms in gcc (Douglas Gregor) (2001-09-20)
| List of all articles for this month |

From: Douglas Gregor <>
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.


Post a followup to this message

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