)
where
+import BlockId (BlockId(..), emptyBlockEnv)
import ZipCfg
import Outputable
import Unique
import UniqFM
import UniqSupply
+import Util
import Prelude hiding (zip, unzip, last)
-- splicing operation <*>, are constant-time operations.
emptyAGraph :: AGraph m l
-mkLabel :: LastNode l =>
+mkLabel :: (LastNode l) =>
BlockId -> AGraph m l -- graph contains the label
-mkMiddle :: m -> AGraph m l -- graph contains the node
+mkMiddle :: m -> AGraph m l -- graph contains the node
mkLast :: (Outputable m, Outputable l, LastNode l) =>
l -> AGraph m l -- graph contains the node
-- below for convenience
-mkMiddles :: [m] -> AGraph m l
-mkZTail :: (Outputable m, Outputable l, LastNode l) => ZTail m l -> AGraph m l
-mkBranch :: (Outputable m, Outputable l, LastNode l) => BlockId -> AGraph m l
+mkMiddles :: [m] -> AGraph m l
+mkZTail :: (Outputable m, Outputable l, LastNode l) =>
+ ZTail m l -> AGraph m l
+mkBranch :: (Outputable m, Outputable l, LastNode l) =>
+ BlockId -> AGraph m l
-- | For the structured control-flow constructs, a condition is
-- represented as a function that takes as arguments the labels to
-- in the number of basic blocks. The conversion is also monadic
-- because it may require the allocation of fresh, unique labels.
-graphOfAGraph :: AGraph m l -> UniqSM (Graph m l)
-lgraphOfAGraph :: AGraph m l -> UniqSM (LGraph m l)
+graphOfAGraph :: AGraph m l -> UniqSM (Graph m l)
+lgraphOfAGraph :: AGraph m l -> UniqSM (LGraph m l)
-- ^ allocate a fresh label for the entry point
labelAGraph :: BlockId -> AGraph m l -> UniqSM (LGraph m l)
-- ^ use the given BlockId as the label of the entry point
f' g
withUnique ofU = AGraph f
- where f g = do u <- getUniqueUs
+ where f g = do u <- getUniqueM
let AGraph f' = ofU u
f' g
-- a string.
freshBlockId :: String -> UniqSM BlockId
-freshBlockId _ = do { u <- getUniqueUs; return $ BlockId u }
+freshBlockId _ = do { u <- getUniqueM; return $ BlockId u }
-_unused :: FS.FastString
-_unused = undefined