Merge in new code generator branch. This changes the new code generator to make use of the Hoopl package for dataflow analysis. Hoopl is a new boot package, and is maintained in a separate upstream git repository (as usual, GHC has its own lagging darcs mirror in http://darcs.haskell.org/packages/hoopl). During this merge I squashed recent history into one patch. I tried to rebase, but the history had some internal conflicts of its own which made rebase extremely confusing, so I gave up. The history I squashed was: - Update new codegen to work with latest Hoopl - Add some notes on new code gen to cmm-notes - Enable Hoopl lag package. - Add SPJ note to cmm-notes - Improve GC calls on new code generator. Work in this branch was done by: - Milan Straka <fox@ucw.cz> - John Dias <dias@cs.tufts.edu> - David Terei <davidterei@gmail.com> Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD and fixed a few bugs.
RegAlloc: Track slot liveness over jumps in spill cleaner
Super-monster patch implementing the new typechecker -- at last This major patch implements the new OutsideIn constraint solving algorithm in the typecheker, following our JFP paper "Modular type inference with local assumptions". Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
Fix warnings
NCG: Reverse SCCs after each round in the graph allocator
NCG: Do explicit check for precondition of computeLiveness computeLiveness requires the SCCs of blocks to be in reverse dependent order, and if they're not it was silently giving bad liveness info, yielding a bad allocation. Now it complains, loudly.
NCG: Handle stripping of liveness info from procs with no blocks (like stg_split_marker)
NCG: Remember to keep the entry block first when erasing liveness info
NCG: Refactor representation of code with liveness info * I've pushed the SPILL and RELOAD instrs down into the LiveInstr type to make them easier to work with. * When the graph allocator does a spill cycle it now just re-annotates the LiveCmmTops instead of converting them to NatCmmTops and back. * This saves working out the SCCS again, and avoids rewriting the SPILL and RELOAD meta instructions into real machine instructions.
NCG: Refactor LiveCmmTop to hold a list of SCCs instead of abusing ListGraph
NCG: Allow the liveness map in a LiveInfo to be Nothing
Split Reg into vreg/hreg and add register pairs * The old Reg type is now split into VirtualReg and RealReg. * For the graph coloring allocator, the type of the register graph is now (Graph VirtualReg RegClass RealReg), which shows that it colors in nodes representing virtual regs with colors representing real regs. (as was intended) * RealReg contains two contructors, RealRegSingle and RealRegPair, where RealRegPair is used to represent a SPARC double reg constructed from two single precision FP regs. * On SPARC we can now allocate double regs into an arbitrary register pair, instead of reserving some reg ranges to only hold float/double values.
NCG: Split up the native code generator into arch specific modules - nativeGen/Instruction defines a type class for a generic instruction set. Each of the instruction sets we have, X86, PPC and SPARC are instances of it. - The register alloctors use this type class when they need info about a certain register or instruction, such as regUsage, mkSpillInstr, mkJumpInstr, patchRegs.. - nativeGen/Platform defines some data types enumerating the architectures and operating systems supported by the native code generator. - DynFlags now keeps track of the current build platform, and the PositionIndependentCode module uses this to decide what to do instead of relying of #ifdefs. - It's not totally retargetable yet. Some info info about the build target is still hardwired, but I've tried to contain most of it to a single module, TargetRegs. - Moved the SPILL and RELOAD instructions into LiveInstr. - Reg and RegClass now have their own modules, and are shared across all architectures.
NCG: Move RegLiveness -> RegAlloc.Liveness