-stg_gc_gen = mkRtsApFastLabel SLIT("gen_cg_TODO") --panic "Need the label for gc"
-make_gc_block block_id fun_label formals safety = BasicBlock block_id stmts
- where
- stmts = [CmmCall stg_gc_gen_target [] [] safety,
- CmmJump fun_expr actuals]
- stg_gc_gen_target =
- CmmForeignCall (CmmLit (CmmLabel stg_gc_gen)) CmmCallConv
- actuals = map (\x -> (CmmReg (CmmLocal x), NoHint)) formals
- fun_expr = CmmLit (CmmLabel fun_label)
-
-make_gc_check stack_use gc_block =
- [CmmCondBranch
- (CmmMachOp (MO_U_Lt $ cmmRegRep spReg)
- [CmmReg stack_use, CmmReg spLimReg])
- gc_block]
-
-force_gc_block old_info stack_use block_id fun_label formals =
- case old_info of
- CmmInfo (Just existing) _ _
- -> (old_info, [], make_gc_check stack_use existing)
- CmmInfo Nothing update_frame info_table
- -> (CmmInfo (Just block_id) update_frame info_table,
- [make_gc_block block_id fun_label formals (CmmSafe $ cmmInfoTableSRT info_table)],
- make_gc_check stack_use block_id)
-
-cmmInfoTableSRT CmmNonInfoTable = NoC_SRT
-cmmInfoTableSRT (CmmInfoTable _ _ (ConstrInfo _ _ _)) = NoC_SRT
-cmmInfoTableSRT (CmmInfoTable _ _ (FunInfo _ srt _ _ _ _)) = srt
-cmmInfoTableSRT (CmmInfoTable _ _ (ThunkInfo _ srt)) = srt
-cmmInfoTableSRT (CmmInfoTable _ _ (ThunkSelectorInfo _ srt)) = srt
-cmmInfoTableSRT (CmmInfoTable _ _ (ContInfo _ srt)) = srt