Skip to content

Commit 212ca77

Browse files
committed
Add s390x CPU support
1 parent 611b8bb commit 212ca77

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

compiler/platform.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ type
210210
cpuNone, cpuI386, cpuM68k, cpuAlpha, cpuPowerpc, cpuPowerpc64,
211211
cpuPowerpc64el, cpuSparc, cpuVm, cpuHppa, cpuIa64, cpuAmd64, cpuMips,
212212
cpuMipsel, cpuArm, cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430,
213-
cpuSparc64, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64, cpuEsp, cpuWasm32,
214-
cpuE2k, cpuLoongArch64
213+
cpuSparc64, cpuS390x, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64,
214+
cpuEsp, cpuWasm32, cpuE2k, cpuLoongArch64
215215

216216
type
217217
TInfoCPU* = tuple[name: string, intSize: int, endian: Endianness,
@@ -241,6 +241,7 @@ const
241241
(name: "avr", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
242242
(name: "msp430", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
243243
(name: "sparc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
244+
(name: "s390x", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
244245
(name: "mips64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
245246
(name: "mips64el", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
246247
(name: "riscv32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),

lib/system.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ const
10681068
##
10691069
## Possible values:
10701070
## `"i386"`, `"alpha"`, `"powerpc"`, `"powerpc64"`, `"powerpc64el"`,
1071-
## `"sparc"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
1071+
## `"sparc"`, `"s390x"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
10721072
## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, `"loongarch64"`.
10731073

10741074
seqShallowFlag = low(int)

lib/system/platforms.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type
2323
powerpc64el, ## Little Endian 64 bit PowerPC
2424
sparc, ## Sparc based processor
2525
sparc64, ## 64-bit Sparc based processor
26+
s390x, ## IBM System z
2627
hppa, ## HP PA-RISC
2728
ia64, ## Intel Itanium
2829
amd64, ## x86_64 (AMD64); 64 bit x86 compatible CPU
@@ -83,6 +84,7 @@ const
8384
elif defined(powerpc64el): CpuPlatform.powerpc64el
8485
elif defined(sparc): CpuPlatform.sparc
8586
elif defined(sparc64): CpuPlatform.sparc64
87+
elif defined(s390x): CpuPlatform.s390x
8688
elif defined(hppa): CpuPlatform.hppa
8789
elif defined(ia64): CpuPlatform.ia64
8890
elif defined(amd64): CpuPlatform.amd64

tools/nim.zsh-completion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ _nim() {
7878
'--opt\:-[optimization mode]:x:(none speed size)'
7979
'--debugger\:native[use native debugger (gdb)]'
8080
'--app\:-[generate this type of app (lib=dynamic)]:x:(console gui lib staticlib)'
81-
'--cpu\:-[target architecture]:x:(alpha amd64 arm arm64 avr e2k esp hppa i386 ia64 js loongarch64 m68k mips mipsel mips64 mips64el msp430 nimvm powerpc powerpc64 powerpc64el riscv32 riscv64 sparc sparc64 vm wasm32)'
81+
'--cpu\:-[target architecture]:x:(alpha amd64 arm arm64 avr e2k esp hppa i386 ia64 js loongarch64 m68k mips mipsel mips64 mips64el msp430 nimvm powerpc powerpc64 powerpc64el riscv32 riscv64 sparc sparc64 s390x vm wasm32)'
8282
'--gc\:-[memory management algorithm to use (default\: refc)]:x:(refc arc orc markAndSweep boehm go regions none)'
8383
'--os\:-[operating system to compile for]:x:(AIX Amiga Android Any Atari DOS DragonFly FreeBSD FreeRTOS Genode Haiku iOS Irix JS Linux MacOS MacOSX MorphOS NetBSD Netware NimVM NintendoSwitch OS2 OpenBSD PalmOS Standalone QNX SkyOS Solaris VxWorks Windows)'
8484
'--panics\:-[turn panics into process termination (default\: off)]:x:(off on)'

tools/niminst/buildsh.nimf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ case $ucpu in
183183
fi
184184
fi
185185
;;
186+
*s390x* )
187+
mycpu="s390x" ;;
186188
*ppc64le* )
187189
mycpu="powerpc64el" ;;
188190
*ppc64* )

tools/niminst/makefile.nimf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ endif
117117
ifeq ($(ucpu),sparc64)
118118
mycpu = sparc64
119119
endif
120+
ifeq ($(ucpu),s390x)
121+
mycpu = s390x
122+
endif
120123
ifeq ($(ucpu),sun)
121124
mycpu = sparc
122125
endif

0 commit comments

Comments
 (0)