if null bindings || length alts == 1 && length bindings == 1 then return expr else change newlet
where
-- Generate a single wild binder, since they are all the same
if null bindings || length alts == 1 && length bindings == 1 then return expr else change newlet
where
-- Generate a single wild binder, since they are all the same
-- Wilden the binders of one alt, producing a list of bindings as a
-- sideeffect.
doalt :: CoreAlt -> TransformMonad ([(CoreBndr, CoreExpr)], CoreAlt)
-- Wilden the binders of one alt, producing a list of bindings as a
-- sideeffect.
doalt :: CoreAlt -> TransformMonad ([(CoreBndr, CoreExpr)], CoreAlt)
-- A set of all the binders that are used by the expression
free_vars = CoreFVs.exprSomeFreeVars (`elem` bndrs) expr
-- Creates a case statement to retrieve the ith element from the scrutinee
-- A set of all the binders that are used by the expression
free_vars = CoreFVs.exprSomeFreeVars (`elem` bndrs) expr
-- Creates a case statement to retrieve the ith element from the scrutinee
normalizeBind bndr =
-- Don't normalize global variables, these should be either builtin
-- functions or data constructors.
normalizeBind bndr =
-- Don't normalize global variables, these should be either builtin
-- functions or data constructors.
-- Skip binders that have a polymorphic type, since it's impossible to
-- create polymorphic hardware.
if is_poly (Var bndr)
-- Skip binders that have a polymorphic type, since it's impossible to
-- create polymorphic hardware.
if is_poly (Var bndr)