summaryrefslogtreecommitdiff
path: root/utils/genapply
diff options
context:
space:
mode:
authorGeoffrey Mainland <gmainlan@microsoft.com>2011-11-04 17:44:39 +0000
committerGeoffrey Mainland <gmainlan@microsoft.com>2013-02-01 22:00:24 +0000
commit6480a35c15717025c169980b1cc763a7e6f36056 (patch)
treea4c5c6584018cd5c584414953435a6c076e02181 /utils/genapply
parent4906460ad21ca2e90c0e2d9d50368fdc13c71bf2 (diff)
downloadhaskell-6480a35c15717025c169980b1cc763a7e6f36056.tar.gz
Always pass vector values on the stack.
Vector values are now always passed on the stack. This isn't particularly efficient, but it will have to do for now.
Diffstat (limited to 'utils/genapply')
-rw-r--r--utils/genapply/GenApply.hs66
1 files changed, 38 insertions, 28 deletions
diff --git a/utils/genapply/GenApply.hs b/utils/genapply/GenApply.hs
index 33146b2a2c..2baf85896a 100644
--- a/utils/genapply/GenApply.hs
+++ b/utils/genapply/GenApply.hs
@@ -26,29 +26,32 @@ import System.IO
-- Argument kinds (rougly equivalent to PrimRep)
data ArgRep
- = N -- non-ptr
- | P -- ptr
- | V -- void
- | F -- float
- | D -- double
- | L -- long (64-bit)
+ = N -- non-ptr
+ | P -- ptr
+ | V -- void
+ | F -- float
+ | D -- double
+ | L -- long (64-bit)
+ | V16 -- 16-byte (128-bit) vectors
-- size of a value in *words*
argSize :: ArgRep -> Int
-argSize N = 1
-argSize P = 1
-argSize V = 0
-argSize F = 1
-argSize D = (SIZEOF_DOUBLE `quot` SIZEOF_VOID_P :: Int)
-argSize L = (8 `quot` SIZEOF_VOID_P :: Int)
-
-showArg :: ArgRep -> Char
-showArg N = 'n'
-showArg P = 'p'
-showArg V = 'v'
-showArg F = 'f'
-showArg D = 'd'
-showArg L = 'l'
+argSize N = 1
+argSize P = 1
+argSize V = 0
+argSize F = 1
+argSize D = (SIZEOF_DOUBLE `quot` SIZEOF_VOID_P :: Int)
+argSize L = (8 `quot` SIZEOF_VOID_P :: Int)
+argSize V16 = (16 `quot` SIZEOF_VOID_P :: Int)
+
+showArg :: ArgRep -> String
+showArg N = "n"
+showArg P = "p"
+showArg V = "v"
+showArg F = "f"
+showArg D = "d"
+showArg L = "l"
+showArg V16 = "v16"
-- is a value a pointer?
isPtr :: ArgRep -> Bool
@@ -174,7 +177,7 @@ mkBitmap args = foldr f 0 args
-- when we start passing args to stg_ap_* in regs).
mkApplyName args
- = text "stg_ap_" <> text (map showArg args)
+ = text "stg_ap_" <> text (concatMap showArg args)
mkApplyRetName args
= mkApplyName args <> text "_ret"
@@ -496,11 +499,12 @@ formalParam arg n =
text "arg" <> int n <> text ", "
formalParamType arg = argRep arg
-argRep F = text "F_"
-argRep D = text "D_"
-argRep L = text "L_"
-argRep P = text "gcptr"
-argRep _ = text "W_"
+argRep F = text "F_"
+argRep D = text "D_"
+argRep L = text "L_"
+argRep P = text "gcptr"
+argRep V16 = text "V16_"
+argRep _ = text "W_"
genApply regstatus args =
let
@@ -758,7 +762,7 @@ genApplyFast regstatus args =
-- void arguments.
mkStackApplyEntryLabel:: [ArgRep] -> Doc
-mkStackApplyEntryLabel args = text "stg_ap_stk_" <> text (map showArg args)
+mkStackApplyEntryLabel args = text "stg_ap_stk_" <> text (concatMap showArg args)
genStackApply :: RegStatus -> [ArgRep] -> Doc
genStackApply regstatus args =
@@ -783,7 +787,7 @@ genStackApply regstatus args =
-- in HeapStackCheck.hc for more details.
mkStackSaveEntryLabel :: [ArgRep] -> Doc
-mkStackSaveEntryLabel args = text "stg_stk_save_" <> text (map showArg args)
+mkStackSaveEntryLabel args = text "stg_stk_save_" <> text (concatMap showArg args)
genStackSave :: RegStatus -> [ArgRep] -> Doc
genStackSave regstatus args =
@@ -849,6 +853,7 @@ applyTypes = [
[F],
[D],
[L],
+ [V16],
[N],
[P],
[P,V],
@@ -865,6 +870,10 @@ applyTypes = [
-- ToDo: the stack apply and stack save code doesn't make a distinction
-- between N and P (they both live in the same register), only the bitmap
-- changes, so we could share the apply/save code between lots of cases.
+--
+-- NOTE: other places to change if you change stackApplyTypes:
+-- - includes/rts/storage/FunTypes.h
+-- - compiler/codeGen/CgCallConv.lhs: stdPattern
stackApplyTypes = [
[],
[N],
@@ -872,6 +881,7 @@ stackApplyTypes = [
[F],
[D],
[L],
+ [V16],
[N,N],
[N,P],
[P,N],