X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCLabel.hs;h=f5d325b9f1d12d59703e46b99a7ba15aba0d4ed7;hb=a7c788e5489ce00a02808c38dd19fffd0c896c5e;hp=aacac3e0ddf7c279a02f87bff64977cda530c0b9;hpb=61d2625ae2e6a4cdae2ffc92df828905e81c24cc;p=ghc-hetmet.git diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index aacac3e..f5d325b 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -2,7 +2,7 @@ -- -- Object-file symbols (called CLabel for histerical raisins). -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -48,7 +48,6 @@ module CLabel ( mkSplitMarkerLabel, mkDirty_MUT_VAR_Label, mkUpdInfoLabel, - mkSeqInfoLabel, mkIndStaticInfoLabel, mkMainCapabilityLabel, mkMAP_FROZEN_infoLabel, @@ -93,8 +92,11 @@ module CLabel ( mkPicBaseLabel, mkDeadStripPreventer, + mkHpcTicksLabel, + mkHpcModuleNameLabel, + infoLblToEntryLbl, entryLblToInfoLbl, - needsCDecl, isAsmTemp, externallyVisibleCLabel, + needsCDecl, isAsmTemp, maybeAsmTemp, externallyVisibleCLabel, CLabelType(..), labelType, labelDynamic, pprCLabel @@ -103,16 +105,16 @@ module CLabel ( #include "HsVersions.h" -import StaticFlags ( opt_Static, opt_DoTickyProfiling ) -import Packages ( isDllName ) -import DataCon ( ConTag ) -import PackageConfig ( PackageId ) -import Module ( Module, modulePackageId ) -import Name ( Name, isExternalName ) -import Unique ( pprUnique, Unique ) -import PrimOp ( PrimOp ) -import Config ( cLeadingUnderscore ) -import CostCentre ( CostCentre, CostCentreStack ) +import StaticFlags +import Packages +import DataCon +import PackageConfig +import Module +import Name +import Unique +import PrimOp +import Config +import CostCentre import Outputable import FastString @@ -205,6 +207,9 @@ data CLabel | DeadStripPreventer CLabel -- label before an info table to prevent excessive dead-stripping on darwin + | HpcTicksLabel Module -- Per-module table of tick locations + | HpcModuleNameLabel -- Per-module name of the module for Hpc + deriving (Eq, Ord) data IdLabelInfo @@ -350,7 +355,6 @@ mkPlainModuleInitLabel this_pkg mod mkSplitMarkerLabel = RtsLabel (RtsCode SLIT("__stg_split_marker")) mkDirty_MUT_VAR_Label = RtsLabel (RtsCode SLIT("dirty_MUT_VAR")) mkUpdInfoLabel = RtsLabel (RtsInfo SLIT("stg_upd_frame")) -mkSeqInfoLabel = RtsLabel (RtsInfo SLIT("stg_seq_frame")) mkIndStaticInfoLabel = RtsLabel (RtsInfo SLIT("stg_IND_STATIC")) mkMainCapabilityLabel = RtsLabel (RtsData SLIT("MainCapability")) mkMAP_FROZEN_infoLabel = RtsLabel (RtsInfo SLIT("stg_MUT_ARR_PTRS_FROZEN0")) @@ -402,6 +406,11 @@ mkRtsApFastLabel str = RtsLabel (RtsApFast str) mkRtsSlowTickyCtrLabel :: String -> CLabel mkRtsSlowTickyCtrLabel pat = RtsLabel (RtsSlowTickyCtr pat) + -- Coverage + +mkHpcTicksLabel = HpcTicksLabel +mkHpcModuleNameLabel = HpcModuleNameLabel + -- Dynamic linking mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel @@ -473,6 +482,8 @@ needsCDecl (RtsLabel _) = False needsCDecl (ForeignLabel _ _ _) = False needsCDecl (CC_Label _) = True needsCDecl (CCS_Label _) = True +needsCDecl (HpcTicksLabel _) = True +needsCDecl HpcModuleNameLabel = False -- Whether the label is an assembler temporary: @@ -480,6 +491,10 @@ isAsmTemp :: CLabel -> Bool -- is a local temporary for native code generati isAsmTemp (AsmTempLabel _) = True isAsmTemp _ = False +maybeAsmTemp :: CLabel -> Maybe Unique +maybeAsmTemp (AsmTempLabel uq) = Just uq +maybeAsmTemp _ = Nothing + -- ----------------------------------------------------------------------------- -- Is a CLabel visible outside this object file or not? @@ -501,6 +516,8 @@ externallyVisibleCLabel (DynIdLabel name _) = isExternalName name externallyVisibleCLabel (CC_Label _) = True externallyVisibleCLabel (CCS_Label _) = True externallyVisibleCLabel (DynamicLinkerLabel _ _) = False +externallyVisibleCLabel (HpcTicksLabel _) = True +externallyVisibleCLabel HpcModuleNameLabel = False -- ----------------------------------------------------------------------------- -- Finding the "type" of a CLabel @@ -544,6 +561,8 @@ idInfoLabelType info = ConInfoTable -> DataLabel StaticInfoTable -> DataLabel ClosureTable -> DataLabel +-- krc: aie! a ticky counter label is data + RednCounts -> DataLabel _ -> CodeLabel @@ -761,6 +780,12 @@ pprCLbl (ModuleInitLabel mod way _) pprCLbl (PlainModuleInitLabel mod _) = ptext SLIT("__stginit_") <> ppr mod +pprCLbl (HpcTicksLabel mod) + = ptext SLIT("_hpc_tickboxes_") <> ppr mod <> ptext SLIT("_hpc") + +pprCLbl HpcModuleNameLabel + = ptext SLIT("_hpc_module_name_str") + ppIdFlavor :: IdLabelInfo -> SDoc ppIdFlavor x = pp_cSEP <> (case x of @@ -804,28 +829,51 @@ asmTempLabelPrefix = pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc -#if darwin_TARGET_OS -pprDynamicLinkerAsmLabel SymbolPtr lbl - = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr" +#if x86_64_TARGET_ARCH && darwin_TARGET_OS +pprDynamicLinkerAsmLabel GotSymbolPtr lbl + = pprCLabel lbl <> text "@GOTPCREL" +pprDynamicLinkerAsmLabel GotSymbolOffset lbl + = pprCLabel lbl +pprDynamicLinkerAsmLabel _ _ + = panic "pprDynamicLinkerAsmLabel" +#elif darwin_TARGET_OS pprDynamicLinkerAsmLabel CodeStub lbl = char 'L' <> pprCLabel lbl <> text "$stub" +pprDynamicLinkerAsmLabel SymbolPtr lbl + = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr" +pprDynamicLinkerAsmLabel _ _ + = panic "pprDynamicLinkerAsmLabel" #elif powerpc_TARGET_ARCH && linux_TARGET_OS pprDynamicLinkerAsmLabel CodeStub lbl = pprCLabel lbl <> text "@plt" pprDynamicLinkerAsmLabel SymbolPtr lbl = text ".LC_" <> pprCLabel lbl +pprDynamicLinkerAsmLabel _ _ + = panic "pprDynamicLinkerAsmLabel" +#elif x86_64_TARGET_ARCH && linux_TARGET_OS +pprDynamicLinkerAsmLabel CodeStub lbl + = pprCLabel lbl <> text "@plt" +pprDynamicLinkerAsmLabel GotSymbolPtr lbl + = pprCLabel lbl <> text "@gotpcrel" +pprDynamicLinkerAsmLabel GotSymbolOffset lbl + = pprCLabel lbl +pprDynamicLinkerAsmLabel SymbolPtr lbl + = text ".LC_" <> pprCLabel lbl #elif linux_TARGET_OS pprDynamicLinkerAsmLabel CodeStub lbl = pprCLabel lbl <> text "@plt" +pprDynamicLinkerAsmLabel SymbolPtr lbl + = text ".LC_" <> pprCLabel lbl pprDynamicLinkerAsmLabel GotSymbolPtr lbl = pprCLabel lbl <> text "@got" pprDynamicLinkerAsmLabel GotSymbolOffset lbl = pprCLabel lbl <> text "@gotoff" -pprDynamicLinkerAsmLabel SymbolPtr lbl - = text ".LC_" <> pprCLabel lbl #elif mingw32_TARGET_OS pprDynamicLinkerAsmLabel SymbolPtr lbl = text "__imp_" <> pprCLabel lbl -#endif pprDynamicLinkerAsmLabel _ _ = panic "pprDynamicLinkerAsmLabel" +#else +pprDynamicLinkerAsmLabel _ _ + = panic "pprDynamicLinkerAsmLabel" +#endif