X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegAlloc%2FGraph%2FCoalesce.hs;h=1eaf00f3a2a2f16ee865473ee1d4ab045e0b0045;hb=f537dd87c4a07526e2b1fc1bd1c125d652833641;hp=74eb0c2f55ced3d34a1284206cdfe0fbc04f583c;hpb=703ca1542c8e0983cc9d8eebce6e9f3dd3fd71e2;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs b/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs index 74eb0c2..1eaf00f 100644 --- a/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs +++ b/compiler/nativeGen/RegAlloc/Graph/Coalesce.hs @@ -12,8 +12,9 @@ import RegAlloc.Liveness import Instruction import Reg -import Cmm +import OldCmm import Bag +import Digraph import UniqFM import UniqSet import UniqSupply @@ -24,7 +25,6 @@ import Data.List -- For Reg -> Reg moves, if the first reg dies at the same time the second reg is born -- 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 :: Instruction instr => [LiveCmmTop instr] @@ -59,7 +59,6 @@ sinkReg fm r -- | Slurp out mov instructions that only serve to join live ranges. -- 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 :: Instruction instr => LiveCmmTop instr @@ -68,13 +67,12 @@ slurpJoinMovs slurpJoinMovs live = slurpCmm emptyBag live where - slurpCmm rs CmmData{} = rs - slurpCmm rs (CmmProc _ _ _ (ListGraph blocks)) = foldl' slurpComp rs blocks - slurpComp rs (BasicBlock _ blocks) = foldl' slurpBlock rs blocks - slurpBlock rs (BasicBlock _ instrs) = foldl' slurpLI rs instrs + slurpCmm rs CmmData{} = rs + slurpCmm rs (CmmProc _ _ sccs) = foldl' slurpBlock rs (flattenSCCs sccs) + slurpBlock rs (BasicBlock _ instrs) = foldl' slurpLI rs instrs - slurpLI rs (Instr _ Nothing) = rs - slurpLI rs (Instr instr (Just live)) + slurpLI rs (LiveInstr _ Nothing) = rs + slurpLI rs (LiveInstr instr (Just live)) | Just (r1, r2) <- takeRegRegMoveInstr instr , elementOfUniqSet r1 $ liveDieRead live , elementOfUniqSet r2 $ liveBorn live @@ -86,8 +84,5 @@ slurpJoinMovs live | otherwise = rs - - slurpLI rs SPILL{} = rs - slurpLI rs RELOAD{} = rs