diff options
author | simonpj <unknown> | 2003-07-02 13:19:29 +0000 |
---|---|---|
committer | simonpj <unknown> | 2003-07-02 13:19:29 +0000 |
commit | 96fd092f6646f2cd1a71ddb10f4024a9d3da53a3 (patch) | |
tree | fc578acdb837b03c870709c19bdb4303763b89e9 | |
parent | 3f5e4368fd4e87e116ce34be4cf9dd0f9f96726d (diff) | |
download | haskell-96fd092f6646f2cd1a71ddb10f4024a9d3da53a3.tar.gz |
[project @ 2003-07-02 13:18:24 by simonpj]
Fixes two minor bugs that I came across in the old
CgCase code generation:
1. We were generating
tmp = Sp[1]
... more uses of Sp[1]....
instead of
tmp = Sp[1]
... more uses of tmp....
in the (case v of ...prim alts...) situation
2. The cost-centre restoration wasn't right for let-no-escapes
I kept this fix separate, becuase it does change the code generated
slightly.
-rw-r--r-- | ghc/compiler/codeGen/CgCase.lhs | 6 | ||||
-rw-r--r-- | ghc/compiler/codeGen/CgExpr.lhs | 9 | ||||
-rw-r--r-- | ghc/compiler/codeGen/CgLetNoEscape.lhs | 5 |
3 files changed, 6 insertions, 14 deletions
diff --git a/ghc/compiler/codeGen/CgCase.lhs b/ghc/compiler/codeGen/CgCase.lhs index 0e6deff9ce..92d5bba346 100644 --- a/ghc/compiler/codeGen/CgCase.lhs +++ b/ghc/compiler/codeGen/CgCase.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgCase.lhs,v 1.63 2003/07/02 13:12:35 simonpj Exp $ +% $Id: CgCase.lhs,v 1.64 2003/07/02 13:18:24 simonpj Exp $ % %******************************************************** %* * @@ -144,9 +144,7 @@ cgCase (StgApp v []) live_in_whole_case live_in_alts bndr srt getCAddrMode v `thenFC` \ amode -> bindNewToTemp bndr `thenFC` \ tmp_amode -> absC (CAssign tmp_amode amode) `thenC` - cgPrimAlts NoGC amode alts alt_type - -- TEMP Should be tmp_amode, not amode - -- but for line-by-line comparison with old stuff, we pass amode too + cgPrimAlts NoGC tmp_amode alts alt_type \end{code} Special case #3: inline PrimOps. diff --git a/ghc/compiler/codeGen/CgExpr.lhs b/ghc/compiler/codeGen/CgExpr.lhs index 3f900d1c8e..d8c7b29dd8 100644 --- a/ghc/compiler/codeGen/CgExpr.lhs +++ b/ghc/compiler/codeGen/CgExpr.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgExpr.lhs,v 1.54 2003/07/02 13:12:36 simonpj Exp $ +% $Id: CgExpr.lhs,v 1.56 2003/07/02 13:19:28 simonpj Exp $ % %******************************************************** %* * @@ -25,7 +25,7 @@ import SMRep ( fixedHdrSize ) import CoreSyn ( AltCon(..) ) import CgBindery ( getArgAmodes, getArgAmode, CgIdInfo, nukeDeadBindings, addBindC, addBindsC ) -import CgCase ( cgCase, saveVolatileVarsAndRegs, restoreCurrentCostCentre ) +import CgCase ( cgCase, saveVolatileVarsAndRegs ) import CgClosure ( cgRhsClosure, cgStdRhsClosure ) import CgCon ( buildDynCon, cgReturnDataCon ) import CgLetNoEscape ( cgLetNoEscapeClosure ) @@ -234,11 +234,6 @@ cgExpr (StgLetNoEscape live_in_whole_let live_in_rhss bindings body) saveVolatileVarsAndRegs live_in_rhss `thenFC` \ (save_assts, rhs_eob_info, maybe_cc_slot) -> - -- TEMP: put back in for line-by-line compatibility - -- Doesn't look right; surely should restore in the branch! - -- And the code isn't used.... - restoreCurrentCostCentre maybe_cc_slot `thenFC` \ restore_cc -> - -- Save those variables right now! absC save_assts `thenC` diff --git a/ghc/compiler/codeGen/CgLetNoEscape.lhs b/ghc/compiler/codeGen/CgLetNoEscape.lhs index 2876eb0806..5e57726b92 100644 --- a/ghc/compiler/codeGen/CgLetNoEscape.lhs +++ b/ghc/compiler/codeGen/CgLetNoEscape.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % -% $Id: CgLetNoEscape.lhs,v 1.21 2003/07/02 13:12:37 simonpj Exp $ +% $Id: CgLetNoEscape.lhs,v 1.22 2003/07/02 13:19:29 simonpj Exp $ % %******************************************************** %* * @@ -167,8 +167,7 @@ cgLetNoEscapeClosure (deAllocStackTop retPrimRepSize `thenFC` \_ -> forkAbsC ( --- TEMP omit for line-by-line compatibility --- restoreCurrentCostCentre cc_slot `thenC` + restoreCurrentCostCentre cc_slot `thenC` cgLetNoEscapeBody bndr cc args body ) `thenFC` \ abs_c -> mkRetDirectTarget bndr abs_c srt |