Index: llvm/CODE_OWNERS.TXT =================================================================== --- llvm/CODE_OWNERS.TXT +++ llvm/CODE_OWNERS.TXT @@ -197,6 +197,10 @@ E: mcrosier@codeaurora.org D: Fast-Isel +N: Andrei Safronov +E: andrei.safronov@espressif.com +D: Xtensa backend (lib/Target/Xtensa/*) + N: Duncan Sands E: baldrick@free.fr D: DragonEgg Index: llvm/include/llvm/ADT/Triple.h =================================================================== --- llvm/include/llvm/ADT/Triple.h +++ llvm/include/llvm/ADT/Triple.h @@ -85,6 +85,7 @@ x86, // X86: i[3-9]86 x86_64, // X86-64: amd64, x86_64 xcore, // XCore: xcore + xtensa, // Tensilica Xtensa nvptx, // NVPTX: 32-bit nvptx64, // NVPTX: 64-bit le32, // le32: generic little-endian 32-bit CPU (PNaCl) Index: llvm/lib/Support/Triple.cpp =================================================================== --- llvm/lib/Support/Triple.cpp +++ llvm/lib/Support/Triple.cpp @@ -83,6 +83,7 @@ case x86: return "i386"; case x86_64: return "x86_64"; case xcore: return "xcore"; + case xtensa: return "xtensa"; } llvm_unreachable("Invalid ArchType!"); @@ -172,6 +173,8 @@ case loongarch64: return "loongarch"; case dxil: return "dx"; + + case xtensa: return "xtensa"; } } @@ -371,6 +374,7 @@ .Case("loongarch32", loongarch32) .Case("loongarch64", loongarch64) .Case("dxil", dxil) + .Case("xtensa", xtensa) .Default(UnknownArch); } @@ -509,6 +513,7 @@ .Case("loongarch32", Triple::loongarch32) .Case("loongarch64", Triple::loongarch64) .Case("dxil", Triple::dxil) + .Case("xtensa", Triple::xtensa) .Default(Triple::UnknownArch); // Some architectures require special parsing logic just to compute the @@ -823,6 +828,7 @@ case Triple::thumbeb: case Triple::ve: case Triple::xcore: + case Triple::xtensa: return Triple::ELF; case Triple::ppc64: @@ -1399,6 +1405,7 @@ case llvm::Triple::wasm32: case llvm::Triple::x86: case llvm::Triple::xcore: + case llvm::Triple::xtensa: return 32; case llvm::Triple::aarch64: @@ -1489,6 +1496,7 @@ case Triple::wasm32: case Triple::x86: case Triple::xcore: + case Triple::xtensa: // Already 32-bit. break; @@ -1537,6 +1545,7 @@ case Triple::tce: case Triple::tcele: case Triple::xcore: + case Triple::xtensa: T.setArch(UnknownArch); break; @@ -1635,6 +1644,7 @@ case Triple::xcore: case Triple::ve: case Triple::csky: + case Triple::xtensa: // ARM is intentionally unsupported here, changing the architecture would // drop any arch suffixes. @@ -1744,6 +1754,7 @@ case Triple::x86: case Triple::x86_64: case Triple::xcore: + case Triple::xtensa: return true; default: return false; Index: llvm/unittests/ADT/TripleTest.cpp =================================================================== --- llvm/unittests/ADT/TripleTest.cpp +++ llvm/unittests/ADT/TripleTest.cpp @@ -716,6 +716,18 @@ EXPECT_EQ(Triple::ShaderModel, T.getOS()); EXPECT_EQ(Triple::Amplification, T.getEnvironment()); + T = Triple("xtensa"); + EXPECT_EQ(Triple::xtensa, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::UnknownOS, T.getOS()); + EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + + T = Triple("xtensa-unknown-unknown"); + EXPECT_EQ(Triple::xtensa, 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()); } @@ -1077,6 +1089,11 @@ EXPECT_TRUE(T.isArch32Bit()); EXPECT_FALSE(T.isArch64Bit()); EXPECT_TRUE(T.isDXIL()); + + T.setArch(Triple::xtensa); + EXPECT_FALSE(T.isArch16Bit()); + EXPECT_TRUE(T.isArch32Bit()); + EXPECT_FALSE(T.isArch64Bit()); } TEST(TripleTest, BitWidthArchVariants) { @@ -1271,6 +1288,10 @@ T.setArch(Triple::dxil); EXPECT_EQ(Triple::dxil, T.get32BitArchVariant().getArch()); EXPECT_EQ(Triple::UnknownArch, T.get64BitArchVariant().getArch()); + + T.setArch(Triple::xtensa); + EXPECT_EQ(Triple::xtensa, T.get32BitArchVariant().getArch()); + EXPECT_EQ(Triple::UnknownArch, T.get64BitArchVariant().getArch()); } TEST(TripleTest, EndianArchVariants) {