module CmmMachOp
( MachOp(..)
, pprMachOp, isCommutableMachOp, isAssociativeMachOp
, isComparisonMachOp, maybeIntComparison, machOpResultType
, machOpArgReps, maybeInvertComparison, isFloatComparison
, 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, mo_WordTo64
, CallishMachOp(..), callishMachOpHints, callishMachOpReps
, pprCallishMachOp
, machOpMemcpyishAlign
, AtomicMachOp(..)
)
where
import GhcPrelude
import CmmType
import Outputable
import DynFlags
import TyCon (PrimRep (..))
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_XX_Conv Width Width
| MO_FF_Conv Width Width
| MO_V_Insert Length Width
| Length Width
| MO_V_Add Length Width
| MO_V_Sub Length Width
| MO_V_Mul Length Width
| MO_VS_Quot Length Width
| MO_VS_Rem Length Width
| MO_VS_Neg Length Width
| MO_VU_Quot Length Width
| MO_VU_Rem Length Width
| MO_VF_Insert Length Width
| Length Width
| MO_VF_Add Length Width
| MO_VF_Sub Length Width
| MO_VF_Neg Length Width
| MO_VF_Mul Length Width
| MO_VF_Quot Length Width
| MO_AlignmentCheck Int Width
deriving (MachOp -> MachOp -> Bool
(MachOp -> MachOp -> Bool)
-> (MachOp -> MachOp -> Bool) -> Eq MachOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MachOp -> MachOp -> Bool
$c/= :: MachOp -> MachOp -> Bool
== :: MachOp -> MachOp -> Bool
$c== :: MachOp -> MachOp -> Bool
Eq, Int -> MachOp -> ShowS
[MachOp] -> ShowS
MachOp -> String
(Int -> MachOp -> ShowS)
-> (MachOp -> String) -> ([MachOp] -> ShowS) -> Show MachOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MachOp] -> ShowS
$cshowList :: [MachOp] -> ShowS
show :: MachOp -> String
$cshow :: MachOp -> String
showsPrec :: Int -> MachOp -> ShowS
$cshowsPrec :: Int -> MachOp -> ShowS
Show)
pprMachOp :: MachOp -> SDoc
pprMachOp :: MachOp -> SDoc
pprMachOp MachOp
mo = String -> SDoc
text (MachOp -> String
forall a. Show a => a -> String
show MachOp
mo)
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_8ToWord, mo_s_8ToWord, mo_u_16ToWord, mo_s_16ToWord, mo_u_32ToWord, mo_s_32ToWord
, mo_WordTo8, mo_WordTo16, mo_WordTo32, mo_WordTo64
:: DynFlags -> MachOp
mo_u_8To32, mo_s_8To32, mo_u_16To32, mo_s_16To32
, mo_32To8, mo_32To16
:: MachOp
mo_wordAdd :: DynFlags -> MachOp
mo_wordAdd DynFlags
dflags = Width -> MachOp
MO_Add (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSub :: DynFlags -> MachOp
mo_wordSub DynFlags
dflags = Width -> MachOp
MO_Sub (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordEq :: DynFlags -> MachOp
mo_wordEq DynFlags
dflags = Width -> MachOp
MO_Eq (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordNe :: DynFlags -> MachOp
mo_wordNe DynFlags
dflags = Width -> MachOp
MO_Ne (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordMul :: DynFlags -> MachOp
mo_wordMul DynFlags
dflags = Width -> MachOp
MO_Mul (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSQuot :: DynFlags -> MachOp
mo_wordSQuot DynFlags
dflags = Width -> MachOp
MO_S_Quot (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSRem :: DynFlags -> MachOp
mo_wordSRem DynFlags
dflags = Width -> MachOp
MO_S_Rem (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSNeg :: DynFlags -> MachOp
mo_wordSNeg DynFlags
dflags = Width -> MachOp
MO_S_Neg (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordUQuot :: DynFlags -> MachOp
mo_wordUQuot DynFlags
dflags = Width -> MachOp
MO_U_Quot (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordURem :: DynFlags -> MachOp
mo_wordURem DynFlags
dflags = Width -> MachOp
MO_U_Rem (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSGe :: DynFlags -> MachOp
mo_wordSGe DynFlags
dflags = Width -> MachOp
MO_S_Ge (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSLe :: DynFlags -> MachOp
mo_wordSLe DynFlags
dflags = Width -> MachOp
MO_S_Le (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSGt :: DynFlags -> MachOp
mo_wordSGt DynFlags
dflags = Width -> MachOp
MO_S_Gt (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSLt :: DynFlags -> MachOp
mo_wordSLt DynFlags
dflags = Width -> MachOp
MO_S_Lt (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordUGe :: DynFlags -> MachOp
mo_wordUGe DynFlags
dflags = Width -> MachOp
MO_U_Ge (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordULe :: DynFlags -> MachOp
mo_wordULe DynFlags
dflags = Width -> MachOp
MO_U_Le (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordUGt :: DynFlags -> MachOp
mo_wordUGt DynFlags
dflags = Width -> MachOp
MO_U_Gt (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordULt :: DynFlags -> MachOp
mo_wordULt DynFlags
dflags = Width -> MachOp
MO_U_Lt (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordAnd :: DynFlags -> MachOp
mo_wordAnd DynFlags
dflags = Width -> MachOp
MO_And (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordOr :: DynFlags -> MachOp
mo_wordOr DynFlags
dflags = Width -> MachOp
MO_Or (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordXor :: DynFlags -> MachOp
mo_wordXor DynFlags
dflags = Width -> MachOp
MO_Xor (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordNot :: DynFlags -> MachOp
mo_wordNot DynFlags
dflags = Width -> MachOp
MO_Not (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordShl :: DynFlags -> MachOp
mo_wordShl DynFlags
dflags = Width -> MachOp
MO_Shl (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordSShr :: DynFlags -> MachOp
mo_wordSShr DynFlags
dflags = Width -> MachOp
MO_S_Shr (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_wordUShr :: DynFlags -> MachOp
mo_wordUShr DynFlags
dflags = Width -> MachOp
MO_U_Shr (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_u_8To32 :: MachOp
mo_u_8To32 = Width -> Width -> MachOp
MO_UU_Conv Width
W8 Width
W32
mo_s_8To32 :: MachOp
mo_s_8To32 = Width -> Width -> MachOp
MO_SS_Conv Width
W8 Width
W32
mo_u_16To32 :: MachOp
mo_u_16To32 = Width -> Width -> MachOp
MO_UU_Conv Width
W16 Width
W32
mo_s_16To32 :: MachOp
mo_s_16To32 = Width -> Width -> MachOp
MO_SS_Conv Width
W16 Width
W32
mo_u_8ToWord :: DynFlags -> MachOp
mo_u_8ToWord DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv Width
W8 (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_s_8ToWord :: DynFlags -> MachOp
mo_s_8ToWord DynFlags
dflags = Width -> Width -> MachOp
MO_SS_Conv Width
W8 (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_u_16ToWord :: DynFlags -> MachOp
mo_u_16ToWord DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv Width
W16 (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_s_16ToWord :: DynFlags -> MachOp
mo_s_16ToWord DynFlags
dflags = Width -> Width -> MachOp
MO_SS_Conv Width
W16 (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_s_32ToWord :: DynFlags -> MachOp
mo_s_32ToWord DynFlags
dflags = Width -> Width -> MachOp
MO_SS_Conv Width
W32 (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_u_32ToWord :: DynFlags -> MachOp
mo_u_32ToWord DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv Width
W32 (DynFlags -> Width
wordWidth DynFlags
dflags)
mo_WordTo8 :: DynFlags -> MachOp
mo_WordTo8 DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv (DynFlags -> Width
wordWidth DynFlags
dflags) Width
W8
mo_WordTo16 :: DynFlags -> MachOp
mo_WordTo16 DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv (DynFlags -> Width
wordWidth DynFlags
dflags) Width
W16
mo_WordTo32 :: DynFlags -> MachOp
mo_WordTo32 DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv (DynFlags -> Width
wordWidth DynFlags
dflags) Width
W32
mo_WordTo64 :: DynFlags -> MachOp
mo_WordTo64 DynFlags
dflags = Width -> Width -> MachOp
MO_UU_Conv (DynFlags -> Width
wordWidth DynFlags
dflags) Width
W64
mo_32To8 :: MachOp
mo_32To8 = Width -> Width -> MachOp
MO_UU_Conv Width
W32 Width
W8
mo_32To16 :: MachOp
mo_32To16 = Width -> Width -> MachOp
MO_UU_Conv Width
W32 Width
W16
isCommutableMachOp :: MachOp -> Bool
isCommutableMachOp :: MachOp -> Bool
isCommutableMachOp MachOp
mop =
case MachOp
mop of
MO_Add Width
_ -> Bool
True
MO_Eq Width
_ -> Bool
True
MO_Ne Width
_ -> Bool
True
MO_Mul Width
_ -> Bool
True
MO_S_MulMayOflo Width
_ -> Bool
True
MO_U_MulMayOflo Width
_ -> Bool
True
MO_And Width
_ -> Bool
True
MO_Or Width
_ -> Bool
True
MO_Xor Width
_ -> Bool
True
MO_F_Add Width
_ -> Bool
True
MO_F_Mul Width
_ -> Bool
True
MachOp
_other -> Bool
False
isAssociativeMachOp :: MachOp -> Bool
isAssociativeMachOp :: MachOp -> Bool
isAssociativeMachOp MachOp
mop =
case MachOp
mop of
MO_Add {} -> Bool
True
MO_Mul {} -> Bool
True
MO_And {} -> Bool
True
MO_Or {} -> Bool
True
MO_Xor {} -> Bool
True
MachOp
_other -> Bool
False
isComparisonMachOp :: MachOp -> Bool
isComparisonMachOp :: MachOp -> Bool
isComparisonMachOp MachOp
mop =
case MachOp
mop of
MO_Eq Width
_ -> Bool
True
MO_Ne Width
_ -> Bool
True
MO_S_Ge Width
_ -> Bool
True
MO_S_Le Width
_ -> Bool
True
MO_S_Gt Width
_ -> Bool
True
MO_S_Lt Width
_ -> Bool
True
MO_U_Ge Width
_ -> Bool
True
MO_U_Le Width
_ -> Bool
True
MO_U_Gt Width
_ -> Bool
True
MO_U_Lt Width
_ -> Bool
True
MO_F_Eq {} -> Bool
True
MO_F_Ne {} -> Bool
True
MO_F_Ge {} -> Bool
True
MO_F_Le {} -> Bool
True
MO_F_Gt {} -> Bool
True
MO_F_Lt {} -> Bool
True
MachOp
_other -> Bool
False
maybeIntComparison :: MachOp -> Maybe Width
maybeIntComparison :: MachOp -> Maybe Width
maybeIntComparison MachOp
mop =
case MachOp
mop of
MO_Eq Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_Ne Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_S_Ge Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_S_Le Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_S_Gt Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_S_Lt Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_U_Ge Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_U_Le Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_U_Gt Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MO_U_Lt Width
w -> Width -> Maybe Width
forall a. a -> Maybe a
Just Width
w
MachOp
_ -> Maybe Width
forall a. Maybe a
Nothing
isFloatComparison :: MachOp -> Bool
isFloatComparison :: MachOp -> Bool
isFloatComparison MachOp
mop =
case MachOp
mop of
MO_F_Eq {} -> Bool
True
MO_F_Ne {} -> Bool
True
MO_F_Ge {} -> Bool
True
MO_F_Le {} -> Bool
True
MO_F_Gt {} -> Bool
True
MO_F_Lt {} -> Bool
True
MachOp
_other -> Bool
False
maybeInvertComparison :: MachOp -> Maybe MachOp
maybeInvertComparison :: MachOp -> Maybe MachOp
maybeInvertComparison MachOp
op
= case MachOp
op of
MO_Eq Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_Ne Width
r)
MO_Ne Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_Eq Width
r)
MO_U_Lt Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_U_Ge Width
r)
MO_U_Gt Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_U_Le Width
r)
MO_U_Le Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_U_Gt Width
r)
MO_U_Ge Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_U_Lt Width
r)
MO_S_Lt Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_S_Ge Width
r)
MO_S_Gt Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_S_Le Width
r)
MO_S_Le Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_S_Gt Width
r)
MO_S_Ge Width
r -> MachOp -> Maybe MachOp
forall a. a -> Maybe a
Just (Width -> MachOp
MO_S_Lt Width
r)
MachOp
_other -> Maybe MachOp
forall a. Maybe a
Nothing
machOpResultType :: DynFlags -> MachOp -> [CmmType] -> CmmType
machOpResultType :: DynFlags -> MachOp -> [CmmType] -> CmmType
machOpResultType DynFlags
dflags MachOp
mop [CmmType]
tys =
case MachOp
mop of
MO_Add {} -> CmmType
ty1
MO_Sub {} -> CmmType
ty1
MO_Mul Width
r -> Width -> CmmType
cmmBits Width
r
MO_S_MulMayOflo Width
r -> Width -> CmmType
cmmBits Width
r
MO_S_Quot Width
r -> Width -> CmmType
cmmBits Width
r
MO_S_Rem Width
r -> Width -> CmmType
cmmBits Width
r
MO_S_Neg Width
r -> Width -> CmmType
cmmBits Width
r
MO_U_MulMayOflo Width
r -> Width -> CmmType
cmmBits Width
r
MO_U_Quot Width
r -> Width -> CmmType
cmmBits Width
r
MO_U_Rem Width
r -> Width -> CmmType
cmmBits Width
r
MO_Eq {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_Ne {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_S_Ge {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_S_Le {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_S_Gt {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_S_Lt {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_U_Ge {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_U_Le {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_U_Gt {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_U_Lt {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_F_Add Width
r -> Width -> CmmType
cmmFloat Width
r
MO_F_Sub Width
r -> Width -> CmmType
cmmFloat Width
r
MO_F_Mul Width
r -> Width -> CmmType
cmmFloat Width
r
MO_F_Quot Width
r -> Width -> CmmType
cmmFloat Width
r
MO_F_Neg Width
r -> Width -> CmmType
cmmFloat Width
r
MO_F_Eq {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_F_Ne {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_F_Ge {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_F_Le {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_F_Gt {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_F_Lt {} -> DynFlags -> CmmType
comparisonResultRep DynFlags
dflags
MO_And {} -> CmmType
ty1
MO_Or {} -> CmmType
ty1
MO_Xor {} -> CmmType
ty1
MO_Not Width
r -> Width -> CmmType
cmmBits Width
r
MO_Shl Width
r -> Width -> CmmType
cmmBits Width
r
MO_U_Shr Width
r -> Width -> CmmType
cmmBits Width
r
MO_S_Shr Width
r -> Width -> CmmType
cmmBits Width
r
MO_SS_Conv Width
_ Width
to -> Width -> CmmType
cmmBits Width
to
MO_UU_Conv Width
_ Width
to -> Width -> CmmType
cmmBits Width
to
MO_XX_Conv Width
_ Width
to -> Width -> CmmType
cmmBits Width
to
MO_FS_Conv Width
_ Width
to -> Width -> CmmType
cmmBits Width
to
MO_SF_Conv Width
_ Width
to -> Width -> CmmType
cmmFloat Width
to
MO_FF_Conv Width
_ Width
to -> Width -> CmmType
cmmFloat Width
to
MO_V_Insert Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_V_Extract Int
_ Width
w -> Width -> CmmType
cmmBits Width
w
MO_V_Add Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_V_Sub Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_V_Mul Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_VS_Quot Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_VS_Rem Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_VS_Neg Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_VU_Quot Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_VU_Rem Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmBits Width
w)
MO_VF_Insert Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmFloat Width
w)
MO_VF_Extract Int
_ Width
w -> Width -> CmmType
cmmFloat Width
w
MO_VF_Add Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmFloat Width
w)
MO_VF_Sub Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmFloat Width
w)
MO_VF_Mul Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmFloat Width
w)
MO_VF_Quot Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmFloat Width
w)
MO_VF_Neg Int
l Width
w -> Int -> CmmType -> CmmType
cmmVec Int
l (Width -> CmmType
cmmFloat Width
w)
MO_AlignmentCheck Int
_ Width
_ -> CmmType
ty1
where
(CmmType
ty1:[CmmType]
_) = [CmmType]
tys
comparisonResultRep :: DynFlags -> CmmType
comparisonResultRep :: DynFlags -> CmmType
comparisonResultRep = DynFlags -> CmmType
bWord
machOpArgReps :: DynFlags -> MachOp -> [Width]
machOpArgReps :: DynFlags -> MachOp -> [Width]
machOpArgReps DynFlags
dflags MachOp
op =
case MachOp
op of
MO_Add Width
r -> [Width
r,Width
r]
MO_Sub Width
r -> [Width
r,Width
r]
MO_Eq Width
r -> [Width
r,Width
r]
MO_Ne Width
r -> [Width
r,Width
r]
MO_Mul Width
r -> [Width
r,Width
r]
MO_S_MulMayOflo Width
r -> [Width
r,Width
r]
MO_S_Quot Width
r -> [Width
r,Width
r]
MO_S_Rem Width
r -> [Width
r,Width
r]
MO_S_Neg Width
r -> [Width
r]
MO_U_MulMayOflo Width
r -> [Width
r,Width
r]
MO_U_Quot Width
r -> [Width
r,Width
r]
MO_U_Rem Width
r -> [Width
r,Width
r]
MO_S_Ge Width
r -> [Width
r,Width
r]
MO_S_Le Width
r -> [Width
r,Width
r]
MO_S_Gt Width
r -> [Width
r,Width
r]
MO_S_Lt Width
r -> [Width
r,Width
r]
MO_U_Ge Width
r -> [Width
r,Width
r]
MO_U_Le Width
r -> [Width
r,Width
r]
MO_U_Gt Width
r -> [Width
r,Width
r]
MO_U_Lt Width
r -> [Width
r,Width
r]
MO_F_Add Width
r -> [Width
r,Width
r]
MO_F_Sub Width
r -> [Width
r,Width
r]
MO_F_Mul Width
r -> [Width
r,Width
r]
MO_F_Quot Width
r -> [Width
r,Width
r]
MO_F_Neg Width
r -> [Width
r]
MO_F_Eq Width
r -> [Width
r,Width
r]
MO_F_Ne Width
r -> [Width
r,Width
r]
MO_F_Ge Width
r -> [Width
r,Width
r]
MO_F_Le Width
r -> [Width
r,Width
r]
MO_F_Gt Width
r -> [Width
r,Width
r]
MO_F_Lt Width
r -> [Width
r,Width
r]
MO_And Width
r -> [Width
r,Width
r]
MO_Or Width
r -> [Width
r,Width
r]
MO_Xor Width
r -> [Width
r,Width
r]
MO_Not Width
r -> [Width
r]
MO_Shl Width
r -> [Width
r, DynFlags -> Width
wordWidth DynFlags
dflags]
MO_U_Shr Width
r -> [Width
r, DynFlags -> Width
wordWidth DynFlags
dflags]
MO_S_Shr Width
r -> [Width
r, DynFlags -> Width
wordWidth DynFlags
dflags]
MO_SS_Conv Width
from Width
_ -> [Width
from]
MO_UU_Conv Width
from Width
_ -> [Width
from]
MO_XX_Conv Width
from Width
_ -> [Width
from]
MO_SF_Conv Width
from Width
_ -> [Width
from]
MO_FS_Conv Width
from Width
_ -> [Width
from]
MO_FF_Conv Width
from Width
_ -> [Width
from]
MO_V_Insert Int
l Width
r -> [CmmType -> Width
typeWidth (Int -> CmmType -> CmmType
vec Int
l (Width -> CmmType
cmmBits Width
r)),Width
r,DynFlags -> Width
wordWidth DynFlags
dflags]
MO_V_Extract Int
l Width
r -> [CmmType -> Width
typeWidth (Int -> CmmType -> CmmType
vec Int
l (Width -> CmmType
cmmBits Width
r)),DynFlags -> Width
wordWidth DynFlags
dflags]
MO_V_Add Int
_ Width
r -> [Width
r,Width
r]
MO_V_Sub Int
_ Width
r -> [Width
r,Width
r]
MO_V_Mul Int
_ Width
r -> [Width
r,Width
r]
MO_VS_Quot Int
_ Width
r -> [Width
r,Width
r]
MO_VS_Rem Int
_ Width
r -> [Width
r,Width
r]
MO_VS_Neg Int
_ Width
r -> [Width
r]
MO_VU_Quot Int
_ Width
r -> [Width
r,Width
r]
MO_VU_Rem Int
_ Width
r -> [Width
r,Width
r]
MO_VF_Insert Int
l Width
r -> [CmmType -> Width
typeWidth (Int -> CmmType -> CmmType
vec Int
l (Width -> CmmType
cmmFloat Width
r)),Width
r,DynFlags -> Width
wordWidth DynFlags
dflags]
MO_VF_Extract Int
l Width
r -> [CmmType -> Width
typeWidth (Int -> CmmType -> CmmType
vec Int
l (Width -> CmmType
cmmFloat Width
r)),DynFlags -> Width
wordWidth DynFlags
dflags]
MO_VF_Add Int
_ Width
r -> [Width
r,Width
r]
MO_VF_Sub Int
_ Width
r -> [Width
r,Width
r]
MO_VF_Mul Int
_ Width
r -> [Width
r,Width
r]
MO_VF_Quot Int
_ Width
r -> [Width
r,Width
r]
MO_VF_Neg Int
_ Width
r -> [Width
r]
MO_AlignmentCheck Int
_ Width
r -> [Width
r]
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_Asinh
| MO_F64_Acosh
| MO_F64_Atanh
| MO_F64_Log
| MO_F64_Log1P
| MO_F64_Exp
| MO_F64_ExpM1
| MO_F64_Fabs
| 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_Asinh
| MO_F32_Acosh
| MO_F32_Atanh
| MO_F32_Log
| MO_F32_Log1P
| MO_F32_Exp
| MO_F32_ExpM1
| MO_F32_Fabs
| MO_F32_Sqrt
| MO_UF_Conv Width
| MO_S_QuotRem Width
| MO_U_QuotRem Width
| MO_U_QuotRem2 Width
| MO_Add2 Width
| MO_AddWordC Width
| MO_SubWordC Width
| MO_AddIntC Width
| MO_SubIntC Width
| MO_U_Mul2 Width
| MO_ReadBarrier
| MO_WriteBarrier
| MO_Touch
| MO_Prefetch_Data Int
| MO_Memcpy Int
| MO_Memset Int
| MO_Memmove Int
| MO_Memcmp Int
| MO_PopCnt Width
| MO_Pdep Width
| MO_Pext Width
| MO_Clz Width
| MO_Ctz Width
| MO_BSwap Width
| MO_BRev Width
| MO_AtomicRMW Width AtomicMachOp
| MO_AtomicRead Width
| MO_AtomicWrite Width
| MO_Cmpxchg Width
deriving (CallishMachOp -> CallishMachOp -> Bool
(CallishMachOp -> CallishMachOp -> Bool)
-> (CallishMachOp -> CallishMachOp -> Bool) -> Eq CallishMachOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CallishMachOp -> CallishMachOp -> Bool
$c/= :: CallishMachOp -> CallishMachOp -> Bool
== :: CallishMachOp -> CallishMachOp -> Bool
$c== :: CallishMachOp -> CallishMachOp -> Bool
Eq, Int -> CallishMachOp -> ShowS
[CallishMachOp] -> ShowS
CallishMachOp -> String
(Int -> CallishMachOp -> ShowS)
-> (CallishMachOp -> String)
-> ([CallishMachOp] -> ShowS)
-> Show CallishMachOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CallishMachOp] -> ShowS
$cshowList :: [CallishMachOp] -> ShowS
show :: CallishMachOp -> String
$cshow :: CallishMachOp -> String
showsPrec :: Int -> CallishMachOp -> ShowS
$cshowsPrec :: Int -> CallishMachOp -> ShowS
Show)
data AtomicMachOp =
AMO_Add
| AMO_Sub
| AMO_And
| AMO_Nand
| AMO_Or
| AMO_Xor
deriving (AtomicMachOp -> AtomicMachOp -> Bool
(AtomicMachOp -> AtomicMachOp -> Bool)
-> (AtomicMachOp -> AtomicMachOp -> Bool) -> Eq AtomicMachOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AtomicMachOp -> AtomicMachOp -> Bool
$c/= :: AtomicMachOp -> AtomicMachOp -> Bool
== :: AtomicMachOp -> AtomicMachOp -> Bool
$c== :: AtomicMachOp -> AtomicMachOp -> Bool
Eq, Int -> AtomicMachOp -> ShowS
[AtomicMachOp] -> ShowS
AtomicMachOp -> String
(Int -> AtomicMachOp -> ShowS)
-> (AtomicMachOp -> String)
-> ([AtomicMachOp] -> ShowS)
-> Show AtomicMachOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AtomicMachOp] -> ShowS
$cshowList :: [AtomicMachOp] -> ShowS
show :: AtomicMachOp -> String
$cshow :: AtomicMachOp -> String
showsPrec :: Int -> AtomicMachOp -> ShowS
$cshowsPrec :: Int -> AtomicMachOp -> ShowS
Show)
pprCallishMachOp :: CallishMachOp -> SDoc
pprCallishMachOp :: CallishMachOp -> SDoc
pprCallishMachOp CallishMachOp
mo = String -> SDoc
text (CallishMachOp -> String
forall a. Show a => a -> String
show CallishMachOp
mo)
callishMachOpHints :: CallishMachOp -> ([ForeignHint], [ForeignHint])
callishMachOpHints :: CallishMachOp -> ([ForeignHint], [ForeignHint])
callishMachOpHints CallishMachOp
op = case CallishMachOp
op of
MO_Memcpy Int
_ -> ([], [ForeignHint
AddrHint, ForeignHint
AddrHint, ForeignHint
NoHint])
MO_Memset Int
_ -> ([], [ForeignHint
AddrHint, ForeignHint
SignedHint, ForeignHint
NoHint])
MO_Memmove Int
_ -> ([], [ForeignHint
AddrHint, ForeignHint
AddrHint, ForeignHint
NoHint])
MO_Memcmp Int
_ -> ([], [ForeignHint
AddrHint, ForeignHint
AddrHint, ForeignHint
NoHint])
CallishMachOp
_ -> ([],[])
callishMachOpReps :: CallishMachOp -> (PrimRep, [PrimRep])
callishMachOpReps :: CallishMachOp -> (PrimRep, [PrimRep])
callishMachOpReps CallishMachOp
op = case CallishMachOp
op of
MO_Memcpy Int
_ -> (PrimRep
AddrRep, [PrimRep
AddrRep, PrimRep
AddrRep, PrimRep
WordRep])
MO_Memset Int
_ -> (PrimRep
AddrRep, [PrimRep
AddrRep, PrimRep
Int32Rep, PrimRep
WordRep])
MO_Memmove Int
_ -> (PrimRep
AddrRep, [PrimRep
AddrRep, PrimRep
AddrRep, PrimRep
WordRep])
MO_Memcmp Int
_ -> (PrimRep
Int32Rep, [PrimRep
AddrRep, PrimRep
AddrRep, PrimRep
WordRep])
CallishMachOp
MO_F64_Pwr -> (PrimRep
DoubleRep, [PrimRep
DoubleRep, PrimRep
DoubleRep])
CallishMachOp
MO_F64_Sin -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Cos -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Tan -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Sinh -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Cosh -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Tanh -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Asin -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Acos -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Atan -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Asinh -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Acosh -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Atanh -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Log -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Log1P -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Exp -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_ExpM1 -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Fabs -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F64_Sqrt -> (PrimRep
DoubleRep, [PrimRep
DoubleRep])
CallishMachOp
MO_F32_Pwr -> (PrimRep
FloatRep, [PrimRep
FloatRep, PrimRep
FloatRep])
CallishMachOp
MO_F32_Sin -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Cos -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Tan -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Sinh -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Cosh -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Tanh -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Asin -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Acos -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Atan -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Asinh -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Acosh -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Atanh -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Log -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Log1P -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Exp -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_ExpM1 -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Fabs -> (PrimRep
FloatRep, [PrimRep
FloatRep])
CallishMachOp
MO_F32_Sqrt -> (PrimRep
FloatRep, [PrimRep
FloatRep])
MO_PopCnt Width
W8 -> (PrimRep
Word8Rep, [PrimRep
Word8Rep])
MO_PopCnt Width
W16 -> (PrimRep
Word16Rep, [PrimRep
Word16Rep])
MO_PopCnt Width
W32 -> (PrimRep
Word32Rep, [PrimRep
Word32Rep])
MO_PopCnt Width
W64 -> (PrimRep
Word64Rep, [PrimRep
Word64Rep])
MO_BSwap Width
W8 -> (PrimRep
Word8Rep, [PrimRep
Word8Rep])
MO_BSwap Width
W16 -> (PrimRep
Word16Rep, [PrimRep
Word16Rep])
MO_BSwap Width
W32 -> (PrimRep
Word32Rep, [PrimRep
Word32Rep])
MO_BSwap Width
W64 -> (PrimRep
Word64Rep, [PrimRep
Word64Rep])
MO_BRev Width
W8 -> (PrimRep
Word8Rep, [PrimRep
Word8Rep])
MO_BRev Width
W16 -> (PrimRep
Word16Rep, [PrimRep
Word16Rep])
MO_BRev Width
W32 -> (PrimRep
Word32Rep, [PrimRep
Word32Rep])
MO_BRev Width
W64 -> (PrimRep
Word64Rep, [PrimRep
Word64Rep])
CallishMachOp
_ -> (PrimRep
VoidRep, [])
machOpMemcpyishAlign :: CallishMachOp -> Maybe Int
machOpMemcpyishAlign :: CallishMachOp -> Maybe Int
machOpMemcpyishAlign CallishMachOp
op = case CallishMachOp
op of
MO_Memcpy Int
align -> Int -> Maybe Int
forall a. a -> Maybe a
Just Int
align
MO_Memset Int
align -> Int -> Maybe Int
forall a. a -> Maybe a
Just Int
align
MO_Memmove Int
align -> Int -> Maybe Int
forall a. a -> Maybe a
Just Int
align
MO_Memcmp Int
align -> Int -> Maybe Int
forall a. a -> Maybe a
Just Int
align
CallishMachOp
_ -> Maybe Int
forall a. Maybe a
Nothing