steven_wu created this revision.
steven_wu added reviewers: rsmith, dexonsmith.
steven_wu added subscribers: cfe-commits, jfb, dschuff.

Previously, all the cc1 options are passed to both compile stage and codegen
stage and almost all of them are embedded in the commandline section in the
object file when using embedded bitcode.
In reality, the most of the options are not needed for codegen phase. Some of
them are useless, for example, include paths, warning flags. Some of them are
included in the bitcode, for example, PIC mode.
This fixes the issue by removing unnecessary opts from both codegen cc1 command
and the commandline embedded in object file. This is achieved by adding all the
necessary cc1 options to a specific group. I also plan to extend this group
to driver flags so clang can issue warnings when using these options with LTO
because they are likely to get dropped in the process.
The list of the cc1 options are created from the options that will affect the
TargetMachine created in clang FrontendInvocation. I also make sure none of
these options are actually turned into an attribute in CGCall.

Note: This is an alternative to http://reviews.llvm.org/D17394

http://reviews.llvm.org/D21230

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/compress.c
  test/Driver/embed-bitcode.c

Index: test/Driver/embed-bitcode.c
===================================================================
--- test/Driver/embed-bitcode.c
+++ test/Driver/embed-bitcode.c
@@ -41,3 +41,68 @@
 // CHECK-MARKER: -fembed-bitcode=marker
 // CHECK-MARKER-NOT: -cc1
 
+// Check the options that affects CodeGen are passed correctly.
+// RUN: %clang -target armv7-apple-darwin -c %s -fembed-bitcode=all -O3 \
+// RUN:   -mios-version-min=9.0 -mcmodel=small \
+// RUN:   -mrecip=default -mthread-model posix -mrelax-all \
+// RUN:   -ffp-contract=fast -ffast-math -flimited-precision=8 -fapple-kext \
+// RUN:   -fno-dwarf-directory-asm -femulated-tls -ffunction-sections \
+// RUN:   -fdata-sections -fno-data-sections -funique-section-names \
+// RUN:   -mstack-alignment=8 -meabi test -fno-zero-initialized-in-bss \
+// RUN:   -mincremental-linker-compatible -Wa,--noexecstack \
+// RUN:   -Wa,--fatal-warnings -Wa,-L -fverbose-asm -mllvm -test \
+// RUN:   -Xclang -cl-finite-math-only -Xclang -cl-unsafe-math-optimizations \
+// RUN:   -Xclang -cl-fast-relaxed-math -Xclang -cl-mad-enable -### 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=CHECK-CODEGEN
+// CHECK-CODEGEN: "-cc1" "-emit-obj"
+// CHECK-CODEGEN: "-triple" "thumbv7-apple-ios9.0.0"
+// CHECK-CODEGEN: "-O3"
+// CHECK-CODEGEN: "-mrelax-all"
+// CHECK-CODEGEN: "-mincremental-linker-compatible"
+// CHECK-CODEGEN: "-mnoexecstack"
+// CHECK-CODEGEN: "-massembler-fatal-warnings"
+// CHECK-CODEGEN: "-msave-temp-labels"
+// CHECK-CODEGEN: "-fembed-bitcode=all"
+// CHECK-CODEGEN: "-meabi" "test"
+// CHECK-CODEGEN: "-mthread-model" "posix"
+// CHECK-CODEGEN: "-mno-zero-initialized-in-bss"
+// CHECK-CODEGEN: "-menable-no-infs"
+// CHECK-CODEGEN: "-menable-no-nans"
+// CHECK-CODEGEN: "-menable-unsafe-fp-math"
+// CHECK-CODEGEN: "-ffp-contract=fast"
+// CHECK-CODEGEN: "-mrecip=default"
+// CHECK-CODEGEN: "-masm-verbose"
+// CHECK-CODEGEN: "-mlimit-float-precision" "8"
+// CHECK-CODEGEN: "-mcode-model" "small"
+// CHECK-CODEGEN: "-target-abi" "apcs-gnu"
+// CHECK-CODEGEN: "-debugger-tuning=lldb"
+// CHECK-CODEGEN: "-ffunction-sections"
+// CHECK-CODEGEN: "-fno-dwarf-directory-asm"
+// CHECK-CODEGEN: "-femulated-tls"
+// CHECK-CODEGEN: "-fapple-kext"
+// CHECK-CODEGEN: "-mstack-alignment=8"
+// CHECK-CODEGEN: "-fsjlj-exceptions"
+// CHECK-CODEGEN: "-cl-finite-math-only"
+// CHECK-CODEGEN: "-cl-unsafe-math-optimizations"
+// CHECK-CODEGEN: "-cl-fast-relaxed-math"
+// CHECK-CODEGEN: "-cl-mad-enable"
+// CHECK-CODEGEN: "-mllvm" "-test"
+
+// RUN: %clang -target arm64-none-none-eabi -fuse-init-array \
+// RUN:   -fembed-bitcode=all -c %s -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
+// CHECK-INIT-ARRAY: "-cc1" "-emit-obj"
+// CHECK-INIT-ARRAY: "-fuse-init-array"
+
+// RUN: %clang -target armv7-apple-darwin -c %s -fembed-bitcode=all \
+// RUN:   -Wall -I/usr/include -c -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-OPTS %s
+// CHECK-NO-OPTS: "-cc1" "-emit-obj"
+// CHECK-NO-OPTS-NOT: "-Wall"
+// CHECK-NO-OPTS-NOT: "-I"
+
+// Check multiple inputs work with -fembed-bitcode.
+// RUN: %clang %s %s -fembed-bitcode=all 2>&1 -### | FileCheck %s -check-prefix=CHECK-MULTIPLE
+// RUN: %clang -arch arm64 -arch armv7 %s  -fembed-bitcode=all 2>&1 -### | FileCheck %s -check-prefix=CHECK-MULTIPLE
+// CHECK-MULTIPLE: "-cc1" "-emit-obj"
+// CHECK-MULTIPLE: "-cc1" "-emit-obj"
Index: test/Driver/compress.c
===================================================================
--- test/Driver/compress.c
+++ test/Driver/compress.c
@@ -6,3 +6,10 @@
 
 // RUN: %clang -### -c -integrated-as -Wa,--compress-debug-sections -Wa,--nocompress-debug-sections %s 2>&1 | FileCheck --check-prefix=NOCOMPRESS_DEBUG %s
 // NOCOMPRESS_DEBUG-NOT: "-compress-debug-sections"
