emitReturn results
= do { sequel <- getSequel;
; updfr_off <- getUpdFrameOff
- ; emit $ mkComment $ mkFastString "emitReturn"
+ ; emit $ mkComment $ mkFastString ("emitReturn: " ++ show sequel)
; case sequel of
Return _ ->
do { adjustHpBackwards
; emit (mkMultiAssign regs results) }
}
-emitCall :: Convention -> CmmExpr -> [CmmExpr] -> FCode ()
+emitCall :: (Convention, Convention) -> CmmExpr -> [CmmExpr] -> FCode ()
-- (cgCall fun args) makes a call to the entry-code of 'fun',
-- passing 'args', and returning the results to the current sequel
-emitCall conv fun args
+emitCall convs@(callConv, _) fun args
= do { adjustHpBackwards
; sequel <- getSequel
; updfr_off <- getUpdFrameOff
- ; emit $ mkComment $ mkFastString "emitCall"
+ ; emit $ mkComment $ mkFastString ("emitCall: " ++ show sequel)
; case sequel of
- Return _ -> emit (mkForeignJump conv fun args updfr_off)
- AssignTo res_regs _ -> emit (mkCall fun conv res_regs args updfr_off)
+ Return _ -> emit (mkForeignJump callConv fun args updfr_off)
+ AssignTo res_regs _ -> emit (mkCall fun convs res_regs args updfr_off)
}
adjustHpBackwards :: FCode ()
<+> ppr args <+> ppr reps )
| null rest_reps -- Precisely the right number of arguments
- = emitCall Native target args
+ = emitCall (NativeCall, NativeReturn) target args
| otherwise -- Over-saturated call
= ASSERT( arity == length initial_reps )
do { pap_id <- newTemp gcWord
- ; let srt = pprTrace "Urk! SRT for over-sat call"
- (ppr lbl) NoC_SRT
- -- XXX: what if rest_args contains static refs?
; withSequel (AssignTo [pap_id] True)
- (emitCall Native target fast_args)
+ (emitCall (NativeCall, NativeReturn) target fast_args)
; slow_call (CmmReg (CmmLocal pap_id))
rest_args rest_reps }
where
-- top-level binding, which this binding would incorrectly shadow.
; node <- if top_lvl then return $ idToReg (NonVoid bndr)
else bindToReg (NonVoid bndr) lf_info
- ; arg_regs <-
- pprTrace "bindArgsToRegs" (ppr args) $
- bindArgsToRegs args
+ ; arg_regs <- bindArgsToRegs args
; emitClosureAndInfoTable cl_info (node : arg_regs) $ body (node, arg_regs)
}