{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module GHC.Cmm.BlockId
( BlockId, mkBlockId
, newBlockId
, blockLbl, infoTblLbl
) where
import GHC.Prelude
import GHC.Cmm.CLabel
import GHC.Data.FastString
import GHC.Types.Id.Info
import GHC.Types.Name
import GHC.Types.Unique
import GHC.Types.Unique.Supply
import GHC.Cmm.Dataflow.Label (Label, mkHooplLabel)
type BlockId = Label
mkBlockId :: Unique -> BlockId
mkBlockId :: Unique -> BlockId
mkBlockId Unique
unique = Int -> BlockId
mkHooplLabel forall a b. (a -> b) -> a -> b
$ Unique -> Int
getKey Unique
unique
newBlockId :: MonadUnique m => m BlockId
newBlockId :: forall (m :: * -> *). MonadUnique m => m BlockId
newBlockId = Unique -> BlockId
mkBlockId forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (m :: * -> *). MonadUnique m => m Unique
getUniqueM
blockLbl :: BlockId -> CLabel
blockLbl :: BlockId -> CLabel
blockLbl BlockId
label = Unique -> CLabel
mkLocalBlockLabel (forall a. Uniquable a => a -> Unique
getUnique BlockId
label)
infoTblLbl :: BlockId -> CLabel
infoTblLbl :: BlockId -> CLabel
infoTblLbl BlockId
label
= Name -> CafInfo -> CLabel
mkBlockInfoTableLabel (Unique -> FastString -> Name
mkFCallName (forall a. Uniquable a => a -> Unique
getUnique BlockId
label) (String -> FastString
fsLit String
"block")) CafInfo
NoCafRefs