r177360 - Centralize the logic for using the integrated assembler.

Rafael Espindola rafael.espindola at gmail.com
Mon Mar 18 16:56:07 PDT 2013


Author: rafael
Date: Mon Mar 18 18:56:07 2013
New Revision: 177360

URL: http://llvm.org/viewvc/llvm-project?rev=177360&view=rev
Log:
Centralize the logic for using the integrated assembler.

Modified:
    cfe/trunk/lib/Driver/ToolChain.cpp
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Driver/WindowsToolChain.cpp

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=177360&r1=177359&r2=177360&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Mar 18 18:56:07 2013
@@ -76,6 +76,8 @@ Tool &ToolChain::SelectTool(const JobAct
 
   if (getDriver().ShouldUseClangCompiler(JA))
     T = new tools::Clang(*this);
+  else if (Key == Action::AssembleJobClass && useIntegratedAs())
+    T = new tools::ClangAs(*this);
   else
     T = constructTool(Key);
 

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=177360&r1=177359&r2=177360&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Mar 18 18:56:07 2013
@@ -183,13 +183,8 @@ Tool *Darwin::constructTool(Action::Acti
   case Action::PrecompileJobClass:
   case Action::CompileJobClass:
     return new tools::Clang(*this);
-  case Action::AssembleJobClass: {
-    if (useIntegratedAs())
-      return new tools::ClangAs(*this);
-    else
-      return new tools::darwin::Assemble(*this);
-    break;
-  }
+  case Action::AssembleJobClass:
+    return new tools::darwin::Assemble(*this);
   case Action::LinkJobClass:
     return new tools::darwin::Link(*this);
   case Action::LipoJobClass:
@@ -1663,13 +1658,8 @@ OpenBSD::OpenBSD(const Driver &D, const
 
 Tool *OpenBSD::constructTool(Action::ActionClass AC) const {
   switch (AC) {
-  case Action::AssembleJobClass: {
-    if (useIntegratedAs())
-      return new tools::ClangAs(*this);
-    else
-      return new tools::openbsd::Assemble(*this);
-    break;
-  }
+  case Action::AssembleJobClass:
+    return new tools::openbsd::Assemble(*this);
   case Action::LinkJobClass:
     return new tools::openbsd::Link(*this);
   default:
@@ -1687,13 +1677,8 @@ Bitrig::Bitrig(const Driver &D, const ll
 
 Tool *Bitrig::constructTool(Action::ActionClass AC) const {
   switch (AC) {
-  case Action::AssembleJobClass: {
-    if (useIntegratedAs())
-      return new tools::ClangAs(*this);
-    else
-      return new tools::bitrig::Assemble(*this);
-    break;
-  }
+  case Action::AssembleJobClass:
+    return new tools::bitrig::Assemble(*this);
   case Action::LinkJobClass:
     return new tools::bitrig::Link(*this); break;
   default:
@@ -1764,11 +1749,7 @@ FreeBSD::FreeBSD(const Driver &D, const
 Tool *FreeBSD::constructTool(Action::ActionClass AC) const {
   switch (AC) {
   case Action::AssembleJobClass:
-    if (useIntegratedAs())
-      return new tools::ClangAs(*this);
-    else
-      return new tools::freebsd::Assemble(*this);
-    break;
+    return new tools::freebsd::Assemble(*this);
   case Action::LinkJobClass:
     return  new tools::freebsd::Link(*this); break;
   default:
@@ -1810,14 +1791,9 @@ NetBSD::NetBSD(const Driver &D, const ll
 Tool *NetBSD::constructTool(Action::ActionClass AC) const {
   switch (AC) {
   case Action::AssembleJobClass:
-    if (useIntegratedAs())
-      return new tools::ClangAs(*this);
-    else
-      return new tools::netbsd::Assemble(*this);
-    break;
+    return new tools::netbsd::Assemble(*this);
   case Action::LinkJobClass:
     return new tools::netbsd::Link(*this);
-    break;
   default:
     return Generic_GCC::constructTool(AC);
   }
@@ -2265,11 +2241,7 @@ bool Linux::HasNativeLLVMSupport() const
 Tool *Linux::constructTool(Action::ActionClass AC) const {
   switch (AC) {
   case Action::AssembleJobClass:
-    if (useIntegratedAs())
-      return new tools::ClangAs(*this);
-    else
-      return new tools::linuxtools::Assemble(*this);
-    break;
+    return new tools::linuxtools::Assemble(*this);
   case Action::LinkJobClass:
     return new tools::linuxtools::Link(*this); break;
   default:

Modified: cfe/trunk/lib/Driver/WindowsToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/WindowsToolChain.cpp?rev=177360&r1=177359&r2=177360&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/WindowsToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/WindowsToolChain.cpp Mon Mar 18 18:56:07 2013
@@ -50,11 +50,9 @@ Tool *Windows::constructTool(Action::Act
   case Action::CompileJobClass:
     return new tools::Clang(*this);
   case Action::AssembleJobClass:
-    if (!useIntegratedAs() &&
-        getTriple().getEnvironment() == llvm::Triple::MachO)
+    if (getTriple().getEnvironment() == llvm::Triple::MachO)
       return new tools::darwin::Assemble(*this);
-    else
-      return new tools::ClangAs(*this);
+    llvm_unreachable("We only have the integrated assembler on this TC");
     break;
   case Action::LinkJobClass:
     return new tools::visualstudio::Link(*this);





More information about the cfe-commits mailing list