summaryrefslogtreecommitdiff
path: root/compiler/codeGen/ClosureInfo.lhs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/codeGen/ClosureInfo.lhs')
-rw-r--r--compiler/codeGen/ClosureInfo.lhs58
1 files changed, 30 insertions, 28 deletions
diff --git a/compiler/codeGen/ClosureInfo.lhs b/compiler/codeGen/ClosureInfo.lhs
index d3db24ce4c..7a72a00602 100644
--- a/compiler/codeGen/ClosureInfo.lhs
+++ b/compiler/codeGen/ClosureInfo.lhs
@@ -265,13 +265,13 @@ instance Outputable CgRep where
ppr FloatArg = ptext (sLit "F_")
ppr DoubleArg = ptext (sLit "D_")
-argMachRep :: CgRep -> CmmType
-argMachRep PtrArg = gcWord
-argMachRep NonPtrArg = bWord
-argMachRep LongArg = b64
-argMachRep FloatArg = f32
-argMachRep DoubleArg = f64
-argMachRep VoidArg = panic "argMachRep:VoidRep"
+argMachRep :: DynFlags -> CgRep -> CmmType
+argMachRep dflags PtrArg = gcWord dflags
+argMachRep dflags NonPtrArg = bWord dflags
+argMachRep _ LongArg = b64
+argMachRep _ FloatArg = f32
+argMachRep _ DoubleArg = f64
+argMachRep _ VoidArg = panic "argMachRep:VoidRep"
primRepToCgRep :: PrimRep -> CgRep
primRepToCgRep VoidRep = VoidArg
@@ -342,17 +342,17 @@ separateByPtrFollowness things
\end{code}
\begin{code}
-cgRepSizeB :: CgRep -> ByteOff
-cgRepSizeB DoubleArg = dOUBLE_SIZE
-cgRepSizeB LongArg = wORD64_SIZE
-cgRepSizeB VoidArg = 0
-cgRepSizeB _ = wORD_SIZE
-
-cgRepSizeW :: CgRep -> ByteOff
-cgRepSizeW DoubleArg = dOUBLE_SIZE `quot` wORD_SIZE
-cgRepSizeW LongArg = wORD64_SIZE `quot` wORD_SIZE
-cgRepSizeW VoidArg = 0
-cgRepSizeW _ = 1
+cgRepSizeB :: DynFlags -> CgRep -> ByteOff
+cgRepSizeB dflags DoubleArg = dOUBLE_SIZE dflags
+cgRepSizeB _ LongArg = wORD64_SIZE
+cgRepSizeB _ VoidArg = 0
+cgRepSizeB dflags _ = wORD_SIZE dflags
+
+cgRepSizeW :: DynFlags -> CgRep -> ByteOff
+cgRepSizeW dflags DoubleArg = dOUBLE_SIZE dflags `quot` wORD_SIZE dflags
+cgRepSizeW dflags LongArg = wORD64_SIZE `quot` wORD_SIZE dflags
+cgRepSizeW _ VoidArg = 0
+cgRepSizeW _ _ = 1
retAddrSizeW :: WordOff
retAddrSizeW = 1 -- One word
@@ -689,7 +689,7 @@ getCallMethod _dflags _name _caf (LFThunk _ _ _updatable _std_form_info is_fun)
-- So the right thing to do is just to enter the thing
-- Old version:
--- | updatable || doingTickyProfiling dflags -- to catch double entry
+-- | updatable || dopt Opt_Ticky dflags -- to catch double entry
-- = EnterIt
-- | otherwise -- Jump direct to code for single-entry thunks
-- = JumpToIt (thunkEntryLabel name caf std_form_info updatable)
@@ -927,25 +927,27 @@ lfFunInfo :: LambdaFormInfo -> Maybe (RepArity, ArgDescr)
lfFunInfo (LFReEntrant _ arity _ arg_desc) = Just (arity, arg_desc)
lfFunInfo _ = Nothing
-funTag :: ClosureInfo -> Int
-funTag (ClosureInfo { closureLFInfo = lf_info }) = funTagLFInfo lf_info
-funTag _ = 0
+funTag :: DynFlags -> ClosureInfo -> Int
+funTag dflags (ClosureInfo { closureLFInfo = lf_info })
+ = funTagLFInfo dflags lf_info
+funTag _ _ = 0
-- maybe this should do constructor tags too?
-funTagLFInfo :: LambdaFormInfo -> Int
-funTagLFInfo lf
+funTagLFInfo :: DynFlags -> LambdaFormInfo -> Int
+funTagLFInfo dflags lf
-- A function is tagged with its arity
| Just (arity,_) <- lfFunInfo lf,
- Just tag <- tagForArity arity
+ Just tag <- tagForArity dflags arity
= tag
-- other closures (and unknown ones) are not tagged
| otherwise
= 0
-tagForArity :: RepArity -> Maybe Int
-tagForArity i | i <= mAX_PTR_TAG = Just i
- | otherwise = Nothing
+tagForArity :: DynFlags -> RepArity -> Maybe Int
+tagForArity dflags i
+ | i <= mAX_PTR_TAG dflags = Just i
+ | otherwise = Nothing
clHasCafRefs :: ClosureInfo -> CafInfo
clHasCafRefs (ClosureInfo {closureSRT = srt}) =