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.)
= CmmProc
[d] -- Info table, may be empty
CLabel -- Used to generate both info & entry labels
= 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
[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
-- Undefined outside range, and when there's a Nothing
| CmmJump CmmExpr -- Jump to another function,
-- 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,
| CmmReturn -- Return from a function,
- CmmActuals -- with these return values.
+ CmmActuals -- with these return values.
type CmmActuals = [(CmmExpr,MachHint)]
type CmmFormals = [(CmmReg,MachHint)]
type CmmActuals = [(CmmExpr,MachHint)]
type CmmFormals = [(CmmReg,MachHint)]
instance Outputable CmmReg where
ppr e = pprReg e
instance Outputable CmmReg where
ppr e = pprReg e
+instance Outputable LocalReg where
+ ppr e = pprLocalReg e
+
instance Outputable GlobalReg where
ppr e = pprGlobalReg e
instance Outputable GlobalReg where
ppr e = pprGlobalReg e
pprTop :: CmmTop -> SDoc
pprTop (CmmProc info lbl params blocks )
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 ]
, nest 8 $ pprInfo info lbl
, nest 4 $ vcat (map ppr blocks)
, rbrace ]
--
-- See includes/InfoTables.h
--
-- 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
emitClosureCodeAndInfoTable cl_info args body
= do { ty_descr_lit <-
if opt_SccProfilingOn
:: CLabel -- Label of info table
-> [CmmLit] -- ...its invariant part
-> [CmmLit] -- ...and its variant part
:: CLabel -- Label of info table
-> [CmmLit] -- ...its invariant part
-> [CmmLit] -- ...and its variant part
- -> [LocalReg] -- ...args
+ -> CmmFormals -- ...args
-> [CmmBasicBlock] -- ...and body
-> Code
-> [CmmBasicBlock] -- ...and body
-> Code
where
data_block = CmmData 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
emitProc lits lbl args blocks
= do { let proc_block = CmmProc (map CmmStaticLit lits) lbl args blocks
; state <- getState