summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmLayout.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-08-24 10:38:58 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-08-25 11:12:33 +0100
commit3a179c20d180ef8302dfccd3470b668c2b2cdeef (patch)
treec0f5baef87d0108ae295a538ec17da3e731684dc /compiler/codeGen/StgCmmLayout.hs
parent4a86a0bff7e8fb3e87708f29adf87bf566632861 (diff)
downloadhaskell-3a179c20d180ef8302dfccd3470b668c2b2cdeef.tar.gz
Refactoring: reduce usage of mkConInfo, with a view to killing it
Diffstat (limited to 'compiler/codeGen/StgCmmLayout.hs')
-rw-r--r--compiler/codeGen/StgCmmLayout.hs28
1 files changed, 10 insertions, 18 deletions
diff --git a/compiler/codeGen/StgCmmLayout.hs b/compiler/codeGen/StgCmmLayout.hs
index 953aa1cdd2..8b94abf828 100644
--- a/compiler/codeGen/StgCmmLayout.hs
+++ b/compiler/codeGen/StgCmmLayout.hs
@@ -369,12 +369,13 @@ stdPattern reps
emitClosureProcAndInfoTable :: Bool -- top-level?
-> Id -- name of the closure
- -> ClosureInfo -- lots of info abt the closure
+ -> LambdaFormInfo
+ -> CmmInfoTable
-> [NonVoid Id] -- incoming arguments
-> ((Int, LocalReg, [LocalReg]) -> FCode ()) -- function body
-> FCode ()
-emitClosureProcAndInfoTable top_lvl bndr cl_info args body
- = do { let lf_info = closureLFInfo cl_info
+emitClosureProcAndInfoTable top_lvl bndr lf_info info_tbl args body
+ = do {
-- Bind the binder itself, but only if it's not a top-level
-- binding. We need non-top let-bindings to refer to the
-- top-level binding, which this binding would incorrectly shadow.
@@ -386,28 +387,19 @@ emitClosureProcAndInfoTable top_lvl bndr cl_info args body
conv = if nodeMustPointToIt lf_info then NativeNodeCall
else NativeDirectCall
(offset, _) = mkCallEntry conv args'
- ; emitClosureAndInfoTable cl_info conv args' $ body (offset, node, arg_regs)
+ ; emitClosureAndInfoTable info_tbl conv args' $ body (offset, node, arg_regs)
}
-- Data constructors need closures, but not with all the argument handling
-- needed for functions. The shared part goes here.
emitClosureAndInfoTable ::
- ClosureInfo -> Convention -> [LocalReg] -> FCode () -> FCode ()
-emitClosureAndInfoTable cl_info conv args body
- = do { let info = mkCmmInfo cl_info
- ; blks <- getCode body
- ; emitProcWithConvention conv info (entryLabelFromCI cl_info) args blks
+ CmmInfoTable -> Convention -> [LocalReg] -> FCode () -> FCode ()
+emitClosureAndInfoTable info_tbl conv args body
+ = do { blks <- getCode body
+ ; let entry_lbl = infoLblToEntryLbl (cit_lbl info_tbl)
+ ; emitProcWithConvention conv info_tbl entry_lbl args blks
}
--- Convert from 'ClosureInfo' to 'CmmInfoTable'.
--- Not used for return points.
-mkCmmInfo :: ClosureInfo -> CmmInfoTable
-mkCmmInfo cl_info
- = CmmInfoTable { cit_lbl = infoTableLabelFromCI cl_info,
- cit_rep = closureSMRep cl_info,
- cit_prof = clProfInfo cl_info,
- cit_srt = closureSRT cl_info }
-
-----------------------------------------------------------------------------
--
-- Info table offsets