-machRepPtrCType :: MachRep -> SDoc
-machRepPtrCType r | r == wordRep = ptext (sLit "P_")
- | otherwise = machRepCType r <> char '*'
-
-machRepCType :: MachRep -> SDoc
-machRepCType r | r == wordRep = ptext (sLit "W_")
- | otherwise = sized_type
- where sized_type = case r of
- I8 -> ptext (sLit "StgWord8")
- I16 -> ptext (sLit "StgWord16")
- I32 -> ptext (sLit "StgWord32")
- I64 -> ptext (sLit "StgWord64")
- F32 -> ptext (sLit "StgFloat") -- ToDo: correct?
- F64 -> ptext (sLit "StgDouble")
- _ -> panic "machRepCType"
-
-machRepSignedCType :: MachRep -> SDoc
-machRepSignedCType r | r == wordRep = ptext (sLit "I_")
- | otherwise = sized_type
- where sized_type = case r of
- I8 -> ptext (sLit "StgInt8")
- I16 -> ptext (sLit "StgInt16")
- I32 -> ptext (sLit "StgInt32")
- I64 -> ptext (sLit "StgInt64")
- F32 -> ptext (sLit "StgFloat") -- ToDo: correct?
- F64 -> ptext (sLit "StgDouble")
- _ -> panic "machRepCType"
+machRepPtrCType :: CmmType -> SDoc
+machRepPtrCType r | isCmmWordType r = ptext (sLit "P_")
+ | otherwise = machRepCType r <> char '*'
+
+machRepCType :: CmmType -> SDoc
+machRepCType ty | isFloatType ty = machRep_F_CType w
+ | otherwise = machRep_U_CType w
+ where
+ w = typeWidth ty
+
+machRep_F_CType :: Width -> SDoc
+machRep_F_CType W32 = ptext (sLit "StgFloat") -- ToDo: correct?
+machRep_F_CType W64 = ptext (sLit "StgDouble")
+machRep_F_CType _ = panic "machRep_F_CType"
+
+machRep_U_CType :: Width -> SDoc
+machRep_U_CType w | w == wordWidth = ptext (sLit "W_")
+machRep_U_CType W8 = ptext (sLit "StgWord8")
+machRep_U_CType W16 = ptext (sLit "StgWord16")
+machRep_U_CType W32 = ptext (sLit "StgWord32")
+machRep_U_CType W64 = ptext (sLit "StgWord64")
+machRep_U_CType _ = panic "machRep_U_CType"
+
+machRep_S_CType :: Width -> SDoc
+machRep_S_CType w | w == wordWidth = ptext (sLit "I_")
+machRep_S_CType W8 = ptext (sLit "StgInt8")
+machRep_S_CType W16 = ptext (sLit "StgInt16")
+machRep_S_CType W32 = ptext (sLit "StgInt32")
+machRep_S_CType W64 = ptext (sLit "StgInt64")
+machRep_S_CType _ = panic "machRep_S_CType"
+