ghc-7.8.4: The GHC API

Safe Haskell | None
Language | Haskell98

CmmNode

Synopsis

- data CmmNode e x where
  - CmmEntry :: !Label -> CmmNode C O
  - CmmComment :: FastString -> CmmNode O O
  - CmmAssign :: !CmmReg -> !CmmExpr -> CmmNode O O
  - CmmStore :: !CmmExpr -> !CmmExpr -> CmmNode O O
  - CmmUnsafeForeignCall :: ForeignTarget -> [CmmFormal] -> [CmmActual] -> CmmNode O O
  - CmmBranch :: !Label -> CmmNode O C
  - CmmCondBranch :: {
    - cml_pred :: CmmExpr
    - cml_true :: !Label
    - cml_false :: !Label
    } -> CmmNode O C
  - CmmSwitch :: CmmExpr -> [Maybe Label] -> CmmNode O C
  - CmmCall :: {
    - cml_target :: CmmExpr
    - cml_cont :: Maybe Label
    - cml_args_regs :: [GlobalReg]
    - cml_args :: ByteOff
    - cml_ret_args :: ByteOff
    - cml_ret_off :: ByteOff
    } -> CmmNode O C
  - CmmForeignCall :: {
    - tgt :: ForeignTarget
    - res :: [CmmFormal]
    - args :: [CmmActual]
    - succ :: !Label
    - ret_args :: ByteOff
    - ret_off :: ByteOff
    - intrbl :: Bool
    } -> CmmNode O C
- type CmmFormal = LocalReg
- type CmmActual = CmmExpr
- type UpdFrameOffset = ByteOff
- data Convention
  - = NativeDirectCall
  - | NativeNodeCall
  - | NativeReturn
  - | Slow
  - | GC
- data ForeignConvention = ForeignConvention CCallConv [ForeignHint] [ForeignHint] CmmReturnInfo
- data ForeignTarget
  - = ForeignTarget CmmExpr ForeignConvention
  - | PrimTarget CallishMachOp
- foreignTargetHints :: ForeignTarget -> ([ForeignHint], [ForeignHint])
- data CmmReturnInfo
  - = CmmMayReturn
  - | CmmNeverReturns
- mapExp :: (CmmExpr -> CmmExpr) -> CmmNode e x -> CmmNode e x
- mapExpDeep :: (CmmExpr -> CmmExpr) -> CmmNode e x -> CmmNode e x
- wrapRecExp :: (CmmExpr -> CmmExpr) -> CmmExpr -> CmmExpr
- foldExp :: (CmmExpr -> z -> z) -> CmmNode e x -> z -> z
- foldExpDeep :: (CmmExpr -> z -> z) -> CmmNode e x -> z -> z
- wrapRecExpf :: (CmmExpr -> z -> z) -> CmmExpr -> z -> z
- mapExpM :: (CmmExpr -> Maybe CmmExpr) -> CmmNode e x -> Maybe (CmmNode e x)
- mapExpDeepM :: (CmmExpr -> Maybe CmmExpr) -> CmmNode e x -> Maybe (CmmNode e x)
- wrapRecExpM :: (CmmExpr -> Maybe CmmExpr) -> CmmExpr -> Maybe CmmExpr
- mapSuccessors :: (Label -> Label) -> CmmNode O C -> CmmNode O C

# Documentation

data CmmNode e x where

Constructors

CmmEntry :: !Label -> CmmNode C O |
CmmComment :: FastString -> CmmNode O O |
CmmAssign :: !CmmReg -> !CmmExpr -> CmmNode O O |
CmmStore :: !CmmExpr -> !CmmExpr -> CmmNode O O |
CmmUnsafeForeignCall :: ForeignTarget -> [CmmFormal] -> [CmmActual] -> CmmNode O O |
CmmBranch :: !Label -> CmmNode O C |
CmmCondBranch :: CmmExpr -> !Label -> !Label -> CmmNode O C |

Fields

cml_pred :: CmmExpr
cml_true :: !Label
cml_false :: !Label

CmmSwitch :: CmmExpr -> [Maybe Label] -> CmmNode O C |
CmmCall :: CmmExpr -> Maybe Label -> [GlobalReg] -> ByteOff -> ByteOff -> ByteOff -> CmmNode O C |

