%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-% $Id: CLabel.lhs,v 1.35 2000/05/18 13:55:36 sewardj Exp $
+% $Id: CLabel.lhs,v 1.36 2000/05/22 17:05:57 simonmar Exp $
%
\section[CLabel]{@CLabel@: Information to make C Labels}
mkSelectorInfoLabel,
mkSelectorEntryLabel,
+ mkForeignLabel,
+
mkCC_Label, mkCCS_Label,
needsCDecl, isAsmTemp, externallyVisibleCLabel,
| RtsLabel RtsLabelInfo
+ | ForeignLabel FAST_STRING Bool -- a 'C' (or otherwise foreign) label
+ -- Bool <=> is dynamic
+
| CC_Label CostCentre
| CCS_Label CostCentreStack
mkApInfoTableLabel upd off = RtsLabel (RtsApInfoTbl upd off)
mkApEntryLabel upd off = RtsLabel (RtsApEntry upd off)
+ -- Foreign labels
+
+mkForeignLabel :: FAST_STRING -> Bool -> CLabel
+mkForeignLabel str is_dynamic = ForeignLabel str is_dynamic
+
-- Cost centres etc.
mkCC_Label cc = CC_Label cc
needsCDecl (AsmTempLabel _) = False
needsCDecl (ModuleInitLabel _) = False
needsCDecl (RtsLabel _) = False
+needsCDecl (ForeignLabel _ _) = False
needsCDecl (CC_Label _) = False
needsCDecl (CCS_Label _) = False
\end{code}
externallyVisibleCLabel (ModuleInitLabel _)= True
externallyVisibleCLabel (RtsLabel RtsModuleRegd) = False --hack
externallyVisibleCLabel (RtsLabel _) = True
+externallyVisibleCLabel (ForeignLabel _ _) = True
externallyVisibleCLabel (IdLabel id _) = isExternallyVisibleName id
externallyVisibleCLabel (CC_Label _) = False -- not strictly true
externallyVisibleCLabel (CCS_Label _) = False -- not strictly true
IdLabel n k -> isDllName n
DataConLabel n k -> isDllName n
TyConLabel tc -> isDllName (getName tc)
+ ForeignLabel _ d -> d
_ -> False
\end{code}
pprCLbl (RtsLabel RtsModuleRegd)
= ptext SLIT("module_registered")
+pprCLbl (ForeignLabel str _)
+ = ptext str
+
pprCLbl (TyConLabel tc)
= hcat [ppr tc, pp_cSEP, ptext SLIT("closure_tbl")]
import Constants ( mIN_INTLIKE, uF_UPDATEE, bLOCK_SIZE )
import CLabel ( mkIntlikeClosureLabel, mkCharlikeClosureLabel,
mkTopClosureLabel, mkErrorIO_innardsLabel,
- mkMAP_FROZEN_infoLabel )
+ mkMAP_FROZEN_infoLabel, mkForeignLabel )
import Outputable
import Char ( ord, isAlphaNum )
-> StInd PtrRep (StIndex PtrRep (amodeToStix arg)
(StInt (toInteger uF_UPDATEE)))
litLitToStix nm
- = error ("\nlitLitToStix: can't handle `" ++ nm ++ "'\n"
- ++ "suggested workaround: use flag -fvia-C\n")
+ | all is_id nm = StCLbl (mkForeignLabel (_PK_ nm) False{-ToDo: dynamic-})
+ | otherwise = error ("\nlitLitToStix: can't handle `" ++ nm ++ "'\n"
+ ++ "suggested workaround: use flag -fvia-C\n")
+
+ where is_id c = isAlphaNum c || c == '_'
\end{code}
Sizes of the CharLike and IntLike closures that are arranged as arrays