X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FRegSpillClean.hs;h=a4be8ed22246169d725636901b5f185b12c87d92;hb=16dc208aaad7aadaea970e47b8055d7d7f8781e5;hp=df6686eeb7042f6486660a5f76d0d3879efa03e7;hpb=f3ebc8951ad495a5a027f1f482b45648dfe11c58;p=ghc-hetmet.git diff --git a/compiler/nativeGen/RegSpillClean.hs b/compiler/nativeGen/RegSpillClean.hs index df6686e..a4be8ed 100644 --- a/compiler/nativeGen/RegSpillClean.hs +++ b/compiler/nativeGen/RegSpillClean.hs @@ -22,7 +22,7 @@ -- This also works if the reloads in B1/B2 were spills instead, because -- spilling %r1 to a slot makes that slot have the same value as %r1. -- --- + module RegSpillClean ( cleanSpills ) @@ -37,7 +37,6 @@ import Cmm import UniqSet import UniqFM import State -import Outputable import Data.Maybe import Data.List @@ -118,10 +117,10 @@ cleanReload -> [LiveInstr] -- ^ instrs to clean (in backwards order) -> CleanM [LiveInstr] -- ^ cleaned instrs (in forward order) -cleanReload assoc acc [] +cleanReload _ acc [] = return acc -cleanReload assoc acc (li@(Instr instr live) : instrs) +cleanReload assoc acc (li@(Instr instr _) : instrs) | SPILL reg slot <- instr = let assoc' = addAssoc reg slot -- doing the spill makes reg and slot the same value @@ -146,13 +145,13 @@ cleanReload assoc acc (li@(Instr instr live) : instrs) in cleanReload assoc' (li : acc) instrs -- on a jump, remember the reg/slot association. - | targets <- jumpDests instr [] + | targets <- jumpDests instr [] , not $ null targets = do mapM_ (accJumpValid assoc) targets cleanReload assoc (li : acc) instrs -- writing to a reg changes its value. - | RU read written <- regUsage instr + | RU _ written <- regUsage instr = let assoc' = foldr deleteAAssoc assoc written in cleanReload assoc' (li : acc) instrs @@ -168,11 +167,11 @@ cleanSpill -> [LiveInstr] -- ^ instrs to clean (in forwards order) -> CleanM [LiveInstr] -- ^ cleaned instrs (in backwards order) -cleanSpill unused acc [] +cleanSpill _ acc [] = return acc -cleanSpill unused acc (li@(Instr instr live) : instrs) - | SPILL reg slot <- instr +cleanSpill unused acc (li@(Instr instr _) : instrs) + | SPILL _ slot <- instr = if elementOfUniqSet slot unused -- we can erase this spill because the slot won't be read until after the next one @@ -186,7 +185,7 @@ cleanSpill unused acc (li@(Instr instr live) : instrs) cleanSpill unused' (li : acc) instrs -- if we reload from a slot then it's no longer unused - | RELOAD slot reg <- instr + | RELOAD slot _ <- instr , unused' <- delOneFromUniqSet unused slot = cleanSpill unused' (li : acc) instrs @@ -231,6 +230,7 @@ data CleanS , sCleanedSpillsAcc :: Int , sCleanedReloadsAcc :: Int } +initCleanS :: CleanS initCleanS = CleanS { sJumpValid = emptyUFM