ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Cmm.CLabel

Contents

- Constructors
- Predicates
- Conversions
- Pretty-printing
- Others

Synopsis

- data CLabel
- newtype NeedExternDecl = NeedExternDecl Bool
- data ForeignLabelSource
  - = ForeignLabelInPackage UnitId
  - | ForeignLabelInExternalPackage
  - | ForeignLabelInThisPackage
- data DynamicLinkerLabelInfo
  - = CodeStub
  - | SymbolPtr
  - | GotSymbolPtr
  - | GotSymbolOffset
- data ConInfoTableLocation
  - = UsageSite Module Int
  - | DefinitionSite
- getConInfoTableLocation :: IdLabelInfo -> Maybe ConInfoTableLocation
- mkClosureLabel :: Name -> CafInfo -> CLabel
- mkSRTLabel :: Unique -> CLabel
- mkInfoTableLabel :: Name -> CafInfo -> CLabel
- mkEntryLabel :: Name -> CafInfo -> CLabel
- mkRednCountsLabel :: Name -> CLabel
- mkTagHitLabel :: Name -> Unique -> CLabel
- mkConInfoTableLabel :: Name -> ConInfoTableLocation -> CLabel
- mkApEntryLabel :: Platform -> Bool -> Int -> CLabel
- mkApInfoTableLabel :: Platform -> Bool -> Int -> CLabel
- mkClosureTableLabel :: Name -> CafInfo -> CLabel
- mkBytesLabel :: Name -> CLabel
- mkLocalBlockLabel :: Unique -> CLabel
- mkBlockInfoTableLabel :: Name -> CafInfo -> CLabel
- mkBitmapLabel :: Unique -> CLabel
- mkStringLitLabel :: Unique -> CLabel
- mkInitializerStubLabel :: Module -> FastString -> CLabel
- mkInitializerArrayLabel :: Module -> CLabel
- mkFinalizerStubLabel :: Module -> FastString -> CLabel
- mkFinalizerArrayLabel :: Module -> CLabel
- mkAsmTempLabel :: Uniquable a => a -> CLabel
- mkAsmTempDerivedLabel :: CLabel -> FastString -> CLabel
- mkAsmTempEndLabel :: CLabel -> CLabel
- mkAsmTempProcEndLabel :: CLabel -> CLabel
- mkAsmTempDieLabel :: CLabel -> CLabel
- mkDirty_MUT_VAR_Label :: CLabel
- mkMUT_VAR_CLEAN_infoLabel :: CLabel
- mkNonmovingWriteBarrierEnabledLabel :: CLabel
- mkOrigThunkInfoLabel :: CLabel
- mkUpdInfoLabel :: CLabel
- mkBHUpdInfoLabel :: CLabel
- mkIndStaticInfoLabel :: CLabel
- mkMainCapabilityLabel :: CLabel
- mkMAP_FROZEN_CLEAN_infoLabel :: CLabel
- mkMAP_FROZEN_DIRTY_infoLabel :: CLabel
- mkMAP_DIRTY_infoLabel :: CLabel
- mkSMAP_FROZEN_CLEAN_infoLabel :: CLabel
- mkSMAP_FROZEN_DIRTY_infoLabel :: CLabel
- mkSMAP_DIRTY_infoLabel :: CLabel
- mkBadAlignmentLabel :: CLabel
- mkOutOfBoundsAccessLabel :: CLabel
- mkMemcpyRangeOverlapLabel :: CLabel
- mkArrWords_infoLabel :: CLabel
- mkSRTInfoLabel :: Int -> CLabel
- mkTopTickyCtrLabel :: CLabel
- mkCAFBlackHoleInfoTableLabel :: CLabel
- mkRtsPrimOpLabel :: PrimOp -> CLabel
- mkRtsSlowFastTickyCtrLabel :: String -> CLabel
- mkRtsUnpackCStringLabel :: CLabel
- mkRtsUnpackCStringUtf8Label :: CLabel
- mkSelectorInfoLabel :: Platform -> Bool -> Int -> CLabel
- mkSelectorEntryLabel :: Platform -> Bool -> Int -> CLabel
- mkCmmInfoLabel :: UnitId -> FastString -> CLabel
- mkCmmEntryLabel :: UnitId -> FastString -> CLabel
- mkCmmRetInfoLabel :: UnitId -> FastString -> CLabel
- mkCmmRetLabel :: UnitId -> FastString -> CLabel
- mkCmmCodeLabel :: UnitId -> FastString -> CLabel
- mkCmmDataLabel :: UnitId -> NeedExternDecl -> FastString -> CLabel
- mkRtsCmmDataLabel :: FastString -> CLabel
- mkCmmClosureLabel :: UnitId -> FastString -> CLabel
- mkRtsApFastLabel :: FastString -> CLabel
- mkPrimCallLabel :: PrimCall -> CLabel
- mkForeignLabel :: FastString -> ForeignLabelSource -> FunctionOrData -> CLabel
- mkCCLabel :: CostCentre -> CLabel
- mkCCSLabel :: CostCentreStack -> CLabel
- mkIPELabel :: Module -> CLabel
- data InfoProvEnt = InfoProvEnt {
  - infoTablePtr :: !CLabel
  - infoProvEntClosureType :: !Int
  - infoTableType :: !String
  - infoProvModule :: !Module
  - infoTableProv :: !(Maybe (RealSrcSpan, LexicalFastString))
  }
- mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel
- mkPicBaseLabel :: CLabel
- mkDeadStripPreventer :: CLabel -> CLabel
- mkHpcTicksLabel :: Module -> CLabel
- hasCAF :: CLabel -> Bool
- needsCDecl :: CLabel -> Bool
- maybeLocalBlockLabel :: CLabel -> Maybe BlockId
- externallyVisibleCLabel :: CLabel -> Bool
- isLibcFun :: CLabel -> Bool
- isCFunctionLabel :: CLabel -> Bool
- isGcPtrLabel :: CLabel -> Bool
- labelDynamic :: Module -> Platform -> Bool -> CLabel -> Bool
- isLocalCLabel :: Module -> CLabel -> Bool
- mayRedirectTo :: CLabel -> CLabel -> Bool
- isInfoTableLabel :: CLabel -> Bool
- isCmmInfoTableLabel :: CLabel -> Bool
- isConInfoTableLabel :: CLabel -> Bool
- isIdLabel :: CLabel -> Bool
- isTickyLabel :: CLabel -> Bool
- hasHaskellName :: CLabel -> Maybe Name
- hasIdLabelInfo :: CLabel -> Maybe IdLabelInfo
- isBytesLabel :: CLabel -> Bool
- isForeignLabel :: CLabel -> Bool
- isSomeRODataLabel :: CLabel -> Bool
- isStaticClosureLabel :: CLabel -> Bool
- toClosureLbl :: Platform -> CLabel -> CLabel
- toSlowEntryLbl :: Platform -> CLabel -> CLabel
- toEntryLbl :: Platform -> CLabel -> CLabel
- toInfoLbl :: Platform -> CLabel -> CLabel
- toProcDelimiterLbl :: CLabel -> CLabel
- data LabelStyle
  - = CStyle
  - | AsmStyle
- pprDebugCLabel :: Platform -> CLabel -> SDoc
- pprCLabel :: IsLine doc => Platform -> CLabel -> doc
- pprAsmLabel :: IsLine doc => Platform -> CLabel -> doc
- ppInternalProcLabel :: IsLine doc => Module -> CLabel -> Maybe doc
- dynamicLinkerLabelInfo :: CLabel -> Maybe (DynamicLinkerLabelInfo, CLabel)
- data CStubLabel = CStubLabel {
  - csl_is_initializer :: Bool
  - csl_module :: Module
  - csl_name :: FastString
  }
