[Git][ghc/ghc][wip/ncg-simd] X86 genCCall: promote arg before calling evalArgs
sheaf (@sheaf)
gitlab at gitlab.haskell.org
Sat Sep 21 10:12:46 UTC 2024
sheaf pushed to branch wip/ncg-simd at Glasgow Haskell Compiler / GHC
Commits:
13c949c5 by sheaf at 2024-09-21T12:12:37+02:00
X86 genCCall: promote arg before calling evalArgs
- - - - -
1 changed file:
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
Changes:
=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -3243,9 +3243,12 @@ genCCall
-> [CmmFormal]
-> [CmmActual]
-> NatM InstrBlock
-genCCall bid addr conv dest_regs args = do
+genCCall bid addr conv@(ForeignConvention _ argHints _ _) dest_regs args = do
+ platform <- getPlatform
+ let args_hints = zip args (argHints ++ repeat NoHint)
+ prom_args = map (maybePromoteCArg platform W32) args_hints
is32Bit <- is32BitPlatform
- (instrs0, args') <- evalArgs bid args
+ (instrs0, args') <- evalArgs bid prom_args
instrs1 <- if is32Bit
then genCCall32 addr conv dest_regs args'
else genCCall64 addr conv dest_regs args'
@@ -3265,11 +3268,9 @@ genCCall32 :: CmmExpr -- ^ address of the function to call
-> [CmmFormal] -- ^ where to put the result
-> [CmmActual] -- ^ arguments (of mixed type)
-> NatM InstrBlock
-genCCall32 addr (ForeignConvention _ argHints _ _) dest_regs args = do
+genCCall32 addr _conv dest_regs args = do
config <- getConfig
let platform = ncgPlatform config
- args_hints = zip args (argHints ++ repeat NoHint)
- prom_args = map (maybePromoteCArg platform W32) args_hints
-- If the size is smaller than the word, we widen things (see maybePromoteCArg)
arg_size_bytes :: CmmType -> Int
@@ -3339,7 +3340,7 @@ genCCall32 addr (ForeignConvention _ argHints _ _) dest_regs args = do
delta0 <- getDeltaNat
setDeltaNat (delta0 - arg_pad_size)
- push_codes <- mapM push_arg (reverse prom_args)
+ push_codes <- mapM push_arg (reverse args)
delta <- getDeltaNat
massert (delta == delta0 - tot_arg_size)
@@ -3414,11 +3415,9 @@ genCCall64 :: CmmExpr -- ^ address of function to call
-> [CmmFormal] -- ^ where to put the result
-> [CmmActual] -- ^ arguments (of mixed type)
-> NatM InstrBlock
-genCCall64 addr conv@(ForeignConvention _ argHints _ _) dest_regs args = do
+genCCall64 addr conv dest_regs args = do
config <- getConfig
let platform = ncgPlatform config
- args_hints = zip args (argHints ++ repeat NoHint)
- prom_args = map (maybePromoteCArg platform W32) args_hints
word_size = platformWordSizeInBytes platform
wordFmt = archWordFormat (target32Bit platform)
@@ -3434,7 +3433,7 @@ genCCall64 addr conv@(ForeignConvention _ argHints _ _) dest_regs args = do
, usedRegs = arg_regs_used
, assignArgsCode = assign_args_code
}
- <- loadArgs config prom_args
+ <- loadArgs config args
let
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/13c949c5140994c7499551f105d8d7c85315470f
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/13c949c5140994c7499551f105d8d7c85315470f
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240921/d109ebd6/attachment-0001.html>
More information about the ghc-commits
mailing list