aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2016-06-06 12:02:21 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2016-06-06 12:02:21 +0000
commit0ca86fe84dc916b9af9c70c1d1163298e1928993 (patch)
tree23c6e17dca1e70ccc5a0f32ebf0c27dc61df9061 /clang/lib/Driver/Tools.cpp
parent3528832930542732d9defefb97e242f03fb5bd5c (diff)
downloadllvm-0ca86fe84dc916b9af9c70c1d1163298e1928993.zip
llvm-0ca86fe84dc916b9af9c70c1d1163298e1928993.tar.gz
llvm-0ca86fe84dc916b9af9c70c1d1163298e1928993.tar.bz2
[mips] The default ABI depends on the CPU not the Arch on MTI and IMG vendor triples.
Summary: 32-bit CPU's default to O32. 64-bit CPU's default to N64. The default CPU (mips32r2/mips64r2) still depends on the arch so there's no functional change when the CPU isn't specified but commands like: clang -target mips-mti-linux-gnu -mips64r2 will now default to a 64-bit ABI like our gcc toolchains do* instead of asserting in the backend**. Other vendors (including Triple::UnknownVendor) still derive the default ABI from the arch. * Although not the same one as our gcc toolchains, clang has historically defaulted to N64 where gcc defaults to N32. ** Mixing O32 and a 64-bit CPU causing assertions is a long-standing bug. Reviewers: atanasyan Subscribers: sdardis, cfe-commits Differential Revision: http://reviews.llvm.org/D21016 llvm-svn: 271884
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 8a5083d1..fbf1e3b 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1221,6 +1221,30 @@ void mips::getMipsCPUAndABI(const ArgList &Args, const llvm::Triple &Triple,
}
}
+ if (ABIName.empty() &&
+ (Triple.getVendor() == llvm::Triple::MipsTechnologies ||
+ Triple.getVendor() == llvm::Triple::ImaginationTechnologies)) {
+ ABIName = llvm::StringSwitch<const char *>(CPUName)
+ .Case("mips1", "o32")
+ .Case("mips2", "o32")
+ .Case("mips3", "n64")
+ .Case("mips4", "n64")
+ .Case("mips5", "n64")
+ .Case("mips32", "o32")
+ .Case("mips32r2", "o32")
+ .Case("mips32r3", "o32")
+ .Case("mips32r5", "o32")
+ .Case("mips32r6", "o32")
+ .Case("mips64", "n64")
+ .Case("mips64r2", "n64")
+ .Case("mips64r3", "n64")
+ .Case("mips64r5", "n64")
+ .Case("mips64r6", "n64")
+ .Case("octeon", "n64")
+ .Case("p5600", "o32")
+ .Default("");
+ }
+
if (ABIName.empty()) {
// Deduce ABI name from the target triple.
if (Triple.getArch() == llvm::Triple::mips ||