ghc-7.0.4: The GHC API

MkZipCfgCmm

Synopsis

- mkNop :: CmmAGraph
- mkAssign :: CmmReg -> CmmExpr -> CmmAGraph
- mkStore :: CmmExpr -> CmmExpr -> CmmAGraph
- mkCall :: CmmExpr -> (Convention, Convention) -> CmmFormals -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkCmmCall :: CmmExpr -> CmmFormals -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkSafeCall :: MidCallTarget -> CmmFormals -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkUnsafeCall :: MidCallTarget -> CmmFormals -> CmmActuals -> CmmAGraph
- mkFinalCall :: CmmExpr -> CCallConv -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkJump :: CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkForeignJump :: Convention -> CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkJumpGC :: CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkCbranch :: CmmExpr -> BlockId -> BlockId -> CmmAGraph
- mkSwitch :: CmmExpr -> [Maybe BlockId] -> CmmAGraph
- mkReturn :: CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkReturnSimple :: CmmActuals -> UpdFrameOffset -> CmmAGraph
- mkComment :: FastString -> CmmAGraph
- copyInOflow :: Convention -> Area -> CmmFormals -> (Int, CmmAGraph)
- copyInSlot :: Convention -> CmmFormals -> CmmAGraph
- copyOutOflow :: Convention -> Transfer -> Area -> CmmActuals -> UpdFrameOffset -> (Int, [Middle])
- copyOutSlot :: Convention -> [LocalReg] -> [Middle]
- mkEntry :: BlockId -> Convention -> CmmFormals -> (Int, CmmAGraph)
- mkCmmIfThenElse :: CmmExpr -> CmmAGraph -> CmmAGraph -> CmmAGraph
- mkCmmIfThen :: CmmExpr -> CmmAGraph -> CmmAGraph
- mkCmmWhileDo :: CmmExpr -> CmmAGraph -> CmmAGraph
- (<*>) :: AGraph m l -> AGraph m l -> AGraph m l
- catAGraphs :: [AGraph m l] -> AGraph m l
- mkLabel :: LastNode l => BlockId -> AGraph m l
- mkBranch :: (Outputable m, Outputable l, LastNode l) => BlockId -> AGraph m l
- emptyAGraph :: AGraph m l
- withFreshLabel :: String -> (BlockId -> AGraph m l) -> AGraph m l
- withUnique :: (Unique -> AGraph m l) -> AGraph m l
- outOfLine :: (LastNode l, Outputable m, Outputable l) => AGraph m l -> AGraph m l
- lgraphOfAGraph :: AGraph m l -> UniqSM (LGraph m l)
- graphOfAGraph :: AGraph m l -> UniqSM (Graph m l)
- labelAGraph :: BlockId -> AGraph m l -> UniqSM (LGraph m l)
- type CmmZ = GenCmm CmmStatic CmmInfo (CmmStackInfo, CmmGraph)
- type CmmTopZ = GenCmmTop CmmStatic CmmInfo (CmmStackInfo, CmmGraph)
- type CmmGraph = LGraph Middle Last
- type CmmBlock = Block Middle Last
- type CmmAGraph = AGraph Middle Last
- type CmmStackInfo = (ByteOff, Maybe ByteOff)
- data Middle
- data Last
- data Convention
  - = NativeDirectCall
  - | NativeNodeCall
  - | NativeReturn
  - | Slow
  - | GC
  - | PrimOpCall
  - | PrimOpReturn
  - | Foreign ForeignConvention
  - | Private
- data ForeignConvention = ForeignConvention CCallConv [ForeignHint] [ForeignHint]
- data MidCallTarget
  - = ForeignTarget CmmExpr ForeignConvention
  - | PrimTarget CallishMachOp
- data Transfer
  - = Call
  - | Jump
  - | Ret
- stackStubExpr :: Width -> CmmExpr
- pprAGraph :: (Outputable m, LastNode l, Outputable l) => AGraph m l -> UniqSM SDoc

# Documentation

mkNop :: CmmAGraph Source

mkAssign :: CmmReg -> CmmExpr -> CmmAGraph Source

mkStore :: CmmExpr -> CmmExpr -> CmmAGraph Source

mkCall :: CmmExpr -> (Convention, Convention) -> CmmFormals -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkCmmCall :: CmmExpr -> CmmFormals -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkSafeCall :: MidCallTarget -> CmmFormals -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkUnsafeCall :: MidCallTarget -> CmmFormals -> CmmActuals -> CmmAGraph Source

mkFinalCall :: CmmExpr -> CCallConv -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkJump :: CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkForeignJump :: Convention -> CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkJumpGC :: CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkCbranch :: CmmExpr -> BlockId -> BlockId -> CmmAGraph Source

mkSwitch :: CmmExpr -> [Maybe BlockId] -> CmmAGraph Source

mkReturn :: CmmExpr -> CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkReturnSimple :: CmmActuals -> UpdFrameOffset -> CmmAGraph Source

mkComment :: FastString -> CmmAGraph Source

copyInOflow :: Convention -> Area -> CmmFormals -> (Int, CmmAGraph)Source

copyInSlot :: Convention -> CmmFormals -> CmmAGraph Source

copyOutOflow :: Convention -> Transfer -> Area -> CmmActuals -> UpdFrameOffset -> (Int, [Middle])Source

copyOutSlot :: Convention -> [LocalReg] -> [Middle]Source

mkEntry :: BlockId -> Convention -> CmmFormals -> (Int, CmmAGraph)Source

mkCmmIfThenElse :: CmmExpr -> CmmAGraph -> CmmAGraph -> CmmAGraph Source

mkCmmIfThen :: CmmExpr -> CmmAGraph -> CmmAGraph Source

mkCmmWhileDo :: CmmExpr -> CmmAGraph -> CmmAGraph Source

(<*>) :: AGraph m l -> AGraph m l -> AGraph m lSource

catAGraphs :: [AGraph m l] -> AGraph m lSource

mkLabel :: LastNode l => BlockId -> AGraph m lSource

mkBranch :: (Outputable m, Outputable l, LastNode l) => BlockId -> AGraph m lSource

emptyAGraph :: AGraph m lSource

A graph is built up by splicing together graphs each containing a single node (where a label is considered a `first` node. The empty graph is a left and right unit for splicing. All of the AGraph constructors (even complex ones like `mkIfThenElse`, as well as the splicing operation *, are constant-time operations.

withFreshLabel :: String -> (BlockId -> AGraph m l) -> AGraph m lSource

This function provides access to fresh labels without requiring clients to be programmed monadically.

withUnique :: (Unique -> AGraph m l) -> AGraph m lSource

outOfLine :: (LastNode l, Outputable m, Outputable l) => AGraph m l -> AGraph m lSource

The argument is an AGraph that has an empty entry sequence and no exit sequence. The result is a new AGraph that has an empty entry sequence connected to an empty exit sequence, with the original graph sitting to the side out-of-line.

Example: mkMiddle (x = 3) * outOfLine (mkLabel L * ...stuff...) * mkMiddle (y = x) Control will flow directly from x=3 to y=x; the block starting with L is on the side.

N.B. algebraically forall g g' : g * outOfLine g' == outOfLine g' * g

lgraphOfAGraphSource

Arguments

:: AGraph m l |
-> UniqSM (LGraph m l) | allocate a fresh label for the entry point

graphOfAGraph :: AGraph m l -> UniqSM (Graph m l)Source

Converting an abstract graph to a concrete form is expensive: the cost is linear in the number of nodes in the answer, plus N log N in the number of basic blocks. The conversion is also monadic because it may require the allocation of fresh, unique labels.

labelAGraphSource

Arguments

:: BlockId |
-> AGraph m l |
-> UniqSM (LGraph m l) | use the given BlockId as the label of the entry point

type CmmZ = GenCmm CmmStatic CmmInfo (CmmStackInfo, CmmGraph)Source

type CmmTopZ = GenCmmTop CmmStatic CmmInfo (CmmStackInfo, CmmGraph)Source

type CmmGraph = LGraph Middle Last Source

type CmmBlock = Block Middle Last Source

type CmmAGraph = AGraph Middle Last Source

type CmmStackInfo = (ByteOff, Maybe ByteOff)Source

data Middle Source

Instances

Eq Middle |
Outputable Middle |
DefinerOfSlots Middle |
UserOfSlots Middle |
DefinerOfLocalRegs Middle |
UserOfLocalRegs Middle |
DebugNodes Middle Last |

data Last Source

Instances

Outputable Last |
DefinerOfSlots Last |
UserOfSlots Last |
DefinerOfLocalRegs Last |
UserOfLocalRegs Last |
LastNode Last |
HavingSuccessors Last |
DebugNodes Middle Last |

data Convention Source

Constructors

NativeDirectCall |
NativeNodeCall |
NativeReturn |
Slow |
GC |
PrimOpCall |
PrimOpReturn |
Foreign ForeignConvention |
Private |

Instances

Eq Convention |
Outputable Convention |

data ForeignConvention Source

Constructors

ForeignConvention CCallConv [ForeignHint] [ForeignHint] |

Instances

Eq ForeignConvention |
Outputable ForeignConvention |

data MidCallTarget Source

Constructors

ForeignTarget CmmExpr ForeignConvention |
PrimTarget CallishMachOp |

Instances

Eq MidCallTarget |
UserOfSlots MidCallTarget |
UserOfLocalRegs MidCallTarget |

data Transfer Source

Constructors

Call |
Jump |
Ret |

Instances

Eq Transfer |

stackStubExpr :: Width -> CmmExpr Source

pprAGraph :: (Outputable m, LastNode l, Outputable l) => AGraph m l -> UniqSM SDoc Source