[pkg-d-commits] [ldc] 115/149: Detect RISC-V architectures and define the correct versions

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:37:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.2.0
in repository ldc.

commit 0d9ab693bf854a0cfe4f02e594bf013d4e31c9c4
Author: e-y-e <e_y_e at tuta.io>
Date:   Tue Feb 14 13:45:37 2017 +0000

    Detect RISC-V architectures and define the correct versions
---
 CMakeLists.txt  | 10 ++++++++++
 driver/main.cpp | 12 ++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18e109c..e631b23 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -454,6 +454,16 @@ if(GENERATE_OFFTI)
     append("-DGENERATE_OFFTI" CMAKE_CXX_FLAGS)
 endif()
 
+option(RISCV_LLVM_DEV, "full RISC-V support with riscv-llvm")
+mark_as_advanced(RISCV_LLVM_DEV)
+
+#
+# Enable building with riscv-llvm, for full RISC-V support.
+#
+if(RISCV_LLVM_DEV)
+    append("-DRISCV_LLVM_DEV" CMAKE_CXX_FLAGS)
+endif()
+
 # if llvm was built with assertions we have to do the same
 # as there are some headers with differing behavior based on NDEBUG
 if(LLVM_ENABLE_ASSERTIONS)
diff --git a/driver/main.cpp b/driver/main.cpp
index a7a8ac2..75cb683 100644
--- a/driver/main.cpp
+++ b/driver/main.cpp
@@ -726,6 +726,18 @@ void registerPredefinedTargetVersions() {
     registerPredefinedFloatABI("MIPS_SoftFloat", "MIPS_HardFloat");
     registerMipsABI();
     break;
+#if defined RISCV_LLVM_DEV || LDC_LLVM_VER >= 400
+#if defined RISCV_LLVM_DEV
+  case llvm::Triple::riscv:
+#else
+  case llvm::Triple::riscv32:
+#endif
+    VersionCondition::addPredefinedGlobalIdent("RISCV32");
+    break;
+  case llvm::Triple::riscv64:
+    VersionCondition::addPredefinedGlobalIdent("RISCV64");
+    break;
+#endif
   case llvm::Triple::sparc:
     // FIXME: Detect SPARC v8+ (SPARC_V8Plus).
     VersionCondition::addPredefinedGlobalIdent("SPARC");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list