{- BlockId module should probably go away completely, being superseded by Label -}moduleBlockId(BlockId,mkBlockId-- ToDo: BlockId should be abstract, but it isn't yet,BlockSet,BlockEnv,IsSet(..),setInsertList,setDeleteList,setUnions,IsMap(..),mapInsertList,mapDeleteList,mapUnions,emptyBlockSet,emptyBlockMap,blockLbl,infoTblLbl,retPtLbl)whereimportCLabelimportIdInfoimportNameimportOutputableimportUniqueimportCompiler.HooplasHooplhiding(Unique)importCompiler.Hoopl.Internals(uniqueToLbl,lblToUnique)------------------------------------------------------------------- Block Ids, their environments, and their sets{- Note [Unique BlockId]
~~~~~~~~~~~~~~~~~~~~~~~~
Although a 'BlockId' is a local label, for reasons of implementation,
'BlockId's must be unique within an entire compilation unit. The reason
is that each local label is mapped to an assembly-language label, and in
most assembly languages allow, a label is visible throughout the entire
compilation unit in which it appears.
-}typeBlockId=Hoopl.LabelinstanceUniquableBlockIdwheregetUniquelabel=getUnique(lblToUniquelabel)instanceOutputableBlockIdwherepprlabel=ppr(getUniquelabel)mkBlockId::Unique->BlockIdmkBlockIdunique=uniqueToLbl$intToUnique$getKeyuniqueretPtLbl::BlockId->CLabelretPtLbllabel=mkReturnPtLabel$getUniquelabelblockLbl::BlockId->CLabelblockLbllabel=mkEntryLabel(mkFCallName(getUniquelabel)"block")NoCafRefsinfoTblLbl::BlockId->CLabelinfoTblLbllabel=mkInfoTableLabel(mkFCallName(getUniquelabel)"block")NoCafRefs-- Block environments: Id blockstypeBlockEnva=Hoopl.LabelMapainstanceOutputablea=>Outputable(BlockEnva)whereppr=ppr.mapToListemptyBlockMap::BlockEnvaemptyBlockMap=mapEmpty-- Block setstypeBlockSet=Hoopl.LabelSetinstanceOutputableBlockSetwhereppr=ppr.setElemsemptyBlockSet::BlockSetemptyBlockSet=setEmpty