[PATCH] D105274: Define sys::getHostCPUName for RISC-V
Andreas Schwab via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 9 03:27:38 PDT 2021
schwab updated this revision to Diff 357468.
schwab added a comment.
Added assert.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105274/new/
https://reviews.llvm.org/D105274
Files:
llvm/lib/Support/Host.cpp
Index: llvm/lib/Support/Host.cpp
===================================================================
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1318,6 +1318,17 @@
return "generic";
}
}
+#elif defined(__riscv)
+StringRef sys::getHostCPUName() {
+#if __riscv_xlen == 64
+ return "generic-rv64";
+#elif __riscv_xlen == 32
+ return "generic-rv32";
+#else
+ assert(false && "Unhandled value of __riscv_xlen");
+ return "generic";
+#endif
+}
#else
StringRef sys::getHostCPUName() { return "generic"; }
namespace llvm {
@@ -1402,7 +1413,7 @@
}
return -1;
}
-#elif defined(__linux__) && defined(__s390x__)
+#elif defined(__linux__) && (defined(__s390x__) || defined(__riscv))
int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
#elif defined(__APPLE__) && defined(__x86_64__)
#include <sys/param.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105274.357468.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/4cff463d/attachment.bin>
More information about the llvm-commits
mailing list