X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCLabel.hs;h=d96d416dec49be7614ac6392074188c52e88531b;hp=b6150e29f83b0e9d69be28a75b2b936a70102205;hb=d50e93cf95b68bf858be82025b56c9977335ed76;hpb=015675fcda6dc9b92ff9f17a84162f544a217563 diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index b6150e2..d96d416 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,10 @@ module CLabel ( mkPicBaseLabel, mkDeadStripPreventer, + mkHpcTicksLabel, + mkHpcModuleNameLabel, + mkHpcModuleOffsetLabel, + infoLblToEntryLbl, entryLblToInfoLbl, needsCDecl, isAsmTemp, externallyVisibleCLabel, CLabelType(..), labelType, labelDynamic, @@ -103,16 +107,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 +209,10 @@ 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 + | HpcModuleOffsetLabel Module-- Per-module offset of the module for Hpc (dynamically generated) + deriving (Eq, Ord) data IdLabelInfo @@ -402,6 +410,12 @@ mkRtsApFastLabel str = RtsLabel (RtsApFast str) mkRtsSlowTickyCtrLabel :: String -> CLabel mkRtsSlowTickyCtrLabel pat = RtsLabel (RtsSlowTickyCtr pat) + -- Coverage + +mkHpcTicksLabel = HpcTicksLabel +mkHpcModuleNameLabel = HpcModuleNameLabel +mkHpcModuleOffsetLabel = HpcModuleOffsetLabel + -- Dynamic linking mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel @@ -473,6 +487,9 @@ needsCDecl (RtsLabel _) = False needsCDecl (ForeignLabel _ _ _) = False needsCDecl (CC_Label _) = True needsCDecl (CCS_Label _) = True +needsCDecl (HpcTicksLabel _) = True +needsCDecl (HpcModuleOffsetLabel _) = True +needsCDecl HpcModuleNameLabel = False -- Whether the label is an assembler temporary: @@ -501,6 +518,9 @@ externallyVisibleCLabel (DynIdLabel name _) = isExternalName name externallyVisibleCLabel (CC_Label _) = True externallyVisibleCLabel (CCS_Label _) = True externallyVisibleCLabel (DynamicLinkerLabel _ _) = False +externallyVisibleCLabel (HpcTicksLabel _) = True +externallyVisibleCLabel (HpcModuleOffsetLabel _) = True +externallyVisibleCLabel HpcModuleNameLabel = False -- ----------------------------------------------------------------------------- -- Finding the "type" of a CLabel @@ -761,6 +781,15 @@ 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 (HpcModuleOffsetLabel mod) + = ptext SLIT("_hpc_module_offset_") <> ppr mod <> ptext SLIT("_hpc") + +pprCLbl HpcModuleNameLabel + = ptext SLIT("_hpc_module_name_str") + ppIdFlavor :: IdLabelInfo -> SDoc ppIdFlavor x = pp_cSEP <> (case x of @@ -804,7 +833,14 @@ asmTempLabelPrefix = pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc -#if darwin_TARGET_OS +#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 @@ -818,6 +854,15 @@ 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 _ _ + = panic "pprDynamicLinkerAsmLabel" #elif linux_TARGET_OS pprDynamicLinkerAsmLabel CodeStub lbl = pprCLabel lbl <> text "@plt" @@ -832,4 +877,7 @@ pprDynamicLinkerAsmLabel SymbolPtr lbl = text "__imp_" <> pprCLabel lbl pprDynamicLinkerAsmLabel _ _ = panic "pprDynamicLinkerAsmLabel" +#else +pprDynamicLinkerAsmLabel _ _ + = panic "pprDynamicLinkerAsmLabel" #endif