summaryrefslogtreecommitdiff
path: root/compiler/codeGen/CgCon.lhs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-09-17 08:09:36 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-09-17 08:09:36 +0100
commit8c3b9aca3aaf946a91c9af6c07fc9d2afb6bbb76 (patch)
tree4cad3f73dbb84bbda3b0b7141c5bde2afd359664 /compiler/codeGen/CgCon.lhs
parent7b8a17ad3c0792f06ffa991e9e587f5458610a3c (diff)
parentb0f4c44ed777af599daf35035b0830b35e57fa4a (diff)
downloadhaskell-8c3b9aca3aaf946a91c9af6c07fc9d2afb6bbb76.tar.gz
Merge branch 'master' of http://darcs.haskell.org/ghc
Diffstat (limited to 'compiler/codeGen/CgCon.lhs')
-rw-r--r--compiler/codeGen/CgCon.lhs27
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/codeGen/CgCon.lhs b/compiler/codeGen/CgCon.lhs
index 8afbc8f64e..aeb87235e3 100644
--- a/compiler/codeGen/CgCon.lhs
+++ b/compiler/codeGen/CgCon.lhs
@@ -98,7 +98,7 @@ cgTopRhsCon id con args
; emitDataLits closure_label closure_rep
-- RETURN
- ; returnFC (id, taggedStableIdInfo id (mkLblExpr closure_label) lf_info con) }
+ ; returnFC (id, taggedStableIdInfo dflags id (mkLblExpr closure_label) lf_info con) }
\end{code}
%************************************************************************
@@ -148,8 +148,8 @@ which have exclusively size-zero (VoidRep) args, we generate no code
at all.
\begin{code}
-buildDynCon' _ _ binder _ con []
- = returnFC (taggedStableIdInfo binder
+buildDynCon' dflags _ binder _ con []
+ = returnFC (taggedStableIdInfo dflags binder
(mkLblExpr (mkClosureLabel (dataConName con)
(idCafInfo binder)))
(mkConLFInfo con)
@@ -192,8 +192,8 @@ buildDynCon' dflags platform binder _ con [arg_amode]
= do { let intlike_lbl = mkCmmGcPtrLabel rtsPackageId (fsLit "stg_INTLIKE_closure")
offsetW = (val_int - mIN_INTLIKE dflags) * (fixedHdrSize dflags + 1)
-- INTLIKE closures consist of a header and one word payload
- intlike_amode = CmmLit (cmmLabelOffW intlike_lbl offsetW)
- ; returnFC (taggedStableIdInfo binder intlike_amode (mkConLFInfo con) con) }
+ intlike_amode = CmmLit (cmmLabelOffW dflags intlike_lbl offsetW)
+ ; returnFC (taggedStableIdInfo dflags binder intlike_amode (mkConLFInfo con) con) }
buildDynCon' dflags platform binder _ con [arg_amode]
| maybeCharLikeCon con
@@ -204,8 +204,8 @@ buildDynCon' dflags platform binder _ con [arg_amode]
= do { let charlike_lbl = mkCmmGcPtrLabel rtsPackageId (fsLit "stg_CHARLIKE_closure")
offsetW = (val_int - mIN_CHARLIKE dflags) * (fixedHdrSize dflags + 1)
-- CHARLIKE closures consist of a header and one word payload
- charlike_amode = CmmLit (cmmLabelOffW charlike_lbl offsetW)
- ; returnFC (taggedStableIdInfo binder charlike_amode (mkConLFInfo con) con) }
+ charlike_amode = CmmLit (cmmLabelOffW dflags charlike_lbl offsetW)
+ ; returnFC (taggedStableIdInfo dflags binder charlike_amode (mkConLFInfo con) con) }
\end{code}
@@ -218,7 +218,7 @@ buildDynCon' dflags _ binder ccs con args
(closure_info, amodes_w_offsets) = layOutDynConstr dflags con args
; hp_off <- allocDynClosure closure_info use_cc blame_cc amodes_w_offsets
- ; returnFC (taggedHeapIdInfo binder hp_off lf_info con) }
+ ; returnFC (taggedHeapIdInfo dflags binder hp_off lf_info con) }
where
lf_info = mkConLFInfo con
@@ -249,7 +249,7 @@ bindConArgs con args
let
-- The binding below forces the masking out of the tag bits
-- when accessing the constructor field.
- bind_arg (arg, offset) = bindNewToUntagNode arg offset (mkLFArgument arg) (tagForCon con)
+ bind_arg (arg, offset) = bindNewToUntagNode arg offset (mkLFArgument arg) (tagForCon dflags con)
(_, args_w_offsets) = layOutDynConstr dflags con (addIdReps args)
--
ASSERT(not (isUnboxedTupleCon con)) return ()
@@ -284,8 +284,8 @@ bindUnboxedTupleComponents args
-- Allocate the rest on the stack
-- The real SP points to the return address, above which any
-- leftover unboxed-tuple components will be allocated
- (ptr_sp, ptr_offsets) = mkVirtStkOffsets rsp ptr_args
- (nptr_sp, nptr_offsets) = mkVirtStkOffsets ptr_sp nptr_args
+ (ptr_sp, ptr_offsets) = mkVirtStkOffsets dflags rsp ptr_args
+ (nptr_sp, nptr_offsets) = mkVirtStkOffsets dflags ptr_sp nptr_args
ptrs = ptr_sp - rsp
nptrs = nptr_sp - ptr_sp
@@ -418,7 +418,8 @@ closures predeclared.
\begin{code}
cgTyCon :: TyCon -> FCode CmmGroup -- each constructor gets a separate CmmGroup
cgTyCon tycon
- = do { constrs <- mapM (getCmm . cgDataCon) (tyConDataCons tycon)
+ = do { dflags <- getDynFlags
+ ; constrs <- mapM (getCmm . cgDataCon) (tyConDataCons tycon)
-- Generate a table of static closures for an enumeration type
-- Put the table after the data constructor decls, because the
@@ -431,7 +432,7 @@ cgTyCon tycon
; extra <-
if isEnumerationTyCon tycon then do
tbl <- getCmm (emitRODataLits "cgTyCon" (mkLocalClosureTableLabel (tyConName tycon) NoCafRefs)
- [ CmmLabelOff (mkLocalClosureLabel (dataConName con) NoCafRefs) (tagForCon con)
+ [ CmmLabelOff (mkLocalClosureLabel (dataConName con) NoCafRefs) (tagForCon dflags con)
| con <- tyConDataCons tycon])
return [tbl]
else