givesUniquePredecessorTo :: LastNode l => LGraph m l -> BlockId -> Bool
givesUniquePredecessorTo g = \id -> elemBlockSet id singlePreds
- -- | accumulates a pair of sets: the set of all blocks containing a single
+ -- accumulates a pair of sets: the set of all blocks containing a single
-- predecessor, and the set of all blocks containing at least two predecessors
where (singlePreds, _) = fold_blocks add (emptyBlockSet, emptyBlockSet) g
add b (single, multi) = foldl add_pred (single, multi) (succs b)
)
import MachOp (MachHint(..), wordRep)
import ZipCfgCmmRep hiding (CmmGraph, CmmAGraph, CmmBlock, CmmZ, CmmTopZ)
- -- ^ to make this module more self-contained, these definitions are duplicated below
+ -- to make this module more self-contained, the above definitions are
+ -- duplicated below
import PprCmm()
import ClosureInfo
mkFinalCall :: CmmExpr -> CCallConv -> CmmActuals -> CmmAGraph
-- Never returns; like exit() or barf()
----------- Context manipulation ('return via')
+---------- Context manipulation ("return via")
mkAddToContext :: CmmExpr -> [CmmExpr] -> CmmAGraph
---------- Control transfer
lastTail (ZLast l) = l
lastTail (ZTail _ t) = lastTail t
-tailOfLast l = ZLast (LastOther l) -- ^ tedious to write in every client
+tailOfLast l = ZLast (LastOther l) -- tedious to write in every client
------------------ simple graph manipulations
-- more mathematically elegant (but results in more complicated code).
--
-- Here's an easy way to go wrong! Consider
+-- @
-- A -> [B,C]
-- B -> D
-- C -> D
+-- @
-- Then ordinary dfs would give [A,B,D,C] which has a back ref from C to D.
-- Better to geot [A,B,C,D]
type PassName = String
--- | zdfSolveFrom is an overloaded name that resolves to a pure
+-- | 'zdfSolveFrom' is an overloaded name that resolves to a pure
-- analysis with no rewriting. It has only two instances: forward and
-- backward. Since it needs no rewrites, the type parameters of the
-- class are transfer functions and the fixed point.
--
-- The intent of the rest of the type signature should be obvious.
-- If not, place a skype call to norman-ramsey or complain bitterly
--- to norman-ramsey@acm.org.
+-- to <norman-ramsey@acm.org>.
class DataflowSolverDirection transfers fixedpt where
zdfSolveFrom :: (DebugNodes m l, Outputable a)
- => BlockEnv a -- Initial facts (unbound == bottom)
+ => BlockEnv a -- ^ Initial facts (unbound == bottom)
-> PassName
- -> DataflowLattice a -- Lattice
- -> transfers m l a -- Dataflow transfer functions
- -> a -- Fact flowing in (at entry or exit)
- -> Graph m l -- Graph to be analyzed
- -> FuelMonad (fixedpt m l a ()) -- Answers
+ -> DataflowLattice a -- ^ Lattice
+ -> transfers m l a -- ^ Dataflow transfer functions
+ -> a -- ^ Fact flowing in (at entry or exit)
+ -> Graph m l -- ^ Graph to be analyzed
+ -> FuelMonad (fixedpt m l a ()) -- ^ Answers
-- There are exactly two instances: forward and backward
instance DataflowSolverDirection ForwardTransfers ForwardFixedPoint