From b613b60c6baeae8068c562878766a90fb750150b Mon Sep 17 00:00:00 2001 From: JiaLing Zhang Date: Fri, 12 Jan 2024 11:49:40 +0800 Subject: [PATCH] Add LoongArch64 support Signed-off-by: JiaLing Zhang --- basis-library/mlton/platform.sig | 2 +- basis-library/mlton/platform.sml | 3 +++ bin/platform | 3 +++ runtime/cenv.h | 2 ++ runtime/platform/loongarch64.h | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 runtime/platform/loongarch64.h diff --git a/basis-library/mlton/platform.sig b/basis-library/mlton/platform.sig index f1c0ae171d..03f9589a5c 100644 --- a/basis-library/mlton/platform.sig +++ b/basis-library/mlton/platform.sig @@ -9,7 +9,7 @@ signature MLTON_PLATFORM = sig structure Arch: sig - datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k | + datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | LoongArch64 | m68k | MIPS | PowerPC | PowerPC64 | RISCV | S390 | Sparc | X86 val fromString: string -> t option diff --git a/basis-library/mlton/platform.sml b/basis-library/mlton/platform.sml index bdb5a47a5e..2206996ea5 100644 --- a/basis-library/mlton/platform.sml +++ b/basis-library/mlton/platform.sml @@ -36,6 +36,7 @@ structure MLtonPlatform: MLTON_PLATFORM = | ARM64 | HPPA | IA64 + | LoongArch64 | m68k | MIPS | PowerPC @@ -52,6 +53,7 @@ structure MLtonPlatform: MLTON_PLATFORM = (ARM64, "ARM64"):: (HPPA, "HPPA"):: (IA64, "IA64"):: + (LoongArch64,"LoongArch64"):: (m68k, "m68k"):: (MIPS, "MIPS"):: (PowerPC, "PowerPC"):: @@ -73,6 +75,7 @@ structure MLtonPlatform: MLTON_PLATFORM = | "arm64" => ARM64 | "hppa" => HPPA | "ia64" => IA64 + | "loongarch64" => LoongArch64 | "m68k" => m68k | "mips" => MIPS | "powerpc" => PowerPC diff --git a/bin/platform b/bin/platform index 977818f271..8e38726ce9 100755 --- a/bin/platform +++ b/bin/platform @@ -109,6 +109,9 @@ parisc*) ia64*) HOST_ARCH=ia64 ;; +loongarch64*) + HOST_ARCH=loongarch64 +;; m68k*) HOST_ARCH=m68k ;; diff --git a/runtime/cenv.h b/runtime/cenv.h index e7d5fd0459..e215035178 100644 --- a/runtime/cenv.h +++ b/runtime/cenv.h @@ -115,6 +115,8 @@ COMPILE_TIME_ASSERT(sizeof_double__is_eight, sizeof(double) == 8); #include "platform/sparc.h" #elif (defined (__i386__)) #include "platform/x86.h" +#elif (defined (__loongarch64)) +#include "platform/loongarch64.h" #else #error unknown platform arch #endif diff --git a/runtime/platform/loongarch64.h b/runtime/platform/loongarch64.h new file mode 100644 index 0000000000..427eb5449a --- /dev/null +++ b/runtime/platform/loongarch64.h @@ -0,0 +1 @@ +#define MLton_Platform_Arch_host "loongarch64"