+
+
+// RUN: %clang -### -c -fembed-bitcode=all -integrated-as \
+// RUN:   -Wa,--compress-debug-sections %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=EMBED_BITCODE %s
+// EMBED_BITCODE: "-cc1" "-emit-obj"
+// EMBED_BITCODE: "-compress-debug-sections"
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -659,23 +659,21 @@
   // attributes in the IR, keep track of them so we can embed them in a
   // separate data section and use them when building the bitcode.
   if (Opts.getEmbedBitcode() == CodeGenOptions::Embed_All) {
+    ArgStringList ASL;
     for (const auto &A : Args) {
       // Do not encode output and input.
       if (A->getOption().getID() == options::OPT_o ||
           A->getOption().getID() == options::OPT_INPUT ||
           A->getOption().getID() == options::OPT_x ||
-          A->getOption().getID() == options::OPT_fembed_bitcode ||
-          (A->getOption().getGroup().isValid() &&
-           A->getOption().getGroup().getID() == options::OPT_W_Group))
+          A->getOption().getID() == options::OPT_fembed_bitcode_EQ)
         continue;
-      ArgStringList ASL;
       A->render(Args, ASL);
-      for (const auto &arg : ASL) {
-        StringRef ArgStr(arg);
-        Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
-        // using \00 to seperate each commandline options.
-        Opts.CmdArgs.push_back('\0');
-      }
+    }
+    for (const auto &arg : ASL) {
+      StringRef ArgStr(arg);
+      Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
+      // using \00 to seperate each commandline options.
+      Opts.CmdArgs.push_back('\0');
     }
   }
 
Index: lib/Driver/Tools.h
===================================================================
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -16,6 +16,7 @@
 #include "clang/Driver/Types.h"
 #include "clang/Driver/Util.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Compiler.h"
 
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3726,6 +3726,35 @@
     CmdArgs.push_back("-KPIC");
 }
 
