Skip to content

Commit

Permalink
Remove -cc1 option "-backend-option".
Browse files Browse the repository at this point in the history
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

llvm-svn: 329965
  • Loading branch information
Eli Friedman committed Apr 12, 2018
1 parent a54e7d1 commit 01d349b
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 41 deletions.
2 changes: 0 additions & 2 deletions clang/include/clang/Driver/CC1Options.td
Expand Up @@ -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">,
Expand Down
3 changes: 0 additions & 3 deletions clang/include/clang/Frontend/CodeGenOptions.h
Expand Up @@ -177,9 +177,6 @@ class CodeGenOptions : public CodeGenOptionsBase {
/// function instead of to trap instructions.
std::string TrapFuncName;

/// A list of command-line options to forward to the LLVM backend.
std::vector<std::string> BackendOptions;

/// A list of dependent libraries.
std::vector<std::string> DependentLibraries;

Expand Down
2 changes: 0 additions & 2 deletions clang/lib/CodeGen/BackendUtil.cpp
Expand Up @@ -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());
Expand Down
18 changes: 9 additions & 9 deletions clang/lib/Driver/ToolChains/Clang.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}

Expand Down
1 change: 0 additions & 1 deletion clang/lib/Frontend/CompilerInvocation.cpp
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions clang/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
Expand All @@ -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'
2 changes: 1 addition & 1 deletion clang/test/CodeGenCUDA/link-device-bitcode.cu
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/aarch64-fix-cortex-a53-835769.c
Expand Up @@ -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"
4 changes: 0 additions & 4 deletions clang/test/Driver/apple-kext-mkernel.c
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions clang/test/Driver/arm-restrict-it.c
Expand Up @@ -4,12 +4,12 @@
// 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

// 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"
4 changes: 2 additions & 2 deletions clang/test/Driver/debug-options.c
Expand Up @@ -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"
//
Expand Down
8 changes: 4 additions & 4 deletions clang/test/Driver/mglobal-merge.c
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion clang/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"

4 changes: 0 additions & 4 deletions clang/test/Frontend/backend-option.c

This file was deleted.

0 comments on commit 01d349b

Please sign in to comment.