Driver: Add clang -cc1 -mrelax-all option, which sets relaxes all instructions when using -integrated-as.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104807 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CodeGenAction.cpp b/lib/Frontend/CodeGenAction.cpp
index 03e3ea6..3416aa8 100644
--- a/lib/Frontend/CodeGenAction.cpp
+++ b/lib/Frontend/CodeGenAction.cpp
@@ -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 :
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 2b75b64..1d81e82 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -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");