+void RenderBitcodeCodeGenOptions(const Driver &Driver, const ArgList &Args,
+                                 ArgStringList &CmdArgs) {
+  unsigned IncludedFlagsBitmask = options::CC1Option;
+  unsigned MissingArgIndex, MissingArgCount;
+  InputArgList CC1ArgList = Driver.getOpts().ParseArgs(
+      CmdArgs, MissingArgIndex, MissingArgCount, IncludedFlagsBitmask);
+  ArgStringList NewCmdArgs;
+  NewCmdArgs.push_back("-cc1");
+  if (Arg *A = CC1ArgList.getLastArg(options::OPT_Action_Group))
+    A->render(Args, NewCmdArgs);
+  // Add triple and optimization.
+  if (Arg *A = CC1ArgList.getLastArg(options::OPT_triple))
+    A->render(Args, NewCmdArgs);
+  if (Arg *A = CC1ArgList.getLastArg(options::OPT_O_Group))
+    A->render(Args, NewCmdArgs);
+
+  // Render codegen/optimization flags.
+  for (const Arg *A : CC1ArgList.filtered(options::OPT_codegen_Group,
+                                          options::OPT_codegen_f_Group,
+                                          options::OPT_codegen_m_Group))
+    A->render(Args, NewCmdArgs);
+  // Input/output flags.
+  for (const Arg *A :
+       CC1ArgList.filtered(options::OPT_x, options::OPT_o, options::OPT_INPUT))
+    A->render(Args, NewCmdArgs);
+
+  CmdArgs = NewCmdArgs;
+}
+
 void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                          const InputInfo &Output, const InputInfoList &Inputs,
                          const ArgList &Args, const char *LinkingOutput) const {
@@ -5884,6 +5913,10 @@
     CmdArgs.push_back("-fwhole-program-vtables");
   }
 
