Hoopl.Block

ghc-8.6.1: The GHC API

Safe Haskell | Safe
Language | Haskell2010

Hoopl.Block

Synopsis

- data C
- data O
- data MaybeO ex t where
  - JustO :: t -> MaybeO O t
  - NothingO :: MaybeO C t
- type family IndexedCO ex a b :: *
- data Block n e x where
  - BlockCO :: n C O -> Block n O O -> Block n C O
  - BlockCC :: n C O -> Block n O O -> n O C -> Block n C C
  - BlockOC :: Block n O O -> n O C -> Block n O C
  - BNil :: Block n O O
  - BMiddle :: n O O -> Block n O O
  - BCat :: Block n O O -> Block n O O -> Block n O O
  - BSnoc :: Block n O O -> n O O -> Block n O O
  - BCons :: n O O -> Block n O O -> Block n O O
- blockAppend :: Block n e O -> Block n O x -> Block n e x
- blockCons :: n O O -> Block n O x -> Block n O x
- blockFromList :: [n O O] -> Block n O O
- blockJoin :: n C O -> Block n O O -> n O C -> Block n C C
- blockJoinHead :: n C O -> Block n O x -> Block n C x
- blockJoinTail :: Block n e O -> n O C -> Block n e C
- blockSnoc :: Block n e O -> n O O -> Block n e O
- blockSplit :: Block n C C -> (n C O, Block n O O, n O C)
- blockSplitHead :: Block n C x -> (n C O, Block n O x)
- blockSplitTail :: Block n e C -> (Block n e O, n O C)
- blockToList :: Block n O O -> [n O O]
- emptyBlock :: Block n O O
- firstNode :: Block n C x -> n C O
- 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
- 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
- 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
- isEmptyBlock :: Block n e x -> Bool
- lastNode :: Block n x C -> n O C
- mapBlock :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x
- mapBlock' :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x
- 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
- replaceFirstNode :: Block n C x -> n C O -> Block n C x
- replaceLastNode :: Block n x C -> n O C -> Block n x C

# Documentation

data C Source #

Used at the type level to indicate a "closed" structure which supports control transfer only through the use of named labels---no "fallthrough" is permitted. The number of control-flow edges is unconstrained.

Instances

Outputable (Block CmmNode C C) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode C C -> SDoc Source # pprPrec :: Rational -> Block CmmNode C C -> SDoc Source #
Outputable (Block CmmNode C O) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode C O -> SDoc Source # pprPrec :: Rational -> Block CmmNode C O -> SDoc Source #
Outputable (Block CmmNode O C) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode O C -> SDoc Source # pprPrec :: Rational -> Block CmmNode O C -> SDoc Source #
type Fact C f # |
Instance details Defined in Hoopl.Dataflow type Fact C f = FactBase f
type IndexedCO C a _b # |
Instance details Defined in Hoopl.Block type IndexedCO C a _b = a

data O Source #

Used at the type level to indicate an "open" structure with a unique, unnamed control-flow edge flowing in or out. Fallthrough and concatenation are permitted at an open point.

Instances

Outputable (Block CmmNode C O) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode C O -> SDoc Source # pprPrec :: Rational -> Block CmmNode C O -> SDoc Source #
Outputable (Block CmmNode O C) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode O C -> SDoc Source # pprPrec :: Rational -> Block CmmNode O C -> SDoc Source #
Outputable (Block CmmNode O O) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode O O -> SDoc Source # pprPrec :: Rational -> Block CmmNode O O -> SDoc Source #
type Fact O f # |
Instance details Defined in Hoopl.Dataflow type Fact O f = f
type IndexedCO O _a b # |
Instance details Defined in Hoopl.Block type IndexedCO O _a b = b

data MaybeO ex t where Source #

Maybe type indexed by open/closed

Constructors

JustO :: t -> MaybeO O t |
NothingO :: MaybeO C t |

Instances

