| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
GHC.Types.Tickish
Contents
Synopsis
- data GenTickish (pass :: TickishPass)
- = ProfNote {
- profNoteCC :: CostCentre
- profNoteCount :: !Bool
- profNoteScope :: !Bool
- | HpcTick {
- tickModule :: Module
- tickId :: !Int
- | Breakpoint {
- breakpointExt :: XBreakpoint pass
- breakpointId :: !BreakpointId
- breakpointFVs :: [XTickishId pass]
- | SourceNote { }
- = ProfNote {
- type CoreTickish = GenTickish 'TickishPassCore
- type StgTickish = GenTickish 'TickishPassStg
- type CmmTickish = GenTickish 'TickishPassCmm
- type family XTickishId (pass :: TickishPass)
- tickishCounts :: GenTickish pass -> Bool
- tickishHasNoScope :: GenTickish pass -> Bool
- tickishHasSoftScope :: GenTickish pass -> Bool
- tickishFloatable :: GenTickish pass -> Bool
- tickishCanSplit :: GenTickish pass -> Bool
- mkNoCount :: GenTickish pass -> GenTickish pass
- mkNoScope :: GenTickish pass -> GenTickish pass
- tickishIsCode :: GenTickish pass -> Bool
- isProfTick :: GenTickish pass -> Bool
- data TickishPlacement
- tickishPlace :: GenTickish pass -> TickishPlacement
- tickishContains :: Eq (GenTickish pass) => GenTickish pass -> GenTickish pass -> Bool
- combineTickish_maybe :: Eq (GenTickish pass) => GenTickish pass -> GenTickish pass -> Maybe (GenTickish pass)
- tickishCommutable :: GenTickish pass -> GenTickish pass -> Bool
- bestSourceNote :: Bool -> FastString -> [GenTickish pass] -> Maybe (RealSrcSpan, LexicalFastString)
- data BreakpointId = BreakpointId {}
- type BreakTickIndex = Int
Documentation
data GenTickish (pass :: TickishPass) Source #
Constructors
| ProfNote | An |
Fields
| |
| HpcTick | A "tick" used by HPC to track the execution of each subexpression in the original source code. |
Fields
| |
| Breakpoint | A breakpoint for the GHCi debugger. This behaves like an HPC tick, but has a list of free variables which will be available for inspection in GHCi when the program stops at the breakpoint. NB. we must take account of these Ids when (a) counting free variables, and (b) substituting (don't substitute for them) |
Fields
| |
| SourceNote | A source note. See Note [Source notes and debug information] |
Fields
| |
Instances
| Outputable (XTickishId pass) => Outputable (GenTickish pass) Source # | |
Defined in GHC.Core.Ppr Methods ppr :: GenTickish pass -> SDoc Source # | |
type CoreTickish = GenTickish 'TickishPassCore Source #
type StgTickish = GenTickish 'TickishPassStg Source #
type CmmTickish = GenTickish 'TickishPassCmm Source #
Tickish in Cmm context (annotations only)
type family XTickishId (pass :: TickishPass) Source #
tickishCounts :: GenTickish pass -> Bool Source #
A "counting tick" (for which tickishCounts is True) is one that
counts evaluations in some way. We cannot discard a counting tick,
and the compiler should preserve the number of counting ticks (as
far as possible).
See Note [Counting ticks]
tickishHasNoScope :: GenTickish pass -> Bool Source #
Is this a non-scoping tick, for which we don't care about precisely the extent of code that the tick encompasses?
See Note [Scoped ticks]
tickishHasSoftScope :: GenTickish pass -> Bool Source #
A "tick with soft scoping" (for which tickishHasSoftScope is True) is
one that either does not scope at all (for which tickishHasNoScope is True),
or that has a "soft" scope: we allow new code to be floated into to the scope,
as long as all code that was covered remains covered.
See Note [Scoped ticks]
tickishFloatable :: GenTickish pass -> Bool Source #
Returns True for ticks that can be floated upwards easily even
where it might change execution counts, such as:
Just (tick... foo) ==> tick... (Just foo)
This is a combination of tickishHasSoftScope and tickishCounts.
Note that in principle splittable ticks can become floatable using mkNoTick,
even though there's currently no tickish for which that is the case.
tickishCanSplit :: GenTickish pass -> Bool Source #
Returns True for a tick that is both counting and scoping and
can be split into its (tick, scope) parts using mkNoScope and
mkNoTick respectively.
mkNoCount :: GenTickish pass -> GenTickish pass Source #
mkNoScope :: GenTickish pass -> GenTickish pass Source #
tickishIsCode :: GenTickish pass -> Bool Source #
Return True if this source annotation compiles to some backend
code. Without this flag, the tickish is seen as a simple annotation
that does not have any associated evaluation code.
What this means that we are allowed to disregard the tick if doing so means that we can skip generating any code in the first place. A typical example is top-level bindings:
foo = tick... y -> ... ==> foo = y -> tick... ...
Here there is just no operational difference between the first and the second version. Therefore code generation should simply translate the code as if it found the latter.
isProfTick :: GenTickish pass -> Bool Source #
data TickishPlacement Source #
Governs the kind of expression that the tick gets placed on when
annotating for example using mkTick. If we find that we want to
put a tickish on an expression ruled out here, we try to float it
inwards until we find a suitable expression.
See Note [Tickish placement].
Constructors
| PlaceRuntime | Place ticks exactly on run-time expressions, moving them through pure compile-time constructs such as other ticks, casts or type lambdas. |
| PlaceNonLam | As |
| PlaceCostCentre | As |
Instances
| Outputable TickishPlacement Source # | |
Defined in GHC.Types.Tickish Methods ppr :: TickishPlacement -> SDoc Source # | |
| Eq TickishPlacement Source # | |
Defined in GHC.Types.Tickish Methods (==) :: TickishPlacement -> TickishPlacement -> Bool Source # (/=) :: TickishPlacement -> TickishPlacement -> Bool Source # | |
| Show TickishPlacement Source # | |
Defined in GHC.Types.Tickish | |
tickishPlace :: GenTickish pass -> TickishPlacement Source #
Placement behaviour we want for the ticks.
See Note [Tickish placement].
tickishContains :: Eq (GenTickish pass) => GenTickish pass -> GenTickish pass -> Bool Source #
Returns whether one tick "contains" the other one, therefore making the second tick redundant.
combineTickish_maybe :: Eq (GenTickish pass) => GenTickish pass -> GenTickish pass -> Maybe (GenTickish pass) Source #
Merge two ticks into one, if that is possible.
Examples:
- combine two source note ticks if one contains the other,
- combine a non-counting profiling tick with a non-scoping profiling tick for the same cost centre
- combine two equal breakpoint ticks or HPC ticks
tickishCommutable :: GenTickish pass -> GenTickish pass -> Bool Source #
Can these two ticks be commuted (moved past eachother)?
Arguments
| :: Bool | accept a location in another module if there are none in the current module? |
| -> FastString | the "local" source file |
| -> [GenTickish pass] | candidates (best first) |
| -> Maybe (RealSrcSpan, LexicalFastString) |
Choose the "best" source note in the given candidate list of ticks, preferring source notes that are local to the source file being consdiered.
Breakpoint tick identifiers
data BreakpointId Source #
Breakpoint identifier.
Indexes into the structures in the created during desugaring
(after inserting the breakpoint ticks in the expressions).
See Note [Breakpoint identifiers]ModBreaks
Constructors
| BreakpointId | |
Fields
| |
Instances
type BreakTickIndex = Int Source #
Breakpoint tick index newtype BreakTickIndex = BreakTickIndex Int deriving (Eq, Ord, Data, Ix, NFData, Outputable)