+  if (C.getDriver().embedBitcodeEnabled() &&
+      (isa<BackendJobAction>(JA) || isa<AssembleJobAction>(JA)))
+    RenderBitcodeCodeGenOptions(C.getDriver(), Args, CmdArgs);
+
   // Finally add the compile command to the compilation.
   if (Args.hasArg(options::OPT__SLASH_fallback) &&
       Output.getType() == types::TY_Object &&
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -116,6 +116,11 @@
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "<clang_ignored_gcc_optimization_f_Group>">, Group<f_Group>;
 
+// Groups for options that affects CodeGen but not encoded in bitcode.
+def codegen_Group : OptionGroup<"<codegen_Group>">;
+def codegen_f_Group : OptionGroup<"<codegen_f_Group>">, Group<f_Group>;
+def codegen_m_Group : OptionGroup<"<codegen_m_Group>">, Group<m_Group>;
+
 /////////
 // Options
 
@@ -310,7 +315,7 @@
 def T : JoinedOrSeparate<["-"], "T">, Group<T_Group>;
 def U : JoinedOrSeparate<["-"], "U">, Group<CompileOnly_Group>, Flags<[CC1Option]>;
 def V : JoinedOrSeparate<["-"], "V">, Flags<[DriverOption, Unsupported]>;
-def Wa_COMMA : CommaJoined<["-"], "Wa,">,
+def Wa_COMMA : CommaJoined<["-"], "Wa,">, Group<codegen_Group>,
   HelpText<"Pass the comma separated arguments in <arg> to the assembler">,
   MetaVarName<"<arg>">;
 def Wall : Flag<["-"], "Wall">, Group<W_Group>, Flags<[CC1Option]>;
@@ -336,7 +341,7 @@
 def Xanalyzer : Separate<["-"], "Xanalyzer">,
   HelpText<"Pass <arg> to the static analyzer">, MetaVarName<"<arg>">;
 def Xarch__ : JoinedAndSeparate<["-"], "Xarch_">, Flags<[DriverOption]>;
-def Xassembler : Separate<["-"], "Xassembler">,
+def Xassembler : Separate<["-"], "Xassembler">, Group<codegen_Group>,
   HelpText<"Pass <arg> to the assembler">, MetaVarName<"<arg>">;
 def Xclang : Separate<["-"], "Xclang">,
   HelpText<"Pass <arg> to the clang compiler">, MetaVarName<"<arg>">,
@@ -432,8 +437,8 @@
 def fno_PIE : Flag<["-"], "fno-PIE">, Group<f_Group>;
 def faccess_control : Flag<["-"], "faccess-control">, Group<f_Group>;
 def fallow_unsupported : Flag<["-"], "fallow-unsupported">, Group<f_Group>;
-def fapple_kext : Flag<["-"], "fapple-kext">, Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Use Apple's kernel extensions ABI">;
+def fapple_kext : Flag<["-"], "fapple-kext">, Group<codegen_f_Group>,
+  Flags<[CC1Option]>, HelpText<"Use Apple's kernel extensions ABI">;
 def fapple_pragma_pack : Flag<["-"], "fapple-pragma-pack">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Enable Apple gcc-compatible #pragma pack handling">;
 def shared_libasan : Flag<["-"], "shared-libasan">;
@@ -454,7 +459,8 @@
   HelpText<"Disable generation of linker directives for automatic library linking">;
 
 def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
-    Group<f_Group>, Flags<[DriverOption, CC1Option]>, MetaVarName<"<option>">,
+    Group<codegen_f_Group>, Flags<[DriverOption, CC1Option]>,
+    MetaVarName<"<option>">,
     HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;
 def fembed_bitcode : Flag<["-"], "fembed-bitcode">, Group<f_Group>,
   Alias<fembed_bitcode_EQ>, AliasArgs<["all"]>,
@@ -569,17 +575,19 @@
 def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group<clang_ignored_f_Group>;
 def fno_dwarf2_cfi_asm : Flag<["-"], "fno-dwarf2-cfi-asm">, Group<clang_ignored_f_Group>;
 def fdwarf_directory_asm : Flag<["-"], "fdwarf-directory-asm">, Group<f_Group>;
-def fno_dwarf_directory_asm : Flag<["-"], "fno-dwarf-directory-asm">, Group<f_Group>, Flags<[CC1Option]>;
+def fno_dwarf_directory_asm : Flag<["-"], "fno-dwarf-directory-asm">,
+  Group<codegen_f_Group>, Flags<[CC1Option]>;
 def felide_constructors : Flag<["-"], "felide-constructors">, Group<f_Group>;
 def fno_elide_type : Flag<["-"], "fno-elide-type">, Group<f_Group>,
     Flags<[CC1Option]>,
     HelpText<"Do not elide types when printing diagnostics">;
 def feliminate_unused_debug_symbols : Flag<["-"], "feliminate-unused-debug-symbols">, Group<f_Group>;
 def femit_all_decls : Flag<["-"], "femit-all-decls">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Emit all declarations, even if unused">;
-def femulated_tls : Flag<["-"], "femulated-tls">, Group<f_Group>, Flags<[CC1Option]>,
+def femulated_tls : Flag<["-"], "femulated-tls">, Group<codegen_f_Group>,
+  Flags<[CC1Option]>,
   HelpText<"Use emutls functions to access thread_local variables">;
-def fno_emulated_tls : Flag<["-"], "fno-emulated-tls">, Group<f_Group>;
+def fno_emulated_tls : Flag<["-"], "fno-emulated-tls">, Group<codegen_f_Group>;
 def fencoding_EQ : Joined<["-"], "fencoding=">, Group<f_Group>;
 def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group<f_Group>, Flags<[CoreOption]>;
 def fexceptions : Flag<["-"], "fexceptions">, Group<f_Group>, Flags<[CC1Option]>,
@@ -710,7 +718,7 @@
 def : Flag<["-"], "fno-honor-infinites">, Alias<fno_honor_infinities>;
 def ftrapping_math : Flag<["-"], "ftrapping-math">, Group<f_Group>;
 def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group<f_Group>;
-def ffp_contract : Joined<["-"], "ffp-contract=">, Group<f_Group>,
+def ffp_contract : Joined<["-"], "ffp-contract=">, Group<codegen_f_Group>,
   Flags<[CC1Option]>, HelpText<"Form fused FP ops (e.g. FMAs): fast (everywhere)"
   " | on (according to FP_CONTRACT pragma, default) | off (never fuse)">;
 
@@ -1148,8 +1156,8 @@
 def fno_unsigned_char : Flag<["-"], "fno-unsigned-char">;
 def funwind_tables : Flag<["-"], "funwind-tables">, Group<f_Group>;
 def fuse_cxa_atexit : Flag<["-"], "fuse-cxa-atexit">, Group<f_Group>;
-def fuse_init_array : Flag<["-"], "fuse-init-array">, Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Use .init_array instead of .ctors">;
+def fuse_init_array : Flag<["-"], "fuse-init-array">, Group<codegen_f_Group>,
+  Flags<[CC1Option]>, HelpText<"Use .init_array instead of .ctors">;
 def fno_var_tracking : Flag<["-"], "fno-var-tracking">, Group<clang_ignored_f_Group>;
 def fverbose_asm : Flag<["-"], "fverbose-asm">, Group<f_Group>;
 def fvisibility_EQ : Joined<["-"], "fvisibility=">, Group<f_Group>,
@@ -1169,21 +1177,21 @@
 def fwritable_strings : Flag<["-"], "fwritable-strings">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Store string literals as writable data">;
 def fzero_initialized_in_bss : Flag<["-"], "fzero-initialized-in-bss">, Group<f_Group>;
-def ffunction_sections : Flag<["-"], "ffunction-sections">, Group<f_Group>,
-  Flags<[CC1Option]>,
+def ffunction_sections : Flag<["-"], "ffunction-sections">,
+  Group<codegen_f_Group>, Flags<[CC1Option]>,
   HelpText<"Place each function in its own section (ELF Only)">;
 def fno_function_sections : Flag<["-"], "fno-function-sections">,
-  Group<f_Group>, Flags<[CC1Option]>;
-def fdata_sections : Flag <["-"], "fdata-sections">, Group<f_Group>,
+  Group<codegen_f_Group>, Flags<[CC1Option]>;
+def fdata_sections : Flag <["-"], "fdata-sections">, Group<codegen_f_Group>,
  Flags<[CC1Option]>, HelpText<"Place each data in its own section (ELF Only)">;
-def fno_data_sections : Flag <["-"], "fno-data-sections">, Group<f_Group>,
-  Flags<[CC1Option]>;
+def fno_data_sections : Flag <["-"], "fno-data-sections">,
+  Group<codegen_f_Group>, Flags<[CC1Option]>;
 
 def funique_section_names : Flag <["-"], "funique-section-names">,
-  Group<f_Group>, Flags<[CC1Option]>,
+  Group<codegen_f_Group>, Flags<[CC1Option]>,
   HelpText<"Use unique names for text and data sections (ELF Only)">;
 def fno_unique_section_names : Flag <["-"], "fno-unique-section-names">,
-  Group<f_Group>, Flags<[CC1Option]>;
+  Group<codegen_f_Group>, Flags<[CC1Option]>;
 
 
 def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group<f_Group>,
@@ -1350,6 +1358,7 @@
 def mlinker_version_EQ : Joined<["-"], "mlinker-version=">,
   Flags<[DriverOption]>;
 def mllvm : Separate<["-"], "mllvm">, Flags<[CC1Option,CC1AsOption,CoreOption]>,
+  Group<codegen_Group>,
   HelpText<"Additional arguments to forward to LLVM's option processing">;
 def mmacosx_version_min_EQ : Joined<["-"], "mmacosx-version-min=">,
   Group<m_Group>, HelpText<"Set Mac OS X deployment target">;
@@ -1359,13 +1368,15 @@
   HelpText<"Do not set the default structure layout to be compatible with the Microsoft compiler standard">;
 def mstackrealign : Flag<["-"], "mstackrealign">, Group<m_Group>, Flags<[CC1Option]>,
   HelpText<"Force realign the stack at entry to every function">;
-def mstack_alignment : Joined<["-"], "mstack-alignment=">, Group<m_Group>, Flags<[CC1Option]>,
+def mstack_alignment : Joined<["-"], "mstack-alignment=">,
+  Group<codegen_m_Group>, Flags<[CC1Option]>,
   HelpText<"Set the stack alignment">;
 def mstack_probe_size : Joined<["-"], "mstack-probe-size=">, Group<m_Group>, Flags<[CC1Option]>,
   HelpText<"Set the stack probe size">;
-def mthread_model : Separate<["-"], "mthread-model">, Group<m_Group>, Flags<[CC1Option]>,
+def mthread_model : Separate<["-"], "mthread-model">, Group<codegen_m_Group>,
+  Flags<[CC1Option]>,
   HelpText<"The thread model to use, e.g. posix, single (posix by default)">;
-def meabi : Separate<["-"], "meabi">, Group<m_Group>, Flags<[CC1Option]>,
+def meabi : Separate<["-"], "meabi">, Group<codegen_m_Group>, Flags<[CC1Option]>,
   HelpText<"Set EABI type, e.g. 4, 5 or gnu (default depends on triple)">;
 
 def mmmx : Flag<["-"], "mmmx">, Group<m_x86_Features_Group>;
@@ -1549,10 +1560,11 @@
 def mpascal_strings : Flag<["-"], "mpascal-strings">, Alias<fpascal_strings>;
 def mred_zone : Flag<["-"], "mred-zone">, Group<m_Group>;
 def mregparm_EQ : Joined<["-"], "mregparm=">, Group<m_Group>;
-def mrelax_all : Flag<["-"], "mrelax-all">, Group<m_Group>, Flags<[CC1Option,CC1AsOption]>,
-  HelpText<"(integrated-as) Relax all machine instructions">;
-def mincremental_linker_compatible : Flag<["-"], "mincremental-linker-compatible">, Group<m_Group>,
+def mrelax_all : Flag<["-"], "mrelax-all">, Group<codegen_m_Group>,
   Flags<[CC1Option,CC1AsOption]>,
+  HelpText<"(integrated-as) Relax all machine instructions">;
+def mincremental_linker_compatible : Flag<["-"], "mincremental-linker-compatible">,
+  Group<codegen_m_Group>, Flags<[CC1Option,CC1AsOption]>,
   HelpText<"(integrated-as) Emit an object file which can be used with an incremental linker">;
 def mno_incremental_linker_compatible : Flag<["-"], "mno-incremental-linker-compatible">, Group<m_Group>,
   HelpText<"(integrated-as) Emit an object file which cannot be used with an incremental linker">;
@@ -1565,7 +1577,8 @@
   HelpText<"Don't generate implicit floating point instructions">;
 def mimplicit_float : Flag<["-"], "mimplicit-float">, Group<m_Group>;
 def mrecip : Flag<["-"], "mrecip">, Group<m_Group>;
-def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group<m_Group>, Flags<[CC1Option]>;
+def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group<codegen_m_Group>,
+  Flags<[CC1Option]>;
 def mx87 : Flag<["-"], "mx87">, Group<m_x86_Features_Group>;
 def m80387 : Flag<["-"], "m80387">, Alias<mx87>;
 def msse2 : Flag<["-"], "msse2">, Group<m_x86_Features_Group>;
@@ -1867,7 +1880,8 @@
 def fintegrated_as : Flag<["-"], "fintegrated-as">, Flags<[DriverOption]>,
                      Group<f_Group>, HelpText<"Enable the integrated assembler">;
 def fno_integrated_as : Flag<["-"], "fno-integrated-as">,
-                        Flags<[CC1Option, DriverOption]>, Group<f_Group>,
+                        Flags<[CC1Option, DriverOption]>,
+                        Group<codegen_f_Group>,
                         HelpText<"Disable the integrated assembler">;
 def : Flag<["-"], "integrated-as">, Alias<fintegrated_as>, Flags<[DriverOption]>;
 def : Flag<["-"], "no-integrated-as">, Alias<fno_integrated_as>,
Index: include/clang/Driver/CC1Options.td
===================================================================
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -25,7 +25,7 @@
   HelpText<"Target specific attributes">;
 def triple : Separate<["-"], "triple">,
   HelpText<"Specify target triple (e.g. i686-apple-darwin9)">;
-def target_abi : Separate<["-"], "target-abi">,
+def target_abi : Separate<["-"], "target-abi">, Group<codegen_Group>,
   HelpText<"Target a particular ABI type">;
 
 }
