diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2016-02-24 16:22:36 -0500 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2016-02-24 16:41:55 -0500 |
commit | a9dc62ae3a28a7c5fc173895f148e65c6ffc14de (patch) | |
tree | b52e5881bfaa2438233aea75fdc2420a62322ba8 /compiler/stgSyn | |
parent | d8c64e86361f6766ebe26a262bb229fb8301a42a (diff) | |
download | haskell-a9dc62ae3a28a7c5fc173895f148e65c6ffc14de.tar.gz |
Remove "use mask" from StgAlt syntax
Reviewers: austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1933
Diffstat (limited to 'compiler/stgSyn')
-rw-r--r-- | compiler/stgSyn/CoreToStg.hs | 8 | ||||
-rw-r--r-- | compiler/stgSyn/StgLint.hs | 8 | ||||
-rw-r--r-- | compiler/stgSyn/StgSyn.hs | 8 |
3 files changed, 8 insertions, 16 deletions
diff --git a/compiler/stgSyn/CoreToStg.hs b/compiler/stgSyn/CoreToStg.hs index 414571cbf8..c275f4d4f3 100644 --- a/compiler/stgSyn/CoreToStg.hs +++ b/compiler/stgSyn/CoreToStg.hs @@ -413,18 +413,14 @@ coreToStgExpr (Case scrut bndr _ alts) = do -- where a nullary tuple is mapped to (State# World#) ASSERT( null binders ) do { (rhs2, rhs_fvs, rhs_escs) <- coreToStgExpr rhs - ; return ((DEFAULT, [], [], rhs2), rhs_fvs, rhs_escs) } + ; return ((DEFAULT, [], rhs2), rhs_fvs, rhs_escs) } | otherwise = let -- Remove type variables binders' = filterStgBinders binders in extendVarEnvLne [(b, LambdaBound) | b <- binders'] $ do (rhs2, rhs_fvs, rhs_escs) <- coreToStgExpr rhs - let - -- Records whether each param is used in the RHS - good_use_mask = [ b `elementOfFVInfo` rhs_fvs | b <- binders' ] - - return ( (con, binders', good_use_mask, rhs2), + return ( (con, binders', rhs2), binders' `minusFVBinders` rhs_fvs, rhs_escs `delVarSetList` binders' ) -- ToDo: remove the delVarSet; diff --git a/compiler/stgSyn/StgLint.hs b/compiler/stgSyn/StgLint.hs index df3c4e57df..dd206d9e39 100644 --- a/compiler/stgSyn/StgLint.hs +++ b/compiler/stgSyn/StgLint.hs @@ -223,15 +223,15 @@ lintStgAlts alts scrut_ty = do -- We can't check that the alternatives have the -- same type, because they don't, with unsafeCoerce# -lintAlt :: Type -> (AltCon, [Id], [Bool], StgExpr) -> LintM (Maybe Type) -lintAlt _ (DEFAULT, _, _, rhs) +lintAlt :: Type -> (AltCon, [Id], StgExpr) -> LintM (Maybe Type) +lintAlt _ (DEFAULT, _, rhs) = lintStgExpr rhs -lintAlt scrut_ty (LitAlt lit, _, _, rhs) = do +lintAlt scrut_ty (LitAlt lit, _, rhs) = do checkTys (literalType lit) scrut_ty (mkAltMsg1 scrut_ty) lintStgExpr rhs -lintAlt scrut_ty (DataAlt con, args, _, rhs) = do +lintAlt scrut_ty (DataAlt con, args, rhs) = do case splitTyConApp_maybe scrut_ty of Just (tycon, tys_applied) | isAlgTyCon tycon && not (isNewTyCon tycon) -> do diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs index 1fc84125f9..4145d9e974 100644 --- a/compiler/stgSyn/StgSyn.hs +++ b/compiler/stgSyn/StgSyn.hs @@ -469,7 +469,7 @@ rhsHasCafRefs (StgRhsCon _ _ args) = any stgArgHasCafRefs args altHasCafRefs :: GenStgAlt bndr Id -> Bool -altHasCafRefs (_, _, _, rhs) = exprHasCafRefs rhs +altHasCafRefs (_, _, rhs) = exprHasCafRefs rhs stgArgHasCafRefs :: GenStgArg Id -> Bool stgArgHasCafRefs (StgVarArg id) @@ -533,10 +533,6 @@ rather than from the scrutinee type. type GenStgAlt bndr occ = (AltCon, -- alts: data constructor, [bndr], -- constructor's parameters, - [Bool], -- "use mask", same length as - -- parameters; a True in a - -- param's position if it is - -- used in the ... GenStgExpr bndr occ) -- ...right-hand side. data AltType @@ -743,7 +739,7 @@ pprStgExpr (StgCase expr bndr alt_type alts) pprStgAlt :: (OutputableBndr bndr, Outputable occ, Ord occ) => GenStgAlt bndr occ -> SDoc -pprStgAlt (con, params, _use_mask, expr) +pprStgAlt (con, params, expr) = hang (hsep [ppr con, sep (map (pprBndr CaseBind) params), text "->"]) 4 (ppr expr <> semi) |