--- | Clean out unneeded spill/reload instrs
+{-# OPTIONS -fno-warn-missing-signatures #-}
+-- | Clean out unneeded spill\/reload instrs
--
-- * Handling of join points
--
-- What we really care about here is that on the entry to B3, %r1 will always
-- have the same value that is in SLOT(0) (ie, %r1 is _valid_)
--
--- This also works if the reloads in B1/B2 were spills instead, because
+-- 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.
--
-{-# OPTIONS -fno-warn-missing-signatures #-}
module RegSpillClean (
cleanSpills
)
where
+import BlockId
import RegLiveness
import RegAllocInfo
import MachRegs
type Slot = Int
--- | Clean out unneeded spill/reloads from this top level thing.
+-- | Clean out unneeded spill\/reloads from this top level thing.
cleanSpills :: LiveCmmTop -> LiveCmmTop
cleanSpills cmm
= evalState (cleanSpin 0 cmm) initCleanS
cleanSpin spinCount code
= do
- -- init count of cleaned spills/reloads
+ -- init count of cleaned spills\/reloads
modify $ \s -> s
{ sCleanedSpillsAcc = 0
, sCleanedReloadsAcc = 0
-- safe to erase reloads after join points for the next pass.
collateJoinPoints
- -- remember how many spills/reloads we cleaned in this pass
+ -- remember how many spills\/reloads we cleaned in this pass
spills <- gets sCleanedSpillsAcc
reloads <- gets sCleanedReloadsAcc
modify $ \s -> s
-- reloaded from on this path.
, sReloadedBy :: UniqFM [BlockId]
- -- spills/reloads cleaned each pass (latest at front)
+ -- spills\/reloads cleaned each pass (latest at front)
, sCleanedCount :: [(Int, Int)]
- -- spills/reloads that have been cleaned in this pass so far.
+ -- spills\/reloads that have been cleaned in this pass so far.
, sCleanedSpillsAcc :: Int
, sCleanedReloadsAcc :: Int }