#include "HsVersions.h"
import Cmm
+import CmmUtils
import CLabel
import MachOp (MachHint(..))
+import CgUtils (callerSaveVolatileRegs)
import ClosureInfo
import Maybes
target results arguments srt
-- Break the block on safe calls (the main job of this function)
- (CmmCall target results arguments (CmmSafe srt):stmts) ->
+ (CmmCall target results arguments (CmmSafe srt) : stmts) ->
(cont_info : cont_infos, block : blocks)
where
next_id = BlockId $ head uniques
(cont_infos, blocks) = breakBlock' (tail uniques) next_id
ControlEntry [] [] stmts
+ -- Unsafe calls don't need a continuation
+ -- but they do need to be expanded
+ (CmmCall target results arguments CmmUnsafe : stmts) ->
+ breakBlock' remaining_uniques current_id entry exits
+ (accum_stmts ++
+ arg_stmts ++
+ caller_save ++
+ [CmmCall target results new_args CmmUnsafe] ++
+ caller_load)
+ stmts
+ where
+ (remaining_uniques, arg_stmts, new_args) =
+ loadArgsIntoTemps uniques arguments
+ (caller_save, caller_load) = callerSaveVolatileRegs (Just [])
+
-- Default case. Just keep accumulating statements
-- and branch targets.
- (s:stmts) ->
+ (s : stmts) ->
breakBlock' uniques current_id entry
(cond_branch_target s++exits)
(accum_stmts++[s])