summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmNode.hs
Commit message (Collapse)AuthorAgeFilesLines
* Add LANGUAGE pragmas to compiler/ source filesHerbert Valerio Riedel2014-05-151-1/+6
| | | | | | | | | | | | | | | | | | In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been reorganized, while following the convention, to - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before any `{-# OPTIONS_GHC #-}`-lines. - Moreover, if the list of language extensions fit into a single `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each individual language extension. In both cases, try to keep the enumeration alphabetically ordered. (The latter layout is preferable as it's more diff-friendly) While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
* Clarify comments and liberalise stack-check optimisation slightlySimon Peyton Jones2013-10-181-1/+5
| | | | | | The only substantive change here is to change "==" into ">=" in the Note [Always false stack check] code. This is semantically correct, but won't have any practical impact.
* Fix definition of DefinerOfRegs for CmmForeignCallJan Stolarek2013-09-041-5/+74
| | | | And update comments
* Comments and type synonym in CmmSinkJan Stolarek2013-09-031-0/+2
|
* Fix a bug in stack layout with safe foreign calls (#8083)Simon Marlow2013-07-241-5/+6
| | | | | | | We weren't properly tracking the number of stack arguments in the continuation of a foreign call. It happened to work when the continuation was not a join point, but when it was a join point we were using the wrong amount of stack fixup.
* Whitespace only in CmmNodeIan Lynagh2013-04-141-21/+14
|
* Derive instance Eq for CmmNodeGabor Greif2013-04-061-14/+3
|
* commentsSimon Marlow2013-03-051-2/+3
|
* Remove OldCmm, convert backends to consume new CmmSimon Marlow2012-11-121-1/+13
| | | | | | | | | | | | | | | | | | This removes the OldCmm data type and the CmmCvt pass that converts new Cmm to OldCmm. The backends (NCGs, LLVM and C) have all been converted to consume new Cmm. The main difference between the two data types is that conditional branches in new Cmm have both true/false successors, whereas in OldCmm the false case was a fallthrough. To generate slightly better code we occasionally need to invert a conditional to ensure that the branch-not-taken becomes a fallthrough; this was previously done in CmmCvt, and it is now done in CmmContFlowOpt. We could go further and use the Hoopl Block representation for native code, which would mean that we could use Hoopl's postorderDfs and analyses for native code, but for now I've left it as is, using the old ListGraph representation for native code.
* Generalize register sets and liveness calculations.Geoffrey Mainland2012-10-301-11/+49
| | | | | | We would like to calculate register liveness for global registers as well as local registers, so this patch generalizes the existing infrastructure to set the stage.
* Produce new-style Cmm from the Cmm parserSimon Marlow2012-10-081-14/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main change here is that the Cmm parser now allows high-level cmm code with argument-passing and function calls. For example: foo ( gcptr a, bits32 b ) { if (b > 0) { // we can make tail calls passing arguments: jump stg_ap_0_fast(a); } return (x,y); } More details on the new cmm syntax are in Note [Syntax of .cmm files] in CmmParse.y. The old syntax is still more-or-less supported for those occasional code fragments that really need to explicitly manipulate the stack. However there are a couple of differences: it is now obligatory to give a list of live GlobalRegs on every jump, e.g. jump %ENTRY_CODE(Sp(0)) [R1]; Again, more details in Note [Syntax of .cmm files]. I have rewritten most of the .cmm files in the RTS into the new syntax, except for AutoApply.cmm which is generated by the genapply program: this file could be generated in the new syntax instead and would probably be better off for it, but I ran out of enthusiasm. Some other changes in this batch: - The PrimOp calling convention is gone, primops now use the ordinary NativeNodeCall convention. This means that primops and "foreign import prim" code must be written in high-level cmm, but they can now take more than 10 arguments. - CmmSink now does constant-folding (should fix #7219) - .cmm files now go through the cmmPipeline, and as a result we generate better code in many cases. All the object files generated for the RTS .cmm files are now smaller. Performance should be better too, but I haven't measured it yet. - RET_DYN frames are removed from the RTS, lots of code goes away - we now have some more canned GC points to cover unboxed-tuples with 2-4 pointers, which will reduce code size a little.
* Fix a bug in foldExpDeepSimon Marlow2012-08-311-8/+1
| | | | | This caused the CAF analysis to occasionally miss a CAF sometimes, resulting in a very hard to diagnose crash.
* Foreign calls may clobber caller-saves registersSimon Marlow2012-08-061-8/+28
| | | | See Note [foreign calls clobber GlobalRegs]
* GHC 7.4 is now required for building HEADIan Lynagh2012-07-201-6/+0
|
* Track liveness of GlobalRegs in the new code generatorSimon Marlow2012-07-091-11/+11
| | | | | | This gives the register allocator access to R1.., F1.., D1.. etc. for the new code generator, and is a cheap way to eliminate all the extra "x = R1" assignments that we get from copyIn.
* Delete some unused codeSimon Marlow2012-07-051-4/+0
|
* Remove "fuel", adapt to Hoopl changes, fix warningsSimon Marlow2012-07-051-1/+1
|
* a bit more UNPACKingSimon Marlow2012-03-151-4/+7
|
* remove dead codeSimon Marlow2012-03-151-31/+0
|
* remove unused Conventions (Foreign, Private)Simon Marlow2012-02-131-8/+0
|
* New stack layout algorithmSimon Marlow2012-02-081-2/+2
| | | | | | | | | | | | | Also: - improvements to code generation: push slow-call continuations on the stack instead of generating explicit continuations - remove unused CmmInfo wrapper type (replace with CmmInfoTable) - squash Area and AreaId together, remove now-unused RegSlot - comment out old unused stack-allocation code that no longer compiles after removal of RegSlot
* add mapSuccessorsSimon Marlow2012-02-031-1/+9
|
* don't inline foldExpDeepSimon Marlow2012-01-301-1/+0
|
* optimise foldExpDeepSimon Marlow2012-01-251-1/+10
|
* strictness annotationsSimon Marlow2012-01-231-2/+2
|
* unpack the Label in CmmEntrySimon Marlow2012-01-181-1/+1
|
* More codegen refactoring with simonpjSimon Marlow2011-12-191-0/+5
|
* Use -fwarn-tabs when validatingIan Lynagh2011-11-041-0/+7
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* Snapshot of codegen refactoring to share with simonpjSimon Marlow2011-08-251-8/+15
|
* 'Fix' a validation problem when bootstrap is 7.2.1David Terei2011-08-191-1/+1
| | | | | | Problem is with GADTs in new code gen and incomplete pattern warnings. Just disabled the warning really and created #5424 to track an actual fix.
* comment updatesSimon Marlow2011-06-281-4/+7
|
* Port MachOp folding to new code generator.Edward Z. Yang2011-06-171-0/+50
| | | | | | | | | | | | | | | * Rewrote cmmMachOpFold to cmmMachOpFoldM, which returns Nothing if no folding took place. * Wrote some generic mapping functions which take functions of form 'a -> Maybe a' and are smart about sharing. * Split up optimizations from PIC and PPC work in the native codegen, so they'll be easier to turn off later (they are not currently being turned off, however.) * Whitespace fixes! ToDo: Turn off MachOp folding when new codegenerator is being used. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Remove type synonyms for CmmFormals, CmmActuals (and hinted versions).Edward Z. Yang2011-06-131-4/+4
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Work around lack of saving volatile registers from unsafe foreign calls.Edward Z. Yang2011-05-151-6/+26
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* More aggressive CmmRegOff inlining, and fix failure to inline to assignments.Edward Z. Yang2011-05-151-1/+1
| | | | Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Comments onlySimon Peyton Jones2011-05-091-3/+25
|
* Unsafe foreign calls (fat machine instructions) do not kill all registers.Edward Z. Yang2011-04-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The new code generator was doing some interesting spilling across unsafe foreign calls: _c1ao::I32 = Hp - 4; I32[Sp - 20] = _c1ao::I32; foreign "ccall" newCAF((BaseReg, PtrHint), (R1, PtrHint))[_unsafe_call_]; _c1ao::I32 = I32[Sp - 20]; This is fairly unnecessary, and resulted from over-conservative liveness analysis from CmmLive. We can see that the old code generator only saved volatile registers across unsafe foreign calls: spilling variables was done by saveVolatileVarsAndRegs, which was only performed for ordinary calls. This commit removes the excess kill from the liveness analysis, as well as the *redundant* excess kill from spilling-and-reloading, and adds a note to CmmNode to this effect. The only registers we need to kill are the ones that the foreign call assigns to, just like any other machine instruction. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
* Fix warningsSimon Marlow2011-01-281-2/+7
|
* Merge in new code generator branch.Simon Marlow2011-01-241-0/+303
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.