Commit 71aa4a47 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add new FFI calling convention "prim"

First in a series of patches to add the feature.
This patch just adds PrimCallConv to the CCallConv type.
parent bfd8d9ef
...@@ -134,7 +134,7 @@ platforms. ...@@ -134,7 +134,7 @@ platforms.
See: http://www.programmersheaven.com/2/Calling-conventions See: http://www.programmersheaven.com/2/Calling-conventions
\begin{code} \begin{code}
data CCallConv = CCallConv | StdCallConv | CmmCallConv data CCallConv = CCallConv | StdCallConv | CmmCallConv | PrimCallConv
deriving (Eq) deriving (Eq)
{-! derive: Binary !-} {-! derive: Binary !-}
...@@ -142,6 +142,7 @@ instance Outputable CCallConv where ...@@ -142,6 +142,7 @@ 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--") ppr CmmCallConv = ptext (sLit "C--")
ppr PrimCallConv = ptext (sLit "prim")
defaultCCallConv :: CCallConv defaultCCallConv :: CCallConv
defaultCCallConv = CCallConv defaultCCallConv = CCallConv
...@@ -332,11 +333,14 @@ instance Binary CCallConv where ...@@ -332,11 +333,14 @@ instance Binary CCallConv where
putByte bh 0 putByte bh 0
put_ bh StdCallConv = do put_ bh StdCallConv = do
putByte bh 1 putByte bh 1
put_ bh PrimCallConv = do
putByte bh 2
get bh = do get bh = do
h <- getByte bh h <- getByte bh
case h of case h of
0 -> do return CCallConv 0 -> do return CCallConv
_ -> do return StdCallConv 1 -> do return StdCallConv
_ -> do return PrimCallConv
instance Binary DNCallSpec where instance Binary DNCallSpec where
put_ bh (DNCallSpec isStatic kind ass nm _ _) = do put_ bh (DNCallSpec isStatic kind ass nm _ _) = do
......
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