summaryrefslogtreecommitdiff
path: root/compiler/codeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* (F)SLIT -> (f)sLit in SMRepIan Lynagh2008-04-121-7/+6
|
* Don't import FastString in HsVersions.hIan Lynagh2008-03-297-5/+6
| | | | Modules that need it import it themselves instead.
* DEBUG removalIan Lynagh2008-03-291-6/+6
|
* DEBUG removalIan Lynagh2008-03-291-2/+0
|
* CgTicky now doesn't know about the Integer data constructorsIan Lynagh2008-03-201-2/+0
|
* Remove leftover NoteTy/FTVNote bitsIan Lynagh2008-03-151-1/+0
|
* Add and use seqBitmap when constructing SRTsIan Lynagh2008-02-271-1/+6
| | | | | | | | | | | This roughly halves memory usage when compiling module Foo where foo :: Double -> Int foo x | x == 1 = 1 ... foo x | x == 500 = 500 without optimisation.
* change CmmActual, CmmFormal to use a data CmmHinted rather than tuple (#1405)Isaac Dupree2008-01-048-33/+36
| | | | | | | This allows the instance of UserOfLocalRegs to be within Haskell98, and IMHO makes the code a little cleaner generally. This is one small (though tedious) step towards making GHC's code more portable...
* Add better panic message in getSRTInfo (Trac #1973)simonpj@microsoft.com2007-12-201-0/+1
|
* #include ../includes/MachRegs.h rather than just MachRegs.hIan Lynagh2007-12-051-1/+1
| | | | | This fixes building on NixOS. I'm not sure why it worked everywhere else, but not on NixOS, before.
* Pad static literals to word size in the code generatorSimon Marlow2007-11-081-1/+12
|
* second attempt to fix C compiler warnings with -fhpcSimon Marlow2007-10-191-2/+5
| | | | | | | | | | | | | The hs_hpc_module() prototype in RtsExternal.h didn't match its usage: we were passing StgWord-sized parameters but the prototype used C ints. I think it accidentally worked because we only ever passed constants that got promoted. The constants unfortunately were sometimes negative, which caused the C compiler to emit warnings. I suspect PprC.pprHexVal may be wrong to emit negative constants in the generated C, but I'm not completely sure. Anyway, it's easy to fix this in CgHpc, which is what I've done.
* Move OPTIONS pragmas above commentsIan Lynagh2007-09-2110-70/+70
| | | | Fixes building with -Werror (i.e. validate) and GHC < 6.6
* get freshBlockId out of ZipCfg and bury it in MkZipCfg where it belongsNorman Ramsey2007-09-151-2/+2
|
* Make various assertions work when !DEBUGIan Lynagh2007-09-083-8/+1
|
* a good deal of salutory renamingNorman Ramsey2007-09-076-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've renamed a number of type and data constructors within Cmm so that the names used in the compiler may more closely reflect the C-- specification 2.1. I've done a bit of other renaming as well. Highlights: CmmFormal and CmmActual now bear a CmmKind (which for now is a MachHint as before) CmmFormals = [CmmFormal] and CmmActuals = [CmmActual] suitable changes have been made to both code and nonterminals in the Cmm parser (which is as yet untested) For reasons I don't understand, parts of the code generator use a sequence of 'formal parameters' with no C-- kinds. For these we now have the types type CmmFormalWithoutKind = LocalReg type CmmFormalsWithoutKinds = [CmmFormalWithoutKind] A great many appearances of (Tau, MachHint) have been simplified to the appropriate CmmFormal or CmmActual, though I'm sure there are more opportunities. Kind and its data constructors are now renamed to data GCKind = GCKindPtr | GCKindNonPtr to avoid confusion with the Kind used in the type checker and with CmmKind. Finally, in a somewhat unrelated bit (and in honor of Simon PJ, who thought of the name), the Whalley/Davidson 'transaction limit' is now called 'OptimizationFuel' with the net effect that there are no longer two unrelated uses of the abbreviation 'tx'.
* Add clarifying commentssimonpj@microsoft.com2007-09-071-1/+3
|
* massive changes to add a 'zipper' representation of C--Norman Ramsey2007-09-064-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes too numerous to comment on, but here is some old history that I saved: Wed Aug 15 11:07:13 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * type synonyms made consistent with new Cmm types M ./compiler/nativeGen/MachInstrs.hs -2 +2 Mon Aug 20 19:22:14 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * pushing return info beyond cmm into codegen M ./compiler/codeGen/Bitmap.hs r3 M ./compiler/codeGen/CgBindery.lhs r3 M ./compiler/codeGen/CgCallConv.hs r3 M ./compiler/codeGen/CgCase.lhs r3 M ./compiler/codeGen/CgClosure.lhs r3 M ./compiler/codeGen/CgCon.lhs r3 M ./compiler/codeGen/CgExpr.lhs r3 M ./compiler/codeGen/CgForeignCall.hs -6 +7 r3 M ./compiler/codeGen/CgHeapery.lhs r3 M ./compiler/codeGen/CgHpc.hs +1 r3 M ./compiler/codeGen/CgInfoTbls.hs r3 M ./compiler/codeGen/CgLetNoEscape.lhs r3 M ./compiler/codeGen/CgMonad.lhs r3 M ./compiler/codeGen/CgParallel.hs r3 M ./compiler/codeGen/CgPrimOp.hs +3 r3 M ./compiler/codeGen/CgProf.hs r3 M ./compiler/codeGen/CgStackery.lhs r3 M ./compiler/codeGen/CgTailCall.lhs r3 M ./compiler/codeGen/CgTicky.hs r3 M ./compiler/codeGen/CgUtils.hs -1 +1 r3 M ./compiler/codeGen/ClosureInfo.lhs r3 M ./compiler/codeGen/CodeGen.lhs r3 M ./compiler/codeGen/SMRep.lhs r3 M ./compiler/nativeGen/AsmCodeGen.lhs -2 +2 r1 M ./compiler/nativeGen/MachCodeGen.hs -3 +3 r1 M ./compiler/nativeGen/MachInstrs.hs r1 M ./compiler/nativeGen/MachRegs.lhs r1 M ./compiler/nativeGen/NCGMonad.hs r1 M ./compiler/nativeGen/PositionIndependentCode.hs r1 M ./compiler/nativeGen/PprMach.hs r1 M ./compiler/nativeGen/RegAllocInfo.hs r1 M ./compiler/nativeGen/RegisterAlloc.hs r1 Mon Aug 20 20:54:41 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * put CmmReturnInfo into a CmmCall (and related types) M ./compiler/cmm/Cmm.hs -2 +1 r3 M ./compiler/cmm/CmmBrokenBlock.hs -13 +12 r1 M ./compiler/cmm/CmmCPS.hs -3 +3 M ./compiler/cmm/CmmCPSGen.hs -8 +6 r1 M ./compiler/cmm/CmmLint.hs -1 +1 M ./compiler/cmm/CmmLive.hs -1 +1 M ./compiler/cmm/CmmOpt.hs -3 +3 M ./compiler/cmm/CmmParse.y -6 +6 r3 M ./compiler/cmm/PprC.hs -3 +3 M ./compiler/cmm/PprCmm.hs -7 +4 r2 M ./compiler/codeGen/CgForeignCall.hs -7 +6 r2 M ./compiler/codeGen/CgHpc.hs -1 r1 M ./compiler/codeGen/CgPrimOp.hs -3 r1 M ./compiler/codeGen/CgUtils.hs -1 +1 r1 M ./compiler/nativeGen/AsmCodeGen.lhs -2 +2 M ./compiler/nativeGen/MachCodeGen.hs -3 +3 r1 Tue Aug 21 18:09:13 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * add call info in nativeGen M ./compiler/nativeGen/AsmCodeGen.lhs r1 M ./compiler/nativeGen/MachInstrs.hs r1 M ./compiler/nativeGen/MachRegs.lhs r1 M ./compiler/nativeGen/NCGMonad.hs r1 M ./compiler/nativeGen/PositionIndependentCode.hs r1 M ./compiler/nativeGen/PprMach.hs r1 M ./compiler/nativeGen/RegAllocInfo.hs r1 Wed Aug 22 16:41:58 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * ListGraph is now a newtype, not a synonym The resultant bookkeepping is unenviable, but the change greatly simplifies our ability to make Cmm things propertly Outputable for both list-graph and zipper-graph representations. M ./compiler/cmm/Cmm.hs -5 +3 M ./compiler/cmm/CmmCPS.hs -2 +2 M ./compiler/cmm/CmmCPSGen.hs -1 +1 M ./compiler/cmm/CmmContFlowOpt.hs -3 +3 M ./compiler/cmm/CmmCvt.hs -2 +2 M ./compiler/cmm/CmmInfo.hs -2 +3 M ./compiler/cmm/CmmLint.hs -1 +1 M ./compiler/cmm/CmmOpt.hs -2 +2 M ./compiler/cmm/PprC.hs -1 +1 M ./compiler/cmm/PprCmm.hs -5 +8 M ./compiler/cmm/PprCmmZ.hs -7 +1 M ./compiler/codeGen/CgMonad.lhs -1 +1 M ./compiler/nativeGen/AsmCodeGen.lhs -15 +15 M ./compiler/nativeGen/MachCodeGen.hs -2 +2 M ./compiler/nativeGen/PositionIndependentCode.hs -6 +6 M ./compiler/nativeGen/PprMach.hs -3 +2 M ./compiler/nativeGen/RegAllocColor.hs +1 M ./compiler/nativeGen/RegAllocLinear.hs -4 +5 M ./compiler/nativeGen/RegCoalesce.hs -6 +6 M ./compiler/nativeGen/RegLiveness.hs -12 +12 Thu Aug 23 13:44:49 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * diagnostic assistance in case fromJust fails M ./compiler/nativeGen/MachCodeGen.hs -2 +5 Thu Aug 23 14:07:28 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * give every block, even the first, a label With branch-chain elimination, the first block of a procedure might be the target of a branch. This actually happens to a dozen or more procedures in the run-time system. M ./compiler/nativeGen/PprMach.hs -8 +3 Fri Aug 24 17:27:04 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * clean up the code in PprMach M ./compiler/nativeGen/PprMach.hs -16 +14 Fri Aug 24 19:35:03 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * a bunch of impedance matching to get the compiler to build, plus * the plus is diagnostics for unreachable code, which required moving a lot of prettyprinting code M ./compiler/cmm/Cmm.hs -7 +5 M ./compiler/cmm/CmmCPSZ.hs -1 +1 M ./compiler/cmm/CmmCvt.hs -8 +8 M ./compiler/cmm/CmmParse.y -4 +3 M ./compiler/cmm/MkZipCfg.hs -19 +9 M ./compiler/cmm/PprCmmZ.hs -118 +4 M ./compiler/cmm/ZipCfg.hs -1 +13 M ./compiler/cmm/ZipCfgCmm.hs -10 +129 M ./compiler/main/HscMain.lhs -4 +4 M ./compiler/nativeGen/NCGMonad.hs -2 +2 M ./compiler/nativeGen/RegAllocInfo.hs -3 +3 Fri Aug 31 14:38:02 BST 2007 Norman Ramsey <nr@eecs.harvard.edu> * fix a warning about an import M ./compiler/nativeGen/RegAllocColor.hs -1 +1
* change of representation for GenCmm, GenCmmTop, CmmProcNorman Ramsey2007-09-052-3/+3
| | | | | | | | | The type parameter to a C-- procedure now represents a control-flow graph, not a single instruction. The newtype ListGraph preserves the current representation while enabling other representations and a sensible way of prettyprinting. Except for a few changes in the prettyprinter the new compiler binary should be bit-for-bit identical to the old.
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-0423-23/+23
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-0323-46/+46
| | | | | | | Older GHCs can't parse OPTIONS_GHC. This also changes the URL referenced for the -w options from WorkingConventions#Warnings to CodingStyle#Warnings for the compiler modules.
* Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modulesIan Lynagh2007-09-0123-0/+160
|
* Refactoring only: remove [Id] field from ForeignStubsSimon Marlow2007-08-261-5/+3
| | | | | | | | | | | We used to pass the list of top-level foreign exported bindings to the code generator so that it could create StablePtrs for them in the stginit code. Now we don't use stginit unless profiling, and the StablePtrs are generated by C functions marked with attribute((constructor)). This patch removes various bits associated with the old way of doing things, which were previously left in place in case we wanted to switch back, I presume. Also I refactored dsForeigns to clean it up a bit.
* Add a missing "entryCode"Ian Lynagh2007-08-251-1/+1
| | | | | This was causing us to try to jump to the address of an infotable when unregisterised, leading to a segfault.
* Fix typo in commentMichael D. Adams2007-08-061-1/+1
|
* put CmmReturnInfo into a CmmCall (and related types)Norman Ramsey2007-08-204-7/+12
|
* Fix description and type profilingIan Lynagh2007-08-171-5/+3
| | | | | Consistently make the type and description in the info table an offset or a pointer, depending on whether tables are next to code or not.
* Rename a constructor CmmForeignCall to CmmCallee, and tidy Cmm codesimonpj@microsoft.com2007-08-094-9/+9
| | | | | | This patch should have no effect; it's mainly comments, layout, plus this contructor name change.
* Warning police: eliminate all defaulting within stage1Isaac Dupree2007-08-071-1/+1
| | | | | | | | Defaulting makes compilation of multiple modules more complicated (re: #1405) Although it was all locally within functions, not because of the module monomorphism-restriction... but it's better to be clear what's meant, anyway. I changed some that were defaulting to Integer, to explicit Int, where Int seemed appropriate rather than Integer.
* Change the strategy to determine dynamic data accessClemens Fruhwirth2007-07-319-84/+68
| | | | | | | | | | | | | Instead of attaching the information whether a Label is going to be accessed dynamically or not (distinction between IdLabel/DynLabel and additional flags in ModuleInitLabel and PlainModuleInitLabel), we hand dflags through the CmmOpt monad and the NatM monad. Before calling labelDynamic in PositionIndependentCode, we extract thisPackage from dflags and supply the current package to labelDynamic, so it can take this information into account instead of extracting it from the labels itself. This simplifies a lot of code in codeGen that just hands through this_pkg.
* Pointer TaggingSimon Marlow2007-07-2710-41/+294
| | | | | | | | | | | | | | | | | | | | | | This patch implements pointer tagging as per our ICFP'07 paper "Faster laziness using dynamic pointer tagging". It improves performance by 10-15% for most workloads, including GHC itself. The original patches were by Alexey Rodriguez Yakushev <mrchebas@gmail.com>, with additions and improvements by me. I've re-recorded the development as a single patch. The basic idea is this: we use the low 2 bits of a pointer to a heap object (3 bits on a 64-bit architecture) to encode some information about the object pointed to. For a constructor, we encode the "tag" of the constructor (e.g. True vs. False), for a function closure its arity. This enables some decisions to be made without dereferencing the pointer, which speeds up some common operations. In particular it enables us to avoid costly indirect jumps in many cases. More information in the commentary: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging
* Typo fix in commentMichael D. Adams2007-07-161-1/+1
|
* Fixes for the unreg buildIan Lynagh2007-07-181-7/+5
| | | | | | | * Fix code output order when printing C so things are defined before they are used. * Generate _ret rather than _entry functions for INFO_TABLE_RET. * Use "ASSIGN_BaseReg" rather than "BaseReg =".
* Factor 'callerSaveVolatileRegs' out of the NCG and into CgUtilMichael D. Adams2007-07-172-12/+185
| | | | | This is needed because CgForeign and parts of the CPS pass now use 'callerSaveVolatileRegs' and not all platforms have access to the NCG.
* Adding pushing of hpc translation status through hi files.andy@galois.com2007-07-172-2/+2
| | | | | | | | | | Now, if a single module *anywhere* on the module tree is built with -fhpc, the binary will enable reading/writing of <bin>.tix. Previously, you needed to compile Main to allow coverage to operate. This changes the file format for .hi files; you will need to recompile every library.
* Adding support for package names into hpc outputed codeandy@galois.com2007-07-111-3/+7
| | | | | | | | | | | | | | We store .mix files in .hpc/<package>/<the.module.name>.mix The package main the empty package (aka other naming passes), so Main just is stored in .hpc/Main.tix This change in backwards compatable.
* Ensure no statements after CmmReturn are emittedMichael D. Adams2007-07-051-0/+1
|
* Warning PoliceMichael D. Adams2007-07-051-3/+0
|
* Remove mapAccumL, mapAccumR, mapAccumBIan Lynagh2007-07-023-0/+5
| | | | | mapAccumL and mapAccumR are in Data.List now. mapAccumB is unused.
* Added support for update frames to the CPS passMichael D. Adams2007-07-032-6/+8
| | | | (This required a bit of refactoring of CmmInfo.)
* Multiple improvements to CPS algorithm.Michael D. Adams2007-07-021-0/+1
| | | | | | | | | | | | | | | These include: - Stack size detection now includes function arguments. - Stack size detection now avoids stack checks just because of the GC block. - A CmmCall followed by a CmmBranch will no longer generate an extra continuation consisting just of the brach. - Multiple CmmCall/CmmBranch pairs that all go to the same place will try to use the same continuation. If they can't (because the return value signature is different), adaptor block are built. - Function entry statements are now in a separate block. (Fixed bug with branches to the entry block having unintended effects.) - Other changes that I can't recall right now.
* Fix typo from amend-recordMichael D. Adams2007-06-271-1/+1
|
* Implemented and fixed bugs in CmmInfo handlingMichael D. Adams2007-06-278-281/+236
|
* Added stack checks to the CPS algorithmMichael D. Adams2007-06-271-1/+1
| | | | | | | | | | | | This eliminates one of the panics introduced by the previous patch: 'First pass at implementing info tables for CPS' The other panic introduced by that patch still remains. It was due to the need to convert from a ContinuationInfo to a CmmInfo. (codeGen/CgInfoTbls.hs:emitClosureCodeAndInfoTable) (codeGen/CgInfoTbls.hs:emitReturnTarget)
* First pass at implementing info tables for CPSMichael D. Adams2007-06-275-13/+45
| | | | | | | | | | | | | | | | This is a fairly complete implementation, however two 'panic's have been placed in the critical path where the implementation is still a bit lacking so do not expect it to run quite yet. One call to panic is because we still need to create a GC block for procedures that don't have them yet. (cmm/CmmCPS.hs:continuationToProc) The other is due to the need to convert from a ContinuationInfo to a CmmInfo. (codeGen/CgInfoTbls.hs:emitClosureCodeAndInfoTable) (codeGen/CgInfoTbls.hs:emitReturnTarget)
* Added an SRT to each CmmCall and added the current SRT to the CgMonadMichael D. Adams2007-06-2712-79/+117
|
* Added pointerhood to LocalRegMichael D. Adams2007-06-2710-117/+148
| | | | | | This version should compile but is still incomplete as it introduces potential bugs at the places marked 'TODO FIXME NOW'. It is being recorded to help keep track of changes.
* Fix bug relating to the return values of prim opsMichael D. Adams2007-06-261-1/+1
| | | | | | The return values were getting put in a LocalReg but that LocalReg needed to be stored into the enclosing expression's return register (e.g. R1).
* Removed trailing whitespaceMichael D. Adams2007-06-211-1/+1
|
* Fixed typo in commentMichael D. Adams2007-06-191-1/+1
|