[commit: ghc] master: Cmm jumps always have live register information. (8e81684)

Geoffrey Mainland <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8e8168446a6f1fe2747ba10bc76053097862f4db

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

commit 8e8168446a6f1fe2747ba10bc76053097862f4db
Author: Geoffrey Mainland <[email protected]>
Date:   Wed Oct 17 17:03:13 2012 +0100

    Cmm jumps always have live register information.
    
    Jumps now always have live register information attached, so drop Maybes.

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

 compiler/cmm/CmmCvt.hs                  |    2 +-
 compiler/cmm/OldCmm.hs                  |    2 +-
 compiler/cmm/OldPprCmm.hs               |    4 ++--
 compiler/llvmGen/LlvmCodeGen/CodeGen.hs |    6 +++---
 compiler/nativeGen/X86/CodeGen.hs       |    5 ++---
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/compiler/cmm/CmmCvt.hs b/compiler/cmm/CmmCvt.hs
index 017d120..4830691 100644
--- a/compiler/cmm/CmmCvt.hs
+++ b/compiler/cmm/CmmCvt.hs
@@ -109,7 +109,7 @@ ofZgraph g = Old.ListGraph $ mapMaybe convert_block $ postorderDfs g
                               | otherwise -> [Old.CmmCondBranch expr tid, Old.CmmBranch fid]
                             CmmSwitch arg ids -> [Old.CmmSwitch arg ids]
                             -- ToDo: STG Live
-                            CmmCall e _ r _ _ _ -> [Old.CmmJump e (Just r)]
+                            CmmCall e _ r _ _ _ -> [Old.CmmJump e r]
                             CmmForeignCall {} -> panic "ofZgraph: CmmForeignCall"
                           tail_of bid = case foldBlockNodesB3 (first, middle, last) block () of
                                           Old.BasicBlock _ stmts -> stmts
diff --git a/compiler/cmm/OldCmm.hs b/compiler/cmm/OldCmm.hs
index cf05db9..00f88a4 100644
--- a/compiler/cmm/OldCmm.hs
+++ b/compiler/cmm/OldCmm.hs
@@ -156,7 +156,7 @@ data CmmStmt
 
   | CmmJump                       -- Jump to another C-- function,
       CmmExpr                       -- Target
-      (Maybe [GlobalReg])           -- Live registers at call site;
+      [GlobalReg]                   -- Live registers at call site;
                                     --      Nothing -> no information, assume
                                     --                 all live
                                     --      Just .. -> info on liveness, []
diff --git a/compiler/cmm/OldPprCmm.hs b/compiler/cmm/OldPprCmm.hs
index dcde86e..edfaef8 100644
--- a/compiler/cmm/OldPprCmm.hs
+++ b/compiler/cmm/OldPprCmm.hs
@@ -161,7 +161,7 @@ genCondBranch expr ident =
 --
 --     jump foo(a, b, c);
 --
-genJump :: CmmExpr -> Maybe [GlobalReg] -> SDoc
+genJump :: CmmExpr -> [GlobalReg] -> SDoc
 genJump expr live =
     hcat [ ptext (sLit "jump")
          , space
@@ -171,7 +171,7 @@ genJump expr live =
                     CmmLoad (CmmReg _) _ -> pprExpr expr
                     _                    -> parens (pprExpr expr)
          , semi <+> ptext (sLit "// ")
-         , maybe empty ppr live]
+         , ppr live]
 
 -- --------------------------------------------------------------------------
 -- Return from a function. [1], Section 6.8.2 of version 1.128
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 73cd98f..f73552d 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -510,7 +510,7 @@ cmmPrimOpFunctions env mop
                           ++ " not supported here")
 
 -- | Tail function calls
-genJump :: LlvmEnv -> CmmExpr -> Maybe [GlobalReg] -> UniqSM StmtData
+genJump :: LlvmEnv -> CmmExpr -> [GlobalReg] -> UniqSM StmtData
 
 -- Call to known function
 genJump env (CmmLit (CmmLabel lbl)) live = do
@@ -1258,10 +1258,10 @@ funPrologue dflags = concat $ map getReg $ activeStgRegs platform
 
 -- | Function epilogue. Load STG variables to use as argument for call.
 -- STG Liveness optimisation done here.
-funEpilogue :: LlvmEnv -> Maybe [GlobalReg] -> UniqSM ([LlvmVar], LlvmStatements)
+funEpilogue :: LlvmEnv -> [GlobalReg] -> UniqSM ([LlvmVar], LlvmStatements)
 
 -- Have information and liveness optimisation is enabled
-funEpilogue env (Just live) | gopt Opt_RegLiveness dflags = do
+funEpilogue env live | gopt Opt_RegLiveness dflags = do
     loads <- mapM loadExpr (activeStgRegs platform)
     let (vars, stmts) = unzip loads
     return (vars, concatOL stmts)
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index 7ab30bf..89e81b4 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -173,9 +173,8 @@ stmtToInstrs stmt = do
       panic "stmtToInstrs: return statement should have been cps'd away"
 
 
-jumpRegs :: DynFlags -> Maybe [GlobalReg] -> [Reg]
-jumpRegs dflags Nothing      = allHaskellArgRegs dflags
-jumpRegs dflags (Just gregs) = [ RegReal r | Just r <- map (globalRegMaybe platform) gregs ]
+jumpRegs :: DynFlags -> [GlobalReg] -> [Reg]
+jumpRegs dflags gregs = [ RegReal r | Just r <- map (globalRegMaybe platform) gregs ]
     where platform = targetPlatform dflags
 
 --------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.