Commit 419af4e7 authored by dterei's avatar dterei

Remove unused arg field of CmmReturn

parent ccba0c22
......@@ -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)
......
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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, [])
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment