Skip to content

FloatOut: Float to top-level only vs. floating iff there are no free variables

This is the config record for FloatOut:

data FloatOutSwitches = FloatOutSwitches {
  floatOutLambdas   :: Maybe Int,  -- ^ Just n <=> float lambdas to top level, if
                                   -- doing so will abstract over n or fewer
                                   -- value variables
                                   -- Nothing <=> float all lambdas to top level,
                                   --             regardless of how many free variables
                                   -- Just 0 is the vanilla case: float a lambda
                                   --    iff it has no free vars
...
  floatToTopLevelOnly :: Bool      -- ^ Allow floating to the top level only.
  }

I wonder what the difference is between floatOutLambdas = Just 0 and floatToTopLevelOnly = True. Perhaps it is relevant when the RHS of a freely floatable binding has unlifted type? When would we ever float that? Puzzling.

We seem to use floatToTopLevelOnly for static pointer floating exclusively.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information