Commit bb7d711c authored by Simon Marlow's avatar Simon Marlow

remove dead code

parent 269b440b
......@@ -14,12 +14,11 @@ module CmmExpr
, GlobalReg(..), globalRegType, spReg, hpReg, spLimReg, nodeReg, node, baseReg
, VGcPtr(..), vgcFlag -- Temporary!
, DefinerOfLocalRegs, UserOfLocalRegs, foldRegsDefd, foldRegsUsed, filterRegsUsed
, DefinerOfSlots, UserOfSlots, foldSlotsDefd, foldSlotsUsed
, RegSet, emptyRegSet, elemRegSet, extendRegSet, deleteFromRegSet, mkRegSet
, plusRegSet, minusRegSet, timesRegSet, sizeRegSet, nullRegSet
, regSetToList
, regUsedIn
, Area(..), SubArea, SubAreaSet, AreaMap
, Area(..)
, module CmmMachOp
, module CmmType
)
......@@ -92,13 +91,6 @@ necessarily at the young end of the Old area.
End of note -}
type SubArea = (Area, Int, Int) -- area, offset, width
type SubAreaSet = Map Area [SubArea]
type AreaMap = Map Area Int
-- Byte offset of the oldest byte of the Area,
-- relative to the oldest byte of the Old Area
data CmmLit
= CmmInt !Integer Width
-- Interpretation: the 2's complement representation of the value
......@@ -281,38 +273,6 @@ reg `regUsedIn` CmmRegOff reg' _ = reg == reg'
reg `regUsedIn` CmmMachOp _ es = any (reg `regUsedIn`) es
_ `regUsedIn` CmmStackSlot _ _ = False
-----------------------------------------------------------------------------
-- Stack slot use information for expressions and other types [_$_]
-----------------------------------------------------------------------------
-- Fold over the area, the offset into the area, and the width of the subarea.
class UserOfSlots a where
foldSlotsUsed :: (b -> SubArea -> b) -> b -> a -> b
class DefinerOfSlots a where
foldSlotsDefd :: (b -> SubArea -> b) -> b -> a -> b
instance UserOfSlots CmmExpr where
foldSlotsUsed f z e = expr z e
where expr z (CmmLit _) = z
expr z (CmmLoad (CmmStackSlot a i) ty) = f z (a, i, widthInBytes $ typeWidth ty)
expr z (CmmLoad addr _) = foldSlotsUsed f z addr
expr z (CmmReg _) = z
expr z (CmmMachOp _ exprs) = foldSlotsUsed f z exprs
expr z (CmmRegOff _ _) = z
expr z (CmmStackSlot _ _) = z
instance UserOfSlots a => UserOfSlots [a] where
foldSlotsUsed _ set [] = set
foldSlotsUsed f set (x:xs) = foldSlotsUsed f (foldSlotsUsed f set x) xs
instance DefinerOfSlots a => DefinerOfSlots [a] where
foldSlotsDefd _ set [] = set
foldSlotsDefd f set (x:xs) = foldSlotsDefd f (foldSlotsDefd f set x) xs
instance DefinerOfSlots SubArea where
foldSlotsDefd f z a = f z a
-----------------------------------------------------------------------------
-- Global STG registers
-----------------------------------------------------------------------------
......
......@@ -280,37 +280,6 @@ instance DefinerOfLocalRegs (CmmNode e x) where
fold f z n = foldRegsDefd f z n
instance UserOfSlots (CmmNode e x) where
foldSlotsUsed f z n = case n of
CmmAssign _ expr -> fold f z expr
CmmStore addr rval -> fold f (fold f z addr) rval
CmmUnsafeForeignCall _ _ args -> fold f z args
CmmCondBranch expr _ _ -> fold f z expr
CmmSwitch expr _ -> fold f z expr
CmmCall {cml_target=tgt} -> fold f z tgt
CmmForeignCall {tgt=tgt, args=args} -> fold f (fold f z tgt) args
_ -> z
where fold :: forall a b.
UserOfSlots a =>
(b -> SubArea -> b) -> b -> a -> b
fold f z n = foldSlotsUsed f z n
instance UserOfSlots ForeignTarget where
foldSlotsUsed f z (ForeignTarget e _) = foldSlotsUsed f z e
foldSlotsUsed _f z (PrimTarget _) = z
instance DefinerOfSlots (CmmNode e x) where
foldSlotsDefd f z n = case n of
CmmStore (CmmStackSlot a i) expr -> f z (a, i, widthInBytes $ typeWidth $ cmmExprType expr)
-- CmmForeignCall {res=res} -> fold f z $ map foreign_call_slot res
_ -> z
where
fold :: forall a b.
DefinerOfSlots a =>
(b -> SubArea -> b) -> b -> a -> b
fold f z n = foldSlotsDefd f z n
-- foreign_call_slot r = case widthInBytes $ typeWidth $ localRegType r of w -> (RegSlot r, w, w)
-----------------------------------
-- mapping Expr in CmmNode
......
......@@ -216,16 +216,9 @@ instance UserOfLocalRegs CmmCallTarget where
foldRegsUsed f set (CmmCallee e _) = foldRegsUsed f set e
foldRegsUsed _ set (CmmPrim {}) = set
instance UserOfSlots CmmCallTarget where
foldSlotsUsed f set (CmmCallee e _) = foldSlotsUsed f set e
foldSlotsUsed _ set (CmmPrim {}) = set
instance UserOfLocalRegs a => UserOfLocalRegs (CmmHinted a) where
foldRegsUsed f set a = foldRegsUsed f set (hintlessCmm a)
instance UserOfSlots a => UserOfSlots (CmmHinted a) where
foldSlotsUsed f set a = foldSlotsUsed f set (hintlessCmm a)
instance DefinerOfLocalRegs a => DefinerOfLocalRegs (CmmHinted a) where
foldRegsDefd f set a = foldRegsDefd f set (hintlessCmm a)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment