HEADS UP: back end changes coming in

Simon Marlow simonmarhaskell at gmail.com
Tue Jul 3 10:21:01 EDT 2007


I'm about to merge into the HEAD a branch that Michael Adams has been working 
on, consisting of about 50 or so patches affecting mostly files in compiler/cmm. 
  I've tested a complete bootstrap and testsuite, and as far as I can tell, the 
changes should have absolutely no effect on anything at all.

This is the first stage in a refactoring of the backend.  Some details are here:

http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/CPS

The main idea is that we introduce a higher-level version of Cmm that includes 
full function calls and parameter passing, and no explicit stack manipulation. 
This language is generated by the Stg->Cmm code generator, and transformed into 
Cmm with explicit stack manipulation by a separate CPS-like phase.  This has 
some nice advantages:

  - it completely separates stack-manipulation from the code generator

  - it means we can make use of function calls and parameter passing in
    the RTS .cmm code, which simplifies lots of things.  Our special
    primop calling conventions go away, for example.  PrimopWrappers
    goes away.  The RET_DYN and RET_FUN frames go away, and stack
    walking gets much simpler.  PAPs will also have a simpler layout,
    although this isn't a forced change.

  - ultimately, we'll get better code this way.  When we drop the via-C
    route, we'll be able to use more registers for passing parameters.

So far, the existing code generation route is unaffected, but the changes have 
been made to the Cmm datatype and some of the code to do the CPS pass is there. 
  We wanted to get the branch merged in now to avoid future conflicts.

Comments welcome!

Cheers,
	Simon




More information about the Cvs-ghc mailing list