summaryrefslogtreecommitdiff
path: root/compiler/vectorise/VectUtils.hs
Commit message (Collapse)AuthorAgeFilesLines
* Finish breaking up vectoriser utilsbenl@ouroborus.net2010-09-091-371/+0
|
* Break out hoisting utils into their own modulebenl@ouroborus.net2010-09-081-70/+4
|
* Break out closure utils into own modulebenl@ouroborus.net2010-09-081-107/+5
|
* Finish breaking up VectBuiltIn and VectMonad, and add commentsbenl@ouroborus.net2010-08-311-2/+3
|
* Move VectCore to Vectorise treebenl@ouroborus.net2010-08-301-2/+1
|
* Split out vectoriser environments into own modulebenl@ouroborus.net2010-08-301-0/+2
|
* Vectorisation of method typesbenl@ouroborus.net2010-08-301-32/+50
|
* Comments and formatting to vectoriserbenl@ouroborus.net2010-08-301-6/+11
|
* Improve the handling of default methodssimonpj@microsoft.com2010-01-061-3/+3
| | | | | | | | | | See the long Note [INLINE and default methods]. This patch changes a couple of data types, with a knock-on effect on the format of interface files. A lot of files get touched, but is a relatively minor change. The main tiresome bit is the extra plumbing to communicate default methods between the type checker and the desugarer.
* More work on the simplifier's inlining strategiessimonpj@microsoft.com2009-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch collects a small raft of related changes * Arrange that during (a) rule matching and (b) uses of exprIsConApp_maybe we "look through" unfoldings only if they are active in the phase. Doing this for (a) required a bit of extra plumbing in the rule matching code, but I think it's worth it. One wrinkle is that even if inlining is off (in the 'gentle' phase of simplification) during rule matching we want to "look through" things with inlinings. See SimplUtils.activeUnfInRule. This fixes a long-standing bug, where things that were supposed to be (say) NOINLINE, could still be poked into via exprIsConApp_maybe. * In the above cases, also check for (non-rule) loop breakers; we never look through these. This fixes a bug that could make the simplifier diverge (and did for Roman). Test = simplCore/should_compile/dfun-loop * Try harder not to choose a DFun as a loop breaker. This is just a small adjustment in the OccurAnal scoring function * In the scoring function in OccurAnal, look at the InlineRule unfolding (if there is one) not the actual RHS, beause the former is what'll be inlined. * Make the application of any function to dictionary arguments CONLIKE. Thus (f d1 d2) is CONLIKE. Encapsulated in CoreUtils.isExpandableApp Reason: see Note [Expandable overloadings] in CoreUtils * Make case expressions seem slightly smaller in CoreUnfold. This reverses an unexpected consequences of charging for alternatives. Refactorings ~~~~~~~~~~~~ * Signficantly refactor the data type for Unfolding (again). The result is much nicer. * Add type synonym BasicTypes.CompilerPhase = Int and use it Many of the files touched by this patch are simply knock-on consequences of these two refactorings.
* Remove dead codeRoman Leshchinskiy2009-11-121-5/+1
|
* Minor refactoringsimonpj@microsoft.com2009-10-301-2/+2
| | | | MkCore.mkCoreTupTy moves to TysWiredIn, where it is called mkBoxedTupleTy
* Adapt vectoriser to new inlining mechanismRoman Leshchinskiy2009-10-301-24/+50
|
* Use packByTag instead of pack in the vectoriserRoman Leshchinskiy2009-10-301-1/+7
|
* Fix bug in data type vectorisationRoman Leshchinskiy2009-10-161-1/+1
|
* Fix Trac #959: a long-standing bug in instantiating otherwise-unbound type ↵simonpj@microsoft.com2009-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | variables DO NOT MERGE TO GHC 6.12 branch (Reason: interface file format change.) The typechecker needs to instantiate otherwise-unconstraint type variables to an appropriately-kinded constant type, but we didn't have a supply of arbitrarily-kinded tycons for this purpose. Now we do. The details are described in Note [Any types] in TysPrim. The fundamental change is that there is a new sort of TyCon, namely AnyTyCon, defined in TyCon. Ter's a small change to interface-file binary format, because the new AnyTyCons have to be serialised. I tided up the handling of uniques a bit too, so that mkUnique is not exported, so that we can see all the different name spaces in one module.
* Fix warningsRoman Leshchinskiy2009-10-151-1/+1
|
* PA and PR from dph are now type classesRoman Leshchinskiy2009-10-151-8/+31
| | | | | This is a fairly big change to the vectoriser in preparation to Simon's inline patch.
* Fix warningsRoman Leshchinskiy2009-07-131-5/+3
|
* Separate length from data in DPH arraysRoman Leshchinskiy2009-07-131-119/+93
|
* Allow RULES for seq, and exploit themsimonpj@microsoft.com2009-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Roman found situations where he had case (f n) of _ -> e where he knew that f (which was strict in n) would terminate if n did. Notice that the result of (f n) is discarded. So it makes sense to transform to case n of _ -> e Rather than attempt some general analysis to support this, I've added enough support that you can do this using a rewrite rule: RULE "f/seq" forall n. seq (f n) e = seq n e You write that rule. When GHC sees a case expression that discards its result, it mentally transforms it to a call to 'seq' and looks for a RULE. (This is done in Simplify.rebuildCase.) As usual, the correctness of the rule is up to you. This patch implements the extra stuff. I have not documented it explicitly in the user manual yet... let's see how useful it is first. The patch looks bigger than it is, because a) Comments; see esp MkId Note [seqId magic] b) Some refactoring. Notably, I moved the special desugaring for seq from MkCore back into DsUtils where it properly belongs. (It's really a desugaring thing, not a CoreSyn invariant.) c) Annoyingly, in a RULE left-hand side we need to be careful that the magical desugaring done in MkId Note [seqId magic] item (c) is *not* done on the LHS of a rule. Or rather, we arrange to un-do it, in DsBinds.decomposeRuleLhs.
* Generate lots of __inline_me during vectorisationRoman Leshchinskiy2009-03-071-3/+4
|
* Try not to avoid vectorising purely scalar functionsRoman Leshchinskiy2009-03-061-0/+19
|
* Make record selectors into ordinary functionssimonpj@microsoft.com2009-01-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This biggish patch addresses Trac #2670. The main effect is to make record selectors into ordinary functions, whose unfoldings appear in interface files, in contrast to their previous existence as magic "implicit Ids". This means that the usual machinery of optimisation, analysis, and inlining applies to them, which was failing before when the selector was somewhat complicated. (Which it can be when strictness annotations, unboxing annotations, and GADTs are involved.) The change involves the following points * Changes in Var.lhs to the representation of Var. Now a LocalId can have an IdDetails as well as a GlobalId. In particular, the information that an Id is a record selector is kept in the IdDetails. While compiling the current module, the record selector *must* be a LocalId, so that it participates properly in compilation (free variables etc). This led me to change the (hidden) representation of Var, so that there is now only one constructor for Id, not two. * The IdDetails is persisted into interface files, so that an importing module can see which Ids are records selectors. * In TcTyClDecls, we generate the record-selector bindings in renamed, but not typechecked form. In this way, we can get the typechecker to add all the types and so on, which is jolly helpful especially when GADTs or type families are involved. Just like derived instance declarations. This is the big new chunk of 180 lines of code (much of which is commentary). A call to the same function, mkAuxBinds, is needed in TcInstDcls for associated types. * The typechecker therefore has to pin the correct IdDetails on to the record selector, when it typechecks it. There was a neat way to do this, by adding a new sort of signature to HsBinds.Sig, namely IdSig. This contains an Id (with the correct Name, Type, and IdDetails); the type checker uses it as the binder for the final binding. This worked out rather easily. * Record selectors are no longer "implicit ids", which entails changes to IfaceSyn.ifaceDeclSubBndrs HscTypes.implicitTyThings TidyPgm.getImplicitBinds (These three functions must agree.) * MkId.mkRecordSelectorId is deleted entirely, some 300+ lines (incl comments) of very error prone code. Happy days. * A TyCon no longer contains the list of record selectors: algTcSelIds is gone The renamer is unaffected, including the way that import and export of record selectors is handled. Other small things * IfaceSyn.ifaceDeclSubBndrs had a fragile test for whether a data constructor had a wrapper. I've replaced that with an explicit flag in the interface file. More robust I hope. * I renamed isIdVar to isId, which touched a few otherwise-unrelated files.
* Tidy up the treatment of dead binderssimonpj@microsoft.com2008-09-201-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does a lot of tidying up of the way that dead variables are handled in Core. Just the sort of thing to do on an aeroplane. * The tricky "binder-swap" optimisation is moved from the Simplifier to the Occurrence Analyser. See Note [Binder swap] in OccurAnal. This is really a nice change. It should reduce the number of simplifier iteratoins (slightly perhaps). And it means that we can be much less pessimistic about zapping occurrence info on binders in a case expression. * For example: case x of y { (a,b) -> e } Previously, each time around, even if y,a,b were all dead, the Simplifier would pessimistically zap their OccInfo, so that we can't see they are dead any more. As a result virtually no case expression ended up with dead binders. This wasn't Bad in itself, but it always felt wrong. * I added a check to CoreLint to check that a dead binder really isn't used. That showed up a couple of bugs in CSE. (Only in this sense -- they didn't really matter.) * I've changed the PprCore printer to print "_" for a dead variable. (Use -dppr-debug to see it again.) This reduces clutter quite a bit, and of course it's much more useful with the above change. * Another benefit of the binder-swap change is that I could get rid of the Simplifier hack (working, but hacky) in which the InScopeSet was used to map a variable to a *different* variable. That allowed me to remove VarEnv.modifyInScopeSet, and to simplify lookupInScopeSet so that it doesn't look for a fixpoint. This fixes no bugs, but is a useful cleanup. * Roman pointed out that Id.mkWildId is jolly dangerous, because of its fixed unique. So I've - localied it to MkCore, where it is private (not exported) - renamed it to 'mkWildBinder' to stress that you should only use it at binding sites, unless you really know what you are doing - provided a function MkCore.mkWildCase that emodies the most common use of mkWildId, and use that elsewhere So things are much better * A knock-on change is that I found a common pattern of localising a potentially global Id, and made a function for it: Id.localiseId
* Clean up vectorisation error messagesRoman Leshchinskiy2008-09-161-10/+14
|
* Remove CoreSyn SOURCE importsMax Bolingbroke2008-08-071-2/+2
|
* Follow introduction of MkCore in VectUtilsMax Bolingbroke2008-07-311-1/+1
|
* Split the Id related functions out from Var into Id, document Var and some of IdMax Bolingbroke2008-07-311-1/+1
|
* (F)SLIT -> (f)sLit in VectUtilsIan Lynagh2008-04-121-7/+5
|
* Fixed warnings in vectorise/VectUtilsTwan van Laarhoven2008-01-261-22/+16
|
* Fix vectorisation bugRoman Leshchinskiy2007-12-061-3/+5
|
* Fix bugs in vectorisation of case expressionsRoman Leshchinskiy2007-11-191-1/+1
|
* Fix bug in generation of environments for vectorisationRoman Leshchinskiy2007-11-181-1/+4
|
* Incomplete support for boxing during vectorisationRoman Leshchinskiy2007-11-171-0/+13
|
* More vectorisation-related built-insRoman Leshchinskiy2007-11-161-1/+9
|
* Vectorisation utilitiesRoman Leshchinskiy2007-11-161-4/+8
|
* Add vectorisation built-insRoman Leshchinskiy2007-11-161-1/+6
|
* Fix CodingStyle#Warnings URLsIan Lynagh2007-09-041-1/+1
|
* Use OPTIONS rather than OPTIONS_GHC for pragmasIan Lynagh2007-09-031-2/+2
| | | | | | | 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-011-0/+7
|
* Remove NDP-related stuff from PrelNamesRoman Leshchinskiy2007-08-311-40/+5
| | | | | We don't need fixed Names for NDP built-ins. Instead, we can look them up ourselves during VM initialisation.
* Vectorisation of enumeration typesRoman Leshchinskiy2007-08-311-1/+6
|
* Number data constructors from 0 when vectorisingRoman Leshchinskiy2007-08-311-1/+1
|
* Fix vectorisation of sum type constructorsRoman Leshchinskiy2007-08-301-1/+1
|
* Find the correct array type for primitive tyconsRoman Leshchinskiy2007-08-301-2/+15
|
* Add code for looking up PA methods of primitive TyConsRoman Leshchinskiy2007-08-301-6/+24
|
* Complete PA dictionary generation for product typesRoman Leshchinskiy2007-08-241-22/+7
|
* Simplify generation of PR dictionaries for productsRoman Leshchinskiy2007-08-241-102/+0
|
* Adapt PArray instance generation to new schemeRoman Leshchinskiy2007-08-241-2/+22
|