The RISCV target doesn't define a "generic" cpu, only "generic-rv32" and
"generic-rv64". Define sys::getHostCPUName for RISC-V that returns the
correct cpu for the host.
Details
- Reviewers
craig.topper luismarques MaskRay - Group Reviewers
Restricted Project - Commits
- rGa706a5ef2251: [Support] Define sys::getHostCPUName for RISC-V
Diff Detail
Event Timeline
llvm/lib/Support/Host.cpp | ||
---|---|---|
1361 | 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 | |
1452 | Just curious why other linux platforms like x86 and power pc have a different solution? |
llvm/lib/Support/Host.cpp | ||
---|---|---|
1361 | What do you want to assert? |
llvm/lib/Support/Host.cpp | ||
---|---|---|
1361 | 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"; |
Not sure if this wouldn't (eventually) be an issue also for RISC-V? https://reviews.llvm.org/rGcd53ded557c3
llvm/lib/Support/Host.cpp | ||
---|---|---|
1361 | clang/gcc always define __riscv_xlen. Should be fine to use #error for the code path. |
llvm/lib/Support/Host.cpp | ||
---|---|---|
1365 | remove the return value is unused due to #error. |
Sorry, we didn't know you didn't have commit access. I can commit this for you. How would you like your name and email to appear in the git log?
Thanks. I pushed it on your behalf. A contributor who doesn't have commit access can ask a reviewer or others to push. Your account was registered in 2019 so we probably assumed that you have commit access :)
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