{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module BlockId
( BlockId, mkBlockId
, newBlockId
, blockLbl, infoTblLbl
) where
import GhcPrelude
import CLabel
import IdInfo
import Name
import Unique
import UniqSupply
import Hoopl.Label (Label, mkHooplLabel)
type BlockId = Label
mkBlockId :: Unique -> BlockId
mkBlockId :: Unique -> BlockId
mkBlockId unique :: Unique
unique = Int -> BlockId
mkHooplLabel (Int -> BlockId) -> Int -> BlockId
forall a b. (a -> b) -> a -> b
$ Unique -> Int
getKey Unique
unique
newBlockId :: MonadUnique m => m BlockId
newBlockId :: m BlockId
newBlockId = Unique -> BlockId
mkBlockId (Unique -> BlockId) -> m Unique -> m BlockId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Unique
forall (m :: * -> *). MonadUnique m => m Unique
getUniqueM
blockLbl :: BlockId -> CLabel
blockLbl :: BlockId -> CLabel
blockLbl label :: BlockId
label = Unique -> CLabel
mkLocalBlockLabel (BlockId -> Unique
forall a. Uniquable a => a -> Unique
getUnique BlockId
label)
infoTblLbl :: BlockId -> CLabel
infoTblLbl :: BlockId -> CLabel
infoTblLbl label :: BlockId
label
= Name -> CafInfo -> CLabel
mkBlockInfoTableLabel (Unique -> String -> Name
mkFCallName (BlockId -> Unique
forall a. Uniquable a => a -> Unique
getUnique BlockId
label) "block") CafInfo
NoCafRefs