-- We'd just float right back out again...
       -- Should match the test in SimplEnv.doFloatFromRhs

{-
************************************************************************
*                                                                      *
\subsection{@sepBindsByDropPoint@}
*                                                                      *
************************************************************************

This is the crucial function.  The idea is: We have a wad of bindings
that we'd like to distribute inside a collection of {\em drop points};
insides the alternatives of a \tr{case} would be one example of some
drop points; the RHS and body of a non-recursive \tr{let} binding
would be another (2-element) collection.

So: We're given a list of sets-of-free-variables, one per drop point,
and a list of floating-inwards bindings.  If a binding can go into
only one drop point (without suddenly making something out-of-scope),
in it goes.  If a binding is used inside {\em multiple} drop points,
then it has to go in a you-must-drop-it-above-all-these-drop-points
point.

We have to maintain the order on these drop-point-related lists.
-}

sepBindsByDropPoint
    :: DynFlags
    -> Bool             -- True <=> is case expression
    -> [FreeVarSet]         -- One set of FVs per drop point
    -> FloatInBinds         -- Candidate floaters
    -> [FloatInBinds]      -- FIRST one is bindings which must not be floated
                            -- inside any drop point; the rest correspond
                            -- one-to-one with the input list of FV sets

-- Every input floater is returned somewhere in the result;
-- none are dropped, not even ones which don't seem to be
-- free in *any* of the drop-point fvs.  Why?  Because, for example,
-- a binding (let x = E in B) might have a specialised version of
-- x (say x') stored inside x, but x' isn't free in E or B.

type DropBox = (FreeVarSet, FloatInBinds)
sepBindsByDropPoint
    :: DynFlags
    -> Bool             -- True <=> is case expression
    -> [FreeVarSet]         -- One set of FVs per drop point
    -> FloatInBinds         -- Candidate floaters
    -> [FloatInBinds]      -- FIRST one is bindings which must not be floated
                            -- inside any drop point; the rest correspond
                            -- one-to-one with the input list of FV sets

-- Every input floater is returned somewhere in the result;
-- none are dropped, not even ones which don't seem to be
-- free in *any* of the drop-point fvs.  Why?  Because, for example,
-- a binding (let x = E in B) might have a specialised version of
-- x (say x') stored inside x, but x' isn't free in E or B.

type DropBox = (FreeVarSet, FloatInBinds)
sepBindsByDropPoint
    :: DynFlags
    -> Bool             -- True <=> is case expression
    -> [FreeVarSet]         -- One set of FVs per drop point
    -> FloatInBinds         -- Candidate floaters
    -> [FloatInBinds]      -- FIRST one is bindings which must not be floated
                            -- inside any drop point; the rest correspond
                            -- one-to-one with the input list of FV sets

-- Every input floater is returned somewhere in the result;
-- none are dropped, not even ones which don't seem to be
-- free in *any* of the drop-point fvs.  Why?  Because, for example,
-- a binding (let x = E in B) might have a specialised version of
-- x (say x') stored inside x, but x' isn't free in E or B.

type DropBox = (FreeVarSet, FloatInBinds)