[lanai] Add Lanai triple.

Add triple for the Lanai backend.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend".

Differential Revision: http://reviews.llvm.org/D17003



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260545 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jacques Pienaar 2016-02-11 17:16:20 +00:00
parent 7872a566bc
commit 9a9aa40b09
3 changed files with 32 additions and 0 deletions

View File

@ -86,6 +86,7 @@ public:
spir64, // SPIR: standard portable IR for OpenCL 64-bit version
kalimba, // Kalimba: generic kalimba
shave, // SHAVE: Movidius vector VLIW processors
lanai, // Lanai: Lanai 32-bit
wasm32, // WebAssembly with 32-bit pointers
wasm64, // WebAssembly with 64-bit pointers
LastArchType = wasm64

View File

@ -60,6 +60,7 @@ const char *Triple::getArchTypeName(ArchType Kind) {
case spir: return "spir";
case spir64: return "spir64";
case kalimba: return "kalimba";
case lanai: return "lanai";
case shave: return "shave";
case wasm32: return "wasm32";
case wasm64: return "wasm64";
@ -126,6 +127,7 @@ const char *Triple::getArchTypePrefix(ArchType Kind) {
case spir:
case spir64: return "spir";
case kalimba: return "kalimba";
case lanai: return "lanai";
case shave: return "shave";
case wasm32:
case wasm64: return "wasm";
@ -268,6 +270,7 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
.Case("spir", spir)
.Case("spir64", spir64)
.Case("kalimba", kalimba)
.Case("lanai", lanai)
.Case("shave", shave)
.Case("wasm32", wasm32)
.Case("wasm64", wasm64)
@ -376,6 +379,7 @@ static Triple::ArchType parseArch(StringRef ArchName) {
.Case("spir", Triple::spir)
.Case("spir64", Triple::spir64)
.StartsWith("kalimba", Triple::kalimba)
.Case("lanai", Triple::lanai)
.Case("shave", Triple::shave)
.Case("wasm32", Triple::wasm32)
.Case("wasm64", Triple::wasm64)
@ -563,6 +567,7 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
case Triple::bpfeb:
case Triple::bpfel:
case Triple::hexagon:
case Triple::lanai:
case Triple::hsail:
case Triple::hsail64:
case Triple::kalimba:
@ -1115,6 +1120,7 @@ static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
case llvm::Triple::hsail:
case llvm::Triple::spir:
case llvm::Triple::kalimba:
case llvm::Triple::lanai:
case llvm::Triple::shave:
case llvm::Triple::wasm32:
return 32;
@ -1188,6 +1194,7 @@ Triple Triple::get32BitArchVariant() const {
case Triple::thumbeb:
case Triple::x86:
case Triple::xcore:
case Triple::lanai:
case Triple::shave:
case Triple::wasm32:
// Already 32-bit.
@ -1217,6 +1224,7 @@ Triple Triple::get64BitArchVariant() const {
case Triple::avr:
case Triple::hexagon:
case Triple::kalimba:
case Triple::lanai:
case Triple::msp430:
case Triple::r600:
case Triple::tce:
@ -1303,6 +1311,7 @@ Triple Triple::getBigEndianArchVariant() const {
case Triple::aarch64_be:
case Triple::armeb:
case Triple::bpfeb:
case Triple::lanai:
case Triple::mips64:
case Triple::mips:
case Triple::ppc64:
@ -1329,6 +1338,7 @@ Triple Triple::getLittleEndianArchVariant() const {
Triple T(*this);
switch (getArch()) {
case Triple::UnknownArch:
case Triple::lanai:
case Triple::ppc:
case Triple::sparcv9:
case Triple::systemz:

View File

@ -212,6 +212,18 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("lanai-unknown-unknown");
EXPECT_EQ(Triple::lanai, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("lanai");
EXPECT_EQ(Triple::lanai, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}
@ -486,6 +498,11 @@ TEST(TripleTest, BitWidthPredicates) {
EXPECT_TRUE(T.isArch16Bit());
EXPECT_FALSE(T.isArch32Bit());
EXPECT_FALSE(T.isArch64Bit());
T.setArch(Triple::lanai);
EXPECT_FALSE(T.isArch16Bit());
EXPECT_TRUE(T.isArch32Bit());
EXPECT_FALSE(T.isArch64Bit());
}
TEST(TripleTest, BitWidthArchVariants) {
@ -654,6 +671,10 @@ TEST(TripleTest, EndianArchVariants) {
T.setArch(Triple::thumbeb);
EXPECT_EQ(Triple::thumbeb, T.getBigEndianArchVariant().getArch());
EXPECT_EQ(Triple::UnknownArch, T.getLittleEndianArchVariant().getArch());
T.setArch(Triple::lanai);
EXPECT_EQ(Triple::lanai, T.getBigEndianArchVariant().getArch());
EXPECT_EQ(Triple::UnknownArch, T.getLittleEndianArchVariant().getArch());
}
TEST(TripleTest, getOSVersion) {