diff options
author | simonpj <unknown> | 2003-07-02 13:12:39 +0000 |
---|---|---|
committer | simonpj <unknown> | 2003-07-02 13:12:39 +0000 |
commit | 3f5e4368fd4e87e116ce34be4cf9dd0f9f96726d (patch) | |
tree | 625a62cc8271ec868d6f698f619d6df7e041d174 /ghc/compiler/profiling/SCCfinal.lhs | |
parent | e82f4943bcf9e40188a75ad21d939a1a794c8a16 (diff) | |
download | haskell-3f5e4368fd4e87e116ce34be4cf9dd0f9f96726d.tar.gz |
[project @ 2003-07-02 13:12:33 by simonpj]
------------------------
Tidy up the code generator
------------------------
The code generation for 'case' expressions had grown
huge and gnarly. This commit removes about 120 lines of
code, and makes it a lot easier to read too. I think the code
generated is identical.
Part of this was to simplify the StgCase data type, so
that it is more like the Core case: there is a simple list
of alternatives, and the DEFAULT (if present) must be the
first. This tidies and simplifies other Stg passes.
Diffstat (limited to 'ghc/compiler/profiling/SCCfinal.lhs')
-rw-r--r-- | ghc/compiler/profiling/SCCfinal.lhs | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/ghc/compiler/profiling/SCCfinal.lhs b/ghc/compiler/profiling/SCCfinal.lhs index aca4961f26..508f812cb0 100644 --- a/ghc/compiler/profiling/SCCfinal.lhs +++ b/ghc/compiler/profiling/SCCfinal.lhs @@ -173,33 +173,14 @@ stgMassageForProfiling mod_name us stg_binds do_expr expr `thenMM` \ expr' -> returnMM (StgSCC cc expr') - do_expr (StgCase expr fv1 fv2 bndr srt alts) + do_expr (StgCase expr fv1 fv2 bndr srt alt_type alts) = do_expr expr `thenMM` \ expr' -> - do_alts alts `thenMM` \ alts' -> - returnMM (StgCase expr' fv1 fv2 bndr srt alts') + mapMM do_alt alts `thenMM` \ alts' -> + returnMM (StgCase expr' fv1 fv2 bndr srt alt_type alts') where - do_alts (StgAlgAlts tycon alts def) - = mapMM do_alt alts `thenMM` \ alts' -> - do_deflt def `thenMM` \ def' -> - returnMM (StgAlgAlts tycon alts' def') - where - do_alt (id, bs, use_mask, e) - = do_expr e `thenMM` \ e' -> - returnMM (id, bs, use_mask, e') - - do_alts (StgPrimAlts tycon alts def) - = mapMM do_alt alts `thenMM` \ alts' -> - do_deflt def `thenMM` \ def' -> - returnMM (StgPrimAlts tycon alts' def') - where - do_alt (l,e) - = do_expr e `thenMM` \ e' -> - returnMM (l,e') - - do_deflt StgNoDefault = returnMM StgNoDefault - do_deflt (StgBindDefault e) - = do_expr e `thenMM` \ e' -> - returnMM (StgBindDefault e') + do_alt (id, bs, use_mask, e) + = do_expr e `thenMM` \ e' -> + returnMM (id, bs, use_mask, e') do_expr (StgLet b e) = do_let b e `thenMM` \ (b,e) -> |