Browse Source

Merge pull request #2174 from svaarala/add-riscv-architecture

Add RISC-V architecture detection
pull/2175/head
Sami Vaarala 5 years ago
committed by GitHub
parent
commit
3123da6cb9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      RELEASES.rst
  2. 8
      config/architectures.yaml
  3. 3
      config/architectures/architecture_riscv32.h.in
  4. 3
      config/architectures/architecture_riscv64.h.in
  5. 15
      config/helper-snippets/DUK_F_RISCV.h.in

3
RELEASES.rst

@ -3565,6 +3565,9 @@ Planned
* Fix some compile warnings (GH-2161, GH-2172) * Fix some compile warnings (GH-2161, GH-2172)
* Add RISC-V architecture detection in duk_config.h; previous versions
also compiled on RISC-V but identified as "generic" (GH-2174)
* Minor performance and footprint improvements (GH-2167) * Minor performance and footprint improvements (GH-2167)
3.0.0 (XXXX-XX-XX) 3.0.0 (XXXX-XX-XX)

8
config/architectures.yaml

@ -45,6 +45,14 @@ autodetect:
name: SPARC 64-bit name: SPARC 64-bit
check: DUK_F_SPARC64 check: DUK_F_SPARC64
include: architecture_sparc64.h.in include: architecture_sparc64.h.in
-
name: RISC-V 32-bit
check: DUK_F_RISCV32
include: architecture_riscv32.h.in
-
name: RISC-V 64-bit
check: DUK_F_RISCV64
include: architecture_riscv64.h.in
- -
name: SuperH name: SuperH
check: DUK_F_SUPERH check: DUK_F_SUPERH

3
config/architectures/architecture_riscv32.h.in

@ -0,0 +1,3 @@
#define DUK_USE_ARCH_STRING "riscv32"
#define DUK_USE_BYTEORDER 1
#define DUK_USE_PACKED_TVAL

3
config/architectures/architecture_riscv64.h.in

@ -0,0 +1,3 @@
#define DUK_USE_ARCH_STRING "riscv64"
#define DUK_USE_BYTEORDER 1
#undef DUK_USE_PACKED_TVAL

15
config/helper-snippets/DUK_F_RISCV.h.in

@ -0,0 +1,15 @@
/* RISC-V, https://github.com/riscv/riscv-toolchain-conventions#cc-preprocessor-definitions */
#if defined(__riscv)
#define DUK_F_RISCV
#if defined(__riscv_xlen)
#if (__riscv_xlen == 32)
#define DUK_F_RISCV32
#elif (__riscv_xlen == 64)
#define DUK_F_RISCV64
#else
#error __riscv_xlen has unsupported value (not 32 or 64)
#endif
#else
#error __riscv defined without __riscv_xlen
#endif
#endif /* __riscv */
Loading…
Cancel
Save