|
|
|
|
Synopsis |
|
|
|
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 | | Instances | |
|
|
machRepBitWidth :: MachRep -> Int |
|
machRepByteWidth :: MachRep -> Int |
|
machRepLogWidth :: MachRep -> Int |
|
isFloatingRep :: MachRep -> Bool |
|
data MachHint |
Constructors | NoHint | | PtrHint | | SignedHint | | FloatHint | |
| Instances | |
|
|
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 | | Instances | |
|
|
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 | |
|
|
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 |