From 45e28963ee1af34aa5becde5463d6c8b68a73150 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 12 Apr 2018 22:21:36 +0000 Subject: [PATCH] Remove -cc1 option "-backend-option". It means the same thing as -mllvm; there isn't any reason to have two options which do the same thing. Differential Revision: https://reviews.llvm.org/D45109 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329965 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/CC1Options.td | 2 -- include/clang/Frontend/CodeGenOptions.h | 3 --- lib/CodeGen/BackendUtil.cpp | 2 -- lib/Driver/ToolChains/Clang.cpp | 18 +++++++++--------- lib/Frontend/CompilerInvocation.cpp | 1 - test/CodeGen/thinlto-backend-option.ll | 6 +++--- test/CodeGenCUDA/link-device-bitcode.cu | 2 +- test/Driver/aarch64-fix-cortex-a53-835769.c | 6 +++--- test/Driver/apple-kext-mkernel.c | 4 ---- test/Driver/arm-restrict-it.c | 4 ++-- test/Driver/debug-options.c | 4 ++-- test/Driver/mglobal-merge.c | 8 ++++---- test/Driver/woa-restrict-it.c | 2 +- test/Frontend/backend-option.c | 4 ---- 14 files changed, 25 insertions(+), 41 deletions(-) delete mode 100644 test/Frontend/backend-option.c diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 97c996d23f..d6202a25b3 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -275,8 +275,6 @@ def split_stacks : Flag<["-"], "split-stacks">, HelpText<"Try to use a split stack if possible.">; def mno_zero_initialized_in_bss : Flag<["-"], "mno-zero-initialized-in-bss">, HelpText<"Do not put zero initialized data in the BSS">; -def backend_option : Separate<["-"], "backend-option">, - HelpText<"Additional arguments to forward to LLVM backend (during code gen)">; def mregparm : Separate<["-"], "mregparm">, HelpText<"Limit the number of registers available for integer arguments">; def munwind_tables : Flag<["-"], "munwind-tables">, diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h index dd2e9bd599..c246a7737e 100644 --- a/include/clang/Frontend/CodeGenOptions.h +++ b/include/clang/Frontend/CodeGenOptions.h @@ -177,9 +177,6 @@ public: /// function instead of to trap instructions. std::string TrapFuncName; - /// A list of command-line options to forward to the LLVM backend. - std::vector BackendOptions; - /// A list of dependent libraries. std::vector DependentLibraries; diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 241fb5cd61..20dc25f05a 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -658,8 +658,6 @@ static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) { BackendArgs.push_back("-limit-float-precision"); BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str()); } - for (const std::string &BackendOption : CodeGenOpts.BackendOptions) - BackendArgs.push_back(BackendOption.c_str()); BackendArgs.push_back(nullptr); llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1, BackendArgs.data()); diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp index 19a4bd05c4..f6c0061387 100644 --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp @@ -1350,7 +1350,7 @@ void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args, // Forward the -mglobal-merge option for explicit control over the pass. if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge, options::OPT_mno_global_merge)) { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); if (A->getOption().matches(options::OPT_mno_global_merge)) CmdArgs.push_back("-arm-global-merge=false"); else @@ -1464,21 +1464,21 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, if (Arg *A = Args.getLastArg(options::OPT_mfix_cortex_a53_835769, options::OPT_mno_fix_cortex_a53_835769)) { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); if (A->getOption().matches(options::OPT_mfix_cortex_a53_835769)) CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); else CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0"); } else if (Triple.isAndroid()) { // Enabled A53 errata (835769) workaround by default on android - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); } // Forward the -mglobal-merge option for explicit control over the pass. if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge, options::OPT_mno_global_merge)) { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); if (A->getOption().matches(options::OPT_mno_global_merge)) CmdArgs.push_back("-aarch64-enable-global-merge=false"); else @@ -3048,13 +3048,13 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D, // Always enabled for SCE tuning. if (Args.hasArg(options::OPT_gdwarf_aranges) || DebuggerTuning == llvm::DebuggerKind::SCE) { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-generate-arange-section"); } if (Args.hasFlag(options::OPT_fdebug_types_section, options::OPT_fno_debug_types_section, false)) { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-generate-type-units"); } @@ -4073,17 +4073,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it, options::OPT_mno_restrict_it)) { if (A->getOption().matches(options::OPT_mrestrict_it)) { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-arm-restrict-it"); } else { - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-arm-no-restrict-it"); } } else if (Triple.isOSWindows() && (Triple.getArch() == llvm::Triple::arm || Triple.getArch() == llvm::Triple::thumb)) { // Windows on ARM expects restricted IT blocks - CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-arm-restrict-it"); } diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index be3019726b..52603466e7 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -677,7 +677,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math); Opts.NoTrappingMath = Args.hasArg(OPT_fno_trapping_math); Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss); - Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option); Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags); Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack); Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings); diff --git a/test/CodeGen/thinlto-backend-option.ll b/test/CodeGen/thinlto-backend-option.ll index 4fcdd079df..b25b584a2f 100644 --- a/test/CodeGen/thinlto-backend-option.ll +++ b/test/CodeGen/thinlto-backend-option.ll @@ -1,4 +1,4 @@ -; Test to ensure -backend-options work when invoking the ThinLTO backend path. +; Test to ensure -mllvm work when invoking the ThinLTO backend path. ; This test uses a non-existent backend option to test that backend options are ; being parsed. While it's more important that the existing options are parsed @@ -8,8 +8,8 @@ ; RUN: %clang -flto=thin -c -o %t.o %s ; RUN: llvm-lto -thinlto -o %t %t.o -; RUN: not %clang_cc1 -x ir %t.o -fthinlto-index=%t.thinlto.bc -backend-option -nonexistent -emit-obj -o /dev/null 2>&1 | FileCheck %s -check-prefix=UNKNOWN -; UNKNOWN: clang: Unknown command line argument '-nonexistent' +; RUN: not %clang_cc1 -x ir %t.o -fthinlto-index=%t.thinlto.bc -mllvm -nonexistent -emit-obj -o /dev/null 2>&1 | FileCheck %s -check-prefix=UNKNOWN +; UNKNOWN: clang (LLVM option parsing): Unknown command line argument '-nonexistent' ; RUN: not %clang_cc1 -flto=thinfoo 2>&1 | FileCheck %s -check-prefix=INVALID ; INVALID: error: invalid value 'thinfoo' in '-flto=thinfoo' diff --git a/test/CodeGenCUDA/link-device-bitcode.cu b/test/CodeGenCUDA/link-device-bitcode.cu index 869fcb1bc9..b307838ae8 100644 --- a/test/CodeGenCUDA/link-device-bitcode.cu +++ b/test/CodeGenCUDA/link-device-bitcode.cu @@ -31,7 +31,7 @@ // Make sure NVVMReflect pass is enabled in NVPTX back-end. // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \ // RUN: -mlink-cuda-bitcode %t.bc -S -o /dev/null %s \ -// RUN: -backend-option -debug-pass=Structure 2>&1 \ +// RUN: -mllvm -debug-pass=Structure 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-REFLECT #include "Inputs/cuda.h" diff --git a/test/Driver/aarch64-fix-cortex-a53-835769.c b/test/Driver/aarch64-fix-cortex-a53-835769.c index 3fe918adec..56de7c7b9d 100644 --- a/test/Driver/aarch64-fix-cortex-a53-835769.c +++ b/test/Driver/aarch64-fix-cortex-a53-835769.c @@ -8,6 +8,6 @@ // RUN: %clang -target aarch64-android-eabi %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-YES %s -// CHECK-DEF-NOT: "-backend-option" "-aarch64-fix-cortex-a53-835769" -// CHECK-YES: "-backend-option" "-aarch64-fix-cortex-a53-835769=1" -// CHECK-NO: "-backend-option" "-aarch64-fix-cortex-a53-835769=0" +// CHECK-DEF-NOT: "-mllvm" "-aarch64-fix-cortex-a53-835769" +// CHECK-YES: "-mllvm" "-aarch64-fix-cortex-a53-835769=1" +// CHECK-NO: "-mllvm" "-aarch64-fix-cortex-a53-835769=0" diff --git a/test/Driver/apple-kext-mkernel.c b/test/Driver/apple-kext-mkernel.c index db3fbb3336..9c60c24e36 100644 --- a/test/Driver/apple-kext-mkernel.c +++ b/test/Driver/apple-kext-mkernel.c @@ -26,7 +26,3 @@ // RUN: %clang -target x86_64-apple-darwin10 \ // RUN: -Werror -fno-builtin -fno-exceptions -fno-common -fno-rtti \ // RUN: -mkernel -fsyntax-only %s - -// RUN: %clang -c %s -target armv7k-apple-watchos -fapple-kext -mwatchos-version-min=1.0.0 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-WATCH -// CHECK-WATCH-NOT: "-backend-option" "-arm-long-calls" diff --git a/test/Driver/arm-restrict-it.c b/test/Driver/arm-restrict-it.c index c2a776046b..5e695199e3 100644 --- a/test/Driver/arm-restrict-it.c +++ b/test/Driver/arm-restrict-it.c @@ -4,7 +4,7 @@ // RUN: %clang -target armv8a-none-gnueabi -mrestrict-it -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-RESTRICTED < %t %s -// CHECK-RESTRICTED: "-backend-option" "-arm-restrict-it" +// CHECK-RESTRICTED: "-mllvm" "-arm-restrict-it" // RUN: %clang -target arm-none-gnueabi -mno-restrict-it -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NO-RESTRICTED < %t %s @@ -12,4 +12,4 @@ // RUN: %clang -target armv8a-none-gnueabi -mno-restrict-it -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NO-RESTRICTED < %t %s -// CHECK-NO-RESTRICTED: "-backend-option" "-arm-no-restrict-it" +// CHECK-NO-RESTRICTED: "-mllvm" "-arm-no-restrict-it" diff --git a/test/Driver/debug-options.c b/test/Driver/debug-options.c index b3f7aa60e3..ebbf293760 100644 --- a/test/Driver/debug-options.c +++ b/test/Driver/debug-options.c @@ -225,9 +225,9 @@ // // GARANGE: -generate-arange-section // -// FDTS: "-backend-option" "-generate-type-units" +// FDTS: "-mllvm" "-generate-type-units" // -// NOFDTS-NOT: "-backend-option" "-generate-type-units" +// NOFDTS-NOT: "-mllvm" "-generate-type-units" // // CI: "-dwarf-column-info" // diff --git a/test/Driver/mglobal-merge.c b/test/Driver/mglobal-merge.c index 271011e985..4ea7ae03e7 100644 --- a/test/Driver/mglobal-merge.c +++ b/test/Driver/mglobal-merge.c @@ -10,8 +10,8 @@ // RUN: -mno-global-merge // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s -// CHECK-NGM-ARM: "-backend-option" "-arm-global-merge=false" -// CHECK-NGM-AARCH64: "-backend-option" "-aarch64-enable-global-merge=false" +// CHECK-NGM-ARM: "-mllvm" "-arm-global-merge=false" +// CHECK-NGM-AARCH64: "-mllvm" "-aarch64-enable-global-merge=false" // RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t \ // RUN: -mglobal-merge @@ -25,8 +25,8 @@ // RUN: -mglobal-merge // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s -// CHECK-GM-ARM: "-backend-option" "-arm-global-merge=true" -// CHECK-GM-AARCH64: "-backend-option" "-aarch64-enable-global-merge=true" +// CHECK-GM-ARM: "-mllvm" "-arm-global-merge=true" +// CHECK-GM-AARCH64: "-mllvm" "-aarch64-enable-global-merge=true" // RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s diff --git a/test/Driver/woa-restrict-it.c b/test/Driver/woa-restrict-it.c index c046991ae1..f9e157b262 100644 --- a/test/Driver/woa-restrict-it.c +++ b/test/Driver/woa-restrict-it.c @@ -1,4 +1,4 @@ // RUN: %clang -target armv7-windows -### %s 2>&1 | FileCheck %s -// CHECK: "-backend-option" "-arm-restrict-it" +// CHECK: "-mllvm" "-arm-restrict-it" diff --git a/test/Frontend/backend-option.c b/test/Frontend/backend-option.c deleted file mode 100644 index e17757422e..0000000000 --- a/test/Frontend/backend-option.c +++ /dev/null @@ -1,4 +0,0 @@ -// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - 2>&1 | FileCheck %s -// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - -triple spir-unknown-unknown 2>&1 | FileCheck %s -// CHECK: Pass execution timing report - -- 2.40.0