ContinuationFormat(..),
) where
-#include "HsVersions.h"
-
+import BlockId
import Cmm
import CLabel
import CmmBrokenBlock -- Data types only
import Unique
import Maybe
import List
+import FastString
import Panic
-- Right <=> Function or Proc point
CLabel -- Used to generate both info & entry labels
CmmFormalsWithoutKinds -- Argument locals live on entry (C-- procedure params)
- Bool -- ^ True <=> GC block so ignore stack size
+ Bool -- True <=> GC block so ignore stack size
[BrokenBlock] -- 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
main_stmts =
case entry of
FunctionEntry _ _ _ ->
- -- Ugh, the statements for an update frame must come
- -- *after* the GC check that was added at the beginning
- -- of the CPS pass. So we have do edit the statements
- -- a bit. This depends on the knowledge that the
- -- statements in the first block are only the GC check.
- -- That's fragile but it works for now.
+ -- The statements for an update frame must come /after/
+ -- the GC check that was added at the beginning of the
+ -- CPS pass. So we have do edit the statements a bit.
+ -- This depends on the knowledge that the statements in
+ -- the first block are only the GC check. That's
+ -- fragile but it works for now.
gc_stmts ++ stmts ++ update_stmts ++ postfix_stmts
ControlEntry -> stmts ++ postfix_stmts
ContinuationEntry _ _ _ -> stmts ++ postfix_stmts
foreignCall call_uniques (CmmPrim target)
results arguments
-formal_to_actual reg = CmmHinted (CmmReg (CmmLocal reg)) NoHint
+formal_to_actual reg = CmmKinded (CmmReg (CmmLocal reg)) NoHint
foreignCall :: [Unique] -> CmmCallTarget -> CmmFormals -> CmmActuals -> [CmmStmt]
foreignCall uniques call results arguments =
saveThreadState ++
caller_save ++
[CmmCall (CmmCallee suspendThread CCallConv)
- [ CmmHinted id PtrHint ]
- [ CmmHinted (CmmReg (CmmGlobal BaseReg)) PtrHint ]
+ [ CmmKinded id PtrHint ]
+ [ CmmKinded (CmmReg (CmmGlobal BaseReg)) PtrHint ]
CmmUnsafe
CmmMayReturn,
CmmCall call results new_args CmmUnsafe CmmMayReturn,
CmmCall (CmmCallee resumeThread CCallConv)
- [ CmmHinted new_base PtrHint ]
- [ CmmHinted (CmmReg (CmmLocal id)) PtrHint ]
+ [ CmmKinded new_base PtrHint ]
+ [ CmmKinded (CmmReg (CmmLocal id)) PtrHint ]
CmmUnsafe
CmmMayReturn,
-- Assign the result to BaseReg: we
CmmAssign (CmmGlobal BaseReg) (CmmReg (CmmLocal new_base))] ++
caller_load ++
loadThreadState tso_unique ++
- [CmmJump (CmmReg spReg) (map (formal_to_actual . hintlessCmm) results)]
+ [CmmJump (CmmReg spReg) (map (formal_to_actual . kindlessCmm) results)]
where
(_, arg_stmts, new_args) =
loadArgsIntoTemps argument_uniques arguments
-- -----------------------------------------------------------------------------
-- Save/restore the thread state in the TSO
-suspendThread = CmmLit (CmmLabel (mkRtsCodeLabel SLIT("suspendThread")))
-resumeThread = CmmLit (CmmLabel (mkRtsCodeLabel SLIT("resumeThread")))
+suspendThread = CmmLit (CmmLabel (mkRtsCodeLabel (sLit "suspendThread")))
+resumeThread = CmmLit (CmmLabel (mkRtsCodeLabel (sLit "resumeThread")))
-- This stuff can't be done in suspendThread/resumeThread, because it
-- refers to global registers which aren't available in the C world.
= store_arguments ++ adjust_sp_reg spRel ++ jump where
store_arguments =
[stack_put spRel expr offset
- | ((CmmHinted expr _), StackParam offset) <- argument_formats] ++
+ | ((CmmKinded expr _), StackParam offset) <- argument_formats] ++
[global_put expr global
- | ((CmmHinted expr _), RegisterParam global) <- argument_formats]
+ | ((CmmKinded expr _), RegisterParam global) <- argument_formats]
jump = [CmmJump target arguments]
- argument_formats = assignArguments (cmmExprRep . hintlessCmm) arguments
+ argument_formats = assignArguments (cmmExprRep . kindlessCmm) arguments
adjust_sp_reg spRel =
if spRel == 0