ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Core.Unfold

Synopsis

- data Unfolding
- data UnfoldingGuidance
- data UnfoldingOpts = UnfoldingOpts {
  - unfoldingCreationThreshold :: !Int
  - unfoldingUseThreshold :: !Int
  - unfoldingFunAppDiscount :: !Int
  - unfoldingDictDiscount :: !Int
  - unfoldingVeryAggressive :: !Bool
  - unfoldingCaseThreshold :: !Int
  - unfoldingCaseScaling :: !Int
  - unfoldingReportPrefix :: !(Maybe String)
  }
- defaultUnfoldingOpts :: UnfoldingOpts
- updateCreationThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts
- updateUseThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts
- updateFunAppDiscount :: Int -> UnfoldingOpts -> UnfoldingOpts
- updateDictDiscount :: Int -> UnfoldingOpts -> UnfoldingOpts
- updateVeryAggressive :: Bool -> UnfoldingOpts -> UnfoldingOpts
- updateCaseScaling :: Int -> UnfoldingOpts -> UnfoldingOpts
- updateCaseThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts
- updateReportPrefix :: Maybe String -> UnfoldingOpts -> UnfoldingOpts
- data ArgSummary
  - = TrivArg
  - | NonTrivArg
  - | ValueArg
- couldBeSmallEnoughToInline :: UnfoldingOpts -> Int -> CoreExpr -> Bool
- inlineBoringOk :: CoreExpr -> Bool
- smallEnoughToInline :: UnfoldingOpts -> Unfolding -> Bool
- callSiteInline :: Logger -> UnfoldingOpts -> Int -> Id -> Bool -> Bool -> [ArgSummary] -> CallCtxt -> Maybe CoreExpr
- data CallCtxt
  - = BoringCtxt
  - | RhsCtxt RecFlag
  - | DiscArgCtxt
  - | RuleArgCtxt
  - | ValAppCtxt
  - | CaseCtxt
- calcUnfoldingGuidance :: UnfoldingOpts -> Bool -> CoreExpr -> UnfoldingGuidance

# Documentation

data Unfolding Source #

Records the unfolding of an identifier, which is approximately the form the identifier would have if we substituted its definition in for the identifier. This type should be treated as abstract everywhere except in GHC.Core.Unfold

#### Instances

Instances details

Outputable Unfolding Source # |
Instance details Defined in GHC.Core.Ppr Methods ppr :: Unfolding -> SDoc Source #

data UnfoldingGuidance Source #

`UnfoldingGuidance` says when unfolding should take place

#### Instances

Instances details

Outputable UnfoldingGuidance Source # |
Instance details Defined in GHC.Core.Ppr Methods ppr :: UnfoldingGuidance -> SDoc Source #
Eq UnfoldingGuidance Source # |
Instance details Defined in GHC.Core Methods (==) :: UnfoldingGuidance -> UnfoldingGuidance -> Bool # (/=) :: UnfoldingGuidance -> UnfoldingGuidance -> Bool #

data UnfoldingOpts Source #

Unfolding options

Constructors

UnfoldingOpts |

Fields

- unfoldingCreationThreshold :: !Int

  Threshold above which unfoldings are not *created*

- unfoldingUseThreshold :: !Int

  Threshold above which unfoldings are not *inlined*

- unfoldingFunAppDiscount :: !Int

  Discount for lambdas that are used (applied)

- unfoldingDictDiscount :: !Int

  Discount for dictionaries

- unfoldingVeryAggressive :: !Bool

  Force inlining in many more cases

- unfoldingCaseThreshold :: !Int

  Don't consider depth up to x

- unfoldingCaseScaling :: !Int

  Penalize depth with 1/x

- unfoldingReportPrefix :: !(Maybe String)

  Only report inlining decisions for names with this prefix

defaultUnfoldingOpts :: UnfoldingOpts Source #

updateCreationThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts Source #

updateUseThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts Source #

updateFunAppDiscount :: Int -> UnfoldingOpts -> UnfoldingOpts Source #

updateDictDiscount :: Int -> UnfoldingOpts -> UnfoldingOpts Source #

updateVeryAggressive :: Bool -> UnfoldingOpts -> UnfoldingOpts Source #

updateCaseScaling :: Int -> UnfoldingOpts -> UnfoldingOpts Source #

updateCaseThreshold :: Int -> UnfoldingOpts -> UnfoldingOpts Source #

updateReportPrefix :: Maybe String -> UnfoldingOpts -> UnfoldingOpts Source #

data ArgSummary Source #

Constructors

TrivArg |
NonTrivArg |
ValueArg |

#### Instances

Instances details

Outputable ArgSummary Source # |
Instance details Defined in GHC.Core.Unfold Methods ppr :: ArgSummary -> SDoc Source #

couldBeSmallEnoughToInline :: UnfoldingOpts -> Int -> CoreExpr -> Bool Source #

inlineBoringOk :: CoreExpr -> Bool Source #

smallEnoughToInline :: UnfoldingOpts -> Unfolding -> Bool Source #

callSiteInline :: Logger -> UnfoldingOpts -> Int -> Id -> Bool -> Bool -> [ArgSummary] -> CallCtxt -> Maybe CoreExpr Source #

data CallCtxt Source #

Constructors

BoringCtxt |
RhsCtxt RecFlag |
DiscArgCtxt |
RuleArgCtxt |
ValAppCtxt |
CaseCtxt |

#### Instances

Instances details

Outputable CallCtxt Source # |
Instance details Defined in GHC.Core.Unfold Methods ppr :: CallCtxt -> SDoc Source #

calcUnfoldingGuidance :: UnfoldingOpts -> Bool -> CoreExpr -> UnfoldingGuidance Source #