| 1 |
From: "Wesley W. Terpstra" <[email protected]> |
| 2 |
Date: Tue, 20 May 2025 12:14:31 -0400 |
| 3 |
Subject: Add a mips64el port |
| 4 |
|
| 5 |
Forwarded: no |
| 6 |
Reviewed-by: Ryan Kavanagh <[email protected]> |
| 7 |
Last-Update: 2025-05-20 |
| 8 |
--- |
| 9 |
basis-library/mlton/platform.sig | 2 +- |
| 10 |
basis-library/mlton/platform.sml | 3 +++ |
| 11 |
bin/platform | 3 +++ |
| 12 |
doc/guide/src/MLtonPlatform.adoc | 2 +- |
| 13 |
mlton/main/main.fun | 1 + |
| 14 |
runtime/cenv.h | 2 ++ |
| 15 |
runtime/platform/mips64.h | 1 + |
| 16 |
7 files changed, 12 insertions(+), 2 deletions(-) |
| 17 |
create mode 100644 runtime/platform/mips64.h |
| 18 |
|
| 19 |
diff --git a/basis-library/mlton/platform.sig b/basis-library/mlton/platform.sig |
| 20 |
index 3eea82c..44d0967 100644 |
| 21 |
--- a/basis-library/mlton/platform.sig |
| 22 |
+++ b/basis-library/mlton/platform.sig |
| 23 |
@@ -10,7 +10,7 @@ signature MLTON_PLATFORM = |
| 24 |
structure Arch: |
| 25 |
sig |
| 26 |
datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | LoongArch64 | m68k | |
| 27 |
|
| 28 |
+ MIPS | MIPS64 | PowerPC | PowerPC64 | RISCV | S390 | Sparc | Wasm32 | X86 |
| 29 |
|
| 30 |
val fromString: string -> t option |
| 31 |
val host: t |
| 32 |
diff --git a/basis-library/mlton/platform.sml b/basis-library/mlton/platform.sml |
| 33 |
index 287284b..650fb91 100644 |
| 34 |
--- a/basis-library/mlton/platform.sml |
| 35 |
+++ b/basis-library/mlton/platform.sml |
| 36 |
@@ -39,6 +39,7 @@ structure MLtonPlatform: MLTON_PLATFORM = |
| 37 |
| LoongArch64 |
| 38 |
| m68k |
| 39 |
| MIPS |
| 40 |
+ | MIPS64 |
| 41 |
| PowerPC |
| 42 |
| PowerPC64 |
| 43 |
| RISCV |
| 44 |
@@ -57,6 +58,7 @@ structure MLtonPlatform: MLTON_PLATFORM = |
| 45 |
(LoongArch64,"LoongArch64"):: |
| 46 |
(m68k, "m68k"):: |
| 47 |
(MIPS, "MIPS"):: |
| 48 |
+ (MIPS64, "MIPS64"):: |
| 49 |
(PowerPC, "PowerPC"):: |
| 50 |
(PowerPC64, "PowerPC64"):: |
| 51 |
(RISCV, "RISCV"):: |
| 52 |
@@ -80,6 +82,7 @@ structure MLtonPlatform: MLTON_PLATFORM = |
| 53 |
| "loongarch64" => LoongArch64 |
| 54 |
| "m68k" => m68k |
| 55 |
| "mips" => MIPS |
| 56 |
+ | "mips64" => MIPS64 |
| 57 |
| "powerpc" => PowerPC |
| 58 |
| "powerpc64" => PowerPC64 |
| 59 |
| "riscv" => RISCV |
| 60 |
diff --git a/bin/platform b/bin/platform |
| 61 |
index 8e38726..eb8a9af 100755 |
| 62 |
--- a/bin/platform |
| 63 |
+++ b/bin/platform |
| 64 |
@@ -115,6 +115,9 @@ loongarch64*) |
| 65 |
m68k*) |
| 66 |
HOST_ARCH=m68k |
| 67 |
;; |
| 68 |
+mips64*) |
| 69 |
+ HOST_ARCH=mips64 |
| 70 |
+;; |
| 71 |
mips*) |
| 72 |
# big-endian and little-endian detect via headers |
| 73 |
HOST_ARCH=mips |
| 74 |
diff --git a/doc/guide/src/MLtonPlatform.adoc b/doc/guide/src/MLtonPlatform.adoc |
| 75 |
index 1e29169..8220fd7 100644 |
| 76 |
--- a/doc/guide/src/MLtonPlatform.adoc |
| 77 |
+++ b/doc/guide/src/MLtonPlatform.adoc |
| 78 |
@@ -7,7 +7,7 @@ signature MLTON_PLATFORM = |
| 79 |
structure Arch: |
| 80 |
sig |
| 81 |
datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k |
| 82 |
|
| 83 |
+ | MIPS | MIPS64 | PowerPC | PowerPC64 | S390 | Sparc | X86 |
| 84 |
|
| 85 |
val fromString: string -> t option |
| 86 |
val host: t |
| 87 |
diff --git a/mlton/main/main.fun b/mlton/main/main.fun |
| 88 |
index 3d61eef..c69892b 100644 |
| 89 |
--- a/mlton/main/main.fun |
| 90 |
+++ b/mlton/main/main.fun |
| 91 |
@@ -199,6 +199,7 @@ fun defaultAlignIs8 () = |
| 92 |
| HPPA => true |
| 93 |
| IA64 => true |
| 94 |
| MIPS => true |
| 95 |
+ | MIPS64 => true |
| 96 |
| PowerPC64 => true |
| 97 |
| Sparc => true |
| 98 |
| S390 => true |
| 99 |
diff --git a/runtime/cenv.h b/runtime/cenv.h |
| 100 |
index 7e40347..c805f00 100644 |
| 101 |
--- a/runtime/cenv.h |
| 102 |
+++ b/runtime/cenv.h |
| 103 |
@@ -103,6 +103,8 @@ COMPILE_TIME_ASSERT(sizeof_double__is_eight, sizeof(double) == 8); |
| 104 |
#include "platform/ia64.h" |
| 105 |
#elif (defined (__m68k__)) |
| 106 |
#include "platform/m68k.h" |
| 107 |
+#elif (defined (__mips64)) |
| 108 |
+#include "platform/mips64.h" |
| 109 |
#elif (defined (__mips__)) |
| 110 |
#include "platform/mips.h" |
| 111 |
#elif (defined (__powerpc64__)) |
| 112 |
diff --git a/runtime/platform/mips64.h b/runtime/platform/mips64.h |
| 113 |
new file mode 100644 |
| 114 |
index 0000000..02271de |
| 115 |
--- /dev/null |
| 116 |
+++ b/runtime/platform/mips64.h |
| 117 |
@@ -0,0 +1 @@ |
| 118 |
+#define MLton_Platform_Arch_host "mips64" |