| ghc-6.10.4: The GHC API | Contents | Index
MachOp
Synopsis
data MachRep
= I8
| I16
| I32
| I64
| I128
| F32
| F64
| F80
machRepBitWidth :: MachRep -> Int
machRepByteWidth :: MachRep -> Int
machRepLogWidth :: MachRep -> Int
isFloatingRep :: MachRep -> Bool
data MachHint
= NoHint
| PtrHint
| SignedHint
| FloatHint
data MachOp
= MO_Add MachRep
| MO_Sub MachRep
| MO_Eq MachRep
| MO_Ne MachRep
| MO_Mul MachRep
| MO_S_MulMayOflo MachRep
| MO_S_Quot MachRep
| MO_S_Rem MachRep
| MO_S_Neg MachRep
| MO_U_MulMayOflo MachRep
| MO_U_Quot MachRep
| MO_U_Rem MachRep
| MO_S_Ge MachRep
| MO_S_Le MachRep
| MO_S_Gt MachRep
| MO_S_Lt MachRep
| MO_U_Ge MachRep
| MO_U_Le MachRep
| MO_U_Gt MachRep
| MO_U_Lt MachRep
| MO_And MachRep
| MO_Or MachRep
| MO_Xor MachRep
| MO_Not MachRep
| MO_Shl MachRep
| MO_U_Shr MachRep
| MO_S_Shr MachRep
| MO_S_Conv MachRep MachRep
| MO_U_Conv MachRep MachRep
pprMachOp :: MachOp -> SDoc
isCommutableMachOp :: MachOp -> Bool
isAssociativeMachOp :: MachOp -> Bool
isComparisonMachOp :: MachOp -> Bool
resultRepOfMachOp :: MachOp -> MachRep
machOpArgReps :: MachOp -> [MachRep]
maybeInvertComparison :: MachOp -> Maybe 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_WriteBarrier
pprCallishMachOp :: CallishMachOp -> SDoc
wordRep
halfWordRep
cIntRep
cLongRep
mo_wordAdd
mo_wordSub
mo_wordEq
mo_wordNe
mo_wordMul
mo_wordSQuot
mo_wordSRem
mo_wordSNeg
mo_wordUQuot
mo_wordURem
mo_wordSGe
mo_wordSLe
mo_wordSGt
mo_wordSLt
mo_wordUGe
mo_wordULe
mo_wordUGt
mo_wordULt
mo_wordAnd
mo_wordOr
mo_wordXor
mo_wordNot
mo_wordShl
mo_wordSShr
mo_wordUShr
mo_u_8To32
mo_s_8To32
mo_u_16To32
mo_s_16To32
mo_u_8ToWord
mo_s_8ToWord
mo_u_16ToWord
mo_s_16ToWord
mo_u_32ToWord
mo_s_32ToWord
mo_32To8
mo_32To16
mo_WordTo8
mo_WordTo16
mo_WordTo32
Documentation
data MachRep
A MachRep is the representation of a value in Cmm. It is used for resource allocation: eg. which kind of register a value should be stored in. The primary requirement is that there exists a function cmmExprRep :: CmmExpr -> MachRep This means that: a register has an implicit MachRep - a literal has an implicit MachRep - an operation (MachOp) has an implicit result MachRep It also means that we can check that the arguments to a MachOp have the correct MachRep, i.e. we can do a kind of lint-style type checking on Cmm.
Constructors
I8 |
I16 |
I32 |
I64 |
I128 |
F32 |
F64 |
F80 |
Instances
Eq MachRep
Ord MachRep
Show MachRep
Outputable MachRep
machRepBitWidth :: MachRep -> Int
machRepByteWidth :: MachRep -> Int
machRepLogWidth :: MachRep -> Int
isFloatingRep :: MachRep -> Bool
data MachHint
Constructors
NoHint |
PtrHint |
SignedHint |
FloatHint |
Instances
Eq MachHint
Outputable MachHint
data MachOp
Machine-level primops; ones which we can reasonably delegate to the native code generators to handle. Basically contains C's primops and no others. Nomenclature: all ops indicate width and signedness, where appropriate. Widths: 8/16/32/64 means the given size, obviously. Nat means the operation works on STG word sized objects. Signedness: S means signed, U means unsigned. For operations where signedness is irrelevant or makes no difference (for example integer add), the signedness component is omitted. An exception: NatP is a ptr-typed native word. From the point of view of the native code generators this distinction is irrelevant, but the C code generator sometimes needs this info to emit the right casts.
Constructors
MO_Add MachRep |
MO_Sub MachRep |
MO_Eq MachRep |
MO_Ne MachRep |
MO_Mul MachRep |
MO_S_MulMayOflo MachRep |
MO_S_Quot MachRep |
MO_S_Rem MachRep |
MO_S_Neg MachRep |
MO_U_MulMayOflo MachRep |
MO_U_Quot MachRep |
MO_U_Rem MachRep |
MO_S_Ge MachRep |
MO_S_Le MachRep |
MO_S_Gt MachRep |
MO_S_Lt MachRep |
MO_U_Ge MachRep |
MO_U_Le MachRep |
MO_U_Gt MachRep |
MO_U_Lt MachRep |
MO_And MachRep |
MO_Or MachRep |
MO_Xor MachRep |
MO_Not MachRep |
MO_Shl MachRep |
MO_U_Shr MachRep |
MO_S_Shr MachRep |
MO_S_Conv MachRep MachRep |
MO_U_Conv MachRep MachRep |
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.
resultRepOfMachOp :: MachOp -> MachRep
Returns the MachRep of the result of a MachOp.
machOpArgReps :: MachOp -> [MachRep]
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
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 |
Instances
Eq CallishMachOp
Show CallishMachOp
pprCallishMachOp :: CallishMachOp -> SDoc
wordRep
halfWordRep
cIntRep
cLongRep
mo_wordAdd
mo_wordSub
mo_wordEq
mo_wordNe
mo_wordMul
mo_wordSQuot
mo_wordSRem
mo_wordSNeg
mo_wordUQuot
mo_wordURem
mo_wordSGe
mo_wordSLe
mo_wordSGt
mo_wordSLt
mo_wordUGe
mo_wordULe
mo_wordUGt
mo_wordULt
mo_wordAnd
mo_wordOr
mo_wordXor
mo_wordNot
mo_wordShl
mo_wordSShr
mo_wordUShr
mo_u_8To32
mo_s_8To32
mo_u_16To32
mo_s_16To32
mo_u_8ToWord
mo_s_8ToWord
mo_u_16ToWord
mo_s_16ToWord
mo_u_32ToWord
mo_s_32ToWord
mo_32To8
mo_32To16
mo_WordTo8
mo_WordTo16
mo_WordTo32
Produced by Haddock version 2.4.2