Commit 8e3b5645 authored by Michael D. Adams's avatar Michael D. Adams
Browse files

Added "C--" foreign calling convention

parent f2cc8b5b
......@@ -767,15 +767,17 @@ foreignCall
-> ExtFCode CmmExpr
-> [ExtFCode (CmmExpr,MachHint)]
-> Maybe [GlobalReg] -> P ExtCode
foreignCall "C" results_code expr_code args_code vols
= return $ do
results <- sequence results_code
expr <- expr_code
args <- sequence args_code
code (emitForeignCall' PlayRisky results
(CmmForeignCall expr CCallConv) args vols)
foreignCall conv _ _ _ _
= fail ("unknown calling convention: " ++ conv)
foreignCall conv_string results_code expr_code args_code vols
= do convention <- case conv_string of
"C" -> return CCallConv
"C--" -> return CmmCallConv
_ -> fail ("unknown calling convention: " ++ conv_string)
return $ do
results <- sequence results_code
expr <- expr_code
args <- sequence args_code
code (emitForeignCall' PlayRisky results
(CmmForeignCall expr convention) args vols) where
primCall
:: [ExtFCode (CmmReg,MachHint)]
......
......@@ -73,7 +73,9 @@ cmmStmtLive other_live (CmmSwitch expr targets) =
cmmExprLive expr .
(foldr ((.) . (addLive . lookupWithDefaultUFM other_live emptyUniqSet)) id (mapCatMaybes id targets))
cmmStmtLive _ (CmmJump expr params) =
const (cmmExprLive expr (mkUniqSet params))
const (cmmExprLive expr $ foldr ((.) . cmmExprLive) id (map fst params) $ emptyUniqSet)
cmmStmtLive _ (CmmReturn params) =
const (foldr ((.) . cmmExprLive) id (map fst params) $ emptyUniqSet)
--------
......
......@@ -128,13 +128,14 @@ so perhaps we should emit a warning if it's being used on other
platforms.
\begin{code}
data CCallConv = CCallConv | StdCallConv
data CCallConv = CCallConv | StdCallConv | CmmCallConv
deriving (Eq)
{-! derive: Binary !-}
instance Outputable CCallConv where
ppr StdCallConv = ptext SLIT("stdcall")
ppr CCallConv = ptext SLIT("ccall")
ppr CmmCallConv = ptext SLIT("C--")
defaultCCallConv :: CCallConv
defaultCCallConv = CCallConv
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment