aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-03-18 23:56:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-03-18 23:56:07 +0000
commit8a1115f382cd61f560b3429a04ddaa70d9409b71 (patch)
treedb317d690aecdc9dca7ace91d1dd204ed63ecc62
parent07c5908fa10c84144907bc699751dc16d4dcb1f8 (diff)
Centralize the logic for using the integrated assembler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177360 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/ToolChain.cpp2
-rw-r--r--lib/Driver/ToolChains.cpp46
-rw-r--r--lib/Driver/WindowsToolChain.cpp6
3 files changed, 13 insertions, 41 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index e5ddfd10d5..5322a6dae2 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -76,6 +76,8 @@ Tool &ToolChain::SelectTool(const JobAction &JA) const {
if (getDriver().ShouldUseClangCompiler(JA))
T = new tools::Clang(*this);
+ else if (Key == Action::AssembleJobClass && useIntegratedAs())
+ T = new tools::ClangAs(*this);
else
T = constructTool(Key);
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 22600eae2d..802d0ce244 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -183,13 +183,8 @@ Tool *Darwin::constructTool(Action::ActionClass AC) const {
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 llvm::Triple& Triple, const ArgList &Arg
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 llvm::Triple& Triple, const ArgList &Args)
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 llvm::Triple& Triple, const ArgList &Arg
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 llvm::Triple& Triple, const ArgList &Args)
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:
diff --git a/lib/Driver/WindowsToolChain.cpp b/lib/Driver/WindowsToolChain.cpp
index 985039ec09..0909c4c217 100644
--- a/lib/Driver/WindowsToolChain.cpp
+++ b/lib/Driver/WindowsToolChain.cpp
@@ -50,11 +50,9 @@ Tool *Windows::constructTool(Action::ActionClass AC) const {
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);