This patch doing more check and verify the -march= string and will issue an error if it's a invalid combination.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
Thanks for submitting this Kito. I've added some minor in-line comments. It might also be worth adding a couple of extra cases to the tests:
- Repeated letters in the ISA string (e.g. rv32immafd)
- Upper case letters in the ISA string. We currently reject these (as does GCC). It would be worth having a test that tracks this behaviour
We could probably give more informative error messages than just "invalid arch name". Especially for common errors like -march=rv32. If not adding such diagnostics in this patch, it would be good to add a // TODO note to record that we'd like to do better.
lib/Driver/ToolChains/Arch/RISCV.cpp | ||
---|---|---|
35 | I'd reference Table 22.1 in RISC-V User-Level ISA V2.2 for anyone who wants to verify this. | |
38–39 | Should be HasF, HasD, and Baseline to conform to standard LLVM naming conventions. | |
40 | I'd phrase this as "Check ISA extensions are specified in the canonical order." | |
107 | I'd be tempted to give a bit more explanation a bit more "It's illegal to specify the 'd' (double-precision floating point) extension without also specifying the 'f' (single precision floating-point) extension". |
Update revision according Alex's review.
Changes:
- Add testcase for uppercase of -march string.
- Add testcase for repeated letter in -march.
- Add more comment.
- Add several TODO item for diagnostic message improvement.
- Fix coding style issue.
Thanks for this Kito. A tiny formatting nit, but otherwise this looks good to me.
lib/Driver/ToolChains/Arch/RISCV.cpp | ||
---|---|---|
38 | Indent should be 2 spaces rather than 3. |
lib/Driver/ToolChains/Arch/RISCV.cpp | ||
---|---|---|
51 | One more question - how about non-standard extensions (vendor/custom) prefixed with X? |
I'd reference Table 22.1 in RISC-V User-Level ISA V2.2 for anyone who wants to verify this.