[project @ 2000-11-21 14:31:58 by simonmar]
[ghc-hetmet.git] / ghc / compiler / absCSyn / Costs.lhs
index f3aee78..063fe13 100644 (file)
@@ -1,7 +1,7 @@
 %
 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 %
-% $Id: Costs.lhs,v 1.21 2000/03/23 17:45:17 simonpj Exp $
+% $Id: Costs.lhs,v 1.27 2000/10/24 07:35:00 simonpj Exp $
 %
 % Only needed in a GranSim setup -- HWL
 % ---------------------------------------------------------------------------
@@ -67,13 +67,10 @@ import Panic                ( trace )
 
 -- --------------------------------------------------------------------------
 data CostRes = Cost (Int, Int, Int, Int, Int)
-              deriving (Text)
+              deriving (Show)
 
 nullCosts    = Cost (0, 0, 0, 0, 0) :: CostRes
 initHdrCosts = Cost (2, 0, 0, 1, 0) :: CostRes
-errorCosts   = Cost (-1, -1, -1, -1, -1)  -- just for debugging
-
-oneArithm = Cost (1, 0, 0, 0, 0) :: CostRes
 
 instance Eq CostRes where
  (==) t1 t2 = i && b && l && s && f
@@ -289,17 +286,11 @@ addrModeCosts addr_mode side =
     CLit    _     -> if lhs then nullCosts            -- should never occur
                             else Cost (1, 0, 0, 0, 0) -- typ.: mov lit,%reg
 
-    CLitLit _  _   -> if lhs then nullCosts
-                            else Cost (1, 0, 0, 0, 0)
-                     -- same es CLit
-
     CJoinPoint _         -> if lhs then Cost (0, 0, 0, 1, 0)
                                    else Cost (0, 0, 1, 0, 0)
 
     CMacroExpr _ macro mode_list -> exprMacroCosts side macro mode_list
 
-    _ -> trace ("Costs.addrModeCosts") nullCosts
-
 -- ---------------------------------------------------------------------------
 
 exprMacroCosts :: Side -> CExprMacro -> [CAddrMode] -> CostRes
@@ -315,17 +306,12 @@ exprMacroCosts side macro mode_list =
     ARG_TAG -> nullCosts -- nothing
     GET_TAG -> Cost (0, 0, 1, 0, 0)  -- indirect load
     UPD_FRAME_UPDATEE -> Cost (0, 0, 1, 0, 0)  -- indirect load
-    _ -> trace ("Costs.exprMacroCosts") nullCosts
 
 -- ---------------------------------------------------------------------------
 
 stmtMacroCosts :: CStmtMacro -> [CAddrMode] -> CostRes
 
 stmtMacroCosts macro modes =
-  let
-    arg_costs =          foldl (+) nullCosts
-                       [addrModeCosts mode Rhs | mode <- modes]
-  in
   case macro of
     ARGS_CHK_LOAD_NODE  ->  Cost (2, 1, 0, 0, 0)        {- StgMacros.lh  -}
                -- p=probability of PAP (instead of AP): + p*(3,1,0,0,0)
@@ -375,13 +361,9 @@ gmpOps     =
     , IntegerQuotRemOp , IntegerDivModOp , IntegerNegOp
     , IntegerCmpOp
     , Integer2IntOp  , Int2IntegerOp
-    , Addr2IntegerOp
   ]
 
 
-abs_costs = nullCosts   -- NB:  This is normal STG code with costs already 
-                       --      included; no need to add costs again.
-
 umul_costs = Cost (21,4,0,0,0)    -- due to spy counts
 rem_costs =  Cost (30,15,0,0,0)           -- due to spy counts
 div_costs =  Cost (30,15,0,0,0)           -- due to spy counts