Cmm jumps always have live register information.

Jumps now always have live register information attached, so drop Maybes.
parent 092c0bd4
......@@ -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
......
......@@ -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, []
......
......@@ -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
......
......@@ -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)
......
......@@ -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
--------------------------------------------------------------------------------
......
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