diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-11 01:14:50 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-11 01:14:50 +0000 |
commit | f4aa4f61de7d364364dc94bbf83ff71448a11327 (patch) | |
tree | c8402ce06591b994740f1ace18d8215b8e548be9 /lib | |
parent | 1da83fafbacd96a85376743a7e40b522dcd478f5 (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')
-rw-r--r-- | lib/Basic/Targets.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/TargetABIInfo.cpp | 1 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 15 |
3 files changed, 14 insertions, 3 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 4e63db6eaf..2cb625323d 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1558,6 +1558,7 @@ TargetInfo* TargetInfo::CreateTargetInfo(const std::string &T) { return NULL; case llvm::Triple::arm: + case llvm::Triple::thumb: switch (os) { case llvm::Triple::Darwin: return new DarwinARMTargetInfo(T); diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp index daeec0a31c..67e25978a8 100644 --- a/lib/CodeGen/TargetABIInfo.cpp +++ b/lib/CodeGen/TargetABIInfo.cpp @@ -1551,6 +1551,7 @@ const ABIInfo &CodeGenTypes::getABIInfo() const { return *(TheABIInfo = new X86_64ABIInfo()); case llvm::Triple::arm: + case llvm::Triple::thumb: // FIXME: Support for OABI? return *(TheABIInfo = new ARMABIInfo()); 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(); } } |