Remove unused imports
[ghc-hetmet.git] / compiler / nativeGen / RegAlloc / Graph / Coalesce.hs
index 34e014c..74eb0c2 100644 (file)
@@ -8,17 +8,16 @@ module RegAlloc.Graph.Coalesce (
 
 where
 
-import Cmm
-import MachRegs
-import RegLiveness
-import RegAllocInfo
+import RegAlloc.Liveness
+import Instruction
+import Reg
 
+import Cmm
 import Bag
 import UniqFM
 import UniqSet
 import UniqSupply
 
-import Control.Monad
 import Data.List
 
 -- | Do register coalescing on this top level thing
@@ -26,7 +25,11 @@ import Data.List
 --     then the mov only serves to join live ranges. The two regs can be renamed to be 
 --     the same and the move instruction safely erased.
 
-regCoalesce :: [LiveCmmTop] -> UniqSM [LiveCmmTop]
+regCoalesce 
+       :: Instruction instr
+       => [LiveCmmTop instr] 
+       -> UniqSM [LiveCmmTop instr]
+
 regCoalesce code
  = do  
        let joins       = foldl' unionBags emptyBag
@@ -57,7 +60,11 @@ sinkReg fm r
 --     During a mov, if the source reg dies and the destiation reg is born
 --     then we can rename the two regs to the same thing and eliminate the move.
 --
-slurpJoinMovs :: LiveCmmTop -> Bag (Reg, Reg)
+slurpJoinMovs 
+       :: Instruction instr
+       => LiveCmmTop instr 
+       -> Bag (Reg, Reg)
+
 slurpJoinMovs live
        = slurpCmm emptyBag live
  where 
@@ -68,7 +75,7 @@ slurpJoinMovs live
                 
         slurpLI    rs (Instr _ Nothing)                 = rs
        slurpLI    rs (Instr instr (Just live))
-               | Just (r1, r2) <- isRegRegMove instr
+               | Just (r1, r2) <- takeRegRegMoveInstr instr
                , elementOfUniqSet r1 $ liveDieRead live
                , elementOfUniqSet r2 $ liveBorn live
 
@@ -80,4 +87,7 @@ slurpJoinMovs live
                | otherwise
                = rs
        
+       slurpLI    rs SPILL{}   = rs
+       slurpLI    rs RELOAD{}  = rs
+