[llvm] r250492 - Initial migration of AVR backend
Dylan McKay via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 15 20:10:31 PDT 2015
Author: dylanmckay
Date: Thu Oct 15 22:10:30 2015
New Revision: 250492
URL: http://llvm.org/viewvc/llvm-project?rev=250492&view=rev
Log:
Initial migration of AVR backend
This patch adds the underlying infrastructure for an AVR backend to be included into LLVM. It is the first of a series of patches aimed at moving the out-of-tree AVR backend into the tree.
It consists of adding a new`Triple` target 'avr'.
Modified:
llvm/trunk/include/llvm/ADT/Triple.h
llvm/trunk/lib/Support/Triple.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=250492&r1=250491&r2=250492&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Thu Oct 15 22:10:30 2015
@@ -50,6 +50,7 @@ public:
armeb, // ARM (big endian): armeb
aarch64, // AArch64 (little endian): aarch64
aarch64_be, // AArch64 (big endian): aarch64_be
+ avr, // AVR: Atmel AVR microcontroller
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
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=250492&r1=250491&r2=250492&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Thu Oct 15 22:10:30 2015
@@ -25,6 +25,7 @@ const char *Triple::getArchTypeName(Arch
case aarch64_be: return "aarch64_be";
case arm: return "arm";
case armeb: return "armeb";
+ case avr: return "avr";
case bpfel: return "bpfel";
case bpfeb: return "bpfeb";
case hexagon: return "hexagon";
@@ -80,6 +81,8 @@ const char *Triple::getArchTypePrefix(Ar
case thumb:
case thumbeb: return "arm";
+ case avr: return "avr";
+
case ppc64:
case ppc64le:
case ppc: return "ppc";
@@ -227,6 +230,7 @@ Triple::ArchType Triple::getArchTypeForL
.Case("arm64", aarch64) // "arm64" is an alias for "aarch64"
.Case("arm", arm)
.Case("armeb", armeb)
+ .Case("avr", avr)
.StartsWith("bpf", BPFArch)
.Case("mips", mips)
.Case("mipsel", mipsel)
@@ -343,6 +347,7 @@ static Triple::ArchType parseArch(String
.Case("armeb", Triple::armeb)
.Case("thumb", Triple::thumb)
.Case("thumbeb", Triple::thumbeb)
+ .Case("avr", Triple::avr)
.Case("msp430", Triple::msp430)
.Cases("mips", "mipseb", "mipsallegrex", Triple::mips)
.Cases("mipsel", "mipsallegrexel", Triple::mipsel)
@@ -1029,6 +1034,7 @@ static unsigned getArchPointerBitWidth(l
case llvm::Triple::UnknownArch:
return 0;
+ case llvm::Triple::avr:
case llvm::Triple::msp430:
return 16;
@@ -1098,6 +1104,7 @@ Triple Triple::get32BitArchVariant() con
case Triple::aarch64:
case Triple::aarch64_be:
case Triple::amdgcn:
+ case Triple::avr:
case Triple::bpfel:
case Triple::bpfeb:
case Triple::msp430:
@@ -1152,6 +1159,7 @@ Triple Triple::get64BitArchVariant() con
case Triple::UnknownArch:
case Triple::arm:
case Triple::armeb:
+ case Triple::avr:
case Triple::hexagon:
case Triple::kalimba:
case Triple::msp430:
@@ -1208,6 +1216,7 @@ Triple Triple::getBigEndianArchVariant()
case Triple::amdgcn:
case Triple::amdil64:
case Triple::amdil:
+ case Triple::avr:
case Triple::hexagon:
case Triple::hsail64:
case Triple::hsail:
@@ -1280,6 +1289,7 @@ Triple Triple::getLittleEndianArchVarian
case Triple::amdil64:
case Triple::amdil:
case Triple::arm:
+ case Triple::avr:
case Triple::bpfel:
case Triple::hexagon:
case Triple::hsail64:
Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=250492&r1=250491&r2=250492&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
+++ llvm/trunk/unittests/ADT/TripleTest.cpp Thu Oct 15 22:10:30 2015
@@ -194,6 +194,18 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::UnknownOS, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+ T = Triple("avr-unknown-unknown");
+ EXPECT_EQ(Triple::avr, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::UnknownOS, T.getOS());
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
+ T = Triple("avr");
+ EXPECT_EQ(Triple::avr, 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());
}
@@ -463,6 +475,11 @@ TEST(TripleTest, BitWidthPredicates) {
EXPECT_FALSE(T.isArch16Bit());
EXPECT_FALSE(T.isArch32Bit());
EXPECT_TRUE(T.isArch64Bit());
+
+ T.setArch(Triple::avr);
+ EXPECT_TRUE(T.isArch16Bit());
+ EXPECT_FALSE(T.isArch32Bit());
+ EXPECT_FALSE(T.isArch64Bit());
}
TEST(TripleTest, BitWidthArchVariants) {
More information about the llvm-commits
mailing list