[PATCH] D105274: Define sys::getHostCPUName for RISC-V
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 11 11:29:31 PDT 2021
MaskRay added inline comments.
================
Comment at: llvm/lib/Support/Host.cpp:1325
+ return "generic-rv64";
+#else
+ return "generic-rv32";
----------------
craig.topper wrote:
> schwab wrote:
> > craig.topper wrote:
> > > Should we check __riscv_xlen == 32 here and leave some assert return "generic" if its not one of the 2 values. That would cover us better if __riscv_xlen isn't defined for some reason
> > What do you want to assert?
> I was thinking something like
>
> ```
> #if __riscv_xlen == 64
> return "generic-rv64";
> #elsif __riscv_xlen == 32
> return "generic-rv32";
> #else
> assert(false && "Couldn't determine xlen")
> return "generic";
> ```
clang/gcc always define `__riscv_xlen`. Should be fine to use `#error` for the code path.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105274/new/
https://reviews.llvm.org/D105274
More information about the llvm-commits
mailing list