This patch doing more check and verify the -march= string and will issue an error if it's a invalid combination.
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.
I'd reference Table 22.1 in RISC-V User-Level ISA V2.2 for anyone who wants to verify this.
Should be HasF, HasD, and Baseline to conform to standard LLVM naming conventions.
I'd phrase this as "Check ISA extensions are specified in the canonical order."
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.
- 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.
One more question - how about non-standard extensions (vendor/custom) prefixed with X?