diff options
| author | David Terei <davidterei@gmail.com> | 2011-12-22 14:48:56 -0800 |
|---|---|---|
| committer | David Terei <davidterei@gmail.com> | 2012-01-05 17:05:44 -0800 |
| commit | 419af4e718b3c79ee814fb36bd6f5da5e06e7001 (patch) | |
| tree | 509f68331328c1147e16ea019260e85dacf50516 | |
| parent | ccba0c2275f16d816e212448466a60866fe5183f (diff) | |
| download | haskell-419af4e718b3c79ee814fb36bd6f5da5e06e7001.tar.gz | |
Remove unused arg field of CmmReturn
| -rw-r--r-- | compiler/cmm/CmmLint.hs | 4 | ||||
| -rw-r--r-- | compiler/cmm/CmmOpt.hs | 2 | ||||
| -rw-r--r-- | compiler/cmm/CmmParse.y | 5 | ||||
| -rw-r--r-- | compiler/cmm/OldCmm.hs | 3 | ||||
| -rw-r--r-- | compiler/cmm/OldPprCmm.hs | 11 | ||||
| -rw-r--r-- | compiler/cmm/PprC.hs | 2 | ||||
| -rw-r--r-- | compiler/codeGen/CgMonad.lhs | 2 | ||||
| -rw-r--r-- | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 | ||||
| -rw-r--r-- | compiler/nativeGen/PPC/CodeGen.hs | 2 | ||||
| -rw-r--r-- | compiler/nativeGen/SPARC/CodeGen.hs | 2 | ||||
| -rw-r--r-- | compiler/nativeGen/X86/CodeGen.hs | 2 |
11 files changed, 16 insertions, 21 deletions
diff --git a/compiler/cmm/CmmLint.hs b/compiler/cmm/CmmLint.hs index db6dd2fc26..a99e5a50a8 100644 --- a/compiler/cmm/CmmLint.hs +++ b/compiler/cmm/CmmLint.hs @@ -144,8 +144,8 @@ lintCmmStmt platform labels = lint else cmmLintErr (text "switch scrutinee is not a word: " <> pprPlatform platform e <> text " :: " <> ppr erep) lint (CmmJump e) = lintCmmExpr platform e >> return () - lint (CmmReturn ress) = mapM_ (lintCmmExpr platform . hintlessCmm) ress - lint (CmmBranch id) = checkTarget id + lint (CmmReturn) = return () + lint (CmmBranch id) = checkTarget id checkTarget id = if setMember id labels then return () else cmmLintErr (text "Branch to nonexistent id" <+> ppr id) diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 649dbb578c..84f106980e 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -66,7 +66,7 @@ cmmEliminateDeadBlocks blocks@(BasicBlock base_id _:_) = stmt m (CmmCondBranch e b) = b:(expr m e) stmt m (CmmSwitch e bs) = catMaybes bs ++ expr m e stmt m (CmmJump e) = expr m e - stmt m (CmmReturn as) = actuals m as + stmt m (CmmReturn) = m actuals m as = foldl' (\m h -> expr m (hintlessCmm h)) m as -- We have to do a deep fold into CmmExpr because -- there may be a BlockId in the CmmBlock literal. diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index 6660a0c33e..f20a05f40f 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -413,8 +413,8 @@ stmt :: { ExtCode } { do l <- lookupLabel $2; stmtEC (CmmBranch l) } | 'jump' expr ';' { do e <- $2; stmtEC (CmmJump e) } - | 'return' maybe_actuals ';' - { do e <- sequence $2; stmtEC (CmmReturn e) } + | 'return' ';' + { stmtEC CmmReturn } | 'if' bool_expr 'goto' NAME { do l <- lookupLabel $4; cmmRawIf $2 l } | 'if' bool_expr '{' body '}' else @@ -946,7 +946,6 @@ emitRetUT args = do -- simultaneous assignments here (#3546) when (sp /= 0) $ stmtC (CmmAssign spReg (cmmRegOffW spReg (-sp))) stmtC $ CmmJump (entryCode (CmmLoad (cmmRegOffW spReg sp) bWord)) - -- TODO (when using CPS): emitStmt (CmmReturn (map snd args)) -- ----------------------------------------------------------------------------- -- If-then-else and boolean expressions diff --git a/compiler/cmm/OldCmm.hs b/compiler/cmm/OldCmm.hs index fae6c8dc4b..d3dc3741b9 100644 --- a/compiler/cmm/OldCmm.hs +++ b/compiler/cmm/OldCmm.hs @@ -164,7 +164,6 @@ data CmmStmt -- Old-style | CmmJump CmmExpr -- Jump to another C-- function, | CmmReturn -- Return from a native C-- function, - [HintedCmmActual] -- with these return values. (parameters never used) data CmmHinted a = CmmHinted { hintlessCmm :: a, cmmHint :: New.ForeignHint } deriving( Eq ) @@ -188,7 +187,7 @@ instance UserOfLocalRegs CmmStmt where stmt (CmmCondBranch e _) = gen e stmt (CmmSwitch e _) = gen e stmt (CmmJump e) = gen e - stmt (CmmReturn es) = gen es + stmt (CmmReturn) = id gen :: UserOfLocalRegs a => a -> b -> b gen a set = foldRegsUsed f set a diff --git a/compiler/cmm/OldPprCmm.hs b/compiler/cmm/OldPprCmm.hs index d6db11bd4f..a0c2fc33b3 100644 --- a/compiler/cmm/OldPprCmm.hs +++ b/compiler/cmm/OldPprCmm.hs @@ -154,7 +154,7 @@ pprStmt platform stmt = case stmt of CmmBranch ident -> genBranch ident CmmCondBranch expr ident -> genCondBranch platform expr ident CmmJump expr -> genJump platform expr - CmmReturn params -> genReturn platform params + CmmReturn -> genReturn platform CmmSwitch arg ids -> genSwitch platform arg ids -- Just look like a tuple, since it was a tuple before @@ -220,12 +220,9 @@ genJump platform expr = -- -- return (a, b, c); -- -genReturn :: Platform -> [CmmHinted CmmExpr] -> SDoc -genReturn platform args = - hcat [ ptext (sLit "return") - , space - , parens ( commafy $ map (pprPlatform platform) args ) - , semi ] +genReturn :: Platform -> SDoc +genReturn platform = + hcat [ ptext (sLit "return") , semi ] -- -------------------------------------------------------------------------- -- Tabled jump to local label diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index e4a5c5f896..330d09082b 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -172,7 +172,7 @@ pprLocalness lbl | not $ externallyVisibleCLabel lbl = ptext (sLit "static ") pprStmt :: Platform -> CmmStmt -> SDoc pprStmt platform stmt = case stmt of - CmmReturn _ -> panic "pprStmt: return statement should have been cps'd away" + CmmReturn -> panic "pprStmt: return statement should have been cps'd away" CmmNop -> empty CmmComment _ -> empty -- (hang (ptext (sLit "/*")) 3 (ftext s)) $$ ptext (sLit "*/") -- XXX if the string contains "*/", we need to fix it diff --git a/compiler/codeGen/CgMonad.lhs b/compiler/codeGen/CgMonad.lhs index 4617aaa8a3..c05019e3ac 100644 --- a/compiler/codeGen/CgMonad.lhs +++ b/compiler/codeGen/CgMonad.lhs @@ -252,7 +252,7 @@ isJump :: CmmStmt -> Bool isJump (CmmJump _ ) = True isJump (CmmBranch _ ) = True isJump (CmmSwitch _ _) = True -isJump (CmmReturn _ ) = True +isJump (CmmReturn ) = True isJump _ = False isOrdinaryStmt :: CgStmt -> Bool diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index 821ef5b933..b8a44447fa 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -132,7 +132,7 @@ stmtToInstrs env stmt = case stmt of -- CPS, only tail calls, no return's -- Actually, there are a few return statements that occur because of hand -- written Cmm code. - CmmReturn _ + CmmReturn -> return (env, unitOL $ Return Nothing, []) diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 6d91bacb31..8b96f7140a 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -142,7 +142,7 @@ stmtToInstrs stmt = do CmmCondBranch arg id -> genCondJump id arg CmmSwitch arg ids -> genSwitch arg ids CmmJump arg -> genJump arg - CmmReturn _ -> + CmmReturn -> panic "stmtToInstrs: return statement should have been cps'd away" diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs index c37cdd6760..0022e043ee 100644 --- a/compiler/nativeGen/SPARC/CodeGen.hs +++ b/compiler/nativeGen/SPARC/CodeGen.hs @@ -143,7 +143,7 @@ stmtToInstrs stmt = case stmt of CmmSwitch arg ids -> genSwitch arg ids CmmJump arg -> genJump arg - CmmReturn _ + CmmReturn -> panic "stmtToInstrs: return statement should have been cps'd away" diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 9ddcf460b4..b7356ea3fd 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -167,7 +167,7 @@ stmtToInstrs stmt = do CmmCondBranch arg id -> genCondJump id arg CmmSwitch arg ids -> genSwitch arg ids CmmJump arg -> genJump arg - CmmReturn _ -> + CmmReturn -> panic "stmtToInstrs: return statement should have been cps'd away" |
