summaryrefslogtreecommitdiff
path: root/tools/llc
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2014-02-19 17:09:35 +0000
committerEli Bendersky <eliben@google.com>2014-02-19 17:09:35 +0000
commitcf42174647af5265e35f0e15fbffa17445ae0e80 (patch)
tree70f756244b660fb0330b77a87251b188ffb1a82a /tools/llc
parenteb5fe7002aa9276b86581da2220c895a85202a9a (diff)
Refactor TargetOptions initialization into a single place.
The same code (~20 lines) for initializing a TargetOptions object from CodeGen cmdline flags is duplicated 4 times in 4 different tools. This patch moves it into a utility function. Since the CodeGen/CommandFlags.h file defines cl::opt flags in a header, it's a bit of a touchy situation because we should only link them into tools. So this patch puts the init function in the header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
-rw-r--r--tools/llc/llc.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index a3bd72347d6..7a56bff50e2 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -259,26 +259,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
case '3': OLvl = CodeGenOpt::Aggressive; break;
}
- TargetOptions Options;
- Options.LessPreciseFPMADOption = EnableFPMAD;
- Options.NoFramePointerElim = DisableFPElim;
- Options.AllowFPOpFusion = FuseFPOps;
- Options.UnsafeFPMath = EnableUnsafeFPMath;
- Options.NoInfsFPMath = EnableNoInfsFPMath;
- Options.NoNaNsFPMath = EnableNoNaNsFPMath;
- Options.HonorSignDependentRoundingFPMathOption =
- EnableHonorSignDependentRoundingFPMath;
- Options.UseSoftFloat = GenerateSoftFloatCalls;
- if (FloatABIForCalls != FloatABI::Default)
- Options.FloatABIType = FloatABIForCalls;
- Options.NoZerosInBSS = DontPlaceZerosInBSS;
- Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt;
- Options.DisableTailCalls = DisableTailCalls;
- Options.StackAlignmentOverride = OverrideStackAlignment;
- Options.TrapFuncName = TrapFuncName;
- Options.PositionIndependentExecutable = EnablePIE;
- Options.EnableSegmentedStacks = SegmentedStacks;
- Options.UseInitArray = UseInitArray;
+ TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
OwningPtr<TargetMachine>
target(TheTarget->createTargetMachine(TheTriple.getTriple(),