cmmToCmm should be the first class CmmToCmm pass

Simon Marlow simonmar at microsoft.com
Mon Feb 16 09:34:12 EST 2004


 
> The cmmToCmm pass that lives in nativeGen/AsmCodeGen seems to do some
> useful things. These optimisations seem to be just as useful in the C
> backend, I think. The constant folding certainly makes the C 
> output look
> smarter.
> 
> Should this be moved out of the nativeGen, and into, say, 
> cmm/CmmToCmm, as a generic cmm optimiser?

Probably.  But bear in mind that optimisation isn't nearly so important
for the C backend, because the C compiler will do all of this and more.
It's worthwhile if doing our own optimisation reduces overall compile
time (by generating less code to pretty print, for example).

Also, the cmmToCmm pass is currently doing some expansion of GlobalRegs
into offsets from BaseReg, which is needed for the NCG.  We'd have to
separate this if we were to make cmmToCmm more generic.

So, I'd say let's keep an open mind for the time being - get things
working first, and then experiment with inserting this pass into the C
compilation pipeline to see what difference it makes.

Cheers,
	Simon


More information about the Cvs-ghc mailing list