mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-25 22:06:14 +00:00
Add support for LoongArch (#19223)
* Add support for LoongArch * Update compiler/installer.ini Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
@@ -202,7 +202,7 @@ type
|
||||
cpuPowerpc64el, cpuSparc, cpuVm, cpuHppa, cpuIa64, cpuAmd64, cpuMips,
|
||||
cpuMipsel, cpuArm, cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430,
|
||||
cpuSparc64, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64, cpuEsp, cpuWasm32,
|
||||
cpuE2k
|
||||
cpuE2k, cpuLoongArch64
|
||||
|
||||
type
|
||||
TInfoCPU* = tuple[name: string, intSize: int, endian: Endianness,
|
||||
@@ -238,7 +238,8 @@ const
|
||||
(name: "riscv64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
|
||||
(name: "esp", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
|
||||
(name: "wasm32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
|
||||
(name: "e2k", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64)]
|
||||
(name: "e2k", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
|
||||
(name: "loongarch64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64)]
|
||||
|
||||
type
|
||||
Target* = object
|
||||
|
||||
@@ -1126,7 +1126,7 @@ const
|
||||
## Possible values:
|
||||
## `"i386"`, `"alpha"`, `"powerpc"`, `"powerpc64"`, `"powerpc64el"`,
|
||||
## `"sparc"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
|
||||
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`.
|
||||
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, '"loongarch64"'.
|
||||
|
||||
seqShallowFlag = low(int)
|
||||
strlitFlag = 1 shl (sizeof(int)*8 - 2) # later versions of the codegen \
|
||||
|
||||
@@ -36,7 +36,8 @@ type
|
||||
riscv32, ## RISC-V 32-bit processor
|
||||
riscv64, ## RISC-V 64-bit processor
|
||||
wasm32, ## WASM, 32-bit
|
||||
e2k ## MCST Elbrus 2000
|
||||
e2k, ## MCST Elbrus 2000
|
||||
loongarch64 ## LoongArch 64-bit processor
|
||||
|
||||
OsPlatform* {.pure.} = enum ## the OS this program will run on.
|
||||
none, dos, windows, os2, linux, morphos, skyos, solaris,
|
||||
@@ -95,5 +96,6 @@ const
|
||||
elif defined(riscv64): CpuPlatform.riscv64
|
||||
elif defined(wasm32): CpuPlatform.wasm32
|
||||
elif defined(e2k): CpuPlatform.e2k
|
||||
elif defined(loongarch64): CpuPlatform.loongarch64
|
||||
else: CpuPlatform.none
|
||||
## the CPU this program will run on.
|
||||
|
||||
@@ -95,6 +95,7 @@ _nim() {
|
||||
'*--cpu=sparc64[compile for SPARC64 architecture]' \
|
||||
'*--cpu=vm[compile for Nim VM]' \
|
||||
'*--cpu=wasm32[compile to WASM 32]' \
|
||||
'*--cpu=loongarch64[compile for LoongArch64 architecture]' \
|
||||
'*--gc=refc[use reference counting garbage collection]' \
|
||||
'*--gc=arc[use ARC garbage collection]' \
|
||||
'*--gc=orc[use ORC garbage collection]' \
|
||||
|
||||
@@ -229,6 +229,8 @@ case $ucpu in
|
||||
mycpu="riscv64" ;;
|
||||
*e2k* )
|
||||
mycpu="e2k" ;;
|
||||
*loongarch64* )
|
||||
mycpu="loongarch64" ;;
|
||||
*)
|
||||
echo 2>&1 "Error: unknown processor: $ucpu"
|
||||
exit 1
|
||||
|
||||
@@ -169,6 +169,9 @@ endif
|
||||
ifeq ($(ucpu),e2k)
|
||||
mycpu = e2k
|
||||
endif
|
||||
ifeq ($(ucpu),loongarch64)
|
||||
mycpu = loongarch64
|
||||
endif
|
||||
ifndef mycpu
|
||||
$(error unknown CPU architecture: $(ucpu) See makefile.nimf)
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user