X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FCLabel.hs;h=54abe2351b4044f38029d88d0009ef623bf6666c;hb=d5934bbb856aa0aa620c9b2e0fa51c90a1a5a048;hp=e42b92db5ad7bd7025b76032cac6f604355bd824;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index e42b92d..54abe23 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 -- ----------------------------------------------------------------------------- @@ -93,6 +93,9 @@ module CLabel ( mkPicBaseLabel, mkDeadStripPreventer, + mkHpcTicksLabel, + mkHpcModuleNameLabel, + infoLblToEntryLbl, entryLblToInfoLbl, needsCDecl, isAsmTemp, externallyVisibleCLabel, CLabelType(..), labelType, labelDynamic, @@ -103,16 +106,16 @@ module CLabel ( #include "HsVersions.h" -import Packages ( HomeModules ) -import StaticFlags ( opt_Static, opt_DoTickyProfiling ) -import Packages ( isHomeModule, isDllName ) -import DataCon ( ConTag ) -import Module ( moduleFS, Module ) -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 +208,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 @@ -293,20 +299,20 @@ mkLocalInfoTableLabel name = IdLabel name InfoTable mkLocalEntryLabel name = IdLabel name Entry mkLocalClosureTableLabel name = IdLabel name ClosureTable -mkClosureLabel hmods name - | isDllName hmods name = DynIdLabel name Closure +mkClosureLabel this_pkg name + | isDllName this_pkg name = DynIdLabel name Closure | otherwise = IdLabel name Closure -mkInfoTableLabel hmods name - | isDllName hmods name = DynIdLabel name InfoTable +mkInfoTableLabel this_pkg name + | isDllName this_pkg name = DynIdLabel name InfoTable | otherwise = IdLabel name InfoTable -mkEntryLabel hmods name - | isDllName hmods name = DynIdLabel name Entry +mkEntryLabel this_pkg name + | isDllName this_pkg name = DynIdLabel name Entry | otherwise = IdLabel name Entry -mkClosureTableLabel hmods name - | isDllName hmods name = DynIdLabel name ClosureTable +mkClosureTableLabel this_pkg name + | isDllName this_pkg name = DynIdLabel name ClosureTable | otherwise = IdLabel name ClosureTable mkLocalConInfoTableLabel con = IdLabel con ConInfoTable @@ -320,12 +326,12 @@ mkConInfoTableLabel name True = DynIdLabel name ConInfoTable mkStaticInfoTableLabel name False = IdLabel name StaticInfoTable mkStaticInfoTableLabel name True = DynIdLabel name StaticInfoTable -mkConEntryLabel hmods name - | isDllName hmods name = DynIdLabel name ConEntry +mkConEntryLabel this_pkg name + | isDllName this_pkg name = DynIdLabel name ConEntry | otherwise = IdLabel name ConEntry -mkStaticConEntryLabel hmods name - | isDllName hmods name = DynIdLabel name StaticConEntry +mkStaticConEntryLabel this_pkg name + | isDllName this_pkg name = DynIdLabel name StaticConEntry | otherwise = IdLabel name StaticConEntry @@ -337,13 +343,13 @@ mkDefaultLabel uniq = CaseLabel uniq CaseDefault mkStringLitLabel = StringLitLabel mkAsmTempLabel = AsmTempLabel -mkModuleInitLabel :: HomeModules -> Module -> String -> CLabel -mkModuleInitLabel hmods mod way - = ModuleInitLabel mod way $! (not (isHomeModule hmods mod)) +mkModuleInitLabel :: PackageId -> Module -> String -> CLabel +mkModuleInitLabel this_pkg mod way + = ModuleInitLabel mod way $! modulePackageId mod /= this_pkg -mkPlainModuleInitLabel :: HomeModules -> Module -> CLabel -mkPlainModuleInitLabel hmods mod - = PlainModuleInitLabel mod $! (not (isHomeModule hmods mod)) +mkPlainModuleInitLabel :: PackageId -> Module -> CLabel +mkPlainModuleInitLabel this_pkg mod + = PlainModuleInitLabel mod $! modulePackageId mod /= this_pkg -- Some fixed runtime system labels @@ -402,6 +408,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 +484,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: @@ -501,6 +514,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 @@ -761,6 +776,12 @@ pprCLbl (ModuleInitLabel mod way _) pprCLbl (PlainModuleInitLabel mod _) = ptext SLIT("__stginit_") <> ppr mod +pprCLbl (HpcTicksLabel mod) + = ptext SLIT("_tickboxes_") <> ppr mod <> ptext SLIT("_hpc") + +pprCLbl HpcModuleNameLabel + = ptext SLIT("_hpc_module_name_str") + ppIdFlavor :: IdLabelInfo -> SDoc ppIdFlavor x = pp_cSEP <> (case x of @@ -805,27 +826,34 @@ asmTempLabelPrefix = pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc #if darwin_TARGET_OS -pprDynamicLinkerAsmLabel SymbolPtr lbl - = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr" 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 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