ghc-7.6.3: The GHC API

Safe Haskell | None

OldCmm

Synopsis

- type CmmGroup = GenCmmGroup CmmStatics CmmInfoTable (ListGraph CmmStmt)
- type GenCmmGroup d h g = [GenCmmDecl d h g]
- type RawCmmGroup = GenCmmGroup CmmStatics (Maybe CmmStatics) (ListGraph CmmStmt)
- type CmmDecl = GenCmmDecl CmmStatics CmmInfoTable (ListGraph CmmStmt)
- type RawCmmDecl = GenCmmDecl CmmStatics (Maybe CmmStatics) (ListGraph CmmStmt)
- newtype ListGraph i = ListGraph [GenBasicBlock i]
- data CmmInfoTable
  - = CmmInfoTable {
    - cit_lbl :: CLabel
    - cit_rep :: SMRep
    - cit_prof :: ProfilingInfo
    - cit_srt :: C_SRT
    }
  - | CmmNonInfoTable
- data ClosureTypeInfo
  - = Constr ConstrTag ConstrDescription
  - | Fun FunArity ArgDescr
  - | Thunk
  - | ThunkSelector SelectorOffset
  - | BlackHole
- data CmmStatic
  - = CmmStaticLit CmmLit
  - | CmmUninitialised Int
  - | CmmString [Word8]
