[cfe-commits] r81497 - in /cfe/trunk: include/clang/Driver/Options.def lib/Basic/Targets.cpp lib/CodeGen/TargetABIInfo.cpp lib/Driver/Tools.cpp
Daniel Dunbar
daniel at zuster.org
Thu Sep 10 18:14:50 PDT 2009
Author: ddunbar
Date: Thu Sep 10 20:14:50 2009
New Revision: 81497
URL: http://llvm.org/viewvc/llvm-project?rev=81497&view=rev
Log:
Swizzle the target triple based on -mthumb, and update clang-cc to recognize
thumb-foo-bar as an ARM target.
Modified:
cfe/trunk/include/clang/Driver/Options.def
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/include/clang/Driver/Options.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.def?rev=81497&r1=81496&r2=81497&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.def (original)
+++ cfe/trunk/include/clang/Driver/Options.def Thu Sep 10 20:14:50 2009
@@ -536,6 +536,7 @@
OPTION("-mno-sse4", mno_sse4, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
OPTION("-mno-sse", mno_sse, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
OPTION("-mno-ssse3", mno_ssse3, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
+OPTION("-mno-thumb", mno_thumb, Flag, m_Group, INVALID, "", 0, 0, 0)
OPTION("-mno-warn-nonportable-cfstrings", mno_warn_nonportable_cfstrings, Flag, m_Group, INVALID, "", 0, 0, 0)
OPTION("-mpascal-strings", mpascal_strings, Flag, m_Group, INVALID, "", 0, 0, 0)
OPTION("-mred-zone", mred_zone, Flag, m_Group, INVALID, "", 0, 0, 0)
@@ -546,6 +547,7 @@
OPTION("-msse4", msse4, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
OPTION("-msse", msse, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
OPTION("-mssse3", mssse3, Flag, m_x86_Features_Group, INVALID, "", 0, 0, 0)
+OPTION("-mthumb", mthumb, Flag, m_Group, INVALID, "", 0, 0, 0)
OPTION("-mtune=", mtune_EQ, Joined, m_Group, INVALID, "", 0, 0, 0)
OPTION("-multi_module", multi__module, Flag, INVALID, INVALID, "", 0, 0, 0)
OPTION("-multiply_defined_unused", multiply__defined__unused, Separate, INVALID, INVALID, "", 0, 0, 0)
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=81497&r1=81496&r2=81497&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Sep 10 20:14:50 2009
@@ -1558,6 +1558,7 @@
return NULL;
case llvm::Triple::arm:
+ case llvm::Triple::thumb:
switch (os) {
case llvm::Triple::Darwin:
return new DarwinARMTargetInfo(T);
Modified: cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetABIInfo.cpp?rev=81497&r1=81496&r2=81497&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Thu Sep 10 20:14:50 2009
@@ -1551,6 +1551,7 @@
return *(TheABIInfo = new X86_64ABIInfo());
case llvm::Triple::arm:
+ case llvm::Triple::thumb:
// FIXME: Support for OABI?
return *(TheABIInfo = new ARMABIInfo());
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=81497&r1=81496&r2=81497&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 10 20:14:50 2009
@@ -297,11 +297,20 @@
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();
}
}
More information about the cfe-commits
mailing list