aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-11 01:14:50 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-11 01:14:50 +0000
commitf4aa4f61de7d364364dc94bbf83ff71448a11327 (patch)
treec8402ce06591b994740f1ace18d8215b8e548be9 /lib/Driver/Tools.cpp
parent1da83fafbacd96a85376743a7e40b522dcd478f5 (diff)
Swizzle the target triple based on -mthumb, and update clang-cc to recognize
thumb-foo-bar as an ARM target. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 05a73b9768..9a037c6a92 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -297,11 +297,20 @@ static std::string getLLVMTriple(const ToolChain &TC, const ArgList &Args) {
case llvm::Triple::arm:
case llvm::Triple::thumb: {
+ // FIXME: Factor into subclasses.
llvm::Triple Triple = TC.getTriple();
- // FIXME: Thumb!
+
+ // Thumb2 is the default for V7 on Darwin.
+ //
+ // FIXME: Thumb should just be another -target-feaure, not in the triple.
+ llvm::StringRef Suffix = getLLVMArchSuffixForARM(getARMTargetCPU(Args));
+ bool ThumbDefault =
+ (Suffix == "v7" && TC.getTriple().getOS() == llvm::Triple::Darwin);
std::string ArchName = "arm";
- ArchName += getLLVMArchSuffixForARM (getARMTargetCPU(Args));
- Triple.setArchName(ArchName);
+ if (Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault))
+ ArchName = "thumb";
+ Triple.setArchName(ArchName + Suffix.str());
+
return Triple.getTriple();
}
}