Cmm

ghc-7.0.4: The GHC API

Cmm

Synopsis

- newtype GenCmm d h g = Cmm [GenCmmTop d h g]
- type Cmm = GenCmm CmmStatic CmmInfo (ListGraph CmmStmt)
- type RawCmm = GenCmm CmmStatic [CmmStatic] (ListGraph CmmStmt)
- data GenCmmTop d h g
  - = CmmProc h CLabel CmmFormals g
  - | CmmData Section [d]
- type CmmTop = GenCmmTop CmmStatic CmmInfo (ListGraph CmmStmt)
- type RawCmmTop = GenCmmTop CmmStatic [CmmStatic] (ListGraph CmmStmt)
- newtype ListGraph i = ListGraph [GenBasicBlock i]
- cmmMapGraph :: (g -> g') -> GenCmm d h g -> GenCmm d h g'
- cmmTopMapGraph :: (g -> g') -> GenCmmTop d h g -> GenCmmTop d h g'
- cmmMapGraphM :: Monad m => (String -> g -> m g') -> GenCmm d h g -> m (GenCmm d h g')
- cmmTopMapGraphM :: Monad m => (String -> g -> m g') -> GenCmmTop d h g -> m (GenCmmTop d h g')
- data CmmInfo = CmmInfo (Maybe BlockId) (Maybe UpdateFrame) CmmInfoTable
- data UpdateFrame = UpdateFrame CmmExpr [CmmExpr]
- data CmmInfoTable
  - = CmmInfoTable HasStaticClosure ProfilingInfo ClosureTypeTag ClosureTypeInfo
  - | CmmNonInfoTable
- type HasStaticClosure = Bool
- data ClosureTypeInfo
  - = ConstrInfo ClosureLayout ConstrTag ConstrDescription
  - | FunInfo ClosureLayout C_SRT FunArity ArgDescr SlowEntry
  - | ThunkInfo ClosureLayout C_SRT
  - | ThunkSelectorInfo SelectorOffset C_SRT
  - | ContInfo [Maybe LocalReg] C_SRT
- type ConstrDescription = CmmLit
- data ProfilingInfo = ProfilingInfo CmmLit CmmLit
- type ClosureTypeTag = StgHalfWord
- 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 CmmReturnInfo
  - = CmmMayReturn
  - | CmmNeverReturns
- data CmmStmt
  - = CmmNop
  - | CmmComment FastString
  - | CmmAssign CmmReg CmmExpr
  - | CmmStore CmmExpr CmmExpr
  - | CmmCall CmmCallTarget HintedCmmFormals HintedCmmActuals CmmSafety CmmReturnInfo
  - | CmmBranch BlockId
  - | CmmCondBranch CmmExpr BlockId
  - | CmmSwitch CmmExpr [Maybe BlockId]
  - | CmmJump CmmExpr HintedCmmActuals
  - | CmmReturn HintedCmmActuals
- type CmmActual = CmmExpr
- type CmmActuals = [CmmActual]
- type CmmFormal = LocalReg
- type CmmFormals = [CmmFormal]
- type HintedCmmFormal = CmmHinted CmmFormal
- type HintedCmmFormals = [HintedCmmFormal]
- type HintedCmmActual = CmmHinted CmmActual
- type HintedCmmActuals = [HintedCmmActual]
- data CmmSafety
  - = CmmUnsafe
  - | CmmSafe C_SRT
- data CmmCallTarget
  - = CmmCallee CmmExpr CCallConv
  - | CmmPrim CallishMachOp
- data CallishMachOp
  - = MO_F64_Pwr
  - | MO_F64_Sin
  - | MO_F64_Cos
  - | MO_F64_Tan
  - | MO_F64_Sinh
  - | MO_F64_Cosh
  - | MO_F64_Tanh
  - | MO_F64_Asin
  - | MO_F64_Acos
  - | MO_F64_Atan
  - | MO_F64_Log
  - | MO_F64_Exp
  - | MO_F64_Sqrt
  - | MO_F32_Pwr
  - | MO_F32_Sin
  - | MO_F32_Cos
  - | MO_F32_Tan
  - | MO_F32_Sinh
  - | MO_F32_Cosh
  - | MO_F32_Tanh
  - | MO_F32_Asin
  - | MO_F32_Acos
  - | MO_F32_Atan
  - | MO_F32_Log
  - | MO_F32_Exp
  - | MO_F32_Sqrt
  - | MO_WriteBarrier
  - | MO_Touch
- pprCallishMachOp :: CallishMachOp -> SDoc
- data ForeignHint
  - = NoHint
  - | AddrHint
  - | SignedHint
- data CmmHinted a = CmmHinted {
  - hintlessCmm :: a
  - cmmHint :: ForeignHint
  }
- data CmmStatic
  - = CmmStaticLit CmmLit
  - | CmmUninitialised Int
  - | CmmAlign Int
  - | CmmDataLabel CLabel
  - | CmmString [Word8]
- data Section
  - = Text
  - | Data
  - | ReadOnlyData
  - | RelocatableReadOnlyData
  - | UninitialisedData
  - | ReadOnlyData16
  - | OtherSection String
- module CmmExpr

# Documentation

newtype GenCmm d h g

Constructors

Cmm [GenCmmTop d h g] |

Instances

(Outputable d, Outputable info, Outputable g) => Outputable (GenCmm d info g) |

type Cmm = GenCmm CmmStatic CmmInfo (ListGraph CmmStmt)

Cmm with the info table as a data type

type RawCmm = GenCmm CmmStatic [CmmStatic] (ListGraph CmmStmt)

Cmm with the info tables converted to a list of `CmmStatic`

data GenCmmTop 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 CmmFormals g |
CmmData Section [d] |

Instances

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

type CmmTop = GenCmmTop CmmStatic CmmInfo (ListGraph CmmStmt)

type RawCmmTop = GenCmmTop CmmStatic [CmmStatic] (ListGraph CmmStmt)

newtype ListGraph i

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

Constructors

ListGraph [GenBasicBlock i] | 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.

Instances

Outputable instr => Outputable (ListGraph instr) |

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

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

cmmMapGraphM :: Monad m => (String -> g -> m g') -> GenCmm d h g -> m (GenCmm d h g')

cmmTopMapGraphM :: Monad m => (String -> g -> m g') -> GenCmmTop d h g -> m (GenCmmTop d h g')

data CmmInfo

Constructors

CmmInfo (Maybe BlockId) (Maybe UpdateFrame) CmmInfoTable |

Instances

Outputable CmmInfo |

data UpdateFrame

A frame that is to be pushed before entry to the function. Used to handle `update` frames.

Constructors

UpdateFrame CmmExpr [CmmExpr] |

data CmmInfoTable

Constructors

CmmInfoTable HasStaticClosure ProfilingInfo ClosureTypeTag ClosureTypeInfo |
CmmNonInfoTable |

type HasStaticClosure = Bool

data ClosureTypeInfo

Constructors

ConstrInfo ClosureLayout ConstrTag ConstrDescription |
FunInfo ClosureLayout C_SRT FunArity ArgDescr SlowEntry |
ThunkInfo ClosureLayout C_SRT |
ThunkSelectorInfo SelectorOffset C_SRT |
ContInfo [Maybe LocalReg] C_SRT |

type ConstrDescription = CmmLit

data ProfilingInfo

Constructors

ProfilingInfo CmmLit CmmLit |

type ClosureTypeTag = StgHalfWord

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

blockStmts :: GenBasicBlock i -> [i]

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

data CmmReturnInfo

Constructors

CmmMayReturn |
CmmNeverReturns |

Instances

Eq CmmReturnInfo |

data CmmStmt

Constructors

CmmNop |
CmmComment FastString |
CmmAssign CmmReg CmmExpr |
CmmStore CmmExpr CmmExpr |
CmmCall CmmCallTarget HintedCmmFormals HintedCmmActuals CmmSafety CmmReturnInfo |
CmmBranch BlockId |
CmmCondBranch CmmExpr BlockId |
CmmSwitch CmmExpr [Maybe BlockId] |
CmmJump CmmExpr HintedCmmActuals |
CmmReturn HintedCmmActuals |

Instances

Outputable CmmStmt |
UserOfLocalRegs CmmStmt | enable us to fold used registers over `CmmActuals` and `CmmFormals`

type CmmActual = CmmExpr

type CmmActuals = [CmmActual]

type CmmFormal = LocalReg

type CmmFormals = [CmmFormal]

type HintedCmmFormal = CmmHinted CmmFormal

type HintedCmmFormals = [HintedCmmFormal]

type HintedCmmActual = CmmHinted CmmActual

type HintedCmmActuals = [HintedCmmActual]

data CmmSafety

Constructors

CmmUnsafe |
CmmSafe C_SRT |

Instances

Outputable CmmSafety |

data CmmCallTarget

Constructors

CmmCallee CmmExpr CCallConv |
CmmPrim CallishMachOp |

Instances

Eq CmmCallTarget |
UserOfSlots CmmCallTarget |
UserOfLocalRegs CmmCallTarget |

data CallishMachOp

Constructors

MO_F64_Pwr |
MO_F64_Sin |
MO_F64_Cos |
MO_F64_Tan |
MO_F64_Sinh |
MO_F64_Cosh |
MO_F64_Tanh |
MO_F64_Asin |
MO_F64_Acos |
MO_F64_Atan |
MO_F64_Log |
MO_F64_Exp |
MO_F64_Sqrt |
MO_F32_Pwr |
MO_F32_Sin |
MO_F32_Cos |
MO_F32_Tan |
MO_F32_Sinh |
MO_F32_Cosh |
MO_F32_Tanh |
MO_F32_Asin |
MO_F32_Acos |
MO_F32_Atan |
MO_F32_Log |
MO_F32_Exp |
MO_F32_Sqrt |
MO_WriteBarrier |
MO_Touch |

Instances

Eq CallishMachOp |
Show CallishMachOp |

pprCallishMachOp :: CallishMachOp -> SDoc

data ForeignHint

Constructors

NoHint |
AddrHint |
SignedHint |

Instances

Eq ForeignHint |
Outputable ForeignHint |

data CmmHinted a

Constructors

CmmHinted |
Fields hintlessCmm :: a cmmHint :: ForeignHint

Instances

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

data CmmStatic

Constructors

CmmStaticLit CmmLit |
CmmUninitialised Int |
CmmAlign Int |
CmmDataLabel CLabel |
CmmString [Word8] |

Instances

Outputable CmmStatic |

data Section

Constructors

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

module CmmExpr