- cStubLabel :: CLabel -> Maybe CStubLabel
- fromCStubLabel :: CStubLabel -> CLabel
- mapInternalNonDetUniques :: Applicative m => (Unique -> m Unique) -> CLabel -> m CLabel

# Documentation

data CLabel #

`CLabel` is an abstract type that supports the following operations:

- Pretty printing
- In a C file, does it need to be declared before use? (i.e. is it guaranteed to be already in scope in the places we need to refer to it?)
- If it needs to be declared, what type (code or data) should it be declared to have?
- Is it visible outside this object file or not?
- Is it "dynamic" (see details below)
- Eq and Ord, so that we can make sets of CLabels (currently only used in outputting C as far as I can tell, to avoid generating more than one declaration for any given label).
- Converting an info table label into an entry label.

CLabel usage is a bit messy in GHC as they are used in a number of different contexts:

- By the C-- AST to identify labels
- By the unregisterised C code generator ("PprC") for naming functions (hence the name `CLabel`)
- By the native and LLVM code generators to identify labels

For extra fun, each of these uses a slightly different subset of constructors (e.g. `AsmTempLabel` and `AsmTempDerivedLabel` are used only in the NCG and LLVM backends).

In general, we use `IdLabel` to represent Haskell things early in the pipeline. However, later optimization passes will often represent blocks they create with `LocalBlockLabel` where there is no obvious `Name` to hang off the label.

#### Instances

Instances details

Show CLabel # |
Instance details Defined in GHC.Cmm.CLabel Methods showsPrec :: Int -> CLabel -> ShowS # show :: CLabel -> String # showList :: [CLabel] -> ShowS #
Eq CLabel # |
Instance details Defined in GHC.Cmm.CLabel Methods (==) :: CLabel -> CLabel -> Bool # (/=) :: CLabel -> CLabel -> Bool #
Ord CLabel # |
Instance details Defined in GHC.Cmm.CLabel Methods compare :: CLabel -> CLabel -> Ordering # (<) :: CLabel -> CLabel -> Bool # (<=) :: CLabel -> CLabel -> Bool # (>) :: CLabel -> CLabel -> Bool # (>=) :: CLabel -> CLabel -> Bool # max :: CLabel -> CLabel -> CLabel # min :: CLabel -> CLabel -> CLabel #
OutputableP Platform CLabel # |
Instance details Defined in GHC.Cmm.CLabel Methods pdoc :: Platform -> CLabel -> SDoc #

newtype NeedExternDecl #

Indicate if GHC.CmmToC has to generate an extern declaration for the label (e.g. "extern StgWordArray(foo)"). The type is fixed to StgWordArray.

Symbols from the RTS don't need "extern" declarations because they are exposed via "rtsincludeStg.h" with the appropriate type. See `needsCDecl`.