@@ -134,20 +134,22 @@
 
 def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
 def dwarf_version_EQ : Joined<["-"], "dwarf-version=">;
-def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">;
+def debugger_tuning_EQ : Joined<["-"], "debugger-tuning=">,
+  Group<codegen_Group>;
 def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
   HelpText<"The compilation directory to embed in the debug info.">;
 def dwarf_debug_flags : Separate<["-"], "dwarf-debug-flags">,
   HelpText<"The string to embed in the Dwarf debug flags record.">;
-def mno_exec_stack : Flag<["-"], "mnoexecstack">,
+def mno_exec_stack : Flag<["-"], "mnoexecstack">, Group<codegen_Group>,
   HelpText<"Mark the file as not needing an executable stack">;
 def massembler_fatal_warnings : Flag<["-"], "massembler-fatal-warnings">,
-  HelpText<"Make assembler warnings fatal">;
+  Group<codegen_Group>, HelpText<"Make assembler warnings fatal">;
 def mrelax_relocations : Flag<["--"], "mrelax-relocations">,
+    Group<codegen_Group>,
     HelpText<"Use relaxable elf relocations">;
 def compress_debug_sections : Flag<["-"], "compress-debug-sections">,
-    HelpText<"Compress DWARF debug sections using zlib">;
-def msave_temp_labels : Flag<["-"], "msave-temp-labels">,
+    Group<codegen_Group>, HelpText<"Compress DWARF debug sections using zlib">;
+def msave_temp_labels : Flag<["-"], "msave-temp-labels">, Group<codegen_Group>,
   HelpText<"Save temporary labels in the symbol table. "
            "Note this may change .s semantics and shouldn't generally be used "
            "on compiler-generated code.">;
