Skip to content
Snippets Groups Projects
Commit 6b28dc92 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1998-02-23 13:01:32 by simonm]

Fix CharLike and IntLike support:

	- rename maybeCharLikeTyCon to maybeCharLikeCon
	- rename maybeIntLikeTyCon  to maybeIntLikeCon

and make them return Bool instead of (Maybe TyCon).
parent d1987b62
No related merge requests found
......@@ -47,7 +47,7 @@ import Id ( idPrimRep, dataConTag, dataConTyCon,
)
import Literal ( Literal(..) )
import Maybes ( maybeToBool )
import PrelInfo ( maybeCharLikeTyCon, maybeIntLikeTyCon )
import PrelInfo ( maybeCharLikeCon, maybeIntLikeCon )
import PrimRep ( isFloatingRep, PrimRep(..) )
import TyCon ( TyCon{-instance Uniquable-} )
import Util ( isIn, zipWithEqual, panic, assertPanic )
......@@ -292,16 +292,15 @@ Because of this, we use can safely return an addressing mode.
\begin{code}
buildDynCon binder cc con [arg_amode] all_zero_size_args@False
| maybeToBool (maybeCharLikeTyCon tycon)
| maybeCharLikeCon con
= ASSERT(isDataCon con)
absC (CAssign temp_amode (CCharLike arg_amode)) `thenC`
returnFC temp_id_info
| maybeToBool (maybeIntLikeTyCon tycon) && in_range_int_lit arg_amode
| maybeIntLikeCon con && in_range_int_lit arg_amode
= ASSERT(isDataCon con)
returnFC (stableAmodeIdInfo binder (CIntLike arg_amode) (mkConLFInfo con))
where
tycon = dataConTyCon con
(temp_amode, temp_id_info) = newTempAmodeAndIdInfo binder (mkConLFInfo con)
in_range_int_lit (CLit (MachInt val _)) = val <= mAX_INTLIKE && val >= mIN_INTLIKE
......
......@@ -39,7 +39,6 @@ import Id ( dataConTag, dataConRawArgTys,
GenId{-instance NamedThing-}, Id
)
import Name ( getOccString )
import PrelInfo ( maybeIntLikeTyCon )
import PrimRep ( getPrimRepSize, PrimRep(..) )
import TyCon ( tyConDataCons, mkSpecTyCon, TyCon )
import Type ( typePrimRep, Type )
......
......@@ -92,7 +92,7 @@ import IdInfo ( ArityInfo(..) )
import Maybes ( maybeToBool )
import Name ( getOccString )
import PprType ( getTyDescription )
import PrelInfo ( maybeCharLikeTyCon, maybeIntLikeTyCon )
import PrelInfo ( maybeCharLikeCon, maybeIntLikeCon )
import PrimRep ( getPrimRepSize, separateByPtrFollowness, PrimRep )
import SMRep -- all of it
import TyCon ( TyCon, isNewTyCon )
......@@ -642,11 +642,9 @@ chooseDynSMRep lf_info tot_wds ptr_wds
(LFCon _ True) -> ConstantRep
(LFCon con _ ) -> if maybeToBool (maybeCharLikeTyCon tycon) then CharLikeRep
else if maybeToBool (maybeIntLikeTyCon tycon) then IntLikeRep
(LFCon con _ ) -> if maybeCharLikeCon con then CharLikeRep
else if maybeIntLikeCon con then IntLikeRep
else SpecRep
where
tycon = dataConTyCon con
_ -> SpecRep
in
......
......@@ -9,7 +9,7 @@ module PrelInfo (
builtinNames, derivingOccurrences,
BuiltinNames,
maybeCharLikeTyCon, maybeIntLikeTyCon,
maybeCharLikeCon, maybeIntLikeCon,
eq_RDR, ne_RDR, le_RDR, lt_RDR, ge_RDR, gt_RDR, max_RDR, min_RDR,
compare_RDR, minBound_RDR, maxBound_RDR, enumFrom_RDR, enumFromTo_RDR,
......@@ -308,8 +308,9 @@ knownKeyNames
ToDo: make it do the ``like'' part properly (as in 0.26 and before).
\begin{code}
maybeCharLikeTyCon tc = if (uniqueOf tc == charDataConKey) then Just charDataCon else Nothing
maybeIntLikeTyCon tc = if (uniqueOf tc == intDataConKey) then Just intDataCon else Nothing
maybeCharLikeCon, maybeIntLikeCon :: Id -> Bool
maybeCharLikeCon con = uniqueOf con == charDataConKey
maybeIntLikeCon con = uniqueOf con == intDataConKey
\end{code}
%************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment