Commit 3599ea7a authored by simonpj's avatar simonpj
Browse files

[project @ 2004-12-08 15:03:50 by simonpj]

First commit for new Cmm code generation (branch)
parent 7504acab
......@@ -65,6 +65,8 @@ data GenCmmTop d i
-- 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
......@@ -93,6 +95,15 @@ blockStmts :: GenBasicBlock i -> [i]
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
......@@ -113,10 +124,7 @@ data CmmStmt
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
......@@ -131,6 +139,14 @@ data CmmStmt
| CmmJump CmmExpr [LocalReg] -- Jump to another function, with these
-- parameters.
| CmmSpan CmmSpan [CmmStmt]
-----------------------------------------------------------------------------
-- CmmSpan
-----------------------------------------------------------------------------
data CmmSpan = UpdateFrame | CatchFrame -- Etc.
-----------------------------------------------------------------------------
-- CmmCallTarget
--
......@@ -138,7 +154,9 @@ data CmmStmt
-----------------------------------------------------------------------------
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
......@@ -147,6 +165,24 @@ data CmmCallTarget
CallishMachOp -- These might be implemented as inline
-- 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.
......
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