[PATCH] D71124: [RISCV] support clang driver to select cpu
Sam Elliott via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 08:28:39 PDT 2020
lenary added a comment.
I've got one major issue (inline below), and I'm confused by some other behaviour:
When I run `clang --target=riscv64 -mcpu=?`, the list includes both `generic-rv32` and `generic-rv64`. It doesn't show only the 64-bit cpus. This is not changed by giving a full triple, or by additionally specifying `-march=rv64gc`. Should it be?
For instance, this output:
$ clang --target=riscv64-unknown-elf -mcpu=\? -march=rv64gc
clang version 11.0.0
Target: riscv64-unknown-unknown-elf
Thread model: posix
InstalledDir: /home/selliott/llvm-project/./build/llvm_clang/all/bin
Available CPUs for this target:
generic-rv32
generic-rv64
rocket-rv32
rocket-rv64
sifive-e31
sifive-u54
Use -mcpu or -mtune to specify the target's processor.
For example, clang --target=aarch64-unknown-linux-gui -mcpu=cortex-a35
================
Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:599
+ return "lp64";
}
}
----------------
I now get a stacktrace here if I call `clang --target=riscv32 -march=unknown foo.c -c`. In clang-10, you get a nice error:
```
clang-10: error: invalid arch name 'wat', string must begin with rv32{i,e,g} or rv64{i,g}
```
The stacktrace is coming from the call to `getRISCVABI` in `findRISCVBareMetalMultilibs` (in `clang/lib/Driver/ToolChains/Gnu.cpp:1608`).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71124/new/
https://reviews.llvm.org/D71124
More information about the llvm-commits
mailing list