The fixed StgWordArray type led to "conflicting types" issues with user provided Cmm files (not in the RTS) that declare data of another type (#15467 and test for #17920). Hence the Cmm parser considers that labels in data sections don't need the "extern" declaration (just add one explicitly if you need it).

See https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/backends/ppr-c#prototypes for why extern declaration are needed at all.

Constructors

NeedExternDecl Bool |

#### Instances

Instances details

Eq NeedExternDecl # |
Instance details Defined in GHC.Cmm.CLabel Methods (==) :: NeedExternDecl -> NeedExternDecl -> Bool # (/=) :: NeedExternDecl -> NeedExternDecl -> Bool #
Ord NeedExternDecl # |
Instance details Defined in GHC.Cmm.CLabel Methods compare :: NeedExternDecl -> NeedExternDecl -> Ordering # (<) :: NeedExternDecl -> NeedExternDecl -> Bool # (<=) :: NeedExternDecl -> NeedExternDecl -> Bool # (>) :: NeedExternDecl -> NeedExternDecl -> Bool # (>=) :: NeedExternDecl -> NeedExternDecl -> Bool # max :: NeedExternDecl -> NeedExternDecl -> NeedExternDecl # min :: NeedExternDecl -> NeedExternDecl -> NeedExternDecl #

data ForeignLabelSource #

Record where a foreign label is stored.

Constructors

ForeignLabelInPackage UnitId | Label is in a named package
ForeignLabelInExternalPackage | Label is in some external, system package that doesn't also contain compiled Haskell code, and is not associated with any .hi files. We don't have to worry about Haskell code being inlined from external packages. It is safe to treat the RTS package as "external".
ForeignLabelInThisPackage | Label is in the package currently being compiled. This is only used for creating hacky tmp labels during code generation. Don't use it in any code that might be inlined across a package boundary (ie, core code) else the information will be wrong relative to the destination module.

#### Instances

Instances details

Outputable ForeignLabelSource # |
Instance details Defined in GHC.Cmm.CLabel Methods ppr :: ForeignLabelSource -> SDoc #
Eq ForeignLabelSource # |
Instance details Defined in GHC.Cmm.CLabel Methods (==) :: ForeignLabelSource -> ForeignLabelSource -> Bool # (/=) :: ForeignLabelSource -> ForeignLabelSource -> Bool #
Ord ForeignLabelSource # |
Instance details Defined in GHC.Cmm.CLabel Methods compare :: ForeignLabelSource -> ForeignLabelSource -> Ordering # (<) :: ForeignLabelSource -> ForeignLabelSource -> Bool # (<=) :: ForeignLabelSource -> ForeignLabelSource -> Bool # (>) :: ForeignLabelSource -> ForeignLabelSource -> Bool # (>=) :: ForeignLabelSource -> ForeignLabelSource -> Bool # max :: ForeignLabelSource -> ForeignLabelSource -> ForeignLabelSource # min :: ForeignLabelSource -> ForeignLabelSource -> ForeignLabelSource #

data DynamicLinkerLabelInfo #

Constructors

CodeStub |
SymbolPtr |
GotSymbolPtr |
GotSymbolOffset |

#### Instances

Instances details

Eq DynamicLinkerLabelInfo # |
Instance details Defined in GHC.Cmm.CLabel Methods (==) :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Bool # (/=) :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Bool #
Ord DynamicLinkerLabelInfo # |
Instance details Defined in GHC.Cmm.CLabel Methods compare :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Ordering # (<) :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Bool # (<=) :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Bool # (>) :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Bool # (>=) :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> Bool # max :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo # min :: DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo -> DynamicLinkerLabelInfo #

data ConInfoTableLocation #

Which module is the info table from, and which number was it.

Constructors

UsageSite Module Int |
DefinitionSite |

#### Instances

Instances details

Outputable ConInfoTableLocation # |
Instance details Defined in GHC.Cmm.CLabel Methods ppr :: ConInfoTableLocation -> SDoc #
Eq ConInfoTableLocation # |
Instance details Defined in GHC.Cmm.CLabel Methods (==) :: ConInfoTableLocation -> ConInfoTableLocation -> Bool # (/=) :: ConInfoTableLocation -> ConInfoTableLocation -> Bool #
Ord ConInfoTableLocation # |
Instance details Defined in GHC.Cmm.CLabel Methods compare :: ConInfoTableLocation -> ConInfoTableLocation -> Ordering # (<) :: ConInfoTableLocation -> ConInfoTableLocation -> Bool # (<=) :: ConInfoTableLocation -> ConInfoTableLocation -> Bool # (>) :: ConInfoTableLocation -> ConInfoTableLocation -> Bool # (>=) :: ConInfoTableLocation -> ConInfoTableLocation -> Bool # max :: ConInfoTableLocation -> ConInfoTableLocation -> ConInfoTableLocation # min :: ConInfoTableLocation -> ConInfoTableLocation -> ConInfoTableLocation #

getConInfoTableLocation :: IdLabelInfo -> Maybe ConInfoTableLocation #

# Constructors

mkClosureLabel :: Name -> CafInfo -> CLabel #

mkSRTLabel :: Unique -> CLabel #

mkInfoTableLabel :: Name -> CafInfo -> CLabel #

Decides between external and local labels based on the names externality.

mkEntryLabel :: Name -> CafInfo -> CLabel #

mkRednCountsLabel :: Name -> CLabel #

mkTagHitLabel :: Name -> Unique -> CLabel #

mkConInfoTableLabel :: Name -> ConInfoTableLocation -> CLabel #

mkApEntryLabel :: Platform -> Bool -> Int -> CLabel #

mkApInfoTableLabel :: Platform -> Bool -> Int -> CLabel #

mkClosureTableLabel :: Name -> CafInfo -> CLabel #

mkBytesLabel :: Name -> CLabel #

mkLocalBlockLabel :: Unique -> CLabel #

mkBlockInfoTableLabel :: Name -> CafInfo -> CLabel #

mkBitmapLabel :: Unique -> CLabel #

mkStringLitLabel :: Unique -> CLabel #

mkInitializerStubLabel :: Module -> FastString -> CLabel #

mkInitializerArrayLabel :: Module -> CLabel #

mkFinalizerStubLabel :: Module -> FastString -> CLabel #

mkFinalizerArrayLabel :: Module -> CLabel #

mkAsmTempLabel :: Uniquable a => a -> CLabel #

mkAsmTempDerivedLabel :: CLabel -> FastString -> CLabel #

mkAsmTempEndLabel :: CLabel -> CLabel #

mkAsmTempProcEndLabel :: CLabel -> CLabel #

A label indicating the end of a procedure.

mkAsmTempDieLabel :: CLabel -> CLabel #

Construct a label for a DWARF Debug Information Entity (DIE) describing another symbol.

mkDirty_MUT_VAR_Label :: CLabel #

mkMUT_VAR_CLEAN_infoLabel :: CLabel #

mkNonmovingWriteBarrierEnabledLabel :: CLabel #

mkOrigThunkInfoLabel :: CLabel #

mkUpdInfoLabel :: CLabel #

mkBHUpdInfoLabel :: CLabel #

mkIndStaticInfoLabel :: CLabel #

mkMainCapabilityLabel :: CLabel #

mkMAP_FROZEN_CLEAN_infoLabel :: CLabel #

mkMAP_FROZEN_DIRTY_infoLabel :: CLabel #

mkMAP_DIRTY_infoLabel :: CLabel #

mkSMAP_FROZEN_CLEAN_infoLabel :: CLabel #

mkSMAP_FROZEN_DIRTY_infoLabel :: CLabel #

mkSMAP_DIRTY_infoLabel :: CLabel #

mkBadAlignmentLabel :: CLabel #

mkOutOfBoundsAccessLabel :: CLabel #

mkMemcpyRangeOverlapLabel :: CLabel #

mkArrWords_infoLabel :: CLabel #

mkSRTInfoLabel :: Int -> CLabel #

mkTopTickyCtrLabel :: CLabel #

mkCAFBlackHoleInfoTableLabel :: CLabel #

mkRtsPrimOpLabel :: PrimOp -> CLabel #

mkRtsSlowFastTickyCtrLabel :: String -> CLabel #

mkRtsUnpackCStringLabel :: CLabel #

A standard string unpacking thunk. See Note [unpack_cstring closures] in StgStdThunks.cmm.

mkRtsUnpackCStringUtf8Label :: CLabel #

A standard string unpacking thunk. See Note [unpack_cstring closures] in StgStdThunks.cmm.

mkSelectorInfoLabel :: Platform -> Bool -> Int -> CLabel #

mkSelectorEntryLabel :: Platform -> Bool -> Int -> CLabel #

mkCmmInfoLabel :: UnitId -> FastString -> CLabel #

mkCmmEntryLabel :: UnitId -> FastString -> CLabel #

mkCmmRetInfoLabel :: UnitId -> FastString -> CLabel #

mkCmmRetLabel :: UnitId -> FastString -> CLabel #

mkCmmCodeLabel :: UnitId -> FastString -> CLabel #

mkCmmDataLabel :: UnitId -> NeedExternDecl -> FastString -> CLabel #

mkRtsCmmDataLabel :: FastString -> CLabel #

mkCmmClosureLabel :: UnitId -> FastString -> CLabel #

mkRtsApFastLabel :: FastString -> CLabel #

mkPrimCallLabel :: PrimCall -> CLabel #

mkForeignLabel :: FastString -> ForeignLabelSource -> FunctionOrData -> CLabel #

Make a foreign label

mkCCLabel :: CostCentre -> CLabel #

mkCCSLabel :: CostCentreStack -> CLabel #

mkIPELabel :: Module -> CLabel #

data InfoProvEnt #

Info Table Provenance Entry See Note [Mapping Info Tables to Source Positions]

Constructors

InfoProvEnt |
Fields infoTablePtr :: !CLabel infoProvEntClosureType :: !Int infoTableType :: !String infoProvModule :: !Module infoTableProv :: !(Maybe (RealSrcSpan, LexicalFastString))

#### Instances

Instances details

Eq InfoProvEnt # |
Instance details Defined in GHC.Cmm.CLabel Methods (==) :: InfoProvEnt -> InfoProvEnt -> Bool # (/=) :: InfoProvEnt -> InfoProvEnt -> Bool #
Ord InfoProvEnt # |
Instance details Defined in GHC.Cmm.CLabel Methods compare :: InfoProvEnt -> InfoProvEnt -> Ordering # (<) :: InfoProvEnt -> InfoProvEnt -> Bool # (<=) :: InfoProvEnt -> InfoProvEnt -> Bool # (>) :: InfoProvEnt -> InfoProvEnt -> Bool # (>=) :: InfoProvEnt -> InfoProvEnt -> Bool # max :: InfoProvEnt -> InfoProvEnt -> InfoProvEnt # min :: InfoProvEnt -> InfoProvEnt -> InfoProvEnt #
OutputableP Platform InfoProvEnt # |
Instance details Defined in GHC.Cmm.CLabel Methods pdoc :: Platform -> InfoProvEnt -> SDoc #

mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel #

mkPicBaseLabel :: CLabel #

mkDeadStripPreventer :: CLabel -> CLabel #

mkHpcTicksLabel :: Module -> CLabel #

# Predicates

hasCAF :: CLabel -> Bool #

needsCDecl :: CLabel -> Bool #

maybeLocalBlockLabel :: CLabel -> Maybe BlockId #

If a label is a local block label then return just its `BlockId`, otherwise `Nothing`.

externallyVisibleCLabel :: CLabel -> Bool #

Is a CLabel visible outside this object file or not? From the point of view of the code generator, a name is externally visible if it has to be declared as exported in the .o file's symbol table; that is, made non-static.

isLibcFun :: CLabel -> Bool #

Check whether a label corresponds to a C function that has a prototype in a system header somewhere, or is built-in to the C compiler. For these labels we avoid generating our own C prototypes.

isCFunctionLabel :: CLabel -> Bool #

isGcPtrLabel :: CLabel -> Bool #

labelDynamic :: Module -> Platform -> Bool -> CLabel -> Bool #

Does a `CLabel` need dynamic linkage?

When referring to data in code, we need to know whether that data resides in a DLL or not. [Win32 only.] `labelDynamic` returns `True` if the label is located in a DLL, be it a data reference or not.

isLocalCLabel :: Module -> CLabel -> Bool #

Is a `CLabel` defined in the current module being compiled?

Sometimes we can optimise references within a compilation unit in ways that we couldn't for inter-module references. This provides a conservative estimate of whether a `CLabel` lives in the current module.

mayRedirectTo :: CLabel -> CLabel -> Bool #

isInfoTableLabel :: CLabel -> Bool #

Whether label is points to some kind of info table

isCmmInfoTableLabel :: CLabel -> Bool #

Whether label points to an info table defined in Cmm

isConInfoTableLabel :: CLabel -> Bool #

Whether label is points to constructor info table

isIdLabel :: CLabel -> Bool #

isTickyLabel :: CLabel -> Bool #

hasHaskellName :: CLabel -> Maybe Name #

hasIdLabelInfo :: CLabel -> Maybe IdLabelInfo #

isBytesLabel :: CLabel -> Bool #

Whether label is a top-level string literal

isForeignLabel :: CLabel -> Bool #

Whether label is a non-haskell label (defined in C code)

isSomeRODataLabel :: CLabel -> Bool #

Whether label is a .rodata label

isStaticClosureLabel :: CLabel -> Bool #

Whether label is a static closure label (can come from haskell or cmm)

# Conversions

toClosureLbl :: Platform -> CLabel -> CLabel #

toSlowEntryLbl :: Platform -> CLabel -> CLabel #

toEntryLbl :: Platform -> CLabel -> CLabel #

toInfoLbl :: Platform -> CLabel -> CLabel #

toProcDelimiterLbl :: CLabel -> CLabel #

Generate a CmmProc delimiter label from the actual entry label.

This delimiter label might be the entry label itself, except when the entry label is a LocalBlockLabel. If we reused the entry label to delimit the proc, we would generate redundant labels (see #22792)

# Pretty-printing

data LabelStyle #

Style of label pretty-printing.

When we produce C sources or headers, we have to take into account that C compilers transform C labels when they convert them into symbols. For example, they can add prefixes (e.g., "_" on Darwin). So we provide two ways to pretty-print CLabels: C style or Asm style.

Constructors

CStyle | C label style (used by C and LLVM backends)
AsmStyle | Asm label style (used by NCG backend)

pprDebugCLabel :: Platform -> CLabel -> SDoc #

For debugging problems with the CLabel representation. We can't make a Show instance for CLabel because lots of its components don't have instances. The regular Outputable instance only shows the label name, and not its other info.

pprCLabel :: IsLine doc => Platform -> CLabel -> doc #

pprAsmLabel :: IsLine doc => Platform -> CLabel -> doc #

ppInternalProcLabel #

Arguments

:: IsLine doc |
=> Module | the current module
-> CLabel |
-> Maybe doc | the internal proc label

Generate a label for a procedure internal to a module (if `Opt_ExposeAllSymbols` is enabled). See Note [Internal proc labels].

# Others

dynamicLinkerLabelInfo :: CLabel -> Maybe (DynamicLinkerLabelInfo, CLabel) #

data CStubLabel #

This type encodes the subset of `CLabel` that occurs in C stubs of foreign declarations for the purpose of serializing to interface files.

See Note [Foreign stubs and TH bytecode linking]

Constructors

CStubLabel |
Fields csl_is_initializer :: Bool csl_module :: Module csl_name :: FastString

#### Instances

Instances details

Outputable CStubLabel # |
Instance details Defined in GHC.Cmm.CLabel Methods ppr :: CStubLabel -> SDoc #

cStubLabel :: CLabel -> Maybe CStubLabel #

Project the constructor `ModuleLabel` out of `CLabel` if it is an initializer or finalizer.

fromCStubLabel :: CStubLabel -> CLabel #

Inject a `CStubLabel` into a `CLabel` as a `ModuleLabel`.

mapInternalNonDetUniques :: Applicative m => (Unique -> m Unique) -> CLabel -> m CLabel #

A utility for renaming uniques in CLabels to produce deterministic object. Note that not all Uniques are mapped over. Only those that can be safely alpha renamed, e.g. uniques of local symbols, but not of external ones. See Note [Renaming uniques deterministically].