Fields

cml_target :: CmmExpr
cml_cont :: Maybe Label
cml_args_regs :: [GlobalReg]
cml_args :: ByteOff
cml_ret_args :: ByteOff
cml_ret_off :: ByteOff

CmmForeignCall :: ForeignTarget -> [CmmFormal] -> [CmmActual] -> !Label -> ByteOff -> ByteOff -> Bool -> CmmNode O C |

Fields

tgt :: ForeignTarget
res :: [CmmFormal]
args :: [CmmActual]
succ :: !Label
ret_args :: ByteOff
ret_off :: ByteOff
intrbl :: Bool

Instances

NonLocal CmmNode |
Outputable CmmGraph |
DefinerOfRegs GlobalReg (CmmNode e x) |
DefinerOfRegs LocalReg (CmmNode e x) |
UserOfRegs GlobalReg (CmmNode e x) |
UserOfRegs LocalReg (CmmNode e x) |
Eq (CmmNode e x) |
Outputable (CmmNode e x) |
Outputable (Graph CmmNode e x) |
Outputable (Block CmmNode O O) |
Outputable (Block CmmNode O C) |
Outputable (Block CmmNode C O) |
Outputable (Block CmmNode C C) |

type CmmFormal = LocalReg

type CmmActual = CmmExpr

type UpdFrameOffset = ByteOff

data Convention

A convention maps a list of values (function arguments or return values) to registers or stack locations.

Constructors

NativeDirectCall | top-level Haskell functions use `NativeDirectCall`, which maps arguments to registers starting with R2, according to how many registers are available on the platform. This convention ignores R1, because for a top-level function call the function closure is implicit, and doesn't need to be passed.
NativeNodeCall | non-top-level Haskell functions, which pass the address of the function closure in R1 (regardless of whether R1 is a real register or not), and the rest of the arguments in registers or on the stack.
NativeReturn | a native return. The convention for returns depends on how many values are returned: for just one value returned, the appropriate register is used (R1, F1, etc.). regardless of whether it is a real register or not. For multiple values returned, they are mapped to registers or the stack.
Slow | Slow entry points: all args pushed on the stack
GC | Entry to the garbage collector: uses the node reg! (TODO: I don't think we need this --SDM)

Instances

Eq Convention |
Outputable Convention |

data ForeignConvention

Constructors

ForeignConvention CCallConv [ForeignHint] [ForeignHint] CmmReturnInfo |

Instances

Eq ForeignConvention |
Outputable ForeignConvention |

data ForeignTarget

Constructors

ForeignTarget CmmExpr ForeignConvention |
PrimTarget CallishMachOp |

Instances

Eq ForeignTarget |
Outputable ForeignTarget |
UserOfRegs r CmmExpr => UserOfRegs r ForeignTarget |

foreignTargetHints :: ForeignTarget -> ([ForeignHint], [ForeignHint])

data CmmReturnInfo

Constructors

CmmMayReturn |
CmmNeverReturns |

Instances

Eq CmmReturnInfo |
Outputable CmmReturnInfo |

mapExp :: (CmmExpr -> CmmExpr) -> CmmNode e x -> CmmNode e x

mapExpDeep :: (CmmExpr -> CmmExpr) -> CmmNode e x -> CmmNode e x

wrapRecExp :: (CmmExpr -> CmmExpr) -> CmmExpr -> CmmExpr

foldExp :: (CmmExpr -> z -> z) -> CmmNode e x -> z -> z

foldExpDeep :: (CmmExpr -> z -> z) -> CmmNode e x -> z -> z

wrapRecExpf :: (CmmExpr -> z -> z) -> CmmExpr -> z -> z

mapExpM :: (CmmExpr -> Maybe CmmExpr) -> CmmNode e x -> Maybe (CmmNode e x)

mapExpDeepM :: (CmmExpr -> Maybe CmmExpr) -> CmmNode e x -> Maybe (CmmNode e x)

wrapRecExpM :: (CmmExpr -> Maybe CmmExpr) -> CmmExpr -> Maybe CmmExpr

mapSuccessors :: (Label -> Label) -> CmmNode O C -> CmmNode O C