[llvm] r343185 - [mips] Add support MIPS r6 Debian triples
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 27 01:51:18 PDT 2018
Author: atanasyan
Date: Thu Sep 27 01:51:18 2018
New Revision: 343185
URL: http://llvm.org/viewvc/llvm-project?rev=343185&view=rev
Log:
[mips] Add support MIPS r6 Debian triples
Debian uses different triples for MIPS r6 and paths. Here we use SubArch
to determine whether it is r6, if we found `r6' in CPU section of triple.
These new triples include:
mipsisa32r6-linux-gnu
mipsisa32r6el-linux-gnu
mipsisa64r6-linux-gnuabi64
mipsisa64r6el-linux-gnuabi64
mipsisa64r6-linux-gnuabin32
mipsisa64r6el-linux-gnuabin32
Patch by YunQiang Su.
Differential revision: https://reviews.llvm.org/D50857
Modified:
llvm/trunk/include/llvm/ADT/Triple.h
llvm/trunk/lib/Support/Triple.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
llvm/trunk/unittests/ADT/TripleTest.cpp
Modified: llvm/trunk/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=343185&r1=343184&r2=343185&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Thu Sep 27 01:51:18 2018
@@ -55,10 +55,10 @@ public:
bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
bpfeb, // eBPF or extended BPF or 64-bit BPF (big endian)
hexagon, // Hexagon: hexagon
- mips, // MIPS: mips, mipsallegrex
- mipsel, // MIPSEL: mipsel, mipsallegrexe
- mips64, // MIPS64: mips64, mipsn32
- mips64el, // MIPS64EL: mips64el, mipsn32el
+ mips, // MIPS: mips, mipsallegrex, mipsr6
+ mipsel, // MIPSEL: mipsel, mipsallegrexe, mipsr6el
+ mips64, // MIPS64: mips64, mips64r6, mipsn32, mipsn32r6
+ mips64el, // MIPS64EL: mips64el, mips64r6el, mipsn32el, mipsn32r6el
msp430, // MSP430: msp430
nios2, // NIOSII: nios2
ppc, // PPC: powerpc
@@ -126,7 +126,9 @@ public:
KalimbaSubArch_v3,
KalimbaSubArch_v4,
- KalimbaSubArch_v5
+ KalimbaSubArch_v5,
+
+ MipsSubArch_r6
};
enum VendorType {
UnknownVendor,
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=343185&r1=343184&r2=343185&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Thu Sep 27 01:51:18 2018
@@ -399,10 +399,14 @@ static Triple::ArchType parseArch(String
.Case("thumbeb", Triple::thumbeb)
.Case("avr", Triple::avr)
.Case("msp430", Triple::msp430)
- .Cases("mips", "mipseb", "mipsallegrex", Triple::mips)
- .Cases("mipsel", "mipsallegrexel", Triple::mipsel)
- .Cases("mips64", "mips64eb", "mipsn32", Triple::mips64)
- .Cases("mips64el", "mipsn32el", Triple::mips64el)
+ .Cases("mips", "mipseb", "mipsallegrex", "mipsisa32r6",
+ "mipsr6", Triple::mips)
+ .Cases("mipsel", "mipsallegrexel", "mipsisa32r6el", "mipsr6el",
+ Triple::mipsel)
+ .Cases("mips64", "mips64eb", "mipsn32", "mipsisa64r6",
+ "mips64r6", "mipsn32r6", Triple::mips64)
+ .Cases("mips64el", "mipsn32el", "mipsisa64r6el", "mips64r6el",
+ "mipsn32r6el", Triple::mips64el)
.Case("nios2", Triple::nios2)
.Case("r600", Triple::r600)
.Case("amdgcn", Triple::amdgcn)
@@ -540,6 +544,10 @@ static Triple::ObjectFormatType parseFor
}
static Triple::SubArchType parseSubArch(StringRef SubArchName) {
+ if (SubArchName.startswith("mips") &&
+ (SubArchName.endswith("r6el") || SubArchName.endswith("r6")))
+ return Triple::MipsSubArch_r6;
+
StringRef ARMSubArch = ARM::getCanonicalArchName(SubArchName);
// For now, this is the small part. Early return.
@@ -714,13 +722,14 @@ Triple::Triple(const Twine &Str)
}
}
} else {
- Environment = StringSwitch<Triple::EnvironmentType>(Components[0])
- .StartsWith("mipsn32", Triple::GNUABIN32)
- .StartsWith("mips64", Triple::GNUABI64)
- .StartsWith("mipsisa64", Triple::GNUABI64)
- .StartsWith("mipsisa32", Triple::GNU)
- .Cases("mips", "mipsel", Triple::GNU)
- .Default(UnknownEnvironment);
+ Environment =
+ StringSwitch<Triple::EnvironmentType>(Components[0])
+ .StartsWith("mipsn32", Triple::GNUABIN32)
+ .StartsWith("mips64", Triple::GNUABI64)
+ .StartsWith("mipsisa64", Triple::GNUABI64)
+ .StartsWith("mipsisa32", Triple::GNU)
+ .Cases("mips", "mipsel", "mipsr6", "mipsr6el", Triple::GNU)
+ .Default(UnknownEnvironment);
}
}
if (ObjectFormat == UnknownObjectFormat)
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp?rev=343185&r1=343184&r2=343185&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp Thu Sep 27 01:51:18 2018
@@ -47,10 +47,17 @@ using namespace llvm;
/// FIXME: Merge with the copy in MipsSubtarget.cpp
StringRef MIPS_MC::selectMipsCPU(const Triple &TT, StringRef CPU) {
if (CPU.empty() || CPU == "generic") {
- if (TT.isMIPS32())
- CPU = "mips32";
- else
- CPU = "mips64";
+ if (TT.getSubArch() == llvm::Triple::MipsSubArch_r6) {
+ if (TT.isMIPS32())
+ CPU = "mips32r6";
+ else
+ CPU = "mips64r6";
+ } else {
+ if (TT.isMIPS32())
+ CPU = "mips32";
+ else
+ CPU = "mips64";
+ }
}
return CPU;
}
Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=343185&r1=343184&r2=343185&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
+++ llvm/trunk/unittests/ADT/TripleTest.cpp Thu Sep 27 01:51:18 2018
@@ -366,59 +366,163 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mips64el");
EXPECT_EQ(Triple::mips64el, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mips64-unknown-linux-gnuabi64");
EXPECT_EQ(Triple::mips64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mips64");
EXPECT_EQ(Triple::mips64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
+
+ T = Triple("mipsisa64r6el-unknown-linux-gnuabi64");
+ EXPECT_EQ(Triple::mips64el, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mips64r6el");
+ EXPECT_EQ(Triple::mips64el, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsisa64r6el");
+ EXPECT_EQ(Triple::mips64el, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+
+ T = Triple("mipsisa64r6-unknown-linux-gnuabi64");
+ EXPECT_EQ(Triple::mips64, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mips64r6");
+ EXPECT_EQ(Triple::mips64, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsisa64r6");
+ EXPECT_EQ(Triple::mips64, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNUABI64, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
T = Triple("mips64el-unknown-linux-gnuabin32");
EXPECT_EQ(Triple::mips64el, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mipsn32el");
EXPECT_EQ(Triple::mips64el, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mips64-unknown-linux-gnuabin32");
EXPECT_EQ(Triple::mips64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mipsn32");
EXPECT_EQ(Triple::mips64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
+
+ T = Triple("mipsisa64r6el-unknown-linux-gnuabin32");
+ EXPECT_EQ(Triple::mips64el, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsn32r6el");
+ EXPECT_EQ(Triple::mips64el, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+
+ T = Triple("mipsisa64r6-unknown-linux-gnuabin32");
+ EXPECT_EQ(Triple::mips64, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsn32r6");
+ EXPECT_EQ(Triple::mips64, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNUABIN32, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
T = Triple("mipsel-unknown-linux-gnu");
EXPECT_EQ(Triple::mipsel, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mipsel");
EXPECT_EQ(Triple::mipsel, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mips-unknown-linux-gnu");
EXPECT_EQ(Triple::mips, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
T = Triple("mips");
EXPECT_EQ(Triple::mips, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::NoSubArch, T.getSubArch());
+
+ T = Triple("mipsisa32r6el-unknown-linux-gnu");
+ EXPECT_EQ(Triple::mipsel, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsr6el");
+ EXPECT_EQ(Triple::mipsel, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsisa32r6el");
+ EXPECT_EQ(Triple::mipsel, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+
+ T = Triple("mipsisa32r6-unknown-linux-gnu");
+ EXPECT_EQ(Triple::mips, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsr6");
+ EXPECT_EQ(Triple::mips, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
+ T = Triple("mipsisa32r6");
+ EXPECT_EQ(Triple::mips, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::GNU, T.getEnvironment());
+ EXPECT_EQ(Triple::MipsSubArch_r6, T.getSubArch());
T = Triple("arm-oe-linux-gnueabi");
EXPECT_EQ(Triple::arm, T.getArch());
More information about the llvm-commits
mailing list