Re: C->C compiler? (Torben AEgidius Mogensen)
14 May 1996 20:18:35 -0400

          From comp.compilers

Related articles
C->C compiler? (1996-05-13)
Re: C->C compiler? (1996-05-14)
Re: C->C compiler? (Ashish Ashtekar) (1996-05-14)
Re: C->C compiler? (1996-05-18)
Re: C->C compiler? (Stefan Monnier) (1996-05-21)
| List of all articles for this month |

From: (Torben AEgidius Mogensen)
Newsgroups: comp.compilers
Date: 14 May 1996 20:18:35 -0400
Organization: Department of Computer Science, U of Copenhagen
References: 96-05-085
Keywords: C, optimize (Pinku Surana) writes:

>Is there a C->C compiler which optimizes C code? Many compilers for
>cheap microcontrollers churn out awful code. Since I cannot depend on
>these compilers to produce adequate code, I would like a compiler
>which optimizes the C code into unintelligible, yet fast, C code. Then
>I can use the compiler for the microcontroller to simply churn out
>object code.

C-mix is a partial evaluator for a subset of C. What this means is
that it can specialize a program with respect to certain values of
input or variables. Usually, this is used to optimize for special
situations, but in some cases you can get speed-up even without fixing
parameters simply by exploiting constants inside the program text.

The optimizations done by C-mix go beyound normal constant folding, as
it can optimize for known values even when they are not constant in
the sense recognized by traditional constant folding optimization.

C-mix is at present a research tool, and in many ways incomplete, but
experiments on moderate to large real-life programs have been
performed. You can obtain a license for C-mix from DIKU. Email for details.

>[I wouldn't hold my breath. What runs fast depends on the details of your
>target architecture, stack layout, exception handling, etc. I'd look for
>better real compilers. -John]

This is of course true. If you have bad register allocation, C-mix can
not help you. Also, C-mix will in some cases (by loop-unrolling etc.)
produce programs that are much larger than the original programs,
which may be a bad thing for micro-controllers.

Torben Mogensen (

Post a followup to this message

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