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 ...@@ -65,6 +65,8 @@ data GenCmmTop d i
-- to a label. To jump to the first block in a Proc, -- to a label. To jump to the first block in a Proc,
-- use the appropriate CLabel. -- use the appropriate CLabel.
[GenCmmCont i] -- Continuations declared in this proc
-- some static data. -- some static data.
| CmmData Section [d] -- constant values only | CmmData Section [d] -- constant values only
...@@ -93,6 +95,15 @@ blockStmts :: GenBasicBlock i -> [i] ...@@ -93,6 +95,15 @@ blockStmts :: GenBasicBlock i -> [i]
blockStmts (BasicBlock _ stmts) = stmts 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 -- CmmStmt
-- A "statement". Note that all branches are explicit: there are no -- A "statement". Note that all branches are explicit: there are no
...@@ -113,10 +124,7 @@ data CmmStmt ...@@ -113,10 +124,7 @@ data CmmStmt
CmmCallTarget CmmCallTarget
[(CmmReg,MachHint)] -- zero or more results [(CmmReg,MachHint)] -- zero or more results
[(CmmExpr,MachHint)] -- zero or more arguments [(CmmExpr,MachHint)] -- zero or more arguments
(Maybe [GlobalReg]) -- Global regs that may need to be saved Flow
-- if they will be clobbered by the call.
-- Nothing <=> save *all* globals that
-- might be clobbered.
| CmmBranch BlockId -- branch to another BB in this fn | CmmBranch BlockId -- branch to another BB in this fn
...@@ -131,6 +139,14 @@ data CmmStmt ...@@ -131,6 +139,14 @@ data CmmStmt
| CmmJump CmmExpr [LocalReg] -- Jump to another function, with these | CmmJump CmmExpr [LocalReg] -- Jump to another function, with these
-- parameters. -- parameters.
| CmmSpan CmmSpan [CmmStmt]
-----------------------------------------------------------------------------
-- CmmSpan
-----------------------------------------------------------------------------
data CmmSpan = UpdateFrame | CatchFrame -- Etc.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- CmmCallTarget -- CmmCallTarget
-- --
...@@ -138,7 +154,9 @@ data CmmStmt ...@@ -138,7 +154,9 @@ data CmmStmt
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
data 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 CmmExpr -- literal label <=> static call
-- other expression <=> dynamic call -- other expression <=> dynamic call
CCallConv -- The calling convention CCallConv -- The calling convention
...@@ -147,6 +165,24 @@ data CmmCallTarget ...@@ -147,6 +165,24 @@ data CmmCallTarget
CallishMachOp -- These might be implemented as inline CallishMachOp -- These might be implemented as inline
-- code by the backend. -- 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 -- CmmExpr
-- An expression. Expressions have no side effects. -- 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