-- to a label. To jump to the first block in a Proc,
-- use the appropriate CLabel.
+ [GenCmmCont i] -- Continuations declared in this proc
+
-- some static data.
| CmmData Section [d] -- constant values only
blockStmts (BasicBlock _ stmts) = stmts
+data GenCmmCont i
+ = CmmCont
+ [LocalReg] -- The formal params of the ccntinuation
+ (GenBasicBlock i)
+
+type ContId = BlockId -- Continuation is named (in eg
+ -- also-unwinds-to annotations) via the
+ -- block-id of its GenBasicBlock
+
-----------------------------------------------------------------------------
-- CmmStmt
-- A "statement". Note that all branches are explicit: there are no
CmmCallTarget
[(CmmReg,MachHint)] -- zero or more results
[(CmmExpr,MachHint)] -- zero or more arguments
- (Maybe [GlobalReg]) -- Global regs that may need to be saved
- -- if they will be clobbered by the call.
- -- Nothing <=> save *all* globals that
- -- might be clobbered.
+ Flow
| CmmBranch BlockId -- branch to another BB in this fn
| CmmJump CmmExpr [LocalReg] -- Jump to another function, with these
-- parameters.
+ | CmmSpan CmmSpan [CmmStmt]
+
+-----------------------------------------------------------------------------
+-- CmmSpan
+-----------------------------------------------------------------------------
+
+data CmmSpan = UpdateFrame | CatchFrame -- Etc.
+
-----------------------------------------------------------------------------
-- CmmCallTarget
--
-----------------------------------------------------------------------------
data CmmCallTarget
- = CmmForeignCall -- Call to a foreign function
+ = CmmVanillaCall CmmExpr -- Ordinarly call to a Cmm procedure
+
+ | CmmForeignCall -- Call to a foreign function
CmmExpr -- literal label <=> static call
-- other expression <=> dynamic call
CCallConv -- The calling convention
-- code by the backend.
-----------------------------------------------------------------------------
+-- Flow
+--
+-----------------------------------------------------------------------------
+
+data Flow
+ = Flow { normal_live :: FlowEdge ()
+ , also_unwinds :: [FlowEdge ContId]
+ }
+
+data FlowEdge a
+ = FlowEdge { edge_target :: a
+ , live_locals :: [LocalReg] -- Live across the call
+ , save_globals :: Maybe [GlobalReg] -- Global regs that may need to be saved
+ } -- if they will be clobbered by the call.
+ -- Nothing <=> save *all* globals that
+ -- might be clobbered
+
+-----------------------------------------------------------------------------
-- CmmExpr
-- An expression. Expressions have no side effects.
-----------------------------------------------------------------------------