summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs3
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear.hs1
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs1
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Target.hs5
-rw-r--r--compiler/GHC/Driver/Backend.hs1
-rw-r--r--compiler/GHC/Platform.hs1
-rw-r--r--configure.ac2
-rw-r--r--hadrian/src/Oracles/Flag.hs3
-rw-r--r--libraries/ghc-boot/GHC/Platform/ArchOS.hs4
-rw-r--r--m4/fptools_set_haskell_platform_vars.m46
-rw-r--r--m4/ghc_convert_cpu.m43
-rw-r--r--m4/ghc_convert_os.m43
-rw-r--r--m4/ghc_tables_next_to_code.m42
-rw-r--r--m4/ghc_unregisterised.m42
-rw-r--r--testsuite/tests/count-deps/CountDepsAst.stdout1
-rw-r--r--testsuite/tests/count-deps/CountDepsParser.stdout1
16 files changed, 35 insertions, 4 deletions
diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs b/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
index 033a5cd034..7e0c570387 100644
--- a/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
@@ -119,6 +119,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcInteger conflicts excl
ArchS390X -> panic "trivColorable ArchS390X"
ArchRISCV64 -> panic "trivColorable ArchRISCV64"
ArchJavaScript-> panic "trivColorable ArchJavaScript"
+ ArchWasm32 -> panic "trivColorable ArchWasm32"
ArchUnknown -> panic "trivColorable ArchUnknown")
, count2 <- accSqueeze 0 cALLOCATABLE_REGS_INTEGER
(virtualRegSqueeze RcInteger)
@@ -152,6 +153,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcFloat conflicts exclus
ArchS390X -> panic "trivColorable ArchS390X"
ArchRISCV64 -> panic "trivColorable ArchRISCV64"
ArchJavaScript-> panic "trivColorable ArchJavaScript"
+ ArchWasm32 -> panic "trivColorable ArchWasm32"
ArchUnknown -> panic "trivColorable ArchUnknown")
, count2 <- accSqueeze 0 cALLOCATABLE_REGS_FLOAT
(virtualRegSqueeze RcFloat)
@@ -184,6 +186,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcDouble conflicts exclu
ArchS390X -> panic "trivColorable ArchS390X"
ArchRISCV64 -> panic "trivColorable ArchRISCV64"
ArchJavaScript-> panic "trivColorable ArchJavaScript"
+ ArchWasm32 -> panic "trivColorable ArchWasm32"
ArchUnknown -> panic "trivColorable ArchUnknown")
, count2 <- accSqueeze 0 cALLOCATABLE_REGS_DOUBLE
(virtualRegSqueeze RcDouble)
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear.hs b/compiler/GHC/CmmToAsm/Reg/Linear.hs
index f20326b738..8469242214 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear.hs
@@ -225,6 +225,7 @@ linearRegAlloc config entry_ids block_live sccs
ArchMipsel -> panic "linearRegAlloc ArchMipsel"
ArchRISCV64 -> panic "linearRegAlloc ArchRISCV64"
ArchJavaScript -> panic "linearRegAlloc ArchJavaScript"
+ ArchWasm32 -> panic "linearRegAlloc ArchWasm32"
ArchUnknown -> panic "linearRegAlloc ArchUnknown"
where
go :: (FR regs, Outputable regs)
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs b/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
index 8f4dc3709e..65c2805e9b 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
@@ -78,4 +78,5 @@ maxSpillSlots config = case platformArch (ncgPlatform config) of
ArchMipsel -> panic "maxSpillSlots ArchMipsel"
ArchRISCV64 -> panic "maxSpillSlots ArchRISCV64"
ArchJavaScript-> panic "maxSpillSlots ArchJavaScript"
+ ArchWasm32 -> panic "maxSpillSlots ArchWasm32"
ArchUnknown -> panic "maxSpillSlots ArchUnknown"
diff --git a/compiler/GHC/CmmToAsm/Reg/Target.hs b/compiler/GHC/CmmToAsm/Reg/Target.hs
index 38fe9fd5df..97440d1ac6 100644
--- a/compiler/GHC/CmmToAsm/Reg/Target.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Target.hs
@@ -51,6 +51,7 @@ targetVirtualRegSqueeze platform
ArchMipsel -> panic "targetVirtualRegSqueeze ArchMipsel"
ArchRISCV64 -> panic "targetVirtualRegSqueeze ArchRISCV64"
ArchJavaScript-> panic "targetVirtualRegSqueeze ArchJavaScript"
+ ArchWasm32 -> panic "targetVirtualRegSqueeze ArchWasm32"
ArchUnknown -> panic "targetVirtualRegSqueeze ArchUnknown"
@@ -69,6 +70,7 @@ targetRealRegSqueeze platform
ArchMipsel -> panic "targetRealRegSqueeze ArchMipsel"
ArchRISCV64 -> panic "targetRealRegSqueeze ArchRISCV64"
ArchJavaScript-> panic "targetRealRegSqueeze ArchJavaScript"
+ ArchWasm32 -> panic "targetRealRegSqueeze ArchWasm32"
ArchUnknown -> panic "targetRealRegSqueeze ArchUnknown"
targetClassOfRealReg :: Platform -> RealReg -> RegClass
@@ -86,6 +88,7 @@ targetClassOfRealReg platform
ArchMipsel -> panic "targetClassOfRealReg ArchMipsel"
ArchRISCV64 -> panic "targetClassOfRealReg ArchRISCV64"
ArchJavaScript-> panic "targetClassOfRealReg ArchJavaScript"
+ ArchWasm32 -> panic "targetClassOfRealReg ArchWasm32"
ArchUnknown -> panic "targetClassOfRealReg ArchUnknown"
targetMkVirtualReg :: Platform -> Unique -> Format -> VirtualReg
@@ -103,6 +106,7 @@ targetMkVirtualReg platform
ArchMipsel -> panic "targetMkVirtualReg ArchMipsel"
ArchRISCV64 -> panic "targetMkVirtualReg ArchRISCV64"
ArchJavaScript-> panic "targetMkVirtualReg ArchJavaScript"
+ ArchWasm32 -> panic "targetMkVirtualReg ArchWasm32"
ArchUnknown -> panic "targetMkVirtualReg ArchUnknown"
targetRegDotColor :: Platform -> RealReg -> SDoc
@@ -120,6 +124,7 @@ targetRegDotColor platform
ArchMipsel -> panic "targetRegDotColor ArchMipsel"
ArchRISCV64 -> panic "targetRegDotColor ArchRISCV64"
ArchJavaScript-> panic "targetRegDotColor ArchJavaScript"
+ ArchWasm32 -> panic "targetRegDotColor ArchWasm32"
ArchUnknown -> panic "targetRegDotColor ArchUnknown"
diff --git a/compiler/GHC/Driver/Backend.hs b/compiler/GHC/Driver/Backend.hs
index 48958594fd..776e5eb675 100644
--- a/compiler/GHC/Driver/Backend.hs
+++ b/compiler/GHC/Driver/Backend.hs
@@ -214,6 +214,7 @@ platformNcgSupported platform = if
ArchPPC -> True
ArchPPC_64 {} -> True
ArchAArch64 -> True
+ ArchWasm32 -> True
_ -> False
diff --git a/compiler/GHC/Platform.hs b/compiler/GHC/Platform.hs
index 39294c9a9a..b345d1535a 100644
--- a/compiler/GHC/Platform.hs
+++ b/compiler/GHC/Platform.hs
@@ -206,6 +206,7 @@ osElfTarget OSHaiku = True
osElfTarget OSQNXNTO = False
osElfTarget OSAIX = False
osElfTarget OSHurd = True
+osElfTarget OSWasi = False
osElfTarget OSUnknown = False
-- Defaulting to False is safe; it means don't rely on any
-- ELF-specific functionality. It is important to have a default for
diff --git a/configure.ac b/configure.ac
index 1a39d71533..1a62c89831 100644
--- a/configure.ac
+++ b/configure.ac
@@ -333,7 +333,7 @@ AC_SUBST(TablesNextToCode)
dnl ** Does target have runtime linker support?
dnl --------------------------------------------------------------
case "$target" in
- powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux|riscv64-*)
+ powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux|riscv64-*|wasm*)
TargetHasRTSLinker=NO
;;
*)
diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs
index a17b788c33..37f675b5e8 100644
--- a/hadrian/src/Oracles/Flag.hs
+++ b/hadrian/src/Oracles/Flag.hs
@@ -80,10 +80,11 @@ arSupportsDashL _ = flag ArSupportsDashL
platformSupportsSharedLibs :: Action Bool
platformSupportsSharedLibs = do
windows <- isWinTarget
+ wasm <- anyTargetArch [ "wasm32" ]
ppc_linux <- anyTargetPlatform [ "powerpc-unknown-linux" ]
solaris <- anyTargetPlatform [ "i386-unknown-solaris2" ]
solarisBroken <- flag SolarisBrokenShld
- return $ not (windows || ppc_linux || solaris && solarisBroken)
+ return $ not (windows || wasm || ppc_linux || solaris && solarisBroken)
-- | Does the target support threaded RTS?
targetSupportsThreadedRts :: Action Bool
diff --git a/libraries/ghc-boot/GHC/Platform/ArchOS.hs b/libraries/ghc-boot/GHC/Platform/ArchOS.hs
index c46371fac0..fa8042671a 100644
--- a/libraries/ghc-boot/GHC/Platform/ArchOS.hs
+++ b/libraries/ghc-boot/GHC/Platform/ArchOS.hs
@@ -45,6 +45,7 @@ data Arch
| ArchMipsel
| ArchRISCV64
| ArchJavaScript
+ | ArchWasm32
deriving (Read, Show, Eq, Ord)
-- | ARM Instruction Set Architecture
@@ -95,6 +96,7 @@ data OS
| OSQNXNTO
| OSAIX
| OSHurd
+ | OSWasi
deriving (Read, Show, Eq, Ord)
@@ -133,6 +135,7 @@ stringEncodeArch = \case
ArchMipsel -> "mipsel"
ArchRISCV64 -> "riscv64"
ArchJavaScript -> "js"
+ ArchWasm32 -> "wasm32"
-- | See Note [Platform Syntax].
stringEncodeOS :: OS -> String
@@ -151,3 +154,4 @@ stringEncodeOS = \case
OSQNXNTO -> "nto-qnx"
OSAIX -> "aix"
OSHurd -> "hurd"
+ OSWasi -> "wasi"
diff --git a/m4/fptools_set_haskell_platform_vars.m4 b/m4/fptools_set_haskell_platform_vars.m4
index 62563633f5..23b7fb63f9 100644
--- a/m4/fptools_set_haskell_platform_vars.m4
+++ b/m4/fptools_set_haskell_platform_vars.m4
@@ -42,6 +42,9 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS_SHELL_FUNCTIONS],
riscv64)
test -z "[$]2" || eval "[$]2=ArchRISCV64"
;;
+ wasm32)
+ test -z "[$]2" || eval "[$]2=ArchWasm32"
+ ;;
hppa|hppa1_1|ia64|m68k|nios2|riscv32|rs6000|s390|sh4|vax)
test -z "[$]2" || eval "[$]2=ArchUnknown"
;;
@@ -97,6 +100,9 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS_SHELL_FUNCTIONS],
nto-qnx)
test -z "[$]2" || eval "[$]2=OSQNXNTO"
;;
+ wasi)
+ test -z "[$]2" || eval "[$]2=OSWasi"
+ ;;
dragonfly|hpux|linuxaout|freebsd2|nextstep2|nextstep3|sunos4|ultrix)
test -z "[$]2" || eval "[$]2=OSUnknown"
;;
diff --git a/m4/ghc_convert_cpu.m4 b/m4/ghc_convert_cpu.m4
index e775c04a8f..f70114142f 100644
--- a/m4/ghc_convert_cpu.m4
+++ b/m4/ghc_convert_cpu.m4
@@ -74,6 +74,9 @@ case "$1" in
x86_64|amd64)
$2="x86_64"
;;
+ wasm32)
+ $2="wasm32"
+ ;;
*)
echo "Unknown CPU $1"
exit 1
diff --git a/m4/ghc_convert_os.m4 b/m4/ghc_convert_os.m4
index dbced12850..b104549b77 100644
--- a/m4/ghc_convert_os.m4
+++ b/m4/ghc_convert_os.m4
@@ -46,6 +46,9 @@ AC_DEFUN([GHC_CONVERT_OS],[
nto-qnx*)
$3="nto-qnx"
;;
+ wasi)
+ $3="wasi"
+ ;;
*)
echo "Unknown OS $1"
exit 1
diff --git a/m4/ghc_tables_next_to_code.m4 b/m4/ghc_tables_next_to_code.m4
index 0f262bba57..3e0ced2137 100644
--- a/m4/ghc_tables_next_to_code.m4
+++ b/m4/ghc_tables_next_to_code.m4
@@ -17,7 +17,7 @@ AC_DEFUN([GHC_TABLES_NEXT_TO_CODE],
case "$Unregisterised" in
NO)
case "$TargetArch" in
- ia64|powerpc64|powerpc64le|s390x)
+ ia64|powerpc64|powerpc64le|s390x|wasm32)
TablesNextToCodeDefault=NO
AC_MSG_RESULT([no])
;;
diff --git a/m4/ghc_unregisterised.m4 b/m4/ghc_unregisterised.m4
index ca3beb8733..b06cb41c90 100644
--- a/m4/ghc_unregisterised.m4
+++ b/m4/ghc_unregisterised.m4
@@ -5,7 +5,7 @@ AC_DEFUN([GHC_UNREGISTERISED],
[
AC_MSG_CHECKING(whether target supports a registerised ABI)
case "$TargetArch" in
- i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64|riscv64)
+ i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64|riscv64|wasm32)
UnregisterisedDefault=NO
AC_MSG_RESULT([yes])
;;
diff --git a/testsuite/tests/count-deps/CountDepsAst.stdout b/testsuite/tests/count-deps/CountDepsAst.stdout
index 212a79d42a..5cc408a593 100644
--- a/testsuite/tests/count-deps/CountDepsAst.stdout
+++ b/testsuite/tests/count-deps/CountDepsAst.stdout
@@ -162,6 +162,7 @@ GHC.Platform.Reg
GHC.Platform.Reg.Class
GHC.Platform.Regs
GHC.Platform.S390X
+GHC.Platform.Wasm32
GHC.Platform.Ways
GHC.Platform.X86
GHC.Platform.X86_64
diff --git a/testsuite/tests/count-deps/CountDepsParser.stdout b/testsuite/tests/count-deps/CountDepsParser.stdout
index 807e8f02ed..8b66535737 100644
--- a/testsuite/tests/count-deps/CountDepsParser.stdout
+++ b/testsuite/tests/count-deps/CountDepsParser.stdout
@@ -169,6 +169,7 @@ GHC.Platform.Reg
GHC.Platform.Reg.Class
GHC.Platform.Regs
GHC.Platform.S390X
+GHC.Platform.Wasm32
GHC.Platform.Ways
GHC.Platform.X86
GHC.Platform.X86_64