hoopl 3.8.7.1 → 3.8.7.3
raw patch · 22 files changed
+132/−29 lines, 22 filesdep ~basenew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Compiler.Hoopl.Passes.Dominator: instance Show DPath
- Compiler.Hoopl.Passes.Dominator: instance Show DominatorNode
- Compiler.Hoopl.Passes.Dominator: instance Show DominatorTree
+ Compiler.Hoopl: liftFuel :: (FuelMonadT fm, Monad m, FuelMonad (fm m)) => m a -> fm m a
+ Compiler.Hoopl: mapBlock :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x
+ Compiler.Hoopl: mapGraph :: (forall e x. n e x -> n' e x) -> Graph n e x -> Graph n' e x
+ Compiler.Hoopl: mapMaybeC :: (forall e x. n e x -> n' e x) -> MaybeC ex (Block n e x) -> MaybeC ex (Block n' e x)
+ Compiler.Hoopl: mapMaybeO :: (forall e x. n e x -> n' e x) -> MaybeO ex (Block n e x) -> MaybeO ex (Block n' e x)
+ Compiler.Hoopl.Passes.Dominator: instance [safe] Show DPath
+ Compiler.Hoopl.Passes.Dominator: instance [safe] Show DominatorNode
+ Compiler.Hoopl.Passes.Dominator: instance [safe] Show DominatorTree
- Compiler.Hoopl: blockToNodeList''' :: ((IndexedCO e (NodeList' C O n) (NodeList' O O n)) ~ (NodeList' e O n), (IndexedCO x (NodeList' e C n) (NodeList' e O n)) ~ (NodeList' e x n)) => Block n e x -> NodeList' e x n
+ Compiler.Hoopl: blockToNodeList''' :: (IndexedCO e (NodeList' C O n) (NodeList' O O n) ~ NodeList' e O n, IndexedCO x (NodeList' e C n) (NodeList' e O n) ~ NodeList' e x n) => Block n e x -> NodeList' e x n
- Compiler.Hoopl: class Monad m => CheckpointMonad m where { type family Checkpoint m; }
+ Compiler.Hoopl: class Monad m => CheckpointMonad m where type family Checkpoint m
- Compiler.Hoopl: class IsMap map where { type family KeyOf map; }
+ Compiler.Hoopl: class IsMap map where type family KeyOf map
- Compiler.Hoopl: class IsSet set where { type family ElemOf set; }
+ Compiler.Hoopl: class IsSet set where type family ElemOf set
- Compiler.Hoopl: data Graph' block n e x
+ Compiler.Hoopl: data Graph' block (n :: * -> * -> *) e x
Files
- hoopl.cabal +28/−25
- src/Compiler/Hoopl.hs +5/−1
- src/Compiler/Hoopl/Checkpoint.hs +3/−0
- src/Compiler/Hoopl/Collections.hs +4/−0
- src/Compiler/Hoopl/Combinators.hs +3/−0
- src/Compiler/Hoopl/Dataflow.hs +4/−1
- src/Compiler/Hoopl/Debug.hs +3/−0
- src/Compiler/Hoopl/Fuel.hs +7/−0
- src/Compiler/Hoopl/GHC.hs +3/−0
- src/Compiler/Hoopl/Graph.hs +32/−2
- src/Compiler/Hoopl/GraphUtil.hs +3/−0
- src/Compiler/Hoopl/Label.hs +4/−0
- src/Compiler/Hoopl/MkGraph.hs +4/−0
- src/Compiler/Hoopl/Passes/DList.hs +3/−0
- src/Compiler/Hoopl/Passes/Dominator.hs +3/−0
- src/Compiler/Hoopl/Pointed.hs +3/−0
- src/Compiler/Hoopl/Shape.hs +3/−0
- src/Compiler/Hoopl/Show.hs +3/−0
- src/Compiler/Hoopl/Unique.hs +4/−0
- src/Compiler/Hoopl/Util.hs +3/−0
- src/Compiler/Hoopl/Wrappers.hs +4/−0
- src/Compiler/Hoopl/XUtil.hs +3/−0
hoopl.cabal view
@@ -1,10 +1,12 @@ Name: hoopl-Version: 3.8.7.1+Version: 3.8.7.3 -- version 3.8.6.0 is the version that goes with the camera-ready Haskell'10 paper -- version 3.8.7.0 works with GHC 7+-- version 3.8.7.1 adds some unnamed functions without breaking compatibility+-- version 3.8.7.2 adds Compiler.Hoopl.Fuel.liftFuel Description: Higher-order optimization library License: BSD3-License-file: LICENSE+License-File: LICENSE Author: Norman Ramsey, João Dias, and Simon Peyton Jones Maintainer: nr@cs.tufts.edu Homepage: http://ghc.cs.tufts.edu/hoopl/@@ -13,38 +15,39 @@ Stability: alpha Synopsis: A library to support dataflow analysis and optimization Category: Compilers/Interpreters-Extra-source-files: README, hoopl.pdf, CHANGES, FAQ+Extra-Source-Files: README, hoopl.pdf, CHANGES, FAQ Library+ Hs-Source-Dirs: src Build-Depends: base >= 3 && < 5, containers- Exposed-modules: Compiler.Hoopl,+ Exposed-Modules: Compiler.Hoopl, Compiler.Hoopl.Wrappers, Compiler.Hoopl.Passes.Dominator, Compiler.Hoopl.Passes.DList,--- Compiler.Hoopl.DataflowFold,--- Compiler.Hoopl.OldDataflow,- Compiler.Hoopl.GHC- Other-modules: Compiler.Hoopl.GraphUtil,+-- Compiler.Hoopl.DataflowFold,+-- Compiler.Hoopl.OldDataflow,+ Compiler.Hoopl.GHC+ Other-Modules: Compiler.Hoopl.GraphUtil, -- GraphUtil should *never* be seen by clients. -- The remaining modules are hidden *provisionally*- Compiler.Hoopl.Checkpoint,- Compiler.Hoopl.Collections,- Compiler.Hoopl.Combinators,- Compiler.Hoopl.Dataflow,- Compiler.Hoopl.Debug,- Compiler.Hoopl.Graph, - Compiler.Hoopl.Label,- Compiler.Hoopl.MkGraph,- Compiler.Hoopl.Fuel,- Compiler.Hoopl.Pointed,- Compiler.Hoopl.Shape,- Compiler.Hoopl.Show, - Compiler.Hoopl.Unique, - Compiler.Hoopl.Util- Compiler.Hoopl.XUtil- ghc-options: -Wall -fno-warn-name-shadowing- hs-source-dirs: src+ Compiler.Hoopl.Checkpoint,+ Compiler.Hoopl.Collections,+ Compiler.Hoopl.Combinators,+ Compiler.Hoopl.Dataflow,+ Compiler.Hoopl.Debug,+ Compiler.Hoopl.Graph, + Compiler.Hoopl.Label,+ Compiler.Hoopl.MkGraph,+ Compiler.Hoopl.Fuel,+ Compiler.Hoopl.Pointed,+ Compiler.Hoopl.Shape,+ Compiler.Hoopl.Show, + Compiler.Hoopl.Unique, + Compiler.Hoopl.Util,+ Compiler.Hoopl.XUtil + Ghc-Options: -Wall -fno-warn-name-shadowing+ Extensions: CPP Source-repository head Type: git
src/Compiler/Hoopl.hs view
@@ -1,3 +1,7 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif+ module Compiler.Hoopl ( module Compiler.Hoopl.Graph , module Compiler.Hoopl.MkGraph@@ -22,7 +26,7 @@ import Compiler.Hoopl.Dataflow hiding ( wrapFR, wrapFR2, wrapBR, wrapBR2 ) import Compiler.Hoopl.Debug-import Compiler.Hoopl.Fuel hiding (withFuel, getFuel, setFuel, FuelMonadT)+import Compiler.Hoopl.Fuel hiding (withFuel, getFuel, setFuel, runWithFuel) import Compiler.Hoopl.Graph hiding ( Body , BCat, BHead, BTail, BClosed -- OK to expose BFirst, BMiddle, BLast
src/Compiler/Hoopl/Checkpoint.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Checkpoint ( CheckpointMonad(..)
src/Compiler/Hoopl/Collections.hs view
@@ -1,6 +1,10 @@ {- Baseclasses for Map-like and Set-like collections inspired by containers. -} {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif+ module Compiler.Hoopl.Collections ( IsSet(..) , setInsertList, setDeleteList, setUnions , IsMap(..)
src/Compiler/Hoopl/Combinators.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE RankNTypes, LiberalTypeSynonyms, ScopedTypeVariables, GADTs #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Combinators ( thenFwdRw
src/Compiler/Hoopl/Dataflow.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE RankNTypes, ScopedTypeVariables, GADTs, EmptyDataDecls, PatternGuards, TypeFamilies, MultiParamTypeClasses #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Dataflow ( DataflowLattice(..), JoinFun, OldFact(..), NewFact(..), Fact, mkFactBase@@ -590,7 +593,7 @@ | otherwise = do { (rg, out_facts) <- do_block blk fbase ; let (cha', fbase') = mapFoldWithKey- (updateFact lat lbls) + (updateFact lat lbls') (cha,fbase) out_facts ; return $ TxFB { tfb_lbls = lbls'
src/Compiler/Hoopl/Debug.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE RankNTypes, GADTs, ScopedTypeVariables, FlexibleContexts #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Debug ( TraceFn , debugFwdJoins , debugBwdJoins
src/Compiler/Hoopl/Fuel.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif ----------------------------------------------------------------------------- -- The fuel monad@@ -29,8 +32,10 @@ class FuelMonadT fm where runWithFuel :: (Monad m, FuelMonad (fm m)) => Fuel -> fm m a -> m a+ liftFuel :: (Monad m, FuelMonad (fm m)) => m a -> fm m a + type Fuel = Int withFuel :: FuelMonad m => Maybe a -> m (Maybe a)@@ -64,6 +69,7 @@ instance FuelMonadT CheckingFuelMonad where runWithFuel fuel m = do { (a, _) <- unFM m fuel; return a }+ liftFuel m = FM $ \f -> do { a <- m; return (a, f) } ---------------------------------------------------------------- @@ -88,6 +94,7 @@ instance FuelMonadT InfiniteFuelMonad where runWithFuel _ = unIFM+ liftFuel = IFM infiniteFuel :: Fuel -- effectively infinite, any, but subtractable infiniteFuel = maxBound
src/Compiler/Hoopl/GHC.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE GADTs, RankNTypes #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif {- Exposing some internals to GHC -} module Compiler.Hoopl.GHC
src/Compiler/Hoopl/Graph.hs view
@@ -1,10 +1,14 @@-{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies #-}+{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies, Rank2Types #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Graph ( O, C, Block(..), Body, Body'(..), Graph, Graph'(..) , MaybeO(..), MaybeC(..), Shape(..), IndexedCO , NonLocal(entryLabel, successors) , emptyBody, addBlock, bodyList+ , mapGraph, mapMaybeO, mapMaybeC, mapBlock ) where @@ -53,7 +57,7 @@ -- A graph open at the entry has a single, distinguished, anonymous entry point; -- if a graph is closed at the entry, its entry point(s) are supplied by a context. type Graph = Graph' Block-data Graph' block n e x where+data Graph' block (n :: * -> * -> *) e x where GNil :: Graph' block n O O GUnit :: block n O O -> Graph' block n O O GMany :: MaybeO e (block n O C) @@ -117,3 +121,29 @@ bodyList :: NonLocal (block n) => Body' block n -> [(Label,block n C C)] bodyList (Body body) = mapToList body++-- | Maps over all nodes in a graph.+mapGraph :: (forall e x. n e x -> n' e x) -> Graph n e x -> Graph n' e x+mapGraph _ GNil = GNil+mapGraph f (GUnit b) = GUnit (mapBlock f b)+mapGraph f (GMany x y z)+ = GMany (mapMaybeO f x)+ (mapMap (mapBlock f) y)+ (mapMaybeO f z)++mapMaybeO :: (forall e x. n e x -> n' e x) -> MaybeO ex (Block n e x) -> MaybeO ex (Block n' e x)+mapMaybeO _ NothingO = NothingO+mapMaybeO f (JustO b) = JustO (mapBlock f b)++mapMaybeC :: (forall e x. n e x -> n' e x) -> MaybeC ex (Block n e x) -> MaybeC ex (Block n' e x)+mapMaybeC _ NothingC = NothingC+mapMaybeC f (JustC b) = JustC (mapBlock f b)++mapBlock :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x+mapBlock f (BFirst n) = BFirst (f n)+mapBlock f (BMiddle n) = BMiddle (f n)+mapBlock f (BLast n) = BLast (f n)+mapBlock f (BCat b1 b2) = BCat (mapBlock f b1) (mapBlock f b2)+mapBlock f (BHead b n) = BHead (mapBlock f b) (f n)+mapBlock f (BTail n b) = BTail (f n) (mapBlock f b)+mapBlock f (BClosed b1 b2) = BClosed (mapBlock f b1) (mapBlock f b2)
src/Compiler/Hoopl/GraphUtil.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif -- N.B. addBasicBlocks won't work on OO without a Node (branch/label) constraint
src/Compiler/Hoopl/Label.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif+ module Compiler.Hoopl.Label ( Label , freshLabel
src/Compiler/Hoopl/MkGraph.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE ScopedTypeVariables, GADTs, TypeSynonymInstances, FlexibleInstances, RankNTypes #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif+ module Compiler.Hoopl.MkGraph ( AGraph, graphOfAGraph, aGraphOfGraph , (<*>), (|*><*|), catGraphs, addEntrySeq, addExitSeq, addBlocks, unionBlocks
src/Compiler/Hoopl/Passes/DList.hs view
@@ -1,5 +1,8 @@ {-# LANGUAGE GADTs #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Passes.DList ( Doms, domEntry, domLattice
src/Compiler/Hoopl/Passes/Dominator.hs view
@@ -1,5 +1,8 @@ {-# LANGUAGE GADTs #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Passes.Dominator ( Doms, DPath(..), domPath, domEntry, domLattice, extendDom
src/Compiler/Hoopl/Pointed.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE GADTs, ScopedTypeVariables #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif -- | Possibly doubly pointed lattices
src/Compiler/Hoopl/Shape.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE GADTs, EmptyDataDecls #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Shape {-# DEPRECATED "not ready to migrate to this yet" #-} where
src/Compiler/Hoopl/Show.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE RankNTypes, GADTs, ScopedTypeVariables, FlexibleContexts #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Show ( showGraph, showFactBase
src/Compiler/Hoopl/Unique.hs view
@@ -1,4 +1,8 @@ {-# LANGUAGE TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif+ module Compiler.Hoopl.Unique ( Unique, intToUnique , UniqueSet, UniqueMap
src/Compiler/Hoopl/Util.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE GADTs, ScopedTypeVariables, FlexibleInstances, RankNTypes, TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Compiler.Hoopl.Util ( gUnitOO, gUnitOC, gUnitCO, gUnitCC
src/Compiler/Hoopl/Wrappers.hs view
@@ -1,3 +1,7 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif+ module Compiler.Hoopl.Wrappers {-# DEPRECATED "Use only if you know what you are doing and can preserve the 'respects fuel' invariant" #-} ( wrapFR, wrapFR2, wrapBR, wrapBR2 )
src/Compiler/Hoopl/XUtil.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables, TypeFamilies #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Trustworthy #-}+#endif -- | Utilities for clients of Hoopl, not used internally.