- 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;
-
- OwningPtr<TargetMachine>
- target(TheTarget->createTargetMachine(TheTriple.getTriple(),
- MCPU, FeaturesStr, Options,
- RelocModel, CMModel, OLvl));
- assert(target.get() && "Could not allocate target machine!");
- assert(mod && "Should have exited after outputting help!");
- TargetMachine &Target = *target.get();
-
- if (DisableDotLoc)
- Target.setMCUseLoc(false);
-
- if (DisableCFI)
- Target.setMCUseCFI(false);
-
- if (EnableDwarfDirectory)
- Target.setMCUseDwarfDirectory(true);
+ TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
+ Options.DisableIntegratedAS = NoIntegratedAssembler;
+ Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
+ Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
+ Options.MCOptions.AsmVerbose = AsmVerbose;
+
+ std::unique_ptr<TargetMachine> Target(
+ TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
+ Options, RelocModel, CMModel, OLvl));
+ assert(Target && "Could not allocate target machine!");
+
+ // If we don't have a module then just exit now. We do this down
+ // here since the CPU/Feature help is underneath the target machine
+ // creation.
+ if (SkipModule)
+ return 0;
+
+ assert(M && "Should have exited if we didn't have a module!");