[PATCH] D146054: [RISCV] Add --print-supported-extensions support
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 16:50:59 PDT 2023
MaskRay added a comment.
Sorry for the delay.
================
Comment at: clang/include/clang/Frontend/FrontendOptions.h:286
+ /// print the supported extensions for the current target
+ unsigned PrintSupportedExtensions : 1;
----------------
================
Comment at: clang/include/clang/Frontend/FrontendOptions.h:290
+ /// Output time trace profile.
+ unsigned TimeTrace : 1;
+
----------------
stray change?
================
Comment at: clang/test/Driver/print-supported-extensions.c:6
+// RUN: %clang --target=riscv64 --print-supported-extensions 2>&1 | \
+// RUN: FileCheck --implicit-check-not=warning --strict-whitespace --match-full-lines %s
+
----------------
================
Comment at: clang/test/Driver/print-supported-extensions.c:10
+// CHECK:All available -march extensions for RISC-V
+// CHECK: Name Version
+// CHECK-NEXT: i 2.1
----------------
For `--strict-whitespace --match-full-lines` testing, we usually right align `CHECK` and `CHECK-NEXT`.
================
Comment at: clang/tools/driver/cc1_main.cpp:187
+/// Print supported extensions of the RISCV target.
+static int print_supported_extensions() {
+ llvm::riscvExtensionsHelp();
----------------
`printSupportedExtensions`. Why does this function return a dummy return value?
You can do `return printSupportedExtensions(), 0` below to save some lines.
================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:202
+void llvm::riscvExtensionsHelp() {
+ errs() << "All available -march extensions for RISC-V\n\n";
+ errs() << '\t' << left_justify("Name", 20) << "Version\n";
----------------
I think `outs()` is more conventional. Most `gcc --print-*` options go to stdout. `clang --print-supported-cpus` deviates and we should not copy its issue.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146054/new/
https://reviews.llvm.org/D146054
More information about the llvm-commits
mailing list