[project @ 2004-08-10 09:02:36 by simonmar]
[ghc-hetmet.git] / ghc / compiler / codeGen / CgExpr.lhs
index 3f900d1..88771b9 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.58 2004/08/10 09:02:41 simonmar Exp $
 %
 %********************************************************
 %*                                                     *
@@ -18,14 +18,14 @@ import Constants    ( mAX_SPEC_SELECTEE_SIZE, mAX_SPEC_AP_SIZE )
 import StgSyn
 import CgMonad
 import AbsCSyn
-import AbsCUtils       ( mkAbstractCs, getAmodeRep )
+import AbsCUtils       ( mkAbstractCs, getAmodeRep, shimFCallArg )
 import CLabel          ( mkClosureTblLabel )
 
 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 )
@@ -41,12 +41,10 @@ import Id           ( idPrimRep, Id )
 import VarSet
 import PrimOp          ( primOpOutOfLine, getPrimOpResultInfo, 
                          PrimOp(..), PrimOpResultInfo(..) )
-import TysPrim         ( foreignObjPrimTyCon, arrayPrimTyCon, 
-                         byteArrayPrimTyCon, mutableByteArrayPrimTyCon,
-                         mutableArrayPrimTyCon )
 import PrimRep         ( PrimRep(..), isFollowableRep )
 import TyCon           ( isUnboxedTupleTyCon, isEnumerationTyCon )
-import Type            ( Type, typePrimRep, tyConAppArgs, tyConAppTyCon, repType )
+import Type            ( Type, typePrimRep, tyConAppArgs, 
+                         tyConAppTyCon, repType )
 import Maybes          ( maybeToBool )
 import ListSetOps      ( assocMaybe )
 import Unique          ( mkBuiltinUnique )
@@ -234,11 +232,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`
 
@@ -485,19 +478,6 @@ primRetUnboxedTuple op args res_ty
       temp_uniqs  = map mkBuiltinUnique [ n_args .. n_args + length ty_args - 1]
       temp_amodes = zipWith CTemp temp_uniqs prim_reps
     in
-    ccallReturnUnboxedTuple temp_amodes        
+    ccallReturnUnboxedTuple temp_amodes
        (absC (COpStmt temp_amodes op arg_temps []))
-
-
-shimFCallArg arg amode
-  | tycon == foreignObjPrimTyCon
-       = CMacroExpr AddrRep ForeignObj_CLOSURE_DATA [amode]
-  | tycon == arrayPrimTyCon || tycon == mutableArrayPrimTyCon
-       = CMacroExpr PtrRep PTRS_ARR_CTS [amode]
-  | tycon == byteArrayPrimTyCon || tycon == mutableByteArrayPrimTyCon
-       = CMacroExpr AddrRep BYTE_ARR_CTS [amode]
-  | otherwise = amode
-  where        
-       -- should be a tycon app, since this is a foreign call
-       tycon = tyConAppTyCon (repType (stgArgType arg))
 \end{code}