@@ -210,31 +212,34 @@
   HelpText<"Turn off Type Based Alias Analysis">;
 def no_struct_path_tbaa : Flag<["-"], "no-struct-path-tbaa">,
   HelpText<"Turn off struct-path aware Type Based Alias Analysis">;
-def masm_verbose : Flag<["-"], "masm-verbose">,
+def masm_verbose : Flag<["-"], "masm-verbose">, Group<codegen_Group>,
   HelpText<"Generate verbose assembly output">;
-def mcode_model : Separate<["-"], "mcode-model">,
+def mcode_model : Separate<["-"], "mcode-model">, Group<codegen_Group>,
   HelpText<"The code model to use">;
 def mdebug_pass : Separate<["-"], "mdebug-pass">,
   HelpText<"Enable additional debug output">;
 def mdisable_fp_elim : Flag<["-"], "mdisable-fp-elim">,
   HelpText<"Disable frame pointer elimination optimization">;
 def mdisable_tail_calls : Flag<["-"], "mdisable-tail-calls">,
   HelpText<"Disable tail call optimization, keeping the call stack accurate">;
 def menable_no_infinities : Flag<["-"], "menable-no-infs">,
+  Group<codegen_Group>,
   HelpText<"Allow optimization to assume there are no infinities.">;
-def menable_no_nans : Flag<["-"], "menable-no-nans">,
+def menable_no_nans : Flag<["-"], "menable-no-nans">, Group<codegen_Group>,
   HelpText<"Allow optimization to assume there are no NaNs.">;
 def menable_unsafe_fp_math : Flag<["-"], "menable-unsafe-fp-math">,
+  Group<codegen_Group>,
   HelpText<"Allow unsafe floating-point math optimizations which may decrease "
            "precision">;
 def mfloat_abi : Separate<["-"], "mfloat-abi">,
   HelpText<"The float ABI to use">;
 def mlimit_float_precision : Separate<["-"], "mlimit-float-precision">,
+  Group<codegen_f_Group>,
   HelpText<"Limit float precision to the given value">;
 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">;
+  Group<codegen_Group>, 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">,
@@ -527,7 +532,7 @@
   HelpText<"Weakly link in the blocks runtime">;
 def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">,
   HelpText<"Assume all functions with C linkage do not unwind">;
-def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">,
+def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group<codegen_Group>,
   HelpText<"Use SjLj style exceptions">;
 def split_dwarf_file : Separate<["-"], "split-dwarf-file">,
   HelpText<"File name to use for split dwarf debug info output">;
@@ -674,14 +679,17 @@
 def cl_single_precision_constant : Flag<["-"], "cl-single-precision-constant">,
   HelpText<"OpenCL only. Treat double precision floating-point constant as single precision constant.">;
 def cl_finite_math_only : Flag<["-"], "cl-finite-math-only">,
+  Group<codegen_Group>,
   HelpText<"OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.">;
 def cl_kernel_arg_info : Flag<["-"], "cl-kernel-arg-info">,
   HelpText<"OpenCL only. Generate kernel argument metadata.">;
 def cl_unsafe_math_optimizations : Flag<["-"], "cl-unsafe-math-optimizations">,
+  Group<codegen_Group>,
   HelpText<"OpenCL only. Allow unsafe floating-point optimizations.  Also implies -cl-no-signed-zeros and -cl-mad-enable">;
 def cl_fast_relaxed_math : Flag<["-"], "cl-fast-relaxed-math">,
+  Group<codegen_Group>,
   HelpText<"OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__">;
-def cl_mad_enable : Flag<["-"], "cl-mad-enable">,
+def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<codegen_Group>,
   HelpText<"OpenCL only. Enable less precise MAD instructions to be generated.">;
 def cl_std_EQ : Joined<["-"], "cl-std=">,
   HelpText<"OpenCL language standard to compile for">;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to