diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-06-03 20:46:05 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-08-18 22:12:13 -0400 |
commit | 0c5ed5c7eb30bc5462b67ff097c3388597265a4b (patch) | |
tree | d55e420625a2118c7854d2b41bb4ee4ed5755b7f /compiler/GHC/CmmToAsm/BlockLayout.hs | |
parent | aa4b744d51aa6bdb46064f981ea8e001627921d6 (diff) | |
download | haskell-0c5ed5c7eb30bc5462b67ff097c3388597265a4b.tar.gz |
DynFlags: refactor GHC.CmmToAsm (#17957, #10143)
This patch removes the use of `sdocWithDynFlags` from GHC.CmmToAsm.*.Ppr
To do that I've had to make some refactoring:
* X86' and PPC's `Instr` are no longer `Outputable` as they require a
`Platform` argument
* `Instruction` class now exposes `pprInstr :: Platform -> instr -> SDoc`
* as a consequence, I've refactored some modules to avoid .hs-boot files
* added (derived) functor instances for some datatypes parametric in the
instruction type. It's useful for pretty-printing as we just have to
map `pprInstr` before pretty-printing the container datatype.
Diffstat (limited to 'compiler/GHC/CmmToAsm/BlockLayout.hs')
-rw-r--r-- | compiler/GHC/CmmToAsm/BlockLayout.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/CmmToAsm/BlockLayout.hs b/compiler/GHC/CmmToAsm/BlockLayout.hs index d93b84887e..21b6865699 100644 --- a/compiler/GHC/CmmToAsm/BlockLayout.hs +++ b/compiler/GHC/CmmToAsm/BlockLayout.hs @@ -22,6 +22,7 @@ import GHC.Driver.Ppr (pprTrace) import GHC.CmmToAsm.Instr import GHC.CmmToAsm.Monad import GHC.CmmToAsm.CFG +import GHC.CmmToAsm.Types import GHC.Cmm.BlockId import GHC.Cmm @@ -668,7 +669,7 @@ buildChains edges blocks -- | Place basic blocks based on the given CFG. -- See Note [Chain based CFG serialization] -sequenceChain :: forall a i. (Instruction i, Outputable i) +sequenceChain :: forall a i. Instruction i => LabelMap a -- ^ Keys indicate an info table on the block. -> CFG -- ^ Control flow graph and some meta data. -> [GenBasicBlock i] -- ^ List of basic blocks to be placed. @@ -815,7 +816,7 @@ dropJumps info ((BasicBlock lbl ins):todo) -- fallthroughs. sequenceTop - :: (Instruction instr, Outputable instr) + :: Instruction instr => DynFlags -- Determine which layout algo to use -> NcgImpl statics instr jumpDest -> Maybe CFG -- ^ CFG if we have one. |