[PATCH] D146054: [RISCV] Add --print-supported-extensions and -march=help support

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 12:56:21 PDT 2023


MaskRay added a comment.

In D146054#4337866 <https://reviews.llvm.org/D146054#4337866>, @kito-cheng wrote:

> GCC ins't implement yet, but planed, so add it later I think?
>
> @4vtomat already drop -march=help, @MaskRay did you mind take a look again?

Done. But this update still doesn't look quite polished. If `-march=help` is dropped, at the very least the subject needs to updated.



================
Comment at: clang/tools/driver/cc1_main.cpp:187
+/// Print supported extensions of the given target.
+static int PrintSupportedExtensions(std::string TargetStr) {
+  llvm::riscvMarchHelp();
----------------
Use camelCase for new function names. `StringRef TargetStr`?


================
Comment at: llvm/include/llvm/Support/RISCVISAInfo.h:26
 
+void riscvMarchHelp();
+
----------------
This naming does not match the `--print-supported-extensions` option name.


================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:143
+void llvm::riscvMarchHelp() {
+  errs() << "All available -march extensions for RISC-V\n\n";
+  errs() << '\t' << left_justify("Name", 20) << "Version\n";
----------------
For most `--print-*` options, the output goes to stdout instead of stderr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146054/new/

https://reviews.llvm.org/D146054



More information about the cfe-commits mailing list