forked from OSchip/llvm-project
print-supported-cpus quality of life patch.
Claim all input files so that clang does not give a warning. Add two short-cut aliases: -mcpu=? and -mtune=?. llvm-svn: 364362
This commit is contained in:
parent
17c18a9e81
commit
de94ac9357
|
@ -2168,6 +2168,8 @@ Link stack frames through backchain on System Z
|
|||
|
||||
.. option:: -mcpu=<arg>, -mv5 (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55), -mv60 (equivalent to -mcpu=hexagonv60), -mv62 (equivalent to -mcpu=hexagonv62), -mv65 (equivalent to -mcpu=hexagonv65)
|
||||
|
||||
Use -mcpu=? to see a list of supported cpu models.
|
||||
|
||||
.. option:: -mcrc, -mno-crc
|
||||
|
||||
Allow use of CRC instructions (ARM/Mips only)
|
||||
|
@ -2302,6 +2304,8 @@ The thread model to use, e.g. posix, single (posix by default)
|
|||
|
||||
.. option:: -mtune=<arg>
|
||||
|
||||
Use -mtune=? to see a list of supported cpu models.
|
||||
|
||||
.. option:: -mtvos-version-min=<arg>, -mappletvos-version-min=<arg>
|
||||
|
||||
.. option:: -municode<arg>
|
||||
|
|
|
@ -330,6 +330,10 @@ number of cross compilers, or may only support a native target.
|
|||
through --target=<architecture> or -arch <architecture>). If no target is
|
||||
specified, the system default target will be used.
|
||||
|
||||
.. option:: -mcpu=?, -mtune=?
|
||||
|
||||
Aliases of --print-supported-cpus
|
||||
|
||||
.. option:: -march=<cpu>
|
||||
|
||||
Specify that Clang should generate code for a specific processor family
|
||||
|
|
|
@ -2648,6 +2648,8 @@ def _print_supported_cpus : Flag<["-", "--"], "print-supported-cpus">,
|
|||
Group<CompileOnly_Group>, Flags<[CC1Option, CoreOption]>,
|
||||
HelpText<"Print supported cpu models for the given target (if target is not specified,"
|
||||
" it will print the supported cpus for the default target)">;
|
||||
def mcpu_EQ_QUESTION : Flag<["-"], "mcpu=?">, Alias<_print_supported_cpus>;
|
||||
def mtune_EQ_QUESTION : Flag<["-"], "mtune=?">, Alias<_print_supported_cpus>;
|
||||
def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[DriverOption]>,
|
||||
HelpText<"Use the gcc toolchain at the given directory">;
|
||||
def time : Flag<["-"], "time">,
|
||||
|
|
|
@ -3377,15 +3377,21 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
|
|||
Args.ClaimAllArgs(options::OPT_cl_compile_Group);
|
||||
}
|
||||
|
||||
// If the use specify --print-supported-cpus, clang will only print out
|
||||
// supported cpu names without doing compilation.
|
||||
// if the user specify --print-supported-cpus, or use -mcpu=?, or use
|
||||
// -mtune=? (aliases), clang will only print out supported cpu names
|
||||
// without doing compilation.
|
||||
if (Arg *A = Args.getLastArg(options::OPT__print_supported_cpus)) {
|
||||
Actions.clear();
|
||||
// the compilation now has only two phases: Input and Compile
|
||||
// use the --prints-supported-cpus flag as the dummy input to cc1
|
||||
Actions.clear();
|
||||
Action *InputAc = C.MakeAction<InputAction>(*A, types::TY_C);
|
||||
Actions.push_back(
|
||||
C.MakeAction<PrecompileJobAction>(InputAc, types::TY_Nothing));
|
||||
// claim all the input files to prevent argument unused warnings
|
||||
for (auto &I : Inputs) {
|
||||
const Arg *InputArg = I.second;
|
||||
InputArg->claim();
|
||||
}
|
||||
}
|
||||
|
||||
// Claim ignored clang-cl options.
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// Test that the --print-supported-cpus flag works
|
||||
// Also test its aliases: -mcpu=? and -mtune=?
|
||||
|
||||
// REQUIRES: x86-registered-target
|
||||
// REQUIRES: arm-registered-target
|
||||
|
||||
// RUN: %clang --target=x86_64-unknown-linux-gnu \
|
||||
// RUN: --print-supported-cpus 2>&1 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-X86
|
||||
|
@ -8,7 +11,13 @@
|
|||
// CHECK-X86: corei7
|
||||
// CHECK-X86: Use -mcpu or -mtune to specify the target's processor.
|
||||
|
||||
// REQUIRES: arm-registered-target
|
||||
// RUN: %clang --target=x86_64-unknown-linux-gnu \
|
||||
// RUN: -mcpu=? 2>&1 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-X86-MCPU
|
||||
// CHECK-X86-MCPU: Target: x86_64-unknown-linux-gnu
|
||||
// CHECK-X86-MCPU: corei7
|
||||
// CHECK-X86-MCPU: Use -mcpu or -mtune to specify the target's processor.
|
||||
|
||||
// RUN: %clang --target=arm-unknown-linux-android \
|
||||
// RUN: --print-supported-cpus 2>&1 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-ARM
|
||||
|
@ -16,3 +25,11 @@
|
|||
// CHECK-ARM: cortex-a73
|
||||
// CHECK-ARM: cortex-a75
|
||||
// CHECK-ARM: Use -mcpu or -mtune to specify the target's processor.
|
||||
|
||||
// RUN: %clang --target=arm-unknown-linux-android \
|
||||
// RUN: -mtune=? 2>&1 \
|
||||
// RUN: | FileCheck %s --check-prefix=CHECK-ARM-MTUNE
|
||||
// CHECK-ARM-MTUNE: Target: arm-unknown-linux-android
|
||||
// CHECK-ARM-MTUNE: cortex-a73
|
||||
// CHECK-ARM-MTUNE: cortex-a75
|
||||
// CHECK-ARM-MTUNE: Use -mcpu or -mtune to specify the target's processor.
|
||||
|
|
Loading…
Reference in New Issue