import Literal ( Literal(..) )
import TyCon ( tyConDataCons )
import Name ( NamedThing(..) )
-import DataCon ( DataCon{-instance NamedThing-}, dataConWrapId )
+import DataCon ( dataConWrapId )
import Maybes ( maybeToBool, catMaybes )
-import PrimOp ( primOpNeedsWrapper, pprPrimOp, pprCCallOp,
+import PrimOp ( primOpNeedsWrapper, pprCCallOp,
PrimOp(..), CCall(..), CCallTarget(..), isDynamicTarget )
-import PrimRep ( isFloatingRep, PrimRep(..), getPrimRepSize, showPrimRep )
+import PrimRep ( isFloatingRep, PrimRep(..), getPrimRepSize )
import SMRep ( pprSMRep )
import Unique ( pprUnique, Unique{-instance NamedThing-} )
import UniqSet ( emptyUniqSet, elementOfUniqSet,
import Util ( nOfThem )
import ST
-import MutableArray
infixr 9 `thenTE`
\end{code}
the_op
where
ppr_op_call results args
- = hcat [ pprPrimOp op, lparen,
+ = hcat [ ppr op, lparen,
hcat (punctuate comma (map ppr_op_result results)),
if null results || null args then empty else comma,
hcat (punctuate comma (map pprAmode args)),
ccall_res_ty =
case non_void_results of
[] -> ptext SLIT("void")
- [amode] -> text (showPrimRep (getAmodeRep amode))
+ [amode] -> ppr (getAmodeRep amode)
_ -> panic "pprAbsC{CCallTypedef}: ccall_res_ty"
ccall_decl_ty_args
| is_tdef = tail ccall_arg_tys
| otherwise = ccall_arg_tys
- ccall_arg_tys = map (text.showPrimRep.getAmodeRep) non_void_args
+ ccall_arg_tys = map (ppr . getAmodeRep) non_void_args
-- the first argument will be the "I/O world" token (a VoidRep)
-- all others should be non-void
where
rep = getAmodeRep item
- padding_wds =
- if not (closureUpdReqd cl_info) then
- []
- else
- case max 0 (mIN_UPD_SIZE - length amodes) of { still_needed ->
- nOfThem still_needed (mkIntCLit 0) } -- a bunch of 0s
+ upd_reqd = closureUpdReqd cl_info
+ padding_wds
+ | not upd_reqd = []
+ | otherwise = case max 0 (mIN_UPD_SIZE - length amodes) of { still_needed ->
+ nOfThem still_needed (mkIntCLit 0) } -- a bunch of 0s
+
+ -- always have a static link field, it's used to save the closure's
+ -- info pointer when we're reverting CAFs (see comment in Storage.c)
static_link_field
- | staticClosureNeedsLink cl_info = [mkIntCLit 0]
- | otherwise = []
+ | upd_reqd || staticClosureNeedsLink cl_info = [mkIntCLit 0]
+ | otherwise = []
pprAbsC stmt@(CClosureInfoAndCode cl_info slow maybe_fast cl_descr) _
= vcat [
\end{code}
\begin{code}
-has_srt (_, NoSRT) = False
-has_srt _ = True
-
pp_srt_info srt =
case srt of
(lbl, NoSRT) ->