summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorMichal Terepeta <michal.terepeta@gmail.com>2017-06-23 11:41:50 -0400
committerBen Gamari <ben@smart-cactus.org>2017-06-23 13:07:30 -0400
commit42eee6eac3d4bf4b2b557cdc13f2d5acae93d4e8 (patch)
tree68a7bfe0f71a983784afb6c3ba1fcfdbaf62a546 /compiler/nativeGen
parent9077120918b78f5152bf3596fe6df07b91cead79 (diff)
downloadhaskell-42eee6eac3d4bf4b2b557cdc13f2d5acae93d4e8.tar.gz
Hoopl: remove dependency on Hoopl package
This copies the subset of Hoopl's functionality needed by GHC to `cmm/Hoopl` and removes the dependency on the Hoopl package. The main motivation for this change is the confusing/noisy interface between GHC and Hoopl: - Hoopl has `Label` which is GHC's `BlockId` but different than GHC's `CLabel` - Hoopl has `Unique` which is different than GHC's `Unique` - Hoopl has `Unique{Map,Set}` which are different than GHC's `Uniq{FM,Set}` - GHC has its own specialized copy of `Dataflow`, so `cmm/Hoopl` is needed just to filter the exposed functions (filter out some of the Hoopl's and add the GHC ones) With this change, we'll be able to simplify this significantly. It'll also be much easier to do invasive changes (Hoopl is a public package on Hackage with users that depend on the current behavior) This should introduce no changes in functionality - it merely copies the relevant code. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: simonpj, kavon, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3616
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs4
-rw-r--r--compiler/nativeGen/Dwarf.hs3
-rw-r--r--compiler/nativeGen/Instruction.hs3
-rw-r--r--compiler/nativeGen/NCGMonad.hs5
-rw-r--r--compiler/nativeGen/PIC.hs2
-rw-r--r--compiler/nativeGen/PPC/CodeGen.hs3
-rw-r--r--compiler/nativeGen/PPC/Instr.hs3
-rw-r--r--compiler/nativeGen/PPC/Ppr.hs3
-rw-r--r--compiler/nativeGen/RegAlloc/Graph/Spill.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Graph/SpillClean.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Graph/SpillCost.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Linear/Main.hs2
-rw-r--r--compiler/nativeGen/RegAlloc/Liveness.hs3
-rw-r--r--compiler/nativeGen/SPARC/CodeGen.hs3
-rw-r--r--compiler/nativeGen/SPARC/Ppr.hs3
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs3
-rw-r--r--compiler/nativeGen/X86/Instr.hs3
-rw-r--r--compiler/nativeGen/X86/Ppr.hs3
19 files changed, 33 insertions, 21 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index b4cfd8e310..e7a3efdfbe 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -65,7 +65,9 @@ import BlockId
import CgUtils ( fixStgRegisters )
import Cmm
import CmmUtils
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
+import Hoopl.Block
import CmmOpt ( cmmMachOpFold )
import PprCmm
import CLabel
diff --git a/compiler/nativeGen/Dwarf.hs b/compiler/nativeGen/Dwarf.hs
index 1066169639..afeac030fd 100644
--- a/compiler/nativeGen/Dwarf.hs
+++ b/compiler/nativeGen/Dwarf.hs
@@ -26,7 +26,8 @@ import qualified Data.Map as Map
import System.FilePath
import System.Directory ( getCurrentDirectory )
-import qualified Compiler.Hoopl as H
+import qualified Hoopl.Label as H
+import qualified Hoopl.Collections as H
-- | Generate DWARF/debug information
dwarfGen :: DynFlags -> ModLocation -> UniqSupply -> [DebugBlock]
diff --git a/compiler/nativeGen/Instruction.hs b/compiler/nativeGen/Instruction.hs
index ff05cbd111..515d4f3d85 100644
--- a/compiler/nativeGen/Instruction.hs
+++ b/compiler/nativeGen/Instruction.hs
@@ -17,7 +17,8 @@ where
import Reg
import BlockId
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import DynFlags
import Cmm hiding (topInfoTable)
import Platform
diff --git a/compiler/nativeGen/NCGMonad.hs b/compiler/nativeGen/NCGMonad.hs
index 34aaa17701..6af0df5b01 100644
--- a/compiler/nativeGen/NCGMonad.hs
+++ b/compiler/nativeGen/NCGMonad.hs
@@ -42,7 +42,8 @@ import Format
import TargetReg
import BlockId
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import CLabel ( CLabel, mkAsmTempLabel )
import Debug
import FastString ( FastString )
@@ -54,8 +55,6 @@ import Module
import Control.Monad ( liftM, ap )
-import Compiler.Hoopl ( LabelMap, Label )
-
data NatM_State
= NatM_State {
natm_us :: UniqSupply,
diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs
index d6005745b3..bef0a21235 100644
--- a/compiler/nativeGen/PIC.hs
+++ b/compiler/nativeGen/PIC.hs
@@ -58,7 +58,7 @@ import Reg
import NCGMonad
-import Hoopl
+import Hoopl.Collections
import Cmm
import CLabel ( CLabel, ForeignLabelSource(..), pprCLabel,
mkDynamicLinkerLabel, DynamicLinkerLabelInfo(..),
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
index a1a205bb95..1e88a1d025 100644
--- a/compiler/nativeGen/PPC/CodeGen.hs
+++ b/compiler/nativeGen/PPC/CodeGen.hs
@@ -46,7 +46,8 @@ import Cmm
import CmmUtils
import CmmSwitch
import CLabel
-import Hoopl
+import Hoopl.Block
+import Hoopl.Graph
-- The rest:
import OrdList
diff --git a/compiler/nativeGen/PPC/Instr.hs b/compiler/nativeGen/PPC/Instr.hs
index b8b5043d96..eb179c5a99 100644
--- a/compiler/nativeGen/PPC/Instr.hs
+++ b/compiler/nativeGen/PPC/Instr.hs
@@ -33,7 +33,8 @@ import Reg
import CodeGen.Platform
import BlockId
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import DynFlags
import Cmm
import CmmInfo
diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs
index 7f30c5b7ee..63d01c3913 100644
--- a/compiler/nativeGen/PPC/Ppr.hs
+++ b/compiler/nativeGen/PPC/Ppr.hs
@@ -20,7 +20,8 @@ import RegClass
import TargetReg
import Cmm hiding (topInfoTable)
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import CLabel
diff --git a/compiler/nativeGen/RegAlloc/Graph/Spill.hs b/compiler/nativeGen/RegAlloc/Graph/Spill.hs
index 9a3808ad9a..0014ab6fed 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Spill.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Spill.hs
@@ -12,7 +12,7 @@ import Instruction
import Reg
import Cmm hiding (RegSet)
import BlockId
-import Hoopl
+import Hoopl.Collections
import MonadUtils
import State
diff --git a/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs b/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs
index 0811147eda..faef4037c2 100644
--- a/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/SpillClean.hs
@@ -33,7 +33,6 @@ import Instruction
import Reg
import BlockId
-import Hoopl
import Cmm
import UniqSet
import UniqFM
@@ -41,6 +40,7 @@ import Unique
import State
import Outputable
import Platform
+import Hoopl.Collections
import Data.List
import Data.Maybe
diff --git a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs
index 82976c08aa..9811f1a64b 100644
--- a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs
@@ -20,7 +20,7 @@ import Reg
import GraphBase
-import Hoopl (mapLookup)
+import Hoopl.Collections (mapLookup)
import Cmm
import UniqFM
import UniqSet
diff --git a/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs b/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs
index 1b639c9757..c262b2b059 100644
--- a/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/JoinToTargets.hs
@@ -17,7 +17,7 @@ import Instruction
import Reg
import BlockId
-import Hoopl
+import Hoopl.Collections
import Digraph
import DynFlags
import Outputable
diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs
index b7721880c3..2ba682ad17 100644
--- a/compiler/nativeGen/RegAlloc/Linear/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs
@@ -118,7 +118,7 @@ import Instruction
import Reg
import BlockId
-import Hoopl
+import Hoopl.Collections
import Cmm hiding (RegSet)
import Digraph
diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs
index 53e09285c4..e66139786b 100644
--- a/compiler/nativeGen/RegAlloc/Liveness.hs
+++ b/compiler/nativeGen/RegAlloc/Liveness.hs
@@ -39,7 +39,8 @@ import Reg
import Instruction
import BlockId
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import Cmm hiding (RegSet, emptyRegSet)
import PprCmm()
diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs
index 3e9058bdfd..71d320fa63 100644
--- a/compiler/nativeGen/SPARC/CodeGen.hs
+++ b/compiler/nativeGen/SPARC/CodeGen.hs
@@ -44,7 +44,8 @@ import BlockId
import Cmm
import CmmUtils
import CmmSwitch
-import Hoopl
+import Hoopl.Block
+import Hoopl.Graph
import PIC
import Reg
import CLabel
diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs
index 5d6b6f70dc..88b04b952a 100644
--- a/compiler/nativeGen/SPARC/Ppr.hs
+++ b/compiler/nativeGen/SPARC/Ppr.hs
@@ -39,7 +39,8 @@ import PprBase
import Cmm hiding (topInfoTable)
import PprCmm()
import CLabel
-import Hoopl
+import Hoopl.Label
+import Hoopl.Collections
import Unique ( Uniquable(..), pprUniqueAlways )
import Outputable
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index baa5c8f1b8..341fa43dbc 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -55,7 +55,8 @@ import PprCmm ()
import CmmUtils
import CmmSwitch
import Cmm
-import Hoopl
+import Hoopl.Block
+import Hoopl.Graph
import CLabel
import CoreSyn ( Tickish(..) )
import SrcLoc ( srcSpanFile, srcSpanStartLine, srcSpanStartCol )
diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs
index 16e08f3a97..71f50e9d2a 100644
--- a/compiler/nativeGen/X86/Instr.hs
+++ b/compiler/nativeGen/X86/Instr.hs
@@ -26,7 +26,8 @@ import Reg
import TargetReg
import BlockId
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import CodeGen.Platform
import Cmm
import FastString
diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
index bd957b45de..fce432a3dc 100644
--- a/compiler/nativeGen/X86/Ppr.hs
+++ b/compiler/nativeGen/X86/Ppr.hs
@@ -32,7 +32,8 @@ import Reg
import PprBase
-import Hoopl
+import Hoopl.Collections
+import Hoopl.Label
import BasicTypes (Alignment)
import DynFlags
import Cmm hiding (topInfoTable)