Note [Floats and FloatDecision]
We have a special datatype `Floats` for modelling a telescope of `FloatingBind` and caching its "maximum" `FloatInfo`, according to `floatsAtLeastAsFarAs` (see Note [BindInfo and FloatInfo] for the ordering). There are several operations for creating and combining `Floats` that maintain scoping and the cached `FloatInfo`. When deciding whether we want to float out a `Floats` out of a binding context such as `let x = <> in e` (let), `f <>` (app), or `x = <>; ...` (top-level), we consult the cached `FloatInfo` of the `Floats`: * If we want to float to the top-level (`x = <>; ...`), we check whether we may float-at-least-as-far-as `TopLvlFloatable`, in which case we respond with `FloatAll :: FloatDecision`; otherwise we say `FloatNone`. * If we want to float locally (let or app), then the floating decision is described in Note [wantFloatLocal]. `executeFloatDecision` is then used to act on the particular `FloatDecision`.
References 2
- BindInfo and FloatInfo GHC.CoreToStg.Prep
- wantFloatLocal GHC.CoreToStg.Prep
Referenced by 3
- GHC.CoreToStg.Prep call site ×2
- BindInfo and FloatInfo GHC.CoreToStg.Prep