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 ...@@ -767,15 +767,17 @@ foreignCall
-> ExtFCode CmmExpr -> ExtFCode CmmExpr
-> [ExtFCode (CmmExpr,MachHint)] -> [ExtFCode (CmmExpr,MachHint)]
-> Maybe [GlobalReg] -> P ExtCode -> Maybe [GlobalReg] -> P ExtCode
foreignCall "C" results_code expr_code args_code vols foreignCall conv_string results_code expr_code args_code vols
= return $ do = do convention <- case conv_string of
results <- sequence results_code "C" -> return CCallConv
expr <- expr_code "C--" -> return CmmCallConv
args <- sequence args_code _ -> fail ("unknown calling convention: " ++ conv_string)
code (emitForeignCall' PlayRisky results return $ do
(CmmForeignCall expr CCallConv) args vols) results <- sequence results_code
foreignCall conv _ _ _ _ expr <- expr_code
= fail ("unknown calling convention: " ++ conv) args <- sequence args_code
code (emitForeignCall' PlayRisky results
(CmmForeignCall expr convention) args vols) where
primCall primCall
:: [ExtFCode (CmmReg,MachHint)] :: [ExtFCode (CmmReg,MachHint)]
......
...@@ -73,7 +73,9 @@ cmmStmtLive other_live (CmmSwitch expr targets) = ...@@ -73,7 +73,9 @@ cmmStmtLive other_live (CmmSwitch expr targets) =
cmmExprLive expr . cmmExprLive expr .
(foldr ((.) . (addLive . lookupWithDefaultUFM other_live emptyUniqSet)) id (mapCatMaybes id targets)) (foldr ((.) . (addLive . lookupWithDefaultUFM other_live emptyUniqSet)) id (mapCatMaybes id targets))
cmmStmtLive _ (CmmJump expr params) = 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 ...@@ -128,13 +128,14 @@ so perhaps we should emit a warning if it's being used on other
platforms. platforms.
\begin{code} \begin{code}
data CCallConv = CCallConv | StdCallConv data CCallConv = CCallConv | StdCallConv | CmmCallConv
deriving (Eq) deriving (Eq)
{-! derive: Binary !-} {-! derive: Binary !-}
instance Outputable CCallConv where instance Outputable CCallConv where
ppr StdCallConv = ptext SLIT("stdcall") ppr StdCallConv = ptext SLIT("stdcall")
ppr CCallConv = ptext SLIT("ccall") ppr CCallConv = ptext SLIT("ccall")
ppr CmmCallConv = ptext SLIT("C--")
defaultCCallConv :: CCallConv defaultCCallConv :: CCallConv
defaultCCallConv = CCallConv defaultCCallConv = CCallConv
......
Supports Markdown
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