[commit: ghc] wip/T10137: Fix module imports, make validate happier (e2c1b53)

git at git.haskell.org git at git.haskell.org
Sun Mar 8 21:41:23 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T10137
Link       : http://ghc.haskell.org/trac/ghc/changeset/e2c1b53261a90d97bffa47b7aa324fc54133d69d/ghc

>---------------------------------------------------------------

commit e2c1b53261a90d97bffa47b7aa324fc54133d69d
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sun Mar 8 22:25:54 2015 +0100

    Fix module imports, make validate happier


>---------------------------------------------------------------

e2c1b53261a90d97bffa47b7aa324fc54133d69d
 compiler/cmm/CmmCommonBlockElim.hs      |  1 +
 compiler/cmm/CmmContFlowOpt.hs          |  1 +
 compiler/cmm/CmmCreateSwitchPlans.hs    | 32 ++++++++++++++++----------------
 compiler/cmm/CmmLint.hs                 |  1 +
 compiler/cmm/CmmNode.hs                 | 10 ----------
 compiler/cmm/CmmParse.y                 |  1 +
 compiler/cmm/CmmProcPoint.hs            |  1 +
 compiler/cmm/CmmSwitch.hs               |  2 +-
 compiler/cmm/MkGraph.hs                 |  1 +
 compiler/cmm/PprC.hs                    |  1 +
 compiler/cmm/PprCmm.hs                  |  1 +
 compiler/codeGen/StgCmmUtils.hs         |  1 +
 compiler/llvmGen/LlvmCodeGen/CodeGen.hs |  1 +
 compiler/nativeGen/PPC/CodeGen.hs       |  1 +
 compiler/nativeGen/SPARC/CodeGen.hs     |  1 +
 compiler/nativeGen/X86/CodeGen.hs       |  1 +
 16 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs
index 6174929..8f2b07e 100644
--- a/compiler/cmm/CmmCommonBlockElim.hs
+++ b/compiler/cmm/CmmCommonBlockElim.hs
@@ -8,6 +8,7 @@ where
 import BlockId
 import Cmm
 import CmmUtils
+import CmmSwitch
 import CmmContFlowOpt
 import Prelude hiding (iterate, succ, unzip, zip)
 
diff --git a/compiler/cmm/CmmContFlowOpt.hs b/compiler/cmm/CmmContFlowOpt.hs
index 87b84c9..6842687 100644
--- a/compiler/cmm/CmmContFlowOpt.hs
+++ b/compiler/cmm/CmmContFlowOpt.hs
@@ -12,6 +12,7 @@ import Hoopl
 import BlockId
 import Cmm
 import CmmUtils
+import CmmSwitch
 import Maybes
 import Panic
 
diff --git a/compiler/cmm/CmmCreateSwitchPlans.hs b/compiler/cmm/CmmCreateSwitchPlans.hs
index e7dba4d..570ed6e 100644
--- a/compiler/cmm/CmmCreateSwitchPlans.hs
+++ b/compiler/cmm/CmmCreateSwitchPlans.hs
@@ -19,6 +19,22 @@ cmmCreateSwitchPlans dflags g = do
     blocks' <- concat <$> mapM (visitSwitches dflags) (toBlockList g)
     return $ ofBlockList (g_entry g) blocks'
 
+visitSwitches :: DynFlags -> CmmBlock -> UniqSM [CmmBlock]
+visitSwitches dflags block
+  | (CmmEntry l s, middle, CmmSwitch expr ids) <- blockSplit block
+  = do
+    let plan = createSwitchPlan ids
+
+    (newTail, newBlocks) <- implementSwitchPlan dflags expr plan
+
+    let block' = CmmEntry l s `blockJoinHead` middle `blockAppend` newTail 
+
+    return $ block' : newBlocks
+
+  | otherwise
+  = return [block]
+
+
 -- Implementing a switch plan (returning a tail block)
 implementSwitchPlan :: DynFlags -> CmmExpr -> SwitchPlan -> UniqSM (Block CmmNode O C, [CmmBlock])
 implementSwitchPlan _ _ (Unconditionally l)
@@ -57,19 +73,3 @@ implementSwitchPlan' dflags expr p
     return (bid, block: newBlocks)
 
 
-visitSwitches :: DynFlags -> CmmBlock -> UniqSM [CmmBlock]
-visitSwitches dflags block
-  | (CmmEntry l s, middle, CmmSwitch expr ids) <- blockSplit block
-  = do
-    let plan = createSwitchPlan ids
-
-    (newTail, newBlocks) <- implementSwitchPlan dflags expr plan
-
-    let block' = CmmEntry l s `blockJoinHead` middle `blockAppend` newTail 
-
-    return $ block' : newBlocks
-
-  | otherwise
-  = return [block]
-
-
diff --git a/compiler/cmm/CmmLint.hs b/compiler/cmm/CmmLint.hs
index 89de56d..d1e80fd 100644
--- a/compiler/cmm/CmmLint.hs
+++ b/compiler/cmm/CmmLint.hs
@@ -14,6 +14,7 @@ import Hoopl
 import Cmm
 import CmmUtils
 import CmmLive
+import CmmSwitch
 import PprCmm ()
 import BlockId
 import FastString
diff --git a/compiler/cmm/CmmNode.hs b/compiler/cmm/CmmNode.hs
index 1d7211a..1899a00 100644
--- a/compiler/cmm/CmmNode.hs
+++ b/compiler/cmm/CmmNode.hs
@@ -19,16 +19,6 @@ module CmmNode (
 
      -- * Tick scopes
      CmmTickScope(..), isTickSubScope, combineTickScopes,
-
-     -- * Switch
-     SwitchTargets,
-     mkSwitchTargets,
-     switchTargetsCases, switchTargetsDefault, switchTargetsRange,
-     mapSwitchTargets, switchTargetsToTable, switchTargetsFallThrough,
-     switchTargetsToList, eqSwitchTargetWith,
-
-     SwitchPlan(..),
-     createSwitchPlan,
   ) where
 
 import CodeGen.Platform
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 7ec1e4a..0322927 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -226,6 +226,7 @@ import CmmOpt
 import MkGraph
 import Cmm
 import CmmUtils
+import CmmSwitch
 import CmmInfo
 import BlockId
 import CmmLex
diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs
index 147afe5..a310482 100644
--- a/compiler/cmm/CmmProcPoint.hs
+++ b/compiler/cmm/CmmProcPoint.hs
@@ -18,6 +18,7 @@ import PprCmm ()
 import CmmUtils
 import CmmInfo
 import CmmLive (cmmGlobalLiveness)
+import CmmSwitch
 import Data.List (sortBy)
 import Maybes
 import Control.Monad
diff --git a/compiler/cmm/CmmSwitch.hs b/compiler/cmm/CmmSwitch.hs
index bbc1199..c5c328a 100644
--- a/compiler/cmm/CmmSwitch.hs
+++ b/compiler/cmm/CmmSwitch.hs
@@ -129,7 +129,7 @@ data SwitchPlan
 
 createSwitchPlan :: SwitchTargets -> SwitchPlan
 createSwitchPlan ids = 
-    pprTrace "createSwitchPlan" (text (show ids) $$ text (show (range,m)) $$ text (show pieces) $$ text (show flatPlan) $$ text (show plan)) $
+    -- pprTrace "createSwitchPlan" (text (show ids) $$ text (show (range,m)) $$ text (show pieces) $$ text (show flatPlan) $$ text (show plan)) $
     plan 
   where
     (range, m, wrap) = addRange ids
diff --git a/compiler/cmm/MkGraph.hs b/compiler/cmm/MkGraph.hs
index f6b9225..6a7ee01 100644
--- a/compiler/cmm/MkGraph.hs
+++ b/compiler/cmm/MkGraph.hs
@@ -22,6 +22,7 @@ where
 import BlockId
 import Cmm
 import CmmCallConv
+import CmmSwitch
 
 import Compiler.Hoopl hiding (Unique, (<*>), mkFirst, mkMiddle, mkLast, mkLabel, mkBranch, Shape(..))
 import DynFlags
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index 5608828..92c8182 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -33,6 +33,7 @@ import Cmm hiding (pprBBlock)
 import PprCmm ()
 import Hoopl
 import CmmUtils
+import CmmSwitch
 
 -- Utils
 import CPrim
diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs
index dac6c46..e623a49 100644
--- a/compiler/cmm/PprCmm.hs
+++ b/compiler/cmm/PprCmm.hs
@@ -43,6 +43,7 @@ import BlockId ()
 import CLabel
 import Cmm
 import CmmUtils
+import CmmSwitch
 import DynFlags
 import FastString
 import Outputable
diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs
index b3cafc6..fd4afbc 100644
--- a/compiler/codeGen/StgCmmUtils.hs
+++ b/compiler/codeGen/StgCmmUtils.hs
@@ -51,6 +51,7 @@ import MkGraph
 import CodeGen.Platform
 import CLabel
 import CmmUtils
+import CmmSwitch
 
 import ForeignCall
 import IdInfo
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 9049214..4f864b6 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -18,6 +18,7 @@ import Cmm
 import CPrim
 import PprCmm
 import CmmUtils
+import CmmSwitch
 import Hoopl
 
 import DynFlags
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
index fb42c07..a115980 100644
--- a/compiler/nativeGen/PPC/CodeGen.hs
+++ b/compiler/nativeGen/PPC/CodeGen.hs
@@ -45,6 +45,7 @@ import BlockId
 import PprCmm           ( pprExpr )
 import Cmm
 import CmmUtils
+import CmmSwitch
 import CLabel
 import Hoopl
 
diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs
index 3f49afe..a9d8619 100644
--- a/compiler/nativeGen/SPARC/CodeGen.hs
+++ b/compiler/nativeGen/SPARC/CodeGen.hs
@@ -43,6 +43,7 @@ import NCGMonad
 import BlockId
 import Cmm
 import CmmUtils
+import CmmSwitch
 import Hoopl
 import PIC
 import Reg
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index a826531..7b7cc54 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -45,6 +45,7 @@ import BlockId
 import Module           ( primPackageKey )
 import PprCmm           ()
 import CmmUtils
+import CmmSwitch
 import Cmm
 import Hoopl
 import CLabel



More information about the ghc-commits mailing list