From 91a10cb06aa9ace905adeff3cc795de9c40f64a9 Mon Sep 17 00:00:00 2001 From: doyougnu Date: Wed, 23 Feb 2022 11:08:22 -0500 Subject: GenStgAlt 3-tuple synonym --> Record type This commit alters GenStgAlt from a type synonym to a Record with field accessors. In pursuit of #21078, this is not a required change but cleans up several areas for nicer code in the upcoming js-backend, and in GHC itself. GenStgAlt: 3-tuple -> record Stg.Utils: GenStgAlt 3-tuple -> record Stg.Stats: StgAlt 3-tuple --> record Stg.InferTags.Rewrite: StgAlt 3-tuple -> record Stg.FVs: GenStgAlt 3-tuple -> record Stg.CSE: GenStgAlt 3-tuple -> record Stg.InferTags: GenStgAlt 3-tuple --> record Stg.Debug: GenStgAlt 3-tuple --> record Stg.Lift.Analysis: GenStgAlt 3-tuple --> record Stg.Lift: GenStgAlt 3-tuple --> record ByteCode.Instr: GenStgAlt 3-tuple --> record Stg.Syntax: add GenStgAlt helper functions Stg.Unarise: GenStgAlt 3-tuple --> record Stg.BcPrep: GenStgAlt 3-tuple --> record CoreToStg: GenStgAlt 3-tuple --> record StgToCmm.Expr: GenStgAlt 3-tuple --> record StgToCmm.Bind: GenStgAlt 3-tuple --> record StgToByteCode: GenStgAlt 3-tuple --> record Stg.Lint: GenStgAlt 3-tuple --> record Stg.Syntax: strictify GenStgAlt GenStgAlt: add haddock, some cleanup fixup: remove calls to pure, single ViewPattern StgToByteCode: use case over viewpatterns --- compiler/GHC/Stg/Lint.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'compiler/GHC/Stg/Lint.hs') diff --git a/compiler/GHC/Stg/Lint.hs b/compiler/GHC/Stg/Lint.hs index 405abdd1f4..0ec0650693 100644 --- a/compiler/GHC/Stg/Lint.hs +++ b/compiler/GHC/Stg/Lint.hs @@ -245,15 +245,20 @@ lintStgExpr (StgCase scrut bndr alts_type alts) = do lintAlt :: (OutputablePass a, BinderP a ~ Id) - => (AltCon, [Id], GenStgExpr a) -> LintM () + => GenStgAlt a -> LintM () -lintAlt (DEFAULT, _, rhs) = - lintStgExpr rhs +lintAlt GenStgAlt{ alt_con = DEFAULT + , alt_bndrs = _ + , alt_rhs = rhs} = lintStgExpr rhs -lintAlt (LitAlt _, _, rhs) = - lintStgExpr rhs +lintAlt GenStgAlt{ alt_con = LitAlt _ + , alt_bndrs = _ + , alt_rhs = rhs} = lintStgExpr rhs -lintAlt (DataAlt _, bndrs, rhs) = do +lintAlt GenStgAlt{ alt_con = DataAlt _ + , alt_bndrs = bndrs + , alt_rhs = rhs} = + do mapM_ checkPostUnariseBndr bndrs addInScopeVars bndrs (lintStgExpr rhs) -- cgit v1.2.1