%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-% $Id: CgCase.lhs,v 1.45 2000/08/02 14:13:27 rrt Exp $
+% $Id: CgCase.lhs,v 1.46 2000/09/06 12:21:15 simonmar Exp $
%
%********************************************************
%* *
)
import Type ( Type, typePrimRep, splitAlgTyConApp,
splitTyConApp_maybe, repType )
-import Unique ( Unique, Uniquable(..), mkPseudoUnique1 )
+import Unique ( Unique, Uniquable(..), newTagUnique )
import Maybes ( maybeToBool )
import Util
import Outputable
table to get the closure).
Being a bit short of uniques for temporary variables here, we use
-mkPseudoUnique1 to generate a temporary for the tag. We can't use
-mkBuiltinUnique, because that occasionally clashes with some
-temporaries generated for _ccall_GC, amongst others (see CgExpr.lhs).
+newTagUnique to generate a new unique from the case binder. The case
+binder's unique will presumably have the 'c' tag (generated by
+CoreToStg), so we just change its tag to 'C' (for 'case') to ensure it
+doesn't clash with anything else.
\begin{code}
cgCase (StgPrimApp op args res_ty)
let tag_amode = case op of
TagToEnumOp -> only arg_amodes
- _ -> CTemp (mkPseudoUnique1{-see above-} 1) IntRep
+ _ -> CTemp (newTagUnique (getUnique bndr) 'C') IntRep
closure = CVal (CIndex (CLbl (mkClosureTblLabel tycon) PtrRep) tag_amode PtrRep) PtrRep
in