[project @ 2003-07-02 13:18:24 by simonpj]
authorsimonpj <unknown>
Wed, 2 Jul 2003 13:19:29 +0000 (13:19 +0000)
committersimonpj <unknown>
Wed, 2 Jul 2003 13:19:29 +0000 (13:19 +0000)
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.

ghc/compiler/codeGen/CgCase.lhs
ghc/compiler/codeGen/CgExpr.lhs
ghc/compiler/codeGen/CgLetNoEscape.lhs

index 0e6deff..92d5bba 100644 (file)
@@ -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.
index 3f900d1..d8c7b29 100644 (file)
@@ -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`
 
index 2876eb0..5e57726 100644 (file)
@@ -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