GHC.Iface.Tidy

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Iface.Tidy

Description

Tidying up Core

This module's purpose is to prepare the Core program for two distinct purposes: * To be serialised into the module's interface file * To feed to the code generator

The most important tasks are: * Determine which `Name`s should ultimately be `Internal` and `External` (which may differ to whether they were originally `Internal` or `External`). See `Note [About the NameSorts]` in GHC.Types.Name. For example, in: module M where f x = x + y where y = factorial 4 could be optimized during the Core pass to: module M where y = factorial 4 f x = x + y in which case `y` would be changed from `Internal` to `External`.

- Rename local identifiers to avoid name clashes, so that unfoldings etc can be serialialised using the OccName, without Uniques.

For example (`x_5` means `x` with a `Unique` of `5`): f x_12 x_23 = x_12 would be changed to: f x_12 x1_23 = x_12

# Documentation

data TidyOpts Source #

Constructors

TidyOpts |
Fields opt_name_cache :: !NameCache opt_collect_ccs :: !Bool Always true if we compile with -prof opt_unfolding_opts :: !UnfoldingOpts opt_expose_unfoldings :: !UnfoldingExposure Which unfoldings to expose opt_trim_ids :: !Bool trim off the arity, one-shot-ness, strictness etc which were retained for the benefit of the code generator opt_expose_rules :: !Bool Are rules exposed or not? opt_static_ptr_opts :: !(Maybe StaticPtrOpts) Options for generated static pointers, if enabled (/= Nothing). opt_keep_auto_rules :: !Bool

data UnfoldingExposure Source #

Constructors

ExposeNone | Don't expose unfoldings
ExposeSome | Only expose required unfoldings
ExposeAll | Expose all unfoldings

#### Instances

Instances details

Show UnfoldingExposure Source # |
Instance details Defined in GHC.Iface.Tidy Methods showsPrec :: Int -> UnfoldingExposure -> ShowS # show :: UnfoldingExposure -> String # showList :: [UnfoldingExposure] -> ShowS #
Eq UnfoldingExposure Source # |
Instance details Defined in GHC.Iface.Tidy Methods (==) :: UnfoldingExposure -> UnfoldingExposure -> Bool # (/=) :: UnfoldingExposure -> UnfoldingExposure -> Bool #
Ord UnfoldingExposure Source # |
Instance details Defined in GHC.Iface.Tidy Methods compare :: UnfoldingExposure -> UnfoldingExposure -> Ordering # (<) :: UnfoldingExposure -> UnfoldingExposure -> Bool # (<=) :: UnfoldingExposure -> UnfoldingExposure -> Bool # (>) :: UnfoldingExposure -> UnfoldingExposure -> Bool # (>=) :: UnfoldingExposure -> UnfoldingExposure -> Bool # max :: UnfoldingExposure -> UnfoldingExposure -> UnfoldingExposure # min :: UnfoldingExposure -> UnfoldingExposure -> UnfoldingExposure #

tidyProgram :: TidyOpts -> ModGuts -> IO (CgGuts, ModDetails) Source #

mkBootModDetailsTc :: Logger -> TcGblEnv -> IO ModDetails Source #