aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/CodeGen/CodeGenOptions.h2
-rw-r--r--include/clang/Driver/CC1Options.td2
-rw-r--r--lib/Frontend/CodeGenAction.cpp3
-rw-r--r--lib/Frontend/CompilerInvocation.cpp3
4 files changed, 10 insertions, 0 deletions
diff --git a/include/clang/CodeGen/CodeGenOptions.h b/include/clang/CodeGen/CodeGenOptions.h
index 54d3ba03f3..6241230ffb 100644
--- a/include/clang/CodeGen/CodeGenOptions.h
+++ b/include/clang/CodeGen/CodeGenOptions.h
@@ -54,6 +54,7 @@ public:
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 @@ public:
ObjCDispatchMethod = Legacy;
OptimizationLevel = 0;
OptimizeSize = 0;
+ RelaxAll = 0;
SoftFloat = 0;
TimePasses = 0;
UnitAtATime = 1;
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index d7079bb933..fd8322b843 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -147,6 +147,8 @@ def mno_zero_initialized_in_bss : Flag<"-mno-zero-initialized-in-bss">,
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">,
diff --git a/lib/Frontend/CodeGenAction.cpp b/lib/Frontend/CodeGenAction.cpp
index 03e3ea605c..3416aa825f 100644
--- a/lib/Frontend/CodeGenAction.cpp
+++ b/lib/Frontend/CodeGenAction.cpp
@@ -321,6 +321,9 @@ bool BackendConsumer::AddEmitPasses() {
}
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 2b75b64dc7..1d81e82ca3 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -187,6 +187,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
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 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
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");