summaryrefslogtreecommitdiff
path: root/compiler/codeGen/CgExpr.lhs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/codeGen/CgExpr.lhs')
-rw-r--r--compiler/codeGen/CgExpr.lhs24
1 files changed, 13 insertions, 11 deletions
diff --git a/compiler/codeGen/CgExpr.lhs b/compiler/codeGen/CgExpr.lhs
index 0a4466292e..151947665f 100644
--- a/compiler/codeGen/CgExpr.lhs
+++ b/compiler/codeGen/CgExpr.lhs
@@ -15,7 +15,6 @@ module CgExpr ( cgExpr ) where
#include "HsVersions.h"
-import Constants
import StgSyn
import CgMonad
@@ -146,10 +145,11 @@ cgExpr (StgOpApp (StgFCallOp fcall _) stg_args res_ty) = do
cgExpr (StgOpApp (StgPrimOp TagToEnumOp) [arg] res_ty)
= ASSERT(isEnumerationTyCon tycon)
- do { (_rep,amode) <- getArgAmode arg
+ do { dflags <- getDynFlags
+ ; (_rep,amode) <- getArgAmode arg
; amode' <- assignTemp amode -- We're going to use it twice,
-- so save in a temp if non-trivial
- ; stmtC (CmmAssign nodeReg (tagToClosure tycon amode'))
+ ; stmtC (CmmAssign nodeReg (tagToClosure dflags tycon amode'))
; performReturn $ emitReturnInstr (Just [node]) }
where
-- If you're reading this code in the attempt to figure
@@ -177,7 +177,8 @@ cgExpr (StgOpApp (StgPrimOp primop) args res_ty)
performReturn $ emitReturnInstr (Just [])
| ReturnsPrim rep <- result_info
- = do res <- newTemp (typeCmmType res_ty)
+ = do dflags <- getDynFlags
+ res <- newTemp (typeCmmType dflags res_ty)
cgPrimOp [res] primop args emptyVarSet
performPrimReturn (primRepToCgRep rep) (CmmReg (CmmLocal res))
@@ -188,10 +189,11 @@ cgExpr (StgOpApp (StgPrimOp primop) args res_ty)
| ReturnsAlg tycon <- result_info, isEnumerationTyCon tycon
-- c.f. cgExpr (...TagToEnumOp...)
- = do tag_reg <- newTemp bWord -- The tag is a word
+ = do dflags <- getDynFlags
+ tag_reg <- newTemp (bWord dflags) -- The tag is a word
cgPrimOp [tag_reg] primop args emptyVarSet
stmtC (CmmAssign nodeReg
- (tagToClosure tycon
+ (tagToClosure dflags tycon
(CmmReg (CmmLocal tag_reg))))
-- ToDo: STG Live -- worried about this
performReturn $ emitReturnInstr (Just [node])
@@ -349,7 +351,7 @@ mkRhsClosure dflags bndr cc bi
(StgApp selectee [{-no args-}]))])
| the_fv == scrutinee -- Scrutinee is the only free variable
&& maybeToBool maybe_offset -- Selectee is a component of the tuple
- && offset_into_int <= mAX_SPEC_SELECTEE_SIZE -- Offset is small enough
+ && offset_into_int <= mAX_SPEC_SELECTEE_SIZE dflags -- Offset is small enough
= -- NOT TRUE: ASSERT(is_single_constructor)
-- The simplifier may have statically determined that the single alternative
-- is the only possible case and eliminated the others, even if there are
@@ -393,7 +395,7 @@ mkRhsClosure dflags bndr cc bi
| args `lengthIs` (arity-1)
&& all isFollowableArg (map idCgRep fvs)
&& isUpdatable upd_flag
- && arity <= mAX_SPEC_AP_SIZE
+ && arity <= mAX_SPEC_AP_SIZE dflags
&& not (dopt Opt_SccProfilingOn dflags)
-- not when profiling: we don't want to
-- lose information about this particular
@@ -481,14 +483,14 @@ Little helper for primitives that return unboxed tuples.
\begin{code}
newUnboxedTupleRegs :: Type -> FCode ([CgRep], [LocalReg], [ForeignHint])
-newUnboxedTupleRegs res_ty =
+newUnboxedTupleRegs res_ty = do
+ dflags <- getDynFlags
let
UbxTupleRep ty_args = repType res_ty
(reps,hints) = unzip [ (rep, typeForeignHint ty) | ty <- ty_args,
let rep = typeCgRep ty,
nonVoidArg rep ]
- make_new_temp rep = newTemp (argMachRep rep)
- in do
+ make_new_temp rep = newTemp (argMachRep dflags rep)
regs <- mapM make_new_temp reps
return (reps,regs,hints)
\end{code}