a7c463b462426ee1676fca430dd19b92040279d9
[ghc.git] / compiler / vectorise / VectType.hs
1 module VectType ( vectTyCon, vectType, vectTypeEnv,
2 PAInstance, buildPADict )
3 where
4
5 #include "HsVersions.h"
6
7 import VectMonad
8 import VectUtils
9 import VectCore
10
11 import HscTypes ( TypeEnv, extendTypeEnvList, typeEnvTyCons )
12 import CoreSyn
13 import CoreUtils
14 import BuildTyCl
15 import DataCon
16 import TyCon
17 import Type
18 import TypeRep
19 import Coercion
20 import FamInstEnv ( FamInst, mkLocalFamInst )
21 import InstEnv ( Instance, mkLocalInstance, instanceDFunId )
22 import OccName
23 import MkId
24 import BasicTypes ( StrictnessMark(..), OverlapFlag(..), boolToRecFlag )
25 import Var ( Var )
26 import Id ( mkWildId )
27 import Name ( Name, getOccName )
28 import NameEnv
29 import TysWiredIn ( unitTy, intTy, intDataCon )
30 import TysPrim ( intPrimTy )
31
32 import Unique
33 import UniqFM
34 import UniqSet
35 import Digraph ( SCC(..), stronglyConnComp )
36
37 import Outputable
38
39 import Control.Monad ( liftM, liftM2, zipWithM, zipWithM_ )
40 import Data.List ( inits, tails, zipWith4, zipWith5 )
41
42 -- ----------------------------------------------------------------------------
43 -- Types
44
45 vectTyCon :: TyCon -> VM TyCon
46 vectTyCon tc
47 | isFunTyCon tc = builtin closureTyCon
48 | isBoxedTupleTyCon tc = return tc
49 | isUnLiftedTyCon tc = return tc
50 | otherwise = do
51 r <- lookupTyCon tc
52 case r of
53 Just tc' -> return tc'
54
55 -- FIXME: just for now
56 Nothing -> pprTrace "ccTyCon:" (ppr tc) $ return tc
57
58 vectType :: Type -> VM Type
59 vectType ty | Just ty' <- coreView ty = vectType ty'
60 vectType (TyVarTy tv) = return $ TyVarTy tv
61 vectType (AppTy ty1 ty2) = liftM2 AppTy (vectType ty1) (vectType ty2)
62 vectType (TyConApp tc tys) = liftM2 TyConApp (vectTyCon tc) (mapM vectType tys)
63 vectType (FunTy ty1 ty2) = liftM2 TyConApp (builtin closureTyCon)
64 (mapM vectType [ty1,ty2])
65 vectType ty@(ForAllTy _ _)
66 = do
67 mdicts <- mapM paDictArgType tyvars
68 mono_ty' <- vectType mono_ty
69 return $ tyvars `mkForAllTys` ([dict | Just dict <- mdicts] `mkFunTys` mono_ty')
70 where
71 (tyvars, mono_ty) = splitForAllTys ty
72
73 vectType ty = pprPanic "vectType:" (ppr ty)
74
75 -- ----------------------------------------------------------------------------
76 -- Type definitions
77
78 type TyConGroup = ([TyCon], UniqSet TyCon)
79
80 data PAInstance = PAInstance {
81 painstDFun :: Var
82 , painstOrigTyCon :: TyCon
83 , painstVectTyCon :: TyCon
84 , painstArrTyCon :: TyCon
85 }
86
87 vectTypeEnv :: TypeEnv -> VM (TypeEnv, [FamInst], [(Var, CoreExpr)])
88 vectTypeEnv env
89 = do
90 cs <- readGEnv $ mk_map . global_tycons
91 let (conv_tcs, keep_tcs) = classifyTyCons cs groups
92 keep_dcs = concatMap tyConDataCons keep_tcs
93 zipWithM_ defTyCon keep_tcs keep_tcs
94 zipWithM_ defDataCon keep_dcs keep_dcs
95 new_tcs <- vectTyConDecls conv_tcs
96
97 let orig_tcs = keep_tcs ++ conv_tcs
98 vect_tcs = keep_tcs ++ new_tcs
99
100 repr_tcs <- zipWithM buildPReprTyCon orig_tcs vect_tcs
101 parr_tcs <- zipWithM buildPArrayTyCon orig_tcs vect_tcs
102 dfuns <- mapM mkPADFun vect_tcs
103 defTyConPAs (zip vect_tcs dfuns)
104 binds <- sequence (zipWith5 buildTyConBindings orig_tcs
105 vect_tcs
106 repr_tcs
107 parr_tcs
108 dfuns)
109
110 let all_new_tcs = new_tcs ++ repr_tcs ++ parr_tcs
111
112 let new_env = extendTypeEnvList env
113 (map ATyCon all_new_tcs
114 ++ [ADataCon dc | tc <- all_new_tcs
115 , dc <- tyConDataCons tc])
116
117 return (new_env, map mkLocalFamInst (repr_tcs ++ parr_tcs), concat binds)
118 where
119 tycons = typeEnvTyCons env
120 groups = tyConGroups tycons
121
122 mk_map env = listToUFM_Directly [(u, getUnique n /= u) | (u,n) <- nameEnvUniqueElts env]
123
124 keep_tc tc = let dcs = tyConDataCons tc
125 in
126 defTyCon tc tc >> zipWithM_ defDataCon dcs dcs
127
128
129 vectTyConDecls :: [TyCon] -> VM [TyCon]
130 vectTyConDecls tcs = fixV $ \tcs' ->
131 do
132 mapM_ (uncurry defTyCon) (lazy_zip tcs tcs')
133 mapM vectTyConDecl tcs
134 where
135 lazy_zip [] _ = []
136 lazy_zip (x:xs) ~(y:ys) = (x,y) : lazy_zip xs ys
137
138 vectTyConDecl :: TyCon -> VM TyCon
139 vectTyConDecl tc
140 = do
141 name' <- cloneName mkVectTyConOcc name
142 rhs' <- vectAlgTyConRhs (algTyConRhs tc)
143
144 liftDs $ buildAlgTyCon name'
145 tyvars
146 [] -- no stupid theta
147 rhs'
148 rec_flag -- FIXME: is this ok?
149 False -- FIXME: no generics
150 False -- not GADT syntax
151 Nothing -- not a family instance
152 where
153 name = tyConName tc
154 tyvars = tyConTyVars tc
155 rec_flag = boolToRecFlag (isRecursiveTyCon tc)
156
157 vectAlgTyConRhs :: AlgTyConRhs -> VM AlgTyConRhs
158 vectAlgTyConRhs (DataTyCon { data_cons = data_cons
159 , is_enum = is_enum
160 })
161 = do
162 data_cons' <- mapM vectDataCon data_cons
163 zipWithM_ defDataCon data_cons data_cons'
164 return $ DataTyCon { data_cons = data_cons'
165 , is_enum = is_enum
166 }
167
168 vectDataCon :: DataCon -> VM DataCon
169 vectDataCon dc
170 | not . null $ dataConExTyVars dc = pprPanic "vectDataCon: existentials" (ppr dc)
171 | not . null $ dataConEqSpec dc = pprPanic "vectDataCon: eq spec" (ppr dc)
172 | otherwise
173 = do
174 name' <- cloneName mkVectDataConOcc name
175 tycon' <- vectTyCon tycon
176 arg_tys <- mapM vectType rep_arg_tys
177
178 liftDs $ buildDataCon name'
179 False -- not infix
180 (map (const NotMarkedStrict) arg_tys)
181 [] -- no labelled fields
182 univ_tvs
183 [] -- no existential tvs for now
184 [] -- no eq spec for now
185 [] -- no context
186 arg_tys
187 tycon'
188 where
189 name = dataConName dc
190 univ_tvs = dataConUnivTyVars dc
191 rep_arg_tys = dataConRepArgTys dc
192 tycon = dataConTyCon dc
193
194 mk_fam_inst :: TyCon -> TyCon -> (TyCon, [Type])
195 mk_fam_inst fam_tc arg_tc
196 = (fam_tc, [mkTyConApp arg_tc . mkTyVarTys $ tyConTyVars arg_tc])
197
198 buildPReprTyCon :: TyCon -> TyCon -> VM TyCon
199 buildPReprTyCon orig_tc vect_tc
200 = do
201 name <- cloneName mkPReprTyConOcc (tyConName orig_tc)
202 rhs_ty <- buildPReprType vect_tc
203 prepr_tc <- builtin preprTyCon
204 liftDs $ buildSynTyCon name
205 tyvars
206 (SynonymTyCon rhs_ty)
207 (Just $ mk_fam_inst prepr_tc vect_tc)
208 where
209 tyvars = tyConTyVars vect_tc
210
211 buildPReprType :: TyCon -> VM Type
212 buildPReprType = mkPRepr . map dataConRepArgTys . tyConDataCons
213
214 buildToPRepr :: Shape -> TyCon -> TyCon -> TyCon -> VM CoreExpr
215 buildToPRepr _ vect_tc prepr_tc _
216 = do
217 arg <- newLocalVar FSLIT("x") arg_ty
218 bndrss <- mapM (mapM (newLocalVar FSLIT("x"))) rep_tys
219 (alt_bodies, res_ty) <- mkToPRepr $ map (map Var) bndrss
220
221 return . Lam arg
222 . wrapFamInstBody prepr_tc var_tys
223 . Case (Var arg) (mkWildId arg_ty) res_ty
224 $ zipWith3 mk_alt data_cons bndrss alt_bodies
225 where
226 var_tys = mkTyVarTys $ tyConTyVars vect_tc
227 arg_ty = mkTyConApp vect_tc var_tys
228 data_cons = tyConDataCons vect_tc
229 rep_tys = map dataConRepArgTys data_cons
230
231 mk_alt data_con bndrs body = (DataAlt data_con, bndrs, body)
232
233 buildFromPRepr :: Shape -> TyCon -> TyCon -> TyCon -> VM CoreExpr
234 buildFromPRepr _ vect_tc prepr_tc _
235 = do
236 arg_ty <- mkPReprType res_ty
237 arg <- newLocalVar FSLIT("x") arg_ty
238 alts <- mapM mk_alt data_cons
239 body <- mkFromPRepr (unwrapFamInstScrut prepr_tc var_tys (Var arg))
240 res_ty alts
241 return $ Lam arg body
242 where
243 var_tys = mkTyVarTys $ tyConTyVars vect_tc
244 res_ty = mkTyConApp vect_tc var_tys
245 data_cons = tyConDataCons vect_tc
246
247 mk_alt dc = do
248 bndrs <- mapM (newLocalVar FSLIT("x")) $ dataConRepArgTys dc
249 return (bndrs, mkConApp dc (map Type var_tys ++ map Var bndrs))
250
251 buildPRDict :: Shape -> TyCon -> TyCon -> TyCon -> VM CoreExpr
252 buildPRDict _ vect_tc prepr_tc _
253 = prCoerce prepr_tc var_tys
254 =<< prDictOfType (mkTyConApp prepr_tc var_tys)
255 where
256 var_tys = mkTyVarTys $ tyConTyVars vect_tc
257
258 buildPArrayTyCon :: TyCon -> TyCon -> VM TyCon
259 buildPArrayTyCon orig_tc vect_tc = fixV $ \repr_tc ->
260 do
261 name' <- cloneName mkPArrayTyConOcc orig_name
262 rhs <- buildPArrayTyConRhs orig_name vect_tc repr_tc
263 parray <- builtin parrayTyCon
264
265 liftDs $ buildAlgTyCon name'
266 tyvars
267 [] -- no stupid theta
268 rhs
269 rec_flag -- FIXME: is this ok?
270 False -- FIXME: no generics
271 False -- not GADT syntax
272 (Just $ mk_fam_inst parray vect_tc)
273 where
274 orig_name = tyConName orig_tc
275 tyvars = tyConTyVars vect_tc
276 rec_flag = boolToRecFlag (isRecursiveTyCon vect_tc)
277
278
279 buildPArrayTyConRhs :: Name -> TyCon -> TyCon -> VM AlgTyConRhs
280 buildPArrayTyConRhs orig_name vect_tc repr_tc
281 = do
282 data_con <- buildPArrayDataCon orig_name vect_tc repr_tc
283 return $ DataTyCon { data_cons = [data_con], is_enum = False }
284
285 buildPArrayDataCon :: Name -> TyCon -> TyCon -> VM DataCon
286 buildPArrayDataCon orig_name vect_tc repr_tc
287 = do
288 dc_name <- cloneName mkPArrayDataConOcc orig_name
289 shape <- tyConShape vect_tc
290 repr_tys <- mapM mkPArrayType types
291
292 liftDs $ buildDataCon dc_name
293 False -- not infix
294 (shapeStrictness shape ++ map (const NotMarkedStrict) repr_tys)
295 [] -- no field labels
296 (tyConTyVars vect_tc)
297 [] -- no existentials
298 [] -- no eq spec
299 [] -- no context
300 (shapeReprTys shape ++ repr_tys)
301 repr_tc
302 where
303 types = [ty | dc <- tyConDataCons vect_tc
304 , ty <- dataConRepArgTys dc]
305
306 mkPADFun :: TyCon -> VM Var
307 mkPADFun vect_tc
308 = newExportedVar (mkPADFunOcc $ getOccName vect_tc) =<< paDFunType vect_tc
309
310 data Shape = Shape {
311 shapeReprTys :: [Type]
312 , shapeStrictness :: [StrictnessMark]
313 , shapeLength :: [CoreExpr] -> VM CoreExpr
314 , shapeReplicate :: CoreExpr -> CoreExpr -> VM [CoreExpr]
315 }
316
317 tyConShape :: TyCon -> VM Shape
318 tyConShape vect_tc
319 | isProductTyCon vect_tc
320 = return $ Shape {
321 shapeReprTys = [intPrimTy]
322 , shapeStrictness = [NotMarkedStrict]
323 , shapeLength = \[len] -> return len
324 , shapeReplicate = \len _ -> return [len]
325 }
326
327 | otherwise
328 = do
329 repr_ty <- mkPArrayType intTy -- FIXME: we want to unbox this
330 return $ Shape {
331 shapeReprTys = [repr_ty]
332 , shapeStrictness = [MarkedStrict]
333 , shapeLength = \[sel] -> lengthPA sel
334 , shapeReplicate = \len n -> do
335 e <- replicatePA len n
336 return [e]
337 }
338
339 buildTyConBindings :: TyCon -> TyCon -> TyCon -> TyCon -> Var
340 -> VM [(Var, CoreExpr)]
341 buildTyConBindings orig_tc vect_tc prepr_tc arr_tc dfun
342 = do
343 shape <- tyConShape vect_tc
344 sequence_ (zipWith4 (vectDataConWorker shape vect_tc arr_tc arr_dc)
345 orig_dcs
346 vect_dcs
347 (inits repr_tys)
348 (tails repr_tys))
349 dict <- buildPADict shape vect_tc prepr_tc arr_tc dfun
350 binds <- takeHoisted
351 return $ (dfun, dict) : binds
352 where
353 orig_dcs = tyConDataCons orig_tc
354 vect_dcs = tyConDataCons vect_tc
355 [arr_dc] = tyConDataCons arr_tc
356
357 repr_tys = map dataConRepArgTys vect_dcs
358
359 vectDataConWorker :: Shape -> TyCon -> TyCon -> DataCon
360 -> DataCon -> DataCon -> [[Type]] -> [[Type]]
361 -> VM ()
362 vectDataConWorker shape vect_tc arr_tc arr_dc orig_dc vect_dc pre (dc_tys : post)
363 = do
364 clo <- closedV
365 . inBind orig_worker
366 . polyAbstract tvs $ \abstract ->
367 liftM (abstract . vectorised)
368 $ buildClosures tvs [] dc_tys res_ty (liftM2 (,) mk_vect mk_lift)
369
370 worker <- cloneId mkVectOcc orig_worker (exprType clo)
371 hoistBinding worker clo
372 defGlobalVar orig_worker worker
373 return ()
374 where
375 tvs = tyConTyVars vect_tc
376 arg_tys = mkTyVarTys tvs
377 res_ty = mkTyConApp vect_tc arg_tys
378
379 orig_worker = dataConWorkId orig_dc
380
381 mk_vect = return . mkConApp vect_dc $ map Type arg_tys
382 mk_lift = do
383 len <- newLocalVar FSLIT("n") intPrimTy
384 arr_tys <- mapM mkPArrayType dc_tys
385 args <- mapM (newLocalVar FSLIT("xs")) arr_tys
386 shapes <- shapeReplicate shape
387 (Var len)
388 (mkDataConTag vect_dc)
389
390 empty_pre <- mapM emptyPA (concat pre)
391 empty_post <- mapM emptyPA (concat post)
392
393 return . mkLams (len : args)
394 . wrapFamInstBody arr_tc arg_tys
395 . mkConApp arr_dc
396 $ map Type arg_tys ++ shapes
397 ++ empty_pre
398 ++ map Var args
399 ++ empty_post
400
401 buildPADict :: Shape -> TyCon -> TyCon -> TyCon -> Var -> VM CoreExpr
402 buildPADict shape vect_tc prepr_tc arr_tc dfun
403 = polyAbstract tvs $ \abstract ->
404 do
405 meth_binds <- mapM (mk_method shape) paMethods
406 let meth_exprs = map (Var . fst) meth_binds
407
408 pa_dc <- builtin paDataCon
409 let dict = mkConApp pa_dc (Type (mkTyConApp vect_tc arg_tys) : meth_exprs)
410 body = Let (Rec meth_binds) dict
411 return . mkInlineMe $ abstract body
412 where
413 tvs = tyConTyVars arr_tc
414 arg_tys = mkTyVarTys tvs
415
416 mk_method shape (name, build)
417 = localV
418 $ do
419 body <- build shape vect_tc prepr_tc arr_tc
420 var <- newLocalVar name (exprType body)
421 return (var, mkInlineMe body)
422
423 paMethods = [(FSLIT("lengthPA"), buildLengthPA),
424 (FSLIT("replicatePA"), buildReplicatePA),
425 (FSLIT("toPRepr"), buildToPRepr),
426 (FSLIT("fromPRepr"), buildFromPRepr),
427 (FSLIT("dictPRepr"), buildPRDict)]
428
429 buildLengthPA :: Shape -> TyCon -> TyCon -> TyCon -> VM CoreExpr
430 buildLengthPA shape vect_tc _ arr_tc
431 = do
432 parr_ty <- mkPArrayType (mkTyConApp vect_tc arg_tys)
433 arg <- newLocalVar FSLIT("xs") parr_ty
434 shapes <- mapM (newLocalVar FSLIT("sh")) shape_tys
435 wilds <- mapM newDummyVar repr_tys
436 let scrut = unwrapFamInstScrut arr_tc arg_tys (Var arg)
437 scrut_ty = exprType scrut
438
439 body <- shapeLength shape (map Var shapes)
440
441 return . Lam arg
442 $ Case scrut (mkWildId scrut_ty) intPrimTy
443 [(DataAlt repr_dc, shapes ++ wilds, body)]
444 where
445 arg_tys = mkTyVarTys $ tyConTyVars arr_tc
446 [repr_dc] = tyConDataCons arr_tc
447
448 shape_tys = shapeReprTys shape
449 repr_tys = drop (length shape_tys) (dataConRepArgTys repr_dc)
450
451 -- data T = C0 t1 ... tm
452 -- ...
453 -- Ck u1 ... un
454 --
455 -- data [:T:] = A ![:Int:] [:t1:] ... [:un:]
456 --
457 -- replicatePA :: Int# -> T -> [:T:]
458 -- replicatePA n# t
459 -- = let c = case t of
460 -- C0 _ ... _ -> 0
461 -- ...
462 -- Ck _ ... _ -> k
463 --
464 -- xs1 = case t of
465 -- C0 x1 _ ... _ -> replicatePA @t1 n# x1
466 -- _ -> emptyPA @t1
467 --
468 -- ...
469 --
470 -- ysn = case t of
471 -- Ck _ ... _ yn -> replicatePA @un n# yn
472 -- _ -> emptyPA @un
473 -- in
474 -- A (replicatePA @Int n# c) xs1 ... ysn
475 --
476 --
477
478 buildReplicatePA :: Shape -> TyCon -> TyCon -> TyCon -> VM CoreExpr
479 buildReplicatePA shape vect_tc _ arr_tc
480 = do
481 len_var <- newLocalVar FSLIT("n") intPrimTy
482 val_var <- newLocalVar FSLIT("x") val_ty
483
484 let len = Var len_var
485 val = Var val_var
486
487 shape_reprs <- shapeReplicate shape len (ctr_num val)
488 reprs <- liftM concat $ mapM (mk_comp_arrs len val) vect_dcs
489
490 return . mkLams [len_var, val_var]
491 . wrapFamInstBody arr_tc arg_tys
492 $ mkConApp arr_dc (map Type arg_tys ++ shape_reprs ++ reprs)
493 where
494 arg_tys = mkTyVarTys (tyConTyVars arr_tc)
495 val_ty = mkTyConApp vect_tc arg_tys
496 wild = mkWildId val_ty
497 vect_dcs = tyConDataCons vect_tc
498 [arr_dc] = tyConDataCons arr_tc
499
500 ctr_num val = Case val wild intTy (zipWith ctr_num_alt vect_dcs [0..])
501 ctr_num_alt dc i = (DataAlt dc, map mkWildId (dataConRepArgTys dc),
502 mkConApp intDataCon [mkIntLitInt i])
503
504
505 mk_comp_arrs len val dc = let tys = dataConRepArgTys dc
506 wilds = map mkWildId tys
507 in
508 sequence (zipWith3 (mk_comp_arr len val dc)
509 tys (inits wilds) (tails wilds))
510
511 mk_comp_arr len val dc ty pre (_:post)
512 = do
513 var <- newLocalVar FSLIT("x") ty
514 rep <- replicatePA len (Var var)
515 empty <- emptyPA ty
516 arr_ty <- mkPArrayType ty
517
518 return $ Case val wild arr_ty
519 [(DEFAULT, [], empty), (DataAlt dc, pre ++ (var : post), rep)]
520
521 -- | Split the given tycons into two sets depending on whether they have to be
522 -- converted (first list) or not (second list). The first argument contains
523 -- information about the conversion status of external tycons:
524 --
525 -- * tycons which have converted versions are mapped to True
526 -- * tycons which are not changed by vectorisation are mapped to False
527 -- * tycons which can't be converted are not elements of the map
528 --
529 classifyTyCons :: UniqFM Bool -> [TyConGroup] -> ([TyCon], [TyCon])
530 classifyTyCons = classify [] []
531 where
532 classify conv keep cs [] = (conv, keep)
533 classify conv keep cs ((tcs, ds) : rs)
534 | can_convert && must_convert
535 = classify (tcs ++ conv) keep (cs `addListToUFM` [(tc,True) | tc <- tcs]) rs
536 | can_convert
537 = classify conv (tcs ++ keep) (cs `addListToUFM` [(tc,False) | tc <- tcs]) rs
538 | otherwise
539 = classify conv keep cs rs
540 where
541 refs = ds `delListFromUniqSet` tcs
542
543 can_convert = isNullUFM (refs `minusUFM` cs) && all convertable tcs
544 must_convert = foldUFM (||) False (intersectUFM_C const cs refs)
545
546 convertable tc = isDataTyCon tc && all isVanillaDataCon (tyConDataCons tc)
547
548 -- | Compute mutually recursive groups of tycons in topological order
549 --
550 tyConGroups :: [TyCon] -> [TyConGroup]
551 tyConGroups tcs = map mk_grp (stronglyConnComp edges)
552 where
553 edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs
554 , let ds = tyConsOfTyCon tc]
555
556 mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds)
557 mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss)
558 where
559 (tcs, dss) = unzip els
560
561 tyConsOfTyCon :: TyCon -> UniqSet TyCon
562 tyConsOfTyCon
563 = tyConsOfTypes . concatMap dataConRepArgTys . tyConDataCons
564
565 tyConsOfType :: Type -> UniqSet TyCon
566 tyConsOfType ty
567 | Just ty' <- coreView ty = tyConsOfType ty'
568 tyConsOfType (TyVarTy v) = emptyUniqSet
569 tyConsOfType (TyConApp tc tys) = extend (tyConsOfTypes tys)
570 where
571 extend | isUnLiftedTyCon tc
572 || isTupleTyCon tc = id
573
574 | otherwise = (`addOneToUniqSet` tc)
575
576 tyConsOfType (AppTy a b) = tyConsOfType a `unionUniqSets` tyConsOfType b
577 tyConsOfType (FunTy a b) = (tyConsOfType a `unionUniqSets` tyConsOfType b)
578 `addOneToUniqSet` funTyCon
579 tyConsOfType (ForAllTy _ ty) = tyConsOfType ty
580 tyConsOfType other = pprPanic "ClosureConv.tyConsOfType" $ ppr other
581
582 tyConsOfTypes :: [Type] -> UniqSet TyCon
583 tyConsOfTypes = unionManyUniqSets . map tyConsOfType
584