
2010/1/27 José Pedro Magalhães
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 compiler/simplCore/CoreMonad.lhs 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, Max
participants (1)
-
Max Bolingbroke