diff options
author | Norman Ramsey <nr@eecs.harvard.edu> | 2007-09-07 16:12:46 +0000 |
---|---|---|
committer | Norman Ramsey <nr@eecs.harvard.edu> | 2007-09-07 16:12:46 +0000 |
commit | fd8d04119e849f9c713d3e697228846d93c5ca69 (patch) | |
tree | 094174348479d042f50a4c85906e9ce8c3b62f88 /compiler/cmm/CmmSpillReload.hs | |
parent | 5f0eea10d6a29f3b2a3faf112279a3c98679c9f8 (diff) | |
download | haskell-fd8d04119e849f9c713d3e697228846d93c5ca69.tar.gz |
a good deal of salutory renaming
I've renamed a number of type and data constructors within Cmm so that
the names used in the compiler may more closely reflect the C--
specification 2.1. I've done a bit of other renaming as well.
Highlights:
CmmFormal and CmmActual now bear a CmmKind (which for now is a
MachHint as before)
CmmFormals = [CmmFormal] and CmmActuals = [CmmActual]
suitable changes have been made to both code and nonterminals in the
Cmm parser (which is as yet untested)
For reasons I don't understand, parts of the code generator use a
sequence of 'formal parameters' with no C-- kinds. For these we now
have the types
type CmmFormalWithoutKind = LocalReg
type CmmFormalsWithoutKinds = [CmmFormalWithoutKind]
A great many appearances of (Tau, MachHint) have been simplified to
the appropriate CmmFormal or CmmActual, though I'm sure there are
more opportunities.
Kind and its data constructors are now renamed to
data GCKind = GCKindPtr | GCKindNonPtr
to avoid confusion with the Kind used in the type checker and with CmmKind.
Finally, in a somewhat unrelated bit (and in honor of Simon PJ, who
thought of the name), the Whalley/Davidson 'transaction limit' is now
called 'OptimizationFuel' with the net effect that there are no longer
two unrelated uses of the abbreviation 'tx'.
Diffstat (limited to 'compiler/cmm/CmmSpillReload.hs')
-rw-r--r-- | compiler/cmm/CmmSpillReload.hs | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/compiler/cmm/CmmSpillReload.hs b/compiler/cmm/CmmSpillReload.hs index bef608036b..3142e8e62d 100644 --- a/compiler/cmm/CmmSpillReload.hs +++ b/compiler/cmm/CmmSpillReload.hs @@ -107,15 +107,7 @@ middleDualLiveness live m@(Reload regs) = where live' = DualLive { on_stack = on_stack live `plusRegSet` regs , in_regs = in_regs live `minusRegSet` regs } -middleDualLiveness live (NotSpillOrReload m) = middle m live - where middle (MidNop) = id - middle (MidComment {}) = id - middle (MidAssign (CmmLocal reg') expr) = changeRegs (gen expr . kill reg') - middle (MidAssign (CmmGlobal _) expr) = changeRegs (gen expr) - middle (MidStore addr rval) = changeRegs (gen addr . gen rval) - middle (MidUnsafeCall _ ress args) = changeRegs (gen args . kill ress) - middle (CopyIn _ formals _) = changeRegs (kill formals) - middle (CopyOut _ formals) = changeRegs (gen formals) +middleDualLiveness live (NotSpillOrReload m) = changeRegs (middleLiveness m) live lastDualLiveness :: (BlockId -> DualLive) -> Last -> DualLive lastDualLiveness env l = last l @@ -196,6 +188,37 @@ show_regs :: String -> RegSet -> Middle show_regs s regs = MidComment $ mkFastString $ showSDoc $ ppr_regs s regs +---------------------------------------------------------------- +--- sinking reloads + +{- + +-- The idea is to compute at each point the set of registers such that +-- on every path to the point, the register is defined by a Reload +-- instruction. Then, if a use appears at such a point, we can safely +-- insert a Reload right before the use. Finally, we can eliminate +-- the early reloads along with other dead assignments. + +data AvailRegs = UniverseMinus RegSet + | AvailRegs RegSet + +availRegsLattice :: DataflowLattice AvailRegs +availRegsLattice = + DataflowLattice "register gotten from reloads" empty add False + where empty = DualLive emptyRegSet emptyRegSet + -- | compute in the Tx monad to track whether anything has changed + add new old = do stack <- add1 (on_stack new) (on_stack old) + regs <- add1 (in_regs new) (in_regs old) + return $ DualLive stack regs + add1 = fact_add_to liveLattice + + + + +-} + + + --------------------- -- prettyprinting |