diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-09-02 16:23:22 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-04 16:24:59 -0400 |
commit | 89ce7cdf977304cb7d0f325a013f822600c1bfbf (patch) | |
tree | baa862e1bfc0f2dab23c70353a190cc6e67d7e9d /compiler/GHC/Cmm/Node.hs | |
parent | 1d6d648866da9e7754859c48235f8009b8c130fd (diff) | |
download | haskell-89ce7cdf977304cb7d0f325a013f822600c1bfbf.tar.gz |
DynFlags: use Platform in foldRegs*
Diffstat (limited to 'compiler/GHC/Cmm/Node.hs')
-rw-r--r-- | compiler/GHC/Cmm/Node.hs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/compiler/GHC/Cmm/Node.hs b/compiler/GHC/Cmm/Node.hs index 01db60b116..9e5b709385 100644 --- a/compiler/GHC/Cmm/Node.hs +++ b/compiler/GHC/Cmm/Node.hs @@ -31,7 +31,6 @@ import GHC.Prelude hiding (succ) import GHC.Platform.Regs import GHC.Cmm.Expr import GHC.Cmm.Switch -import GHC.Driver.Session import GHC.Data.FastString import GHC.Types.ForeignCall import GHC.Utils.Outputable @@ -320,7 +319,7 @@ foreignTargetHints target -- Instances of register and slot users / definers instance UserOfRegs LocalReg (CmmNode e x) where - foldRegsUsed dflags f !z n = case n of + foldRegsUsed platform f !z n = case n of CmmAssign _ expr -> fold f z expr CmmStore addr rval -> fold f (fold f z addr) rval CmmUnsafeForeignCall t _ args -> fold f (fold f z t) args @@ -331,10 +330,10 @@ instance UserOfRegs LocalReg (CmmNode e x) where _ -> z where fold :: forall a b. UserOfRegs LocalReg a => (b -> LocalReg -> b) -> b -> a -> b - fold f z n = foldRegsUsed dflags f z n + fold f z n = foldRegsUsed platform f z n instance UserOfRegs GlobalReg (CmmNode e x) where - foldRegsUsed dflags f !z n = case n of + foldRegsUsed platform f !z n = case n of CmmAssign _ expr -> fold f z expr CmmStore addr rval -> fold f (fold f z addr) rval CmmUnsafeForeignCall t _ args -> fold f (fold f z t) args @@ -345,26 +344,26 @@ instance UserOfRegs GlobalReg (CmmNode e x) where _ -> z where fold :: forall a b. UserOfRegs GlobalReg a => (b -> GlobalReg -> b) -> b -> a -> b - fold f z n = foldRegsUsed dflags f z n + fold f z n = foldRegsUsed platform f z n instance (Ord r, UserOfRegs r CmmReg) => UserOfRegs r ForeignTarget where -- The (Ord r) in the context is necessary here -- See Note [Recursive superclasses] in GHC.Tc.TyCl.Instance - foldRegsUsed _ _ !z (PrimTarget _) = z - foldRegsUsed dflags f !z (ForeignTarget e _) = foldRegsUsed dflags f z e + foldRegsUsed _ _ !z (PrimTarget _) = z + foldRegsUsed platform f !z (ForeignTarget e _) = foldRegsUsed platform f z e instance DefinerOfRegs LocalReg (CmmNode e x) where - foldRegsDefd dflags f !z n = case n of + foldRegsDefd platform f !z n = case n of CmmAssign lhs _ -> fold f z lhs CmmUnsafeForeignCall _ fs _ -> fold f z fs CmmForeignCall {res=res} -> fold f z res _ -> z where fold :: forall a b. DefinerOfRegs LocalReg a => (b -> LocalReg -> b) -> b -> a -> b - fold f z n = foldRegsDefd dflags f z n + fold f z n = foldRegsDefd platform f z n instance DefinerOfRegs GlobalReg (CmmNode e x) where - foldRegsDefd dflags f !z n = case n of + foldRegsDefd platform f !z n = case n of CmmAssign lhs _ -> fold f z lhs CmmUnsafeForeignCall tgt _ _ -> fold f z (foreignTargetRegs tgt) CmmCall {} -> fold f z activeRegs @@ -373,9 +372,8 @@ instance DefinerOfRegs GlobalReg (CmmNode e x) where _ -> z where fold :: forall a b. DefinerOfRegs GlobalReg a => (b -> GlobalReg -> b) -> b -> a -> b - fold f z n = foldRegsDefd dflags f z n + fold f z n = foldRegsDefd platform f z n - platform = targetPlatform dflags activeRegs = activeStgRegs platform activeCallerSavesRegs = filter (callerSaves platform) activeRegs |