[cfe-commits] r104807 - in /cfe/trunk: include/clang/CodeGen/CodeGenOptions.h include/clang/Driver/CC1Options.td lib/Frontend/CodeGenAction.cpp lib/Frontend/CompilerInvocation.cpp

Daniel Dunbar daniel at zuster.org
Wed May 26 22:39:39 PDT 2010


Author: ddunbar
Date: Thu May 27 00:39:39 2010
New Revision: 104807

URL: http://llvm.org/viewvc/llvm-project?rev=104807&view=rev
Log:
Driver: Add clang -cc1 -mrelax-all option, which sets relaxes all instructions when using -integrated-as.

Modified:
    cfe/trunk/include/clang/CodeGen/CodeGenOptions.h
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/lib/Frontend/CodeGenAction.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/CodeGen/CodeGenOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CodeGenOptions.h?rev=104807&r1=104806&r2=104807&view=diff
==============================================================================
--- cfe/trunk/include/clang/CodeGen/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/CodeGen/CodeGenOptions.h Thu May 27 00:39:39 2010
@@ -54,6 +54,7 @@
   unsigned ObjCDispatchMethod : 2; /// Method of Objective-C dispatch to use.
   unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
   unsigned OptimizeSize      : 1; /// If -Os is specified.
+  unsigned RelaxAll          : 1; /// Relax all machine code instructions.
   unsigned SoftFloat         : 1; /// -soft-float.
   unsigned TimePasses        : 1; /// Set when -ftime-report is enabled.
   unsigned UnitAtATime       : 1; /// Unused. For mirroring GCC optimization
@@ -108,6 +109,7 @@
     ObjCDispatchMethod = Legacy;
     OptimizationLevel = 0;
     OptimizeSize = 0;
+    RelaxAll = 0;
     SoftFloat = 0;
     TimePasses = 0;
     UnitAtATime = 1;

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=104807&r1=104806&r2=104807&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu May 27 00:39:39 2010
@@ -147,6 +147,8 @@
   HelpText<"Do not put zero initialized data in the BSS">;
 def msoft_float : Flag<"-msoft-float">,
   HelpText<"Use software floating point">;
+def mrelax_all : Flag<"-mrelax-all">,
+  HelpText<"Relax all machine instructions">;
 def mrelocation_model : Separate<"-mrelocation-model">,
   HelpText<"The relocation model to use">;
 def munwind_tables : Flag<"-munwind-tables">,

Modified: cfe/trunk/lib/Frontend/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CodeGenAction.cpp?rev=104807&r1=104806&r2=104807&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/Frontend/CodeGenAction.cpp Thu May 27 00:39:39 2010
@@ -321,6 +321,9 @@
   }
   TargetMachine *TM = TheTarget->createTargetMachine(Triple, FeaturesStr);
 
+  if (CodeGenOpts.RelaxAll)
+    TM->setMCRelaxAll(true);
+
   // Set register scheduler & allocation policy.
   RegisterScheduler::setDefault(createDefaultScheduler);
   RegisterRegAlloc::setDefault(Fast ? createLocalRegisterAllocator :

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=104807&r1=104806&r2=104807&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 27 00:39:39 2010
@@ -187,6 +187,8 @@
     Res.push_back("-fobjc-dispatch-method=non-legacy");
     break;
   }
+  if (Opts.RelaxAll)
+    Res.push_back("-mrelax-all");
   if (Opts.SoftFloat)
     Res.push_back("-msoft-float");
   if (Opts.UnwindTables)
@@ -815,6 +817,7 @@
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
   Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
+  Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
   Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
   Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
   Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic");





More information about the cfe-commits mailing list