From 418175d3c36ca51495d9dfb085fb01711e4c38f9 Mon Sep 17 00:00:00 2001 From: "Michael D. Adams" Date: Tue, 22 May 2007 15:20:08 +0000 Subject: [PATCH] Make CmmProc take CmmFormals as argument Since a CmmCall returns CmmFormals which may include global registers (and indeed one place in the code returns the results of a CmmCall into BaseReg) and since CPS conversion will change those return slots into formal arguments for the continuation of the call, CmmProc has to have CmmFormals for the formal arguments. Oddly, the old code never made use of procedure arguments so this change only effects the types and not any of the code. (Because [] is both of type [LocalReg] and CmmFormals.) --- compiler/cmm/Cmm.hs | 6 +++--- compiler/cmm/PprCmm.hs | 5 ++++- compiler/codeGen/CgInfoTbls.hs | 4 ++-- compiler/codeGen/CgMonad.lhs | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs index 0d1876e..7438750 100644 --- a/compiler/cmm/Cmm.hs +++ b/compiler/cmm/Cmm.hs @@ -58,7 +58,7 @@ data GenCmmTop d i = CmmProc [d] -- Info table, may be empty CLabel -- Used to generate both info & entry labels - [LocalReg] -- Argument locals live on entry (C-- procedure params) + CmmFormals -- Argument locals live on entry (C-- procedure params) [GenBasicBlock i] -- Code, may be empty. The first block is -- the entry point. The order is otherwise initially -- unimportant, but at some point the code gen will @@ -132,10 +132,10 @@ data CmmStmt -- Undefined outside range, and when there's a Nothing | CmmJump CmmExpr -- Jump to another function, - CmmActuals -- with these parameters. + CmmActuals -- with these parameters. | CmmReturn -- Return from a function, - CmmActuals -- with these return values. + CmmActuals -- with these return values. type CmmActuals = [(CmmExpr,MachHint)] type CmmFormals = [(CmmReg,MachHint)] diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 06d68c0..0c79f6f 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -80,6 +80,9 @@ instance Outputable CmmExpr where instance Outputable CmmReg where ppr e = pprReg e +instance Outputable LocalReg where + ppr e = pprLocalReg e + instance Outputable GlobalReg where ppr e = pprGlobalReg e @@ -96,7 +99,7 @@ pprCmm (Cmm tops) = vcat $ intersperse (text "") $ map pprTop tops pprTop :: CmmTop -> SDoc pprTop (CmmProc info lbl params blocks ) - = vcat [ pprCLabel lbl <> parens (commafy $ map pprLocalReg params) <+> lbrace + = vcat [ pprCLabel lbl <> parens (commafy $ map ppr params) <+> lbrace , nest 8 $ pprInfo info lbl , nest 4 $ vcat (map ppr blocks) , rbrace ] diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs index 62a6db2..d3b54a2 100644 --- a/compiler/codeGen/CgInfoTbls.hs +++ b/compiler/codeGen/CgInfoTbls.hs @@ -70,7 +70,7 @@ import Constants -- -- See includes/InfoTables.h -emitClosureCodeAndInfoTable :: ClosureInfo -> [LocalReg] -> CgStmts -> Code +emitClosureCodeAndInfoTable :: ClosureInfo -> CmmFormals -> CgStmts -> Code emitClosureCodeAndInfoTable cl_info args body = do { ty_descr_lit <- if opt_SccProfilingOn @@ -396,7 +396,7 @@ emitInfoTableAndCode :: CLabel -- Label of info table -> [CmmLit] -- ...its invariant part -> [CmmLit] -- ...and its variant part - -> [LocalReg] -- ...args + -> CmmFormals -- ...args -> [CmmBasicBlock] -- ...and body -> Code diff --git a/compiler/codeGen/CgMonad.lhs b/compiler/codeGen/CgMonad.lhs index 0e4a8a4..61b358a 100644 --- a/compiler/codeGen/CgMonad.lhs +++ b/compiler/codeGen/CgMonad.lhs @@ -730,7 +730,7 @@ emitData sect lits where data_block = CmmData sect lits -emitProc :: [CmmLit] -> CLabel -> [LocalReg] -> [CmmBasicBlock] -> Code +emitProc :: [CmmLit] -> CLabel -> CmmFormals -> [CmmBasicBlock] -> Code emitProc lits lbl args blocks = do { let proc_block = CmmProc (map CmmStaticLit lits) lbl args blocks ; state <- getState -- 1.7.10.4