Functor (MaybeO ex) # |
Instance details Defined in Hoopl.Block Methods fmap :: (a -> b) -> MaybeO ex a -> MaybeO ex b Source # (<$) :: a -> MaybeO ex b -> MaybeO ex a Source #

type family IndexedCO ex a b :: * Source #

Either type indexed by closed/open using type families

Instances

type IndexedCO C a _b # |
Instance details Defined in Hoopl.Block type IndexedCO C a _b = a
type IndexedCO O _a b # |
Instance details Defined in Hoopl.Block type IndexedCO O _a b = b

data Block n e x where Source #

A sequence of nodes. May be any of four shapes (OO, OC, CO, CC). Open at the entry means single entry, mutatis mutandis for exit. A closedclosed block is a basic/ block and can't be extended further. Clients should avoid manipulating blocks and should stick to either nodes or graphs.

Constructors

BlockCO :: n C O -> Block n O O -> Block n C O |
BlockCC :: n C O -> Block n O O -> n O C -> Block n C C |
BlockOC :: Block n O O -> n O C -> Block n O C |
BNil :: Block n O O |
BMiddle :: n O O -> Block n O O |
BCat :: Block n O O -> Block n O O -> Block n O O |
BSnoc :: Block n O O -> n O O -> Block n O O |
BCons :: n O O -> Block n O O -> Block n O O |

Instances

NonLocal n => NonLocal (Block n) # |
Instance details Defined in Hoopl.Graph Methods entryLabel :: Block n C x -> Label Source # successors :: Block n e C -> [Label] Source #
Outputable (Block CmmNode C C) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode C C -> SDoc Source # pprPrec :: Rational -> Block CmmNode C C -> SDoc Source #
Outputable (Block CmmNode C O) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode C O -> SDoc Source # pprPrec :: Rational -> Block CmmNode C O -> SDoc Source #
Outputable (Block CmmNode O C) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode O C -> SDoc Source # pprPrec :: Rational -> Block CmmNode O C -> SDoc Source #
Outputable (Block CmmNode O O) # |
Instance details Defined in PprCmm Methods ppr :: Block CmmNode O O -> SDoc Source # pprPrec :: Rational -> Block CmmNode O O -> SDoc Source #
Outputable (Graph CmmNode e x) # |
Instance details Defined in PprCmm Methods ppr :: Graph CmmNode e x -> SDoc Source # pprPrec :: Rational -> Graph CmmNode e x -> SDoc Source #

blockAppend :: Block n e O -> Block n O x -> Block n e x Source #

blockCons :: n O O -> Block n O x -> Block n O x Source #

blockFromList :: [n O O] -> Block n O O Source #

blockJoin :: n C O -> Block n O O -> n O C -> Block n C C Source #

blockJoinHead :: n C O -> Block n O x -> Block n C x Source #

blockJoinTail :: Block n e O -> n O C -> Block n e C Source #

blockSnoc :: Block n e O -> n O O -> Block n e O Source #

blockSplit :: Block n C C -> (n C O, Block n O O, n O C) Source #

Split a closed block into its entry node, open middle block, and exit node.

blockSplitHead :: Block n C x -> (n C O, Block n O x) Source #

blockSplitTail :: Block n e C -> (Block n e O, n O C) Source #

blockToList :: Block n O O -> [n O O] Source #

emptyBlock :: Block n O O Source #

firstNode :: Block n C x -> n C O Source #

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 Source #

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 Source #

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 Source #

isEmptyBlock :: Block n e x -> Bool Source #

lastNode :: Block n x C -> n O C Source #

mapBlock :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x Source #

map a function over the nodes of a `Block`

mapBlock' :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x Source #

A strict `mapBlock`

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 Source #

map over a block, with different functions to apply to first nodes, middle nodes and last nodes respectively. The map is strict.

replaceFirstNode :: Block n C x -> n C O -> Block n C x Source #

replaceLastNode :: Block n x C -> n O C -> Block n x C Source #