hoopl 3.10.2.1 → 3.10.2.2
raw patch · 9 files changed
+78/−88 lines, 9 filesdep ~basedep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, containers
API changes (from Hackage documentation)
- Compiler.Hoopl: BCat :: Block n O O -> Block n O O -> Block n O O
- Compiler.Hoopl: BCons :: n O O -> Block n O O -> Block n O O
- Compiler.Hoopl: BMiddle :: n O O -> Block n O O
- Compiler.Hoopl: BNil :: Block n O O
- Compiler.Hoopl: BSnoc :: Block n O O -> n O O -> Block n O O
- Compiler.Hoopl: BlockCC :: n C O -> Block n O O -> n O C -> Block n C C
- Compiler.Hoopl: BlockCO :: n C O -> Block n O O -> Block n C O
- Compiler.Hoopl: BlockOC :: Block n O O -> n O C -> Block n O C
- Compiler.Hoopl: Bot :: Pointed t C a
- Compiler.Hoopl: Closed :: Shape C
- Compiler.Hoopl: GMany :: MaybeO e (block n O C) -> Body' block n -> MaybeO x (block n C O) -> Graph' block n e x
- Compiler.Hoopl: GNil :: Graph' block n O O
- Compiler.Hoopl: GUnit :: block n O O -> Graph' block n O O
- Compiler.Hoopl: JustC :: t -> MaybeC C t
- Compiler.Hoopl: JustO :: t -> MaybeO O t
- Compiler.Hoopl: NothingC :: MaybeC O t
- Compiler.Hoopl: NothingO :: MaybeO C t
- Compiler.Hoopl: Open :: Shape O
- Compiler.Hoopl: PElem :: a -> Pointed t b a
- Compiler.Hoopl: Top :: Pointed C b a
- Compiler.Hoopl: bp_lattice :: BwdPass m n f -> DataflowLattice f
- Compiler.Hoopl: bp_rewrite :: BwdPass m n f -> BwdRewrite m n f
- Compiler.Hoopl: bp_transfer :: BwdPass m n f -> BwdTransfer n f
- Compiler.Hoopl: fact_bot :: DataflowLattice a -> a
- Compiler.Hoopl: fact_join :: DataflowLattice a -> JoinFun a
- Compiler.Hoopl: fact_name :: DataflowLattice a -> String
- Compiler.Hoopl: fp_lattice :: FwdPass m n f -> DataflowLattice f
- Compiler.Hoopl: fp_rewrite :: FwdPass m n f -> FwdRewrite m n f
- Compiler.Hoopl: fp_transfer :: FwdPass m n f -> FwdTransfer n f
- Compiler.Hoopl: getBRewrite3 :: BwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, BwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, BwdRewrite m n f)), n O C -> FactBase f -> m (Maybe (Graph n O C, BwdRewrite m n f)))
- Compiler.Hoopl: getBTransfer3 :: BwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> FactBase f -> f)
- Compiler.Hoopl: getFRewrite3 :: FwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, FwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, FwdRewrite m n f)), n O C -> f -> m (Maybe (Graph n O C, FwdRewrite m n f)))
- Compiler.Hoopl: getFTransfer3 :: FwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> f -> FactBase f)
- Compiler.Hoopl.Internals: BCat :: Block n O O -> Block n O O -> Block n O O
- Compiler.Hoopl.Internals: BCons :: n O O -> Block n O O -> Block n O O
- Compiler.Hoopl.Internals: BMiddle :: n O O -> Block n O O
- Compiler.Hoopl.Internals: BNil :: Block n O O
- Compiler.Hoopl.Internals: BSnoc :: Block n O O -> n O O -> Block n O O
- Compiler.Hoopl.Internals: BlockCC :: n C O -> Block n O O -> n O C -> Block n C C
- Compiler.Hoopl.Internals: BlockCO :: n C O -> Block n O O -> Block n C O
- Compiler.Hoopl.Internals: BlockOC :: Block n O O -> n O C -> Block n O C
- Compiler.Hoopl.Internals: Closed :: Shape C
- Compiler.Hoopl.Internals: GMany :: MaybeO e (block n O C) -> Body' block n -> MaybeO x (block n C O) -> Graph' block n e x
- Compiler.Hoopl.Internals: GNil :: Graph' block n O O
- Compiler.Hoopl.Internals: GUnit :: block n O O -> Graph' block n O O
- Compiler.Hoopl.Internals: JustC :: t -> MaybeC C t
- Compiler.Hoopl.Internals: JustO :: t -> MaybeO O t
- Compiler.Hoopl.Internals: NothingC :: MaybeC O t
- Compiler.Hoopl.Internals: NothingO :: MaybeO C t
- Compiler.Hoopl.Internals: Open :: Shape O
- Compiler.Hoopl.Internals: bp_lattice :: BwdPass m n f -> DataflowLattice f
- Compiler.Hoopl.Internals: bp_rewrite :: BwdPass m n f -> BwdRewrite m n f
- Compiler.Hoopl.Internals: bp_transfer :: BwdPass m n f -> BwdTransfer n f
- Compiler.Hoopl.Internals: fact_bot :: DataflowLattice a -> a
- Compiler.Hoopl.Internals: fact_join :: DataflowLattice a -> JoinFun a
- Compiler.Hoopl.Internals: fact_name :: DataflowLattice a -> String
- Compiler.Hoopl.Internals: fp_lattice :: FwdPass m n f -> DataflowLattice f
- Compiler.Hoopl.Internals: fp_rewrite :: FwdPass m n f -> FwdRewrite m n f
- Compiler.Hoopl.Internals: fp_transfer :: FwdPass m n f -> FwdTransfer n f
- Compiler.Hoopl.Internals: getBRewrite3 :: BwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, BwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, BwdRewrite m n f)), n O C -> FactBase f -> m (Maybe (Graph n O C, BwdRewrite m n f)))
- Compiler.Hoopl.Internals: getBTransfer3 :: BwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> FactBase f -> f)
- Compiler.Hoopl.Internals: getFRewrite3 :: FwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, FwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, FwdRewrite m n f)), n O C -> f -> m (Maybe (Graph n O C, FwdRewrite m n f)))
- Compiler.Hoopl.Internals: getFTransfer3 :: FwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> f -> FactBase f)
- 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: [BCat] :: Block n O O -> Block n O O -> Block n O O
+ Compiler.Hoopl: [BCons] :: n O O -> Block n O O -> Block n O O
+ Compiler.Hoopl: [BMiddle] :: n O O -> Block n O O
+ Compiler.Hoopl: [BNil] :: Block n O O
+ Compiler.Hoopl: [BSnoc] :: Block n O O -> n O O -> Block n O O
+ Compiler.Hoopl: [BlockCC] :: n C O -> Block n O O -> n O C -> Block n C C
+ Compiler.Hoopl: [BlockCO] :: n C O -> Block n O O -> Block n C O
+ Compiler.Hoopl: [BlockOC] :: Block n O O -> n O C -> Block n O C
+ Compiler.Hoopl: [Bot] :: Pointed t C a
+ Compiler.Hoopl: [Closed] :: Shape C
+ Compiler.Hoopl: [GMany] :: MaybeO e (block n O C) -> Body' block n -> MaybeO x (block n C O) -> Graph' block n e x
+ Compiler.Hoopl: [GNil] :: Graph' block n O O
+ Compiler.Hoopl: [GUnit] :: block n O O -> Graph' block n O O
+ Compiler.Hoopl: [JustC] :: t -> MaybeC C t
+ Compiler.Hoopl: [JustO] :: t -> MaybeO O t
+ Compiler.Hoopl: [NothingC] :: MaybeC O t
+ Compiler.Hoopl: [NothingO] :: MaybeO C t
+ Compiler.Hoopl: [Open] :: Shape O
+ Compiler.Hoopl: [PElem] :: a -> Pointed t b a
+ Compiler.Hoopl: [Top] :: Pointed C b a
+ Compiler.Hoopl: [bp_lattice] :: BwdPass m n f -> DataflowLattice f
+ Compiler.Hoopl: [bp_rewrite] :: BwdPass m n f -> BwdRewrite m n f
+ Compiler.Hoopl: [bp_transfer] :: BwdPass m n f -> BwdTransfer n f
+ Compiler.Hoopl: [fact_bot] :: DataflowLattice a -> a
+ Compiler.Hoopl: [fact_join] :: DataflowLattice a -> JoinFun a
+ Compiler.Hoopl: [fact_name] :: DataflowLattice a -> String
+ Compiler.Hoopl: [fp_lattice] :: FwdPass m n f -> DataflowLattice f
+ Compiler.Hoopl: [fp_rewrite] :: FwdPass m n f -> FwdRewrite m n f
+ Compiler.Hoopl: [fp_transfer] :: FwdPass m n f -> FwdTransfer n f
+ Compiler.Hoopl: [getBRewrite3] :: BwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, BwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, BwdRewrite m n f)), n O C -> FactBase f -> m (Maybe (Graph n O C, BwdRewrite m n f)))
+ Compiler.Hoopl: [getBTransfer3] :: BwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> FactBase f -> f)
+ Compiler.Hoopl: [getFRewrite3] :: FwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, FwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, FwdRewrite m n f)), n O C -> f -> m (Maybe (Graph n O C, FwdRewrite m n f)))
+ Compiler.Hoopl: [getFTransfer3] :: FwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> f -> FactBase f)
+ Compiler.Hoopl: infixl 2 |*><*|
+ Compiler.Hoopl: infixl 3 <*>
+ Compiler.Hoopl: type family Checkpoint m;
+ Compiler.Hoopl: }
+ Compiler.Hoopl.Internals: [BCat] :: Block n O O -> Block n O O -> Block n O O
+ Compiler.Hoopl.Internals: [BCons] :: n O O -> Block n O O -> Block n O O
+ Compiler.Hoopl.Internals: [BMiddle] :: n O O -> Block n O O
+ Compiler.Hoopl.Internals: [BNil] :: Block n O O
+ Compiler.Hoopl.Internals: [BSnoc] :: Block n O O -> n O O -> Block n O O
+ Compiler.Hoopl.Internals: [BlockCC] :: n C O -> Block n O O -> n O C -> Block n C C
+ Compiler.Hoopl.Internals: [BlockCO] :: n C O -> Block n O O -> Block n C O
+ Compiler.Hoopl.Internals: [BlockOC] :: Block n O O -> n O C -> Block n O C
+ Compiler.Hoopl.Internals: [Closed] :: Shape C
+ Compiler.Hoopl.Internals: [GMany] :: MaybeO e (block n O C) -> Body' block n -> MaybeO x (block n C O) -> Graph' block n e x
+ Compiler.Hoopl.Internals: [GNil] :: Graph' block n O O
+ Compiler.Hoopl.Internals: [GUnit] :: block n O O -> Graph' block n O O
+ Compiler.Hoopl.Internals: [JustC] :: t -> MaybeC C t
+ Compiler.Hoopl.Internals: [JustO] :: t -> MaybeO O t
+ Compiler.Hoopl.Internals: [NothingC] :: MaybeC O t
+ Compiler.Hoopl.Internals: [NothingO] :: MaybeO C t
+ Compiler.Hoopl.Internals: [Open] :: Shape O
+ Compiler.Hoopl.Internals: [bp_lattice] :: BwdPass m n f -> DataflowLattice f
+ Compiler.Hoopl.Internals: [bp_rewrite] :: BwdPass m n f -> BwdRewrite m n f
+ Compiler.Hoopl.Internals: [bp_transfer] :: BwdPass m n f -> BwdTransfer n f
+ Compiler.Hoopl.Internals: [fact_bot] :: DataflowLattice a -> a
+ Compiler.Hoopl.Internals: [fact_join] :: DataflowLattice a -> JoinFun a
+ Compiler.Hoopl.Internals: [fact_name] :: DataflowLattice a -> String
+ Compiler.Hoopl.Internals: [fp_lattice] :: FwdPass m n f -> DataflowLattice f
+ Compiler.Hoopl.Internals: [fp_rewrite] :: FwdPass m n f -> FwdRewrite m n f
+ Compiler.Hoopl.Internals: [fp_transfer] :: FwdPass m n f -> FwdTransfer n f
+ Compiler.Hoopl.Internals: [getBRewrite3] :: BwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, BwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, BwdRewrite m n f)), n O C -> FactBase f -> m (Maybe (Graph n O C, BwdRewrite m n f)))
+ Compiler.Hoopl.Internals: [getBTransfer3] :: BwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> FactBase f -> f)
+ Compiler.Hoopl.Internals: [getFRewrite3] :: FwdRewrite m n f -> (n C O -> f -> m (Maybe (Graph n C O, FwdRewrite m n f)), n O O -> f -> m (Maybe (Graph n O O, FwdRewrite m n f)), n O C -> f -> m (Maybe (Graph n O C, FwdRewrite m n f)))
+ Compiler.Hoopl.Internals: [getFTransfer3] :: FwdTransfer n f -> (n C O -> f -> f, n O O -> f -> f, n O C -> f -> FactBase f)
+ Compiler.Hoopl.Passes.Dominator: instance GHC.Show.Show Compiler.Hoopl.Passes.Dominator.DPath
+ Compiler.Hoopl.Passes.Dominator: instance GHC.Show.Show Compiler.Hoopl.Passes.Dominator.DominatorNode
+ Compiler.Hoopl.Passes.Dominator: instance GHC.Show.Show Compiler.Hoopl.Passes.Dominator.DominatorTree
- Compiler.Hoopl: addPoints' :: String -> (Label -> OldFact a -> NewFact a -> (ChangeFlag, Pointed t C a)) -> DataflowLattice (Pointed t C a)
+ Compiler.Hoopl: addPoints' :: forall a t. String -> (Label -> OldFact a -> NewFact a -> (ChangeFlag, Pointed t C a)) -> DataflowLattice (Pointed t C a)
- Compiler.Hoopl: addTop' :: String -> a -> (Label -> OldFact a -> NewFact a -> (ChangeFlag, WithTop a)) -> DataflowLattice (WithTop a)
+ Compiler.Hoopl: addTop' :: forall a. String -> a -> (Label -> OldFact a -> NewFact a -> (ChangeFlag, WithTop a)) -> DataflowLattice (WithTop a)
- Compiler.Hoopl: analyzeAndRewriteBwdBody :: (CheckpointMonad m, NonLocal n, LabelsPtr entries) => BwdPass m n f -> entries -> Body n -> FactBase f -> m (Body n, FactBase f)
+ Compiler.Hoopl: analyzeAndRewriteBwdBody :: forall m n f entries. (CheckpointMonad m, NonLocal n, LabelsPtr entries) => BwdPass m n f -> entries -> Body n -> FactBase f -> m (Body n, FactBase f)
- Compiler.Hoopl: analyzeAndRewriteBwdOx :: (CheckpointMonad m, NonLocal n) => BwdPass m n f -> Graph n O x -> Fact x f -> m (Graph n O x, FactBase f, f)
+ Compiler.Hoopl: analyzeAndRewriteBwdOx :: forall m n f x. (CheckpointMonad m, NonLocal n) => BwdPass m n f -> Graph n O x -> Fact x f -> m (Graph n O x, FactBase f, f)
- Compiler.Hoopl: analyzeAndRewriteFwd :: (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> MaybeC e entries -> Graph n e x -> Fact e f -> m (Graph n e x, FactBase f, MaybeO x f)
+ Compiler.Hoopl: analyzeAndRewriteFwd :: forall m n f e x entries. (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> MaybeC e entries -> Graph n e x -> Fact e f -> m (Graph n e x, FactBase f, MaybeO x f)
- Compiler.Hoopl: analyzeAndRewriteFwdBody :: (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> entries -> Body n -> FactBase f -> m (Body n, FactBase f)
+ Compiler.Hoopl: analyzeAndRewriteFwdBody :: forall m n f entries. (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> entries -> Body n -> FactBase f -> m (Body n, FactBase f)
- Compiler.Hoopl: analyzeAndRewriteFwdOx :: (CheckpointMonad m, NonLocal n) => FwdPass m n f -> Graph n O x -> f -> m (Graph n O x, FactBase f, MaybeO x f)
+ Compiler.Hoopl: analyzeAndRewriteFwdOx :: forall m n f x. (CheckpointMonad m, NonLocal n) => FwdPass m n f -> Graph n O x -> f -> m (Graph n O x, FactBase f, MaybeO x f)
- Compiler.Hoopl: bodyUnion :: LabelMap a -> LabelMap a -> LabelMap a
+ Compiler.Hoopl: bodyUnion :: forall a. LabelMap a -> LabelMap a -> LabelMap a
- Compiler.Hoopl: class Monad m => CheckpointMonad m where type family Checkpoint m
+ Compiler.Hoopl: class Monad m => CheckpointMonad m where type Checkpoint m where {
- Compiler.Hoopl: class IsMap map where type family KeyOf map
+ Compiler.Hoopl: class IsMap map where type KeyOf map where {
- Compiler.Hoopl: class IsSet set where type family ElemOf set
+ Compiler.Hoopl: class IsSet set where type ElemOf set where {
- Compiler.Hoopl: debugBwdJoins :: Show f => TraceFn -> ChangePred -> BwdPass m n f -> BwdPass m n f
+ Compiler.Hoopl: debugBwdJoins :: forall m n f. Show f => TraceFn -> ChangePred -> BwdPass m n f -> BwdPass m n f
- Compiler.Hoopl: debugBwdTransfers :: Show f => TraceFn -> ShowN n -> BPred n f -> BwdPass m n f -> BwdPass m n f
+ Compiler.Hoopl: debugBwdTransfers :: forall m n f. Show f => TraceFn -> ShowN n -> BPred n f -> BwdPass m n f -> BwdPass m n f
- Compiler.Hoopl: debugFwdJoins :: Show f => TraceFn -> ChangePred -> FwdPass m n f -> FwdPass m n f
+ Compiler.Hoopl: debugFwdJoins :: forall m n f. Show f => TraceFn -> ChangePred -> FwdPass m n f -> FwdPass m n f
- Compiler.Hoopl: debugFwdTransfers :: Show f => TraceFn -> ShowN n -> FPred n f -> FwdPass m n f -> FwdPass m n f
+ Compiler.Hoopl: debugFwdTransfers :: forall m n f. Show f => TraceFn -> ShowN n -> FPred n f -> FwdPass m n f -> FwdPass m n f
- Compiler.Hoopl: extendJoinDomain :: (Label -> OldFact a -> NewFact a -> (ChangeFlag, WithTop a)) -> JoinFun (WithTop a)
+ Compiler.Hoopl: extendJoinDomain :: forall a. (Label -> OldFact a -> NewFact a -> (ChangeFlag, WithTop a)) -> JoinFun (WithTop a)
- Compiler.Hoopl: externalEntryLabels :: NonLocal n => LabelMap (Block n C C) -> LabelSet
+ Compiler.Hoopl: externalEntryLabels :: forall n. NonLocal n => LabelMap (Block n C C) -> LabelSet
- Compiler.Hoopl: foldBlockNodesB :: (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO x a a -> IndexedCO e a a)
+ Compiler.Hoopl: foldBlockNodesB :: forall n a. (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO x a a -> IndexedCO e a a)
- Compiler.Hoopl: foldBlockNodesB3 :: (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> (forall e x. Block n e x -> IndexedCO x a b -> IndexedCO e c b)
+ Compiler.Hoopl: foldBlockNodesB3 :: forall n a b c. (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> (forall e x. Block n e x -> IndexedCO x a b -> IndexedCO e c b)
- Compiler.Hoopl: foldBlockNodesF :: (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO e a a -> IndexedCO x a a)
+ Compiler.Hoopl: foldBlockNodesF :: forall n a. (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO e a a -> IndexedCO x a a)
- Compiler.Hoopl: foldBlockNodesF3 :: (n C O -> a -> b, n O O -> b -> b, n O C -> b -> c) -> (forall e x. Block n e x -> IndexedCO e a b -> IndexedCO x c b)
+ Compiler.Hoopl: foldBlockNodesF3 :: forall n a b c. (n C O -> a -> b, n O O -> b -> b, n O C -> b -> c) -> (forall e x. Block n e x -> IndexedCO e a b -> IndexedCO x c b)
- Compiler.Hoopl: foldGraphNodes :: (forall e x. n e x -> a -> a) -> (forall e x. Graph n e x -> a -> a)
+ Compiler.Hoopl: foldGraphNodes :: forall n a. (forall e x. n e x -> a -> a) -> (forall e x. Graph n e x -> a -> a)
- Compiler.Hoopl: iterBwdRw :: Monad m => BwdRewrite m n f -> BwdRewrite m n f
+ Compiler.Hoopl: iterBwdRw :: forall m n f. Monad m => BwdRewrite m n f -> BwdRewrite m n f
- Compiler.Hoopl: iterFwdRw :: Monad m => FwdRewrite m n f -> FwdRewrite m n f
+ Compiler.Hoopl: iterFwdRw :: forall m n f. Monad m => FwdRewrite m n f -> FwdRewrite m n f
- Compiler.Hoopl: joinOutFacts :: NonLocal node => DataflowLattice f -> node O C -> FactBase f -> f
+ Compiler.Hoopl: joinOutFacts :: (NonLocal node) => DataflowLattice f -> node O C -> FactBase f -> f
- Compiler.Hoopl: labelsDefined :: NonLocal (block n) => Graph' block n e x -> LabelSet
+ Compiler.Hoopl: labelsDefined :: forall block n e x. NonLocal (block n) => Graph' block n e x -> LabelSet
- Compiler.Hoopl: labelsUsed :: NonLocal (block n) => Graph' block n e x -> LabelSet
+ Compiler.Hoopl: labelsUsed :: forall block n e x. NonLocal (block n) => Graph' block n e x -> LabelSet
- Compiler.Hoopl: mapBlock3' :: (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x
+ Compiler.Hoopl: mapBlock3' :: forall n n' e x. (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x
- Compiler.Hoopl: mapGraphBlocks :: (forall e x. block n e x -> block' n' e x) -> (Graph' block n e x -> Graph' block' n' e x)
+ Compiler.Hoopl: mapGraphBlocks :: forall block n block' n' e x. (forall e x. block n e x -> block' n' e x) -> (Graph' block n e x -> Graph' block' n' e x)
- Compiler.Hoopl: mkBRewrite3 :: FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> FactBase f -> m (Maybe (Graph n O C))) -> BwdRewrite m n f
+ Compiler.Hoopl: mkBRewrite3 :: forall m n f. FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> FactBase f -> m (Maybe (Graph n O C))) -> BwdRewrite m n f
- Compiler.Hoopl: mkFRewrite3 :: FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> f -> m (Maybe (Graph n O C))) -> FwdRewrite m n f
+ Compiler.Hoopl: mkFRewrite3 :: forall m n f. FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> f -> m (Maybe (Graph n O C))) -> FwdRewrite m n f
- Compiler.Hoopl: mkFactBase :: DataflowLattice f -> [(Label, f)] -> FactBase f
+ Compiler.Hoopl: mkFactBase :: forall f. DataflowLattice f -> [(Label, f)] -> FactBase f
- Compiler.Hoopl: pairBwd :: Monad m => BwdPass m n f -> BwdPass m n f' -> BwdPass m n (f, f')
+ Compiler.Hoopl: pairBwd :: forall m n f f'. Monad m => BwdPass m n f -> BwdPass m n f' -> BwdPass m n (f, f')
- Compiler.Hoopl: pairFwd :: Monad m => FwdPass m n f -> FwdPass m n f' -> FwdPass m n (f, f')
+ Compiler.Hoopl: pairFwd :: forall m n f f'. Monad m => FwdPass m n f -> FwdPass m n f' -> FwdPass m n (f, f')
- Compiler.Hoopl: pairLattice :: DataflowLattice f -> DataflowLattice f' -> DataflowLattice (f, f')
+ Compiler.Hoopl: pairLattice :: forall f f'. DataflowLattice f -> DataflowLattice f' -> DataflowLattice (f, f')
- Compiler.Hoopl: postorder_dfs_from_except :: (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
+ Compiler.Hoopl: postorder_dfs_from_except :: forall block e. (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
- Compiler.Hoopl: preorder_dfs_from_except :: (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
+ Compiler.Hoopl: preorder_dfs_from_except :: forall block e. (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
- Compiler.Hoopl: showGraph :: Showing n -> Graph n e x -> String
+ Compiler.Hoopl: showGraph :: forall n e x. Showing n -> Graph n e x -> String
- Compiler.Hoopl: splice :: NonLocal (block n) => (forall e x. block n e O -> block n O x -> block n e x) -> (Graph' block n e a -> Graph' block n a x -> Graph' block n e x)
+ Compiler.Hoopl: splice :: forall block n e a x. NonLocal (block n) => (forall e x. block n e O -> block n O x -> block n e x) -> (Graph' block n e a -> Graph' block n a x -> Graph' block n e x)
- Compiler.Hoopl: thenBwdRw :: Monad m => BwdRewrite m n f -> BwdRewrite m n f -> BwdRewrite m n f
+ Compiler.Hoopl: thenBwdRw :: forall m n f. Monad m => BwdRewrite m n f -> BwdRewrite m n f -> BwdRewrite m n f
- Compiler.Hoopl: thenFwdRw :: Monad m => FwdRewrite m n f -> FwdRewrite m n f -> FwdRewrite m n f
+ Compiler.Hoopl: thenFwdRw :: forall m n f. Monad m => FwdRewrite m n f -> FwdRewrite m n f -> FwdRewrite m n f
- Compiler.Hoopl.Internals: analyzeAndRewriteFwd :: (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> MaybeC e entries -> Graph n e x -> Fact e f -> m (Graph n e x, FactBase f, MaybeO x f)
+ Compiler.Hoopl.Internals: analyzeAndRewriteFwd :: forall m n f e x entries. (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> MaybeC e entries -> Graph n e x -> Fact e f -> m (Graph n e x, FactBase f, MaybeO x f)
- Compiler.Hoopl.Internals: bodyUnion :: LabelMap a -> LabelMap a -> LabelMap a
+ Compiler.Hoopl.Internals: bodyUnion :: forall a. LabelMap a -> LabelMap a -> LabelMap a
- Compiler.Hoopl.Internals: externalEntryLabels :: NonLocal n => LabelMap (Block n C C) -> LabelSet
+ Compiler.Hoopl.Internals: externalEntryLabels :: forall n. NonLocal n => LabelMap (Block n C C) -> LabelSet
- Compiler.Hoopl.Internals: foldBlockNodesB :: (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO x a a -> IndexedCO e a a)
+ Compiler.Hoopl.Internals: foldBlockNodesB :: forall n a. (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO x a a -> IndexedCO e a a)
- Compiler.Hoopl.Internals: foldBlockNodesB3 :: (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> (forall e x. Block n e x -> IndexedCO x a b -> IndexedCO e c b)
+ Compiler.Hoopl.Internals: foldBlockNodesB3 :: forall n a b c. (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> (forall e x. Block n e x -> IndexedCO x a b -> IndexedCO e c b)
- Compiler.Hoopl.Internals: foldBlockNodesF :: (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO e a a -> IndexedCO x a a)
+ Compiler.Hoopl.Internals: foldBlockNodesF :: forall n a. (forall e x. n e x -> a -> a) -> (forall e x. Block n e x -> IndexedCO e a a -> IndexedCO x a a)
- Compiler.Hoopl.Internals: foldBlockNodesF3 :: (n C O -> a -> b, n O O -> b -> b, n O C -> b -> c) -> (forall e x. Block n e x -> IndexedCO e a b -> IndexedCO x c b)
+ Compiler.Hoopl.Internals: foldBlockNodesF3 :: forall n a b c. (n C O -> a -> b, n O O -> b -> b, n O C -> b -> c) -> (forall e x. Block n e x -> IndexedCO e a b -> IndexedCO x c b)
- Compiler.Hoopl.Internals: foldGraphNodes :: (forall e x. n e x -> a -> a) -> (forall e x. Graph n e x -> a -> a)
+ Compiler.Hoopl.Internals: foldGraphNodes :: forall n a. (forall e x. n e x -> a -> a) -> (forall e x. Graph n e x -> a -> a)
- Compiler.Hoopl.Internals: labelsDefined :: NonLocal (block n) => Graph' block n e x -> LabelSet
+ Compiler.Hoopl.Internals: labelsDefined :: forall block n e x. NonLocal (block n) => Graph' block n e x -> LabelSet
- Compiler.Hoopl.Internals: labelsUsed :: NonLocal (block n) => Graph' block n e x -> LabelSet
+ Compiler.Hoopl.Internals: labelsUsed :: forall block n e x. NonLocal (block n) => Graph' block n e x -> LabelSet
- Compiler.Hoopl.Internals: mapBlock3' :: (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x
+ Compiler.Hoopl.Internals: mapBlock3' :: forall n n' e x. (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x
- Compiler.Hoopl.Internals: mapGraphBlocks :: (forall e x. block n e x -> block' n' e x) -> (Graph' block n e x -> Graph' block' n' e x)
+ Compiler.Hoopl.Internals: mapGraphBlocks :: forall block n block' n' e x. (forall e x. block n e x -> block' n' e x) -> (Graph' block n e x -> Graph' block' n' e x)
- Compiler.Hoopl.Internals: mkBRewrite3 :: FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> FactBase f -> m (Maybe (Graph n O C))) -> BwdRewrite m n f
+ Compiler.Hoopl.Internals: mkBRewrite3 :: forall m n f. FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> FactBase f -> m (Maybe (Graph n O C))) -> BwdRewrite m n f
- Compiler.Hoopl.Internals: mkFRewrite3 :: FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> f -> m (Maybe (Graph n O C))) -> FwdRewrite m n f
+ Compiler.Hoopl.Internals: mkFRewrite3 :: forall m n f. FuelMonad m => (n C O -> f -> m (Maybe (Graph n C O))) -> (n O O -> f -> m (Maybe (Graph n O O))) -> (n O C -> f -> m (Maybe (Graph n O C))) -> FwdRewrite m n f
- Compiler.Hoopl.Internals: mkFactBase :: DataflowLattice f -> [(Label, f)] -> FactBase f
+ Compiler.Hoopl.Internals: mkFactBase :: forall f. DataflowLattice f -> [(Label, f)] -> FactBase f
- Compiler.Hoopl.Internals: postorder_dfs_from_except :: (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
+ Compiler.Hoopl.Internals: postorder_dfs_from_except :: forall block e. (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
- Compiler.Hoopl.Internals: preorder_dfs_from_except :: (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
+ Compiler.Hoopl.Internals: preorder_dfs_from_except :: forall block e. (NonLocal block, LabelsPtr e) => LabelMap (block C C) -> e -> LabelSet -> [block C C]
- Compiler.Hoopl.Internals: splice :: NonLocal (block n) => (forall e x. block n e O -> block n O x -> block n e x) -> (Graph' block n e a -> Graph' block n a x -> Graph' block n e x)
+ Compiler.Hoopl.Internals: splice :: forall block n e a x. NonLocal (block n) => (forall e x. block n e O -> block n O x -> block n e x) -> (Graph' block n e a -> Graph' block n a x -> Graph' block n e x)
Files
- README.md +18/−8
- changelog.md +14/−0
- hoopl.cabal +8/−17
- hoopl.pdf binary
- src/Compiler/Hoopl/Combinators.hs +0/−6
- src/Compiler/Hoopl/Dataflow.hs +15/−42
- src/Compiler/Hoopl/Label.hs +7/−1
- src/Compiler/Hoopl/Passes/Dominator.hs +6/−10
- src/Compiler/Hoopl/Unique.hs +10/−4
README.md view
@@ -3,35 +3,45 @@ ## Hoopl: A Higher-Order OPtimization Library -API documentation can be found on [Hackage](https://hackage.haskell.org/package/hoopl).+API documentation can be found on+[Hackage](https://hackage.haskell.org/package/hoopl). For detailed explanation+of the library design see paper ["Hoopl: A Modular, Reusable Library for+Dataflow Analysis and+Transformation"](http://research.microsoft.com/en-us/um/people/simonpj/Papers/c--/hoopl-haskell10.pdf) | Directory | Contents | -------------- | ----------| `paper/` | A paper about Hoopl-| `prototypes/` | A sampling of prototypes and early designs | `src/` | The current official sources to the Cabal package | `testing/` | Tests, including a sample client. See [`testing/README`](testing/README) ### Development Notes -To build the library, change to the src directory and run+#### Building and testing - cabal configure --prefix=$HOME --user # we have no idea what this means+To build the library run:++ cabal configure cabal build cabal install --enable-documentation -To run the tests in the folder testing/, change to the src directory and run +To run the tests in the `testing/` folder run: cabal configure --enable-tests cabal test -To run the tests with the test coverage report, change to the src directory and run +To run the tests with the test coverage report run: - cabal configure --enable-tests -f testcoverage+ cabal configure --enable-tests --enable-coverage cabal test You'll need a Haskell Platform, which should include appropriate versions of Cabal and GHC.++#### Coding style++Please follow Johan Tibell's+[Haskell Style Guide](https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md)+for all new/modified code. ### Checklist for Making Releases
changelog.md view
@@ -1,5 +1,19 @@ # Changelog for [`hoopl` package](http://hackage.haskell.org/package/hoopl) +## 3.10.2.2 *Feb 2017*+ This release includes non-API changes.++ - Use cabal builtin options to enable test coverage++ - Move up the constraints of base and containers++ - Refactor the references of the fold family functions to their equivalant foldr functions.++ - Drop the support for 7.0.1++ - Fix a bug that drops out dominators when joined DPATHs have non-shared nodes in the middle.++ ## 3.10.2.1 *Dec 2015* This release includes only non-functional changes.
hoopl.cabal view
@@ -1,5 +1,5 @@ Name: hoopl-Version: 3.10.2.1+Version: 3.10.2.2 -- NOTE: Don't forget to update ./changelog.md Description: Higher-order optimization library@@ -10,25 +10,20 @@ License: BSD3 License-File: LICENSE Author: Norman Ramsey, Joao Dias, Simon Marlow and Simon Peyton Jones-Maintainer: nr@cs.tufts.edu, andreas.voellmy@gmail.com, email@ningwang.org-Homepage: http://ghc.cs.tufts.edu/hoopl/+Maintainer: Ning Wang <email@ningwang.org>, Michal Terepeta <michal.terepeta@gmail.com>, Norman Ramsey <nr@cs.tufts.edu>+Homepage: https://github.com/haskell/hoopl Bug-Reports: https://github.com/haskell/hoopl/issues/ Build-Type: Simple Cabal-Version: >=1.10 Synopsis: A library to support dataflow analysis and optimization Category: Compilers/Interpreters Tested-With: GHC>=7.0.1-Extra-Source-Files: README.md, hoopl.pdf, changelog.md+Extra-Source-Files: README.md, changelog.md Source-repository head Type: git Location: http://git.haskell.org/packages/hoopl.git -flag testcoverage - description: Enable test coverage report- default: False-- Library Default-Language: Haskell2010 Other-Extensions: CPP@@ -45,14 +40,13 @@ Other-Extensions: Safe Trustworthy Hs-Source-Dirs: src- Build-Depends: base >= 4.3 && < 4.10, containers >= 0.4 && < 0.6+ Build-Depends: base >= 4.3 && < 4.11,+ containers >= 0.5 && < 0.6 Exposed-Modules: Compiler.Hoopl, Compiler.Hoopl.Internals, Compiler.Hoopl.Wrappers, Compiler.Hoopl.Passes.Dominator, Compiler.Hoopl.Passes.DList--- Compiler.Hoopl.DataflowFold,--- Compiler.Hoopl.OldDataflow, -- The remaining modules are hidden *provisionally* Other-modules: Compiler.Hoopl.Checkpoint,@@ -78,14 +72,11 @@ Type: exitcode-stdio-1.0 Main-Is: Main.hs Hs-Source-Dirs: testing src- Build-Depends: base >= 4.3 && < 4.10, - containers >= 0.4 && < 0.6,+ Build-Depends: base >= 4.3 && < 4.10,+ containers >= 0.5 && < 0.6, filepath, mtl >= 2.1.3.1, parsec >= 3.1.7, test-framework < 0.9, test-framework-hunit < 0.4, mtl >= 2.1.3.1-- if flag(testcoverage) - Ghc-Options: -fhpc
− hoopl.pdf
binary file changed (279781 → absent bytes)
src/Compiler/Hoopl/Combinators.hs view
@@ -37,12 +37,10 @@ -- N.B. rw3, rw3', and rw3a are triples of functions. -- But rw and rw' are single functions.--- @ start comb1.tex thenFwdRw :: forall m n f. Monad m => FwdRewrite m n f -> FwdRewrite m n f -> FwdRewrite m n f--- @ end comb1.tex thenFwdRw rw3 rw3' = wrapFR2 thenrw rw3 rw3' where thenrw :: forall m1 e x t t1.@@ -56,11 +54,9 @@ where fwdRes Nothing = rw' n f fwdRes (Just gr) = return $ Just $ fadd_rw rw3' gr --- @ start iterf.tex iterFwdRw :: forall m n f. Monad m => FwdRewrite m n f -> FwdRewrite m n f--- @ end iterf.tex iterFwdRw rw3 = wrapFR iter rw3 where iter :: forall a m1 m2 e x t. (Monad m2, Monad m1) =>@@ -141,12 +137,10 @@ badd_rw rw2 (g, rw1) = (g, rw1 `thenBwdRw` rw2) --- @ start pairf.tex pairFwd :: forall m n f f'. Monad m => FwdPass m n f -> FwdPass m n f' -> FwdPass m n (f, f')--- @ end pairf.tex pairFwd pass1 pass2 = FwdPass lattice transfer rewrite where lattice = pairLattice (fp_lattice pass1) (fp_lattice pass2)
src/Compiler/Hoopl/Dataflow.hs view
@@ -212,27 +212,16 @@ type ARFX thing = forall e x . thing e x -> Fact e f -> m (DG f n e x, Fact x f) -} graph :: Graph n e x -> Fact e f -> m (DG f n e x, Fact x f)--- @ start block.tex -2- block :: forall e x . - Block n e x -> f -> m (DG f n e x, Fact x f)--- @ end block.tex--- @ start node.tex -4- node :: forall e x . (ShapeLifter e x) - => n e x -> f -> m (DG f n e x, Fact x f)--- @ end node.tex--- @ start bodyfun.tex- body :: [Label] -> LabelMap (Block n C C)- -> Fact C f -> m (DG f n C C, Fact C f)--- @ end bodyfun.tex- -- Outgoing factbase is restricted to Labels *not* in- -- in the Body; the facts for Labels *in*- -- the Body are in the 'DG f n C C'--- @ start cat.tex -2+ block :: forall e x . Block n e x -> f -> m (DG f n e x, Fact x f)+ node :: forall e x . (ShapeLifter e x) => n e x -> f -> m (DG f n e x, Fact x f)+ body :: [Label] -> LabelMap (Block n C C) -> Fact C f -> m (DG f n C C, Fact C f)+ -- Outgoing factbase is restricted to Labels *not* in+ -- in the Body; the facts for Labels *in*+ -- the Body are in the 'DG f n C C' cat :: forall e a x f1 f2 f3. (f1 -> m (DG f n e a, f2)) -> (f2 -> m (DG f n a x, f3)) -> (f1 -> m (DG f n e x, f3))--- @ end cat.tex graph GNil = \f -> return (dgnil, f) graph (GUnit blk) = block blk@@ -252,7 +241,6 @@ #endif -- Lift from nodes to blocks--- @ start block.tex -2 block BNil = \f -> return (dgnil, f) block (BlockCO l b) = node l `cat` block b block (BlockCC l b n) = node l `cat` block b `cat` node n@@ -260,11 +248,9 @@ block (BMiddle n) = node n block (BCat b1 b2) = block b1 `cat` block b2--- @ end block.tex block (BSnoc h n) = block h `cat` node n block (BCons n t) = node n `cat` block t --- @ start node.tex -4 node n f = do { grw <- frewrite rewrite n f ; case grw of@@ -275,16 +261,12 @@ f' = fwdEntryFact n f in arfGraph pass' (fwdEntryLabel n) g f' } --- @ end node.tex- -- | Compose fact transformers and concatenate the resulting -- rewritten graphs. {-# INLINE cat #-} --- @ start cat.tex -2 cat ft1 ft2 f = do { (g1,f1) <- ft1 f ; (g2,f2) <- ft2 f1 ; return (g1 `dgSplice` g2, f2) }--- @ end cat.tex arfx :: forall thing x . NonLocal thing => (thing C x -> f -> m (DG f n C x, Fact x f))@@ -294,10 +276,9 @@ -- joinInFacts adds debugging information - -- Outgoing factbase is restricted to Labels *not* in- -- in the Body; the facts for Labels *in*- -- the Body are in the 'DG f n C C'--- @ start bodyfun.tex+ -- Outgoing factbase is restricted to Labels *not* in+ -- in the Body; the facts for Labels *in*+ -- the Body are in the 'DG f n C C' body entries blockmap init_fbase = fixpoint Fwd lattice do_block entries blockmap init_fbase where@@ -305,9 +286,7 @@ -> m (DG f n C x, Fact x f) do_block b fb = block b entryFact where entryFact = getFact lattice (entryLabel b) fb--- @ end bodyfun.tex - -- Join all the incoming facts with bottom. -- We know the results _shouldn't change_, but the transfer -- functions might, for example, generate some debugging traces.@@ -484,9 +463,9 @@ ; return (rg, fb) } -- joinInFacts adds debugging information - -- Outgoing factbase is restricted to Labels *not* in- -- in the Body; the facts for Labels *in*- -- the Body are in the 'DG f n C C'+ -- Outgoing factbase is restricted to Labels *not* in+ -- in the Body; the facts for Labels *in*+ -- the Body are in the 'DG f n C C' body entries blockmap init_fbase = fixpoint Bwd lattice do_block (map entryLabel (backwardBlockList entries blockmap)) blockmap init_fbase where@@ -568,7 +547,6 @@ observeChangedFactBase :: m (Maybe (FactBase f)) -> Maybe (FactBase f) -} --- @ start fptype.tex data Direction = Fwd | Bwd fixpoint :: forall m n f. (CheckpointMonad m, NonLocal n) => Direction@@ -577,8 +555,7 @@ -> [Label] -> LabelMap (Block n C C) -> (Fact C f -> m (DG f n C C, Fact C f))--- @ end fptype.tex--- @ start fpimp.tex+ fixpoint direction lat do_block entries blockmap init_fbase = do -- trace ("fixpoint: " ++ show (case direction of Fwd -> True; Bwd -> False) ++ " " ++ show (mapKeys blockmap) ++ show entries ++ " " ++ show (mapKeys init_fbase)) $ return()@@ -705,11 +682,10 @@ -- TOTALLY internal to Hoopl; each block is decorated with a fact ----------------------------------------------------------------------------- --- @ start dg.tex type Graph = Graph' Block type DG f = Graph' (DBlock f) data DBlock f n e x = DBlock f (Block n e x) -- ^ block decorated with fact--- @ end dg.tex+ instance NonLocal n => NonLocal (DBlock f n) where entryLabel (DBlock _ b) = entryLabel b successors (DBlock _ b) = successors b@@ -762,15 +738,12 @@ -- Lowering back: -- - from fact-like things to facts -- Note that the latter two functions depend only on the entry shape.--- @ start node.tex class ShapeLifter e x where singletonDG :: f -> n e x -> DG f n e x fwdEntryFact :: NonLocal n => n e x -> f -> Fact e f fwdEntryLabel :: NonLocal n => n e x -> MaybeC e [Label] ftransfer :: FwdTransfer n f -> n e x -> f -> Fact x f- frewrite :: FwdRewrite m n f -> n e x- -> f -> m (Maybe (Graph n e x, FwdRewrite m n f))--- @ end node.tex+ frewrite :: FwdRewrite m n f -> n e x -> f -> m (Maybe (Graph n e x, FwdRewrite m n f)) bwdEntryFact :: NonLocal n => DataflowLattice f -> n e x -> Fact e f -> f btransfer :: BwdTransfer n f -> n e x -> Fact x f -> f brewrite :: BwdRewrite m n f -> n e x
src/Compiler/Hoopl/Label.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP, TypeFamilies #-}+{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} #if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Safe #-} #endif@@ -17,6 +18,10 @@ import Compiler.Hoopl.Collections import Compiler.Hoopl.Unique+#if !MIN_VERSION_base(4,8,0)+import Data.Traversable (Traversable)+import Data.Foldable (Foldable)+#endif ----------------------------------------------------------------------------- -- Label@@ -64,7 +69,8 @@ ----------------------------------------------------------------------------- -- LabelMap -newtype LabelMap v = LM (UniqueMap v) deriving (Eq, Ord, Show)+newtype LabelMap v = LM (UniqueMap v)+ deriving (Eq, Ord, Show, Functor, Foldable, Traversable) instance IsMap LabelMap where type KeyOf LabelMap = Label
src/Compiler/Hoopl/Passes/Dominator.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP, GADTs #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}-#if __GLASGOW_HASKELL__ >= 701+#if __GLASGOW_HASKELL__ >= 723 {-# LANGUAGE Safe #-} #endif @@ -13,6 +13,7 @@ where import Data.Maybe+import qualified Data.Set as Set import Compiler.Hoopl @@ -47,15 +48,10 @@ extend :: JoinFun DPath extend _ (OldFact (DPath l)) (NewFact (DPath l')) = (changeIf (l `lengthDiffers` j), DPath j)- where j = lcs l l'- lcs :: [Label] -> [Label] -> [Label] -- longest common suffix- lcs l l' | length l > length l' = lcs (drop (length l - length l') l) l'- | length l < length l' = lcs l' l- | otherwise = dropUnlike l l' l- dropUnlike [] [] maybe_like = maybe_like- dropUnlike (x:xs) (y:ys) maybe_like =- dropUnlike xs ys (if x == y then maybe_like else xs)- dropUnlike _ _ _ = error "this can't happen"+ where lx = filter (\elem -> Set.member elem common) l+ rx = filter (\elem -> Set.member elem common) l'+ common = Set.intersection (Set.fromList l) (Set.fromList l')+ j = [x | (x, y) <- zip lx rx, x == y] lengthDiffers [] [] = False lengthDiffers (_:xs) (_:ys) = lengthDiffers xs ys
src/Compiler/Hoopl/Unique.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP, TypeFamilies #-}+{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #elif __GLASGOW_HASKELL__ >= 701@@ -26,6 +27,10 @@ import Control.Applicative as AP import Control.Monad (ap,liftM)+#if !MIN_VERSION_base(4,8,0)+import Data.Traversable (Traversable)+import Data.Foldable (Foldable)+#endif ----------------------------------------------------------------------------- -- Unique@@ -61,7 +66,7 @@ setIntersection (US x) (US y) = US (S.intersection x y) setIsSubsetOf (US x) (US y) = S.isSubsetOf x y - setFold k z (US s) = S.fold k z s+ setFold k z (US s) = S.foldr k z s setElems (US s) = S.elems s setFromList ks = US (S.fromList ks)@@ -69,7 +74,8 @@ ----------------------------------------------------------------------------- -- UniqueMap -newtype UniqueMap v = UM (M.IntMap v) deriving (Eq, Ord, Show)+newtype UniqueMap v = UM (M.IntMap v)+ deriving (Eq, Ord, Show, Functor, Foldable, Traversable) instance IsMap UniqueMap where type KeyOf UniqueMap = Unique@@ -94,8 +100,8 @@ mapMap f (UM m) = UM (M.map f m) mapMapWithKey f (UM m) = UM (M.mapWithKey (f . intToUnique) m)- mapFold k z (UM m) = M.fold k z m- mapFoldWithKey k z (UM m) = M.foldWithKey (k . intToUnique) z m+ mapFold k z (UM m) = M.foldr k z m+ mapFoldWithKey k z (UM m) = M.foldrWithKey (k . intToUnique) z m mapFilter f (UM m) = UM (M.filter f m) mapElems (UM m) = M.elems m