ghc-7.6.3: The GHC API

Safe Haskell | None

CmmMachOp

Synopsis

- data MachOp
  - = MO_Add Width
  - | MO_Sub Width
  - | MO_Eq Width
  - | MO_Ne Width
  - | MO_Mul Width
  - | MO_S_MulMayOflo Width
  - | MO_S_Quot Width
  - | MO_S_Rem Width
  - | MO_S_Neg Width
  - | MO_U_MulMayOflo Width
  - | MO_U_Quot Width
  - | MO_U_Rem Width
  - | MO_S_Ge Width
  - | MO_S_Le Width
  - | MO_S_Gt Width
  - | MO_S_Lt Width
  - | MO_U_Ge Width
  - | MO_U_Le Width
  - | MO_U_Gt Width
  - | MO_U_Lt Width
  - | MO_F_Add Width
  - | MO_F_Sub Width
  - | MO_F_Neg Width
  - | MO_F_Mul Width
  - | MO_F_Quot Width
  - | MO_F_Eq Width
  - | MO_F_Ne Width
  - | MO_F_Ge Width
  - | MO_F_Le Width
  - | MO_F_Gt Width
  - | MO_F_Lt Width
  - | MO_And Width
  - | MO_Or Width
  - | MO_Xor Width
  - | MO_Not Width
  - | MO_Shl Width
  - | MO_U_Shr Width
  - | MO_S_Shr Width
  - | MO_SF_Conv Width Width
  - | MO_FS_Conv Width Width
  - | MO_SS_Conv Width Width
  - | MO_UU_Conv Width Width
  - | MO_FF_Conv Width Width
- pprMachOp :: MachOp -> SDoc
- isCommutableMachOp :: MachOp -> Bool
- isAssociativeMachOp :: MachOp -> Bool
- isComparisonMachOp :: MachOp -> Bool
- machOpResultType :: MachOp -> [CmmType] -> CmmType
- machOpArgReps :: MachOp -> [Width]
- maybeInvertComparison :: MachOp -> Maybe MachOp
- mo_wordAdd :: MachOp
- mo_wordSub :: MachOp
- mo_wordEq :: MachOp
- mo_wordNe :: MachOp
- mo_wordMul :: MachOp
- mo_wordSQuot :: MachOp
- mo_wordSRem :: MachOp
- mo_wordSNeg :: MachOp
- mo_wordUQuot :: MachOp
- mo_wordURem :: MachOp
- mo_wordSGe :: MachOp
- mo_wordSLe :: MachOp
- mo_wordSGt :: MachOp
- mo_wordSLt :: MachOp
- mo_wordUGe :: MachOp
- mo_wordULe :: MachOp
- mo_wordUGt :: MachOp
- mo_wordULt :: MachOp
- mo_wordAnd :: MachOp
- mo_wordOr :: MachOp
- mo_wordXor :: MachOp
- mo_wordNot :: MachOp
- mo_wordShl :: MachOp
- mo_wordSShr :: MachOp
- mo_wordUShr :: MachOp
- mo_u_8To32 :: MachOp
- mo_s_8To32 :: MachOp
- mo_u_16To32 :: MachOp
- mo_s_16To32 :: MachOp
- mo_u_8ToWord :: MachOp
- mo_s_8ToWord :: MachOp
- mo_u_16ToWord :: MachOp
- mo_s_16ToWord :: MachOp
- mo_u_32ToWord :: MachOp
- mo_s_32ToWord :: MachOp
- mo_32To8 :: MachOp
- mo_32To16 :: MachOp
- mo_WordTo8 :: MachOp
- mo_WordTo16 :: MachOp
- mo_WordTo32 :: MachOp
- 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_S_QuotRem Width
  - | MO_U_QuotRem Width
  - | MO_U_QuotRem2 Width
  - | MO_Add2 Width
  - | MO_U_Mul2 Width
  - | MO_WriteBarrier
  - | MO_Touch
  - | MO_Memcpy
  - | MO_Memset
  - | MO_Memmove
  - | MO_PopCnt Width
- pprCallishMachOp :: CallishMachOp -> SDoc

# Documentation

data MachOp

Machine-level primops; ones which we can reasonably delegate to the native code generators to handle.

Most operations are parameterised by the `Width` that they operate on. Some operations have separate signed and unsigned versions, and float and integer versions.

Constructors

