[cfe-commits] r104815 - in /cfe/trunk: include/clang/Driver/Options.td lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Wed May 26 23:18:05 PDT 2010


Author: ddunbar
Date: Thu May 27 01:18:05 2010
New Revision: 104815

URL: http://llvm.org/viewvc/llvm-project?rev=104815&view=rev
Log:
Driver: Add support for -m[no-]relax-all, and make it the default at -O0.

Modified:
    cfe/trunk/include/clang/Driver/Options.td
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=104815&r1=104814&r2=104815&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu May 27 01:18:05 2010
@@ -139,6 +139,7 @@
 def MT : JoinedOrSeparate<"-MT">, Group<M_Group>;
 def Mach : Flag<"-Mach">;
 def M : Flag<"-M">, Group<M_Group>;
+def O0 : Joined<"-O0">, Group<O_Group>;
 def O4 : Joined<"-O4">, Group<O_Group>;
 def ObjCXX : Flag<"-ObjC++">, Flags<[DriverOption]>,
   HelpText<"Treat source input files as Objective-C++ inputs">;
@@ -436,6 +437,7 @@
 def mno_mmx : Flag<"-mno-mmx">, Group<m_x86_Features_Group>;
 def mno_pascal_strings : Flag<"-mno-pascal-strings">, Group<m_Group>;
 def mno_red_zone : Flag<"-mno-red-zone">, Group<m_Group>;
+def mno_relax_all : Flag<"-mno-relax-all">, Group<m_Group>;
 def mno_soft_float : Flag<"-mno-soft-float">, Group<m_Group>;
 def mno_sse2 : Flag<"-mno-sse2">, Group<m_x86_Features_Group>;
 def mno_sse3 : Flag<"-mno-sse3">, Group<m_x86_Features_Group>;
@@ -453,6 +455,7 @@
 def mno_warn_nonportable_cfstrings : Flag<"-mno-warn-nonportable-cfstrings">, Group<m_Group>;
 def mpascal_strings : Flag<"-mpascal-strings">, Group<m_Group>;
 def mred_zone : Flag<"-mred-zone">, Group<m_Group>;
+def mrelax_all : Flag<"-mrelax-all">, Group<m_Group>;
 def msoft_float : Flag<"-msoft-float">, Group<m_Group>;
 def msse2 : Flag<"-msse2">, Group<m_x86_Features_Group>;
 def msse3 : Flag<"-msse3">, Group<m_x86_Features_Group>;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=104815&r1=104814&r2=104815&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu May 27 01:18:05 2010
@@ -768,6 +768,15 @@
       CmdArgs.push_back("-E");
   } else if (isa<AssembleJobAction>(JA)) {
     CmdArgs.push_back("-emit-obj");
+
+    // At -O0, we use -mrelax-all by default.
+    bool IsOpt = false;
+    if (Arg *A = Args.getLastArg(options::OPT_O_Group))
+      IsOpt = !A->getOption().matches(options::OPT_O0);
+    if (Args.hasFlag(options::OPT_mrelax_all,
+                      options::OPT_mno_relax_all,
+                      !IsOpt))
+      CmdArgs.push_back("-mrelax-all");
   } else if (isa<PrecompileJobAction>(JA)) {
     // Use PCH if the user requested it, except for C++ (for now).
     bool UsePCH = D.CCCUsePCH;
@@ -1512,6 +1521,15 @@
   CmdArgs.push_back("-filetype");
   CmdArgs.push_back("obj");
 
+  // At -O0, we use -mrelax-all by default.
+  bool IsOpt = false;
+  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
+    IsOpt = !A->getOption().matches(options::OPT_O0);
+  if (Args.hasFlag(options::OPT_mrelax_all,
+                    options::OPT_mno_relax_all,
+                    !IsOpt))
+    CmdArgs.push_back("-mrelax-all");
+
   // FIXME: Add -force_cpusubtype_ALL support, once we have it.
 
   // FIXME: Add -g support, once we have it.





More information about the cfe-commits mailing list