X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FcodeGen%2FCgForeignCall.hs;h=9db66f6a64aef2c8f2b86bf5498173e94251998e;hb=f3ebc8951ad495a5a027f1f482b45648dfe11c58;hp=5d84da773c2d9757304409a0c85ee27c20669ecb;hpb=d31dfb32ea936c22628b508c28a36c12e631430a;p=ghc-hetmet.git diff --git a/compiler/codeGen/CgForeignCall.hs b/compiler/codeGen/CgForeignCall.hs index 5d84da7..9db66f6 100644 --- a/compiler/codeGen/CgForeignCall.hs +++ b/compiler/codeGen/CgForeignCall.hs @@ -37,12 +37,6 @@ import Constants import StaticFlags import Outputable -import MachRegs (callerSaveVolatileRegs) - -- HACK: this is part of the NCG so we shouldn't use this, but we need - -- it for now to eliminate the need for saved regs to be in CmmCall. - -- The long term solution is to factor callerSaveVolatileRegs - -- from nativeGen into codeGen - import Control.Monad -- ----------------------------------------------------------------------------- @@ -79,7 +73,7 @@ emitForeignCall results (CCall (CCallSpec target cconv safety)) args live = do vols <- getVolatileRegs live srt <- getSRTInfo emitForeignCall' safety results - (CmmForeignCall cmm_target cconv) call_args (Just vols) srt + (CmmCallee cmm_target cconv) call_args (Just vols) srt CmmMayReturn where (call_args, cmm_target) = case target of @@ -110,13 +104,14 @@ emitForeignCall' -> [(CmmExpr,MachHint)] -- arguments -> Maybe [GlobalReg] -- live vars, in case we need to save them -> C_SRT -- the SRT of the calls continuation + -> CmmReturnInfo -> Code -emitForeignCall' safety results target args vols srt +emitForeignCall' safety results target args vols srt ret | not (playSafe safety) = do temp_args <- load_args_into_temps args let (caller_save, caller_load) = callerSaveVolatileRegs vols stmtsC caller_save - stmtC (CmmCall target results temp_args CmmUnsafe) + stmtC (CmmCall target results temp_args CmmUnsafe ret) stmtsC caller_load | otherwise = do @@ -134,15 +129,15 @@ emitForeignCall' safety results target args vols srt -- Once that happens, this function will just emit a (CmmSafe srt) call, -- and the CPS will will be the one to convert that -- to this sequence of three CmmUnsafe calls. - stmtC (CmmCall (CmmForeignCall suspendThread CCallConv) + stmtC (CmmCall (CmmCallee suspendThread CCallConv) [ (id,PtrHint) ] [ (CmmReg (CmmGlobal BaseReg), PtrHint) ] - CmmUnsafe) - stmtC (CmmCall temp_target results temp_args CmmUnsafe) - stmtC (CmmCall (CmmForeignCall resumeThread CCallConv) + CmmUnsafe ret) + stmtC (CmmCall temp_target results temp_args CmmUnsafe ret) + stmtC (CmmCall (CmmCallee resumeThread CCallConv) [ (new_base, PtrHint) ] [ (CmmReg (CmmLocal id), PtrHint) ] - CmmUnsafe) + CmmUnsafe ret) -- Assign the result to BaseReg: we -- might now have a different Capability! stmtC (CmmAssign (CmmGlobal BaseReg) (CmmReg (CmmLocal new_base))) @@ -165,9 +160,9 @@ load_args_into_temps = mapM arg_assign_temp tmp <- maybe_assign_temp e return (tmp,hint) -load_target_into_temp (CmmForeignCall expr conv) = do +load_target_into_temp (CmmCallee expr conv) = do tmp <- maybe_assign_temp expr - return (CmmForeignCall tmp conv) + return (CmmCallee tmp conv) load_target_into_temp other_target = return other_target