michaelmaitland created this revision. michaelmaitland added reviewers: craig.topper, reames. Herald added a project: All. michaelmaitland requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Clang currently uses `-mcpu=?`. The `?` causes errors on some shells such as zsh since it is a special character. In order for it to work on shells such as zsh, the option must be passed in quotes or escaped. This patch adds `-mcpu=help` as another alias for `--print-supported-cpus`. In llc, `-mcpu=help` an alias to print supported cpus. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D144914 Files: clang/docs/CommandGuide/clang.rst clang/include/clang/Driver/Options.td clang/test/Driver/print-supported-cpus.c Index: clang/test/Driver/print-supported-cpus.c =================================================================== --- clang/test/Driver/print-supported-cpus.c +++ clang/test/Driver/print-supported-cpus.c @@ -13,6 +13,13 @@ // RUN: %clang --target=x86_64-unknown-linux-gnu -mtune=? -fuse-ld=dummy 2>&1 | \ // RUN: FileCheck %s --check-prefix=CHECK-X86 +// Test -mcpu=list and -mtune=list alises. +// RUN: %clang --target=x86_64-unknown-linux-gnu -mcpu=list 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-X86 + +// RUN: %clang --target=x86_64-unknown-linux-gnu -mtune=list -fuse-ld=dummy 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-X86 + // CHECK-NOT: warning: argument unused during compilation // CHECK-X86: Target: x86_64-unknown-linux-gnu // CHECK-X86: corei7 Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4347,6 +4347,8 @@ MarshallingInfoFlag<FrontendOpts<"PrintSupportedCPUs">>; def mcpu_EQ_QUESTION : Flag<["-"], "mcpu=?">, Alias<print_supported_cpus>; def mtune_EQ_QUESTION : Flag<["-"], "mtune=?">, Alias<print_supported_cpus>; +def mcpu_EQ_list : Flag<["-"], "mcpu=list">, Alias<print_supported_cpus>; +def mtune_EQ_list : Flag<["-"], "mtune=list">, Alias<print_supported_cpus>; def time : Flag<["-"], "time">, HelpText<"Time individual commands">; def traditional_cpp : Flag<["-", "--"], "traditional-cpp">, Flags<[CC1Option]>, Index: clang/docs/CommandGuide/clang.rst =================================================================== --- clang/docs/CommandGuide/clang.rst +++ clang/docs/CommandGuide/clang.rst @@ -373,6 +373,10 @@ Acts as an alias for :option:`--print-supported-cpus`. +.. option:: -mcpu=list, -mtune=list + + Acts as an alias for :option:`--print-supported-cpus`. + .. option:: -march=<cpu> Specify that Clang should generate code for a specific processor family
Index: clang/test/Driver/print-supported-cpus.c =================================================================== --- clang/test/Driver/print-supported-cpus.c +++ clang/test/Driver/print-supported-cpus.c @@ -13,6 +13,13 @@ // RUN: %clang --target=x86_64-unknown-linux-gnu -mtune=? -fuse-ld=dummy 2>&1 | \ // RUN: FileCheck %s --check-prefix=CHECK-X86 +// Test -mcpu=list and -mtune=list alises. +// RUN: %clang --target=x86_64-unknown-linux-gnu -mcpu=list 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-X86 + +// RUN: %clang --target=x86_64-unknown-linux-gnu -mtune=list -fuse-ld=dummy 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-X86 + // CHECK-NOT: warning: argument unused during compilation // CHECK-X86: Target: x86_64-unknown-linux-gnu // CHECK-X86: corei7 Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4347,6 +4347,8 @@ MarshallingInfoFlag<FrontendOpts<"PrintSupportedCPUs">>; def mcpu_EQ_QUESTION : Flag<["-"], "mcpu=?">, Alias<print_supported_cpus>; def mtune_EQ_QUESTION : Flag<["-"], "mtune=?">, Alias<print_supported_cpus>; +def mcpu_EQ_list : Flag<["-"], "mcpu=list">, Alias<print_supported_cpus>; +def mtune_EQ_list : Flag<["-"], "mtune=list">, Alias<print_supported_cpus>; def time : Flag<["-"], "time">, HelpText<"Time individual commands">; def traditional_cpp : Flag<["-", "--"], "traditional-cpp">, Flags<[CC1Option]>, Index: clang/docs/CommandGuide/clang.rst =================================================================== --- clang/docs/CommandGuide/clang.rst +++ clang/docs/CommandGuide/clang.rst @@ -373,6 +373,10 @@ Acts as an alias for :option:`--print-supported-cpus`. +.. option:: -mcpu=list, -mtune=list + + Acts as an alias for :option:`--print-supported-cpus`. + .. option:: -march=<cpu> Specify that Clang should generate code for a specific processor family
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits