ghc-6.12.1: The GHC APISource codeContentsIndex
CmmBrokenBlock
Synopsis
data BrokenBlock = BrokenBlock {
brokenBlockId :: BlockId
brokenBlockEntry :: BlockEntryInfo
brokenBlockStmts :: [CmmStmt]
brokenBlockTargets :: [BlockId]
brokenBlockExit :: FinalStmt
}
data BlockEntryInfo
= FunctionEntry CmmInfo CLabel CmmFormals
| ContinuationEntry CmmFormals C_SRT Bool
| ControlEntry
data FinalStmt
= FinalBranch BlockId
| FinalReturn HintedCmmActuals
| FinalJump CmmExpr HintedCmmActuals
| FinalCall BlockId CmmCallTarget HintedCmmFormals HintedCmmActuals C_SRT CmmReturnInfo Bool
| FinalSwitch CmmExpr [Maybe BlockId]
breakBlock :: [BlockId] -> [Unique] -> CmmBasicBlock -> BlockEntryInfo -> ([(BlockId, ContFormat)], [BrokenBlock])
cmmBlockFromBrokenBlock :: BrokenBlock -> CmmBasicBlock
blocksToBlockEnv :: [BrokenBlock] -> BlockEnv BrokenBlock
adaptBlockToFormat :: [(BlockId, ContFormat)] -> Unique -> BrokenBlock -> [BrokenBlock]
selectContinuations :: [(BlockId, ContFormat)] -> [(BlockId, ContFormat)]
data ContFormat
makeContinuationEntries :: [(BlockId, ContFormat)] -> BrokenBlock -> BrokenBlock
Documentation
data BrokenBlock Source
Similar to a CmmBlock with a little extra information to help the CPS analysis.
Constructors
BrokenBlock
brokenBlockId :: BlockIdThe block's label like a CmmBasicBlock
brokenBlockEntry :: BlockEntryInfoWays this block can be entered
brokenBlockStmts :: [CmmStmt]Body like a CmmBasicBlock (but without the last statement)
brokenBlockTargets :: [BlockId]Blocks that this block could branch to either by conditional branches or via the last statement
brokenBlockExit :: FinalStmtThe final statement of the block
data BlockEntryInfo Source
How a block could be entered See Note [An example of CPS conversion]
Constructors
FunctionEntry CmmInfo CLabel CmmFormalsBlock is the beginning of a function, parameters are: 1. Function header info 2. The function name 3. Aguments to function Only the formal parameters are live
ContinuationEntry CmmFormals C_SRT BoolReturn point of a function call, parameters are: 1. return values (argument to continuation) 2. SRT for the continuation's info table 3. True = GC block so ignore stack size Live variables, other than the return values, are on the stack
ControlEntryAny other kind of block. Only entered due to control flow.
data FinalStmt Source
Final statement in a BlokenBlock. Constructors and arguments match those in Cmm, but are restricted to branches, returns, jumps, calls and switches
Constructors
FinalBranch BlockIdSame as CmmBranch. Target must be a ControlEntry
FinalReturn HintedCmmActualsSame as CmmReturn. Parameter is the return values.
FinalJump CmmExpr HintedCmmActualsSame as CmmJump. Parameters: 1. The function to call, 2. Arguments of the call
FinalCall BlockId CmmCallTarget HintedCmmFormals HintedCmmActuals C_SRT CmmReturnInfo BoolSame as CmmCallee followed by CmmGoto. Parameters: 1. Target of the CmmGoto (must be a ContinuationEntry) 2. The function to call 3. Results from call (redundant with ContinuationEntry) 4. Arguments to call 5. SRT for the continuation's info table 6. Does the function return? 7. True = GC block so ignore stack size
FinalSwitch CmmExpr [Maybe BlockId]Same as a CmmSwitch. Paremeters: 1. Scrutinee (zero based) 2. Targets
breakBlockSource
:: [BlockId]Any GC blocks that should be special
-> [Unique]An infinite list of uniques to create names of the new blocks with
-> CmmBasicBlockInput block to break apart
-> BlockEntryInfoInfo for the first created BrokenBlock
-> ([(BlockId, ContFormat)], [BrokenBlock])
Takes a CmmBasicBlock and breaks it up into a list of BrokenBlock by splitting on each CmmCall in the CmmBasicBlock.
cmmBlockFromBrokenBlock :: BrokenBlock -> CmmBasicBlockSource
Convert from a BrokenBlock back to an equivalent CmmBasicBlock Needed by liveness analysis
blocksToBlockEnv :: [BrokenBlock] -> BlockEnv BrokenBlockSource
Build a mapping so we can lookup a BrokenBlock by its BlockId
adaptBlockToFormat :: [(BlockId, ContFormat)] -> Unique -> BrokenBlock -> [BrokenBlock]Source
selectContinuations :: [(BlockId, ContFormat)] -> [(BlockId, ContFormat)]Source
data ContFormat Source
show/hide Instances
makeContinuationEntries :: [(BlockId, ContFormat)] -> BrokenBlock -> BrokenBlockSource
Produced by Haddock version 2.6.0