MO_Add Width |
MO_Sub Width |
MO_Eq Width |
MO_Ne Width |
MO_Mul Width |
MO_S_MulMayOflo Width |
MO_S_Quot Width |
MO_S_Rem Width |
MO_S_Neg Width |
MO_U_MulMayOflo Width |
MO_U_Quot Width |
MO_U_Rem Width |
MO_S_Ge Width |
MO_S_Le Width |
MO_S_Gt Width |
MO_S_Lt Width |
MO_U_Ge Width |
MO_U_Le Width |
MO_U_Gt Width |
MO_U_Lt Width |
MO_F_Add Width |
MO_F_Sub Width |
MO_F_Neg Width |
MO_F_Mul Width |
MO_F_Quot Width |
MO_F_Eq Width |
MO_F_Ne Width |
MO_F_Ge Width |
MO_F_Le Width |
MO_F_Gt Width |
MO_F_Lt Width |
MO_And Width |
MO_Or Width |
MO_Xor Width |
MO_Not Width |
MO_Shl Width |
MO_U_Shr Width |
MO_S_Shr Width |
MO_SF_Conv Width Width |
MO_FS_Conv Width Width |
MO_SS_Conv Width Width |
MO_UU_Conv Width Width |
MO_FF_Conv Width Width |

Instances

Eq MachOp |
Show MachOp |

pprMachOp :: MachOp -> SDoc

isCommutableMachOp :: MachOp -> Bool

Returns `True` if the MachOp has commutable arguments. This is used in the platform-independent Cmm optimisations.

If in doubt, return `False`. This generates worse code on the native routes, but is otherwise harmless.

isAssociativeMachOp :: MachOp -> Bool

Returns `True` if the MachOp is associative (i.e. `(x+y)+z == x+(y+z)`) This is used in the platform-independent Cmm optimisations.

If in doubt, return `False`. This generates worse code on the native routes, but is otherwise harmless.

isComparisonMachOp :: MachOp -> Bool

Returns `True` if the MachOp is a comparison.

If in doubt, return False. This generates worse code on the native routes, but is otherwise harmless.

machOpResultType :: MachOp -> [CmmType] -> CmmType

Returns the MachRep of the result of a MachOp.

machOpArgReps :: MachOp -> [Width]

This function is used for debugging only: we can check whether an application of a MachOp is type-correct by checking that the MachReps of its arguments are the same as the MachOp expects. This is used when linting a CmmExpr.

maybeInvertComparison :: MachOp -> Maybe MachOp

mo_wordAdd :: MachOp

mo_wordSub :: MachOp

mo_wordEq :: MachOp

mo_wordNe :: MachOp

mo_wordMul :: MachOp

mo_wordSQuot :: MachOp

mo_wordSRem :: MachOp

mo_wordSNeg :: MachOp

mo_wordUQuot :: MachOp

mo_wordURem :: MachOp

mo_wordSGe :: MachOp

mo_wordSLe :: MachOp

mo_wordSGt :: MachOp

mo_wordSLt :: MachOp

mo_wordUGe :: MachOp

mo_wordULe :: MachOp

mo_wordUGt :: MachOp

mo_wordULt :: MachOp

mo_wordAnd :: MachOp

mo_wordOr :: MachOp

mo_wordXor :: MachOp

mo_wordNot :: MachOp

mo_wordShl :: MachOp

mo_wordSShr :: MachOp

mo_wordUShr :: MachOp

mo_u_8To32 :: MachOp

mo_s_8To32 :: MachOp

mo_u_16To32 :: MachOp

mo_s_16To32 :: MachOp

mo_u_8ToWord :: MachOp

mo_s_8ToWord :: MachOp

mo_u_16ToWord :: MachOp

mo_s_16ToWord :: MachOp

mo_u_32ToWord :: MachOp

mo_s_32ToWord :: MachOp

mo_32To8 :: MachOp

mo_32To16 :: MachOp

mo_WordTo8 :: MachOp

mo_WordTo16 :: MachOp

mo_WordTo32 :: MachOp

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_S_QuotRem Width |
MO_U_QuotRem Width |
MO_U_QuotRem2 Width |
MO_Add2 Width |
MO_U_Mul2 Width |
MO_WriteBarrier |
MO_Touch |
MO_Memcpy |
MO_Memset |
MO_Memmove |
MO_PopCnt Width |

Instances

Eq CallishMachOp |
Show CallishMachOp |

pprCallishMachOp :: CallishMachOp -> SDoc