class EmitAssemblyHelper {
DiagnosticsEngine &Diags;
const CodeGenOptions &CodeGenOpts;
- const TargetOptions &TargetOpts;
+ const clang::TargetOptions &TargetOpts;
const LangOptions &LangOpts;
Module *TheModule;
public:
EmitAssemblyHelper(DiagnosticsEngine &_Diags,
- const CodeGenOptions &CGOpts, const TargetOptions &TOpts,
+ const CodeGenOptions &CGOpts,
+ const clang::TargetOptions &TOpts,
const LangOptions &LOpts,
Module *M)
: Diags(_Diags), CodeGenOpts(CGOpts), TargetOpts(TOpts), LangOpts(LOpts),
// being gross, this is also totally broken if we ever care about
// concurrency.
- // Set frame pointer elimination mode.
- if (!CodeGenOpts.DisableFPElim) {
- llvm::NoFramePointerElim = false;
- llvm::NoFramePointerElimNonLeaf = false;
- } else if (CodeGenOpts.OmitLeafFramePointer) {
- llvm::NoFramePointerElim = false;
- llvm::NoFramePointerElimNonLeaf = true;
- } else {
- llvm::NoFramePointerElim = true;
- llvm::NoFramePointerElimNonLeaf = true;
- }
-
- // Set float ABI type.
- if (CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp")
- llvm::FloatABIType = llvm::FloatABI::Soft;
- else if (CodeGenOpts.FloatABI == "hard")
- llvm::FloatABIType = llvm::FloatABI::Hard;
- else {
- assert(CodeGenOpts.FloatABI.empty() && "Invalid float abi!");
- llvm::FloatABIType = llvm::FloatABI::Default;
- }
-
- llvm::LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
- llvm::NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
- llvm::NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
- NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
- llvm::UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
- llvm::UseSoftFloat = CodeGenOpts.SoftFloat;
-
TargetMachine::setAsmVerbosityDefault(CodeGenOpts.AsmVerbose);
TargetMachine::setFunctionSections(CodeGenOpts.FunctionSections);
case 3: OptLevel = CodeGenOpt::Aggressive; break;
}
+ llvm::TargetOptions Options;
+
+ // Set frame pointer elimination mode.
+ if (!CodeGenOpts.DisableFPElim) {
+ Options.NoFramePointerElim = false;
+ Options.NoFramePointerElimNonLeaf = false;
+ } else if (CodeGenOpts.OmitLeafFramePointer) {
+ Options.NoFramePointerElim = false;
+ Options.NoFramePointerElimNonLeaf = true;
+ } else {
+ Options.NoFramePointerElim = true;
+ Options.NoFramePointerElimNonLeaf = true;
+ }
+
+ // Set float ABI type.
+ if (CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp")
+ Options.FloatABIType = llvm::FloatABI::Soft;
+ else if (CodeGenOpts.FloatABI == "hard")
+ Options.FloatABIType = llvm::FloatABI::Hard;
+ else {
+ assert(CodeGenOpts.FloatABI.empty() && "Invalid float abi!");
+ Options.FloatABIType = llvm::FloatABI::Default;
+ }
+
+ Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
+ Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
+ Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
+ Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
+ Options.UnsafeFPMath = CodeGenOpts.UnsafeFPMath;
+ Options.UseSoftFloat = CodeGenOpts.SoftFloat;
+
TargetMachine *TM = TheTarget->createTargetMachine(Triple, TargetOpts.CPU,
- FeaturesStr, RM, CM,
- OptLevel);
+ FeaturesStr, Options,
+ RM, CM, OptLevel);
if (CodeGenOpts.RelaxAll)
TM->setMCRelaxAll(true);
void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
const CodeGenOptions &CGOpts,
- const TargetOptions &TOpts,
+ const clang::TargetOptions &TOpts,
const LangOptions &LOpts,
Module *M,
BackendAction Action, raw_ostream *OS) {