mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
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
This commit is contained in:
@ -273,29 +273,6 @@ static void AddStandardLinkPasses(PassManagerBase &PM) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CodeGen-related helper functions.
|
||||
//
|
||||
static TargetOptions GetTargetOptions() {
|
||||
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;
|
||||
return Options;
|
||||
}
|
||||
|
||||
CodeGenOpt::Level GetCodeGenOptLevel() {
|
||||
if (OptLevelO1)
|
||||
@ -327,7 +304,8 @@ static TargetMachine* GetTargetMachine(Triple TheTriple) {
|
||||
}
|
||||
|
||||
return TheTarget->createTargetMachine(TheTriple.getTriple(),
|
||||
MCPU, FeaturesStr, GetTargetOptions(),
|
||||
MCPU, FeaturesStr,
|
||||
InitTargetOptionsFromCodeGenFlags(),
|
||||
RelocModel, CMModel,
|
||||
GetCodeGenOptLevel());
|
||||
}
|
||||
|
Reference in New Issue
Block a user