- data CmmStatics = Statics CLabel [CmmStatic]
- type CmmFormal = LocalReg
- type CmmActual = CmmExpr
- cmmMapGraph :: (g -> g') -> GenCmmGroup d h g -> GenCmmGroup d h g'
- cmmTopMapGraph :: (g -> g') -> GenCmmDecl d h g -> GenCmmDecl d h g'
- data GenBasicBlock i = BasicBlock BlockId [i]
- type CmmBasicBlock = GenBasicBlock CmmStmt
- blockId :: GenBasicBlock i -> BlockId
- blockStmts :: GenBasicBlock i -> [i]
- mapBlockStmts :: (i -> i') -> GenBasicBlock i -> GenBasicBlock i'
- data CmmStmt
  - = CmmNop
  - | CmmComment FastString
  - | CmmAssign CmmReg CmmExpr
  - | CmmStore CmmExpr CmmExpr
  - | CmmCall CmmCallTarget [HintedCmmFormal] [HintedCmmActual] CmmReturnInfo
  - | CmmBranch BlockId
  - | CmmCondBranch CmmExpr BlockId
  - | CmmSwitch CmmExpr [Maybe BlockId]
  - | CmmJump CmmExpr (Maybe [GlobalReg])
  - | CmmReturn
- data CmmReturnInfo
  - = CmmMayReturn
  - | CmmNeverReturns
- data CmmHinted a = CmmHinted {
  - hintlessCmm :: a
  - cmmHint :: ForeignHint
  }
- type HintedCmmFormal = CmmHinted CmmFormal
- type HintedCmmActual = CmmHinted CmmActual
- data CmmSafety
  - = CmmUnsafe
  - | CmmSafe C_SRT
  - | CmmInterruptible
- data CmmCallTarget
  - = CmmCallee CmmExpr CCallConv
  - | CmmPrim CallishMachOp (Maybe [CmmStmt])
- data GenCmmDecl d h g
  - = CmmProc h CLabel g
  - | CmmData Section d
- data ForeignHint
  - = NoHint
  - | AddrHint
  - | SignedHint
- module CmmExpr
- data Section
  - = Text
  - | Data
  - | ReadOnlyData
  - | RelocatableReadOnlyData
  - | UninitialisedData
  - | ReadOnlyData16
  - | OtherSection String
- data ProfilingInfo
  - = NoProfilingInfo
  - | ProfilingInfo [Word8] [Word8]
- data C_SRT
  - = NoC_SRT
  - | C_SRT !CLabel !WordOff !StgHalfWord

# Documentation

type CmmGroup = GenCmmGroup CmmStatics CmmInfoTable (ListGraph CmmStmt)

Cmm with the info table as a data type

type GenCmmGroup d h g = [GenCmmDecl d h g]

type RawCmmGroup = GenCmmGroup CmmStatics (Maybe CmmStatics) (ListGraph CmmStmt)

Cmm with the info tables converted to a list of `CmmStatic` along with the info table label. If we are building without tables-next-to-code there will be no statics

INVARIANT: if there is an info table, it has at least one CmmStatic

type CmmDecl = GenCmmDecl CmmStatics CmmInfoTable (ListGraph CmmStmt)

type RawCmmDecl = GenCmmDecl CmmStatics (Maybe CmmStatics) (ListGraph CmmStmt)

newtype ListGraph i

A control-flow graph represented as a list of extended basic blocks.

Code, may be empty. The first block is the entry point. The order is otherwise initially unimportant, but at some point the code gen will fix the order.

BlockIds must be unique across an entire compilation unit, since they are translated to assembly-language labels, which scope across a whole compilation unit.

Constructors

ListGraph [GenBasicBlock i] |

Instances

Outputable instr => Outputable (ListGraph instr) |

data CmmInfoTable

Info table as a haskell data type

Constructors

CmmInfoTable |

Fields

cit_lbl :: CLabel
cit_rep :: SMRep
cit_prof :: ProfilingInfo
cit_srt :: C_SRT

CmmNonInfoTable |

Instances

Outputable CmmInfoTable |

data ClosureTypeInfo

Constructors

Constr ConstrTag ConstrDescription |
Fun FunArity ArgDescr |
Thunk |
ThunkSelector SelectorOffset |
BlackHole |

Instances

Outputable ClosureTypeInfo |

data CmmStatic

Constructors

CmmStaticLit CmmLit |
CmmUninitialised Int |
CmmString [Word8] |

Instances

Outputable CmmStatic |

data CmmStatics

Constructors

Statics CLabel [CmmStatic] |

Instances

Outputable CmmStatics |

type CmmFormal = LocalReg

type CmmActual = CmmExpr

cmmMapGraph :: (g -> g') -> GenCmmGroup d h g -> GenCmmGroup d h g'

cmmTopMapGraph :: (g -> g') -> GenCmmDecl d h g -> GenCmmDecl d h g'

data GenBasicBlock i

Constructors

BasicBlock BlockId [i] |

Instances

Outputable instr => Outputable (GenBasicBlock instr) |
UserOfLocalRegs i => UserOfLocalRegs (GenBasicBlock i) |

type CmmBasicBlock = GenBasicBlock CmmStmt

blockId :: GenBasicBlock i -> BlockId

The branch block id is that of the first block in the branch, which is that branch's entry point

blockStmts :: GenBasicBlock i -> [i]

mapBlockStmts :: (i -> i') -> GenBasicBlock i -> GenBasicBlock i'

data CmmStmt

Constructors

CmmNop |
CmmComment FastString |
CmmAssign CmmReg CmmExpr |
CmmStore CmmExpr CmmExpr |
CmmCall CmmCallTarget [HintedCmmFormal] [HintedCmmActual] CmmReturnInfo |
CmmBranch BlockId |
CmmCondBranch CmmExpr BlockId |
CmmSwitch CmmExpr [Maybe BlockId] |
CmmJump CmmExpr (Maybe [GlobalReg]) |
CmmReturn |

Instances

Outputable CmmStmt |
UserOfLocalRegs CmmStmt | enable us to fold used registers over '[CmmActual]' and '[CmmFormal]'

data CmmReturnInfo

Constructors

CmmMayReturn |
CmmNeverReturns |

Instances

Eq CmmReturnInfo |

data CmmHinted a

Constructors

CmmHinted |

Fields

hintlessCmm :: a
cmmHint :: ForeignHint

Instances

Eq a => Eq (CmmHinted a) |
Outputable a => Outputable (CmmHinted a) |
DefinerOfLocalRegs a => DefinerOfLocalRegs (CmmHinted a) |
UserOfLocalRegs a => UserOfLocalRegs (CmmHinted a) |

type HintedCmmFormal = CmmHinted CmmFormal

type HintedCmmActual = CmmHinted CmmActual

data CmmSafety

Constructors

CmmUnsafe |
CmmSafe C_SRT |
CmmInterruptible |

Instances

Outputable CmmSafety |

data CmmCallTarget

Constructors

CmmCallee CmmExpr CCallConv |
CmmPrim CallishMachOp (Maybe [CmmStmt]) |

Instances

UserOfLocalRegs CmmCallTarget |

data GenCmmDecl d h g

A top-level chunk, abstracted over the type of the contents of the basic blocks (Cmm or instructions are the likely instantiations).

Constructors

CmmProc h CLabel g |
CmmData Section d |

Instances

(Outputable d, Outputable info, Outputable i) => Outputable (GenCmmDecl d info i) |

data ForeignHint

Constructors

NoHint |
AddrHint |
SignedHint |

Instances

Eq ForeignHint |
Outputable ForeignHint |

module CmmExpr

data Section

Constructors

Text |
Data |
ReadOnlyData |
RelocatableReadOnlyData |
UninitialisedData |
ReadOnlyData16 |
OtherSection String |

data ProfilingInfo

Constructors

NoProfilingInfo |
ProfilingInfo [Word8] [Word8] |

data C_SRT

Constructors

NoC_SRT |
C_SRT !CLabel !WordOff !StgHalfWord |

Instances

Eq C_SRT |
Outputable C_SRT |