GHC core plugins
José Pedro Magalhães
jpm at cs.uu.nl
Thu Jan 28 09:44:02 EST 2010
2010/1/27 Max Bolingbroke <batterseapower at hotmail.com>
> 2010/1/27 José Pedro Magalhães <jpm at cs.uu.nl>:
> > Alright, ticket created: http://hackage.haskell.org/trac/ghc/ticket/3843
> > In any case, for now I am willing to hard-code a new core-to-core pass on
> > the compiler. Any pointers for where I have to look at?
> I recommend you look at compiler/simplCore/CSE.lhs. It is a simple
> example of a core-to-core pass.
> However, in short you'll need to:
> 1) Create a function which implements your core to core pass, of a
> type such as [CoreBind] -> [CoreBind]
> *) If that function lives in a new module, edit ghc.cabal.in to tell
> the build system about the module
> 2) Add a constructor to the CoreToDo data type in
> 3) Add a case for it to the coreDumpFlag and Outputable instance
> 4) Add that pass to the list returned by getCoreToDo in CoreMonad. The
> order of the list is the order the passes will be run in.
> *) If you want the pass to be under the control of a new flag, you'll
> need to add a new dynflag - add a constructor to the DOpt data type in
> compiler/main/DynFlags.lhs, and add something to build that
> constructor to one of the lists that get fed to the command line
> handling code in the same module. It should be fairly obvious how to
> do this.
> 5) Add a handler for the new constructor to
> compiler/simplCore/SimplCore.lhs, in the doCorePass function which
> calls into the core pass function you wrote
> Hope that helps,
Yes, that helped quite a lot. One last thing: currently it takes me about 6
minutes to rebuild the compiler after I change the core pass. Are there any
tricks of the build system I can use to speed this up? I'm already using a
fast build without optimizations and docs...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Glasgow-haskell-users