ghc-7.8.0.20140228: The GHC API

Safe HaskellNone
LanguageHaskell98

MkGraph

Synopsis

Documentation

type CmmAGraph = OrdList CgStmt Source

CmmAGraph is a chunk of code consisting of:

  • ordinary statements (assignments, stores etc.)
  • jumps
  • labels
  • out-of-line labelled blocks

The semantics is that control falls through labels and out-of-line blocks. Everything after a jump up to the next label is by definition unreachable code, and will be discarded.

Two CmmAGraphs can be stuck together with *, with the meaning that control flows from the first to the second.

A CmmAGraph can be turned into a CmmGraph (closed at both ends) by providing a label for the entry point; see labelAGraph.

mkLabel :: BlockId -> CmmAGraph Source

created a sequence "goto id; id:" as an AGraph

mkMiddle :: CmmNode O O -> CmmAGraph Source

creates an open AGraph from a given node

mkLast :: CmmNode O C -> CmmAGraph Source

created a closed AGraph from a given node

outOfLine :: BlockId -> CmmAGraph -> CmmAGraph Source

A labelled code block; should end in a last node

lgraphOfAGraph :: CmmAGraph -> UniqSM CmmGraph Source

allocate a fresh label for the entry point

labelAGraph :: BlockId -> CmmAGraph -> CmmGraph Source

use the given BlockId as the label of the entry point

mkRawJump :: DynFlags -> CmmExpr -> UpdFrameOffset -> [GlobalReg] -> CmmAGraph Source

A jump where the caller says what the live GlobalRegs are. Used for low-level hand-written Cmm.

data Transfer Source

Constructors

Call 
JumpRet 
Jump 
Ret 

Instances