[cfe-commits] r145715 - /cfe/trunk/lib/CodeGen/BackendUtil.cpp

Nick Lewycky nicholas at mxc.ca
Fri Dec 2 14:17:00 PST 2011


Author: nicholas
Date: Fri Dec  2 16:17:00 2011
New Revision: 145715

URL: http://llvm.org/viewvc/llvm-project?rev=145715&view=rev
Log:
Update for change to LLVM TargetMachine API in r145714.

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=145715&r1=145714&r2=145715&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Dec  2 16:17:00 2011
@@ -43,7 +43,7 @@
 class EmitAssemblyHelper {
   DiagnosticsEngine &Diags;
   const CodeGenOptions &CodeGenOpts;
-  const TargetOptions &TargetOpts;
+  const clang::TargetOptions &TargetOpts;
   const LangOptions &LangOpts;
   Module *TheModule;
 
@@ -87,7 +87,8 @@
 
 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),
@@ -218,35 +219,6 @@
   // 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);
@@ -315,9 +287,40 @@
   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);
@@ -412,7 +415,7 @@
 
 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) {





More information about the cfe-commits mailing list