Skip to content

Commit 0fa3061

Browse files
authored
Revert "[ELF][LLDB] Add an nvsass triple (#159459)" (#159879)
Summary: This patch has broken the `libc` build bot. I could work around that but the changes seem unnecessary. This reverts commit 9ba844e.
1 parent 5b017e3 commit 0fa3061

File tree

9 files changed

+10
-37
lines changed

9 files changed

+10
-37
lines changed

lldb/include/lldb/Utility/ArchSpec.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ class ArchSpec {
236236

237237
eCore_wasm32,
238238

239-
eCore_nvsass,
240-
241239
kNumCores,
242240

243241
kCore_invalid,
@@ -284,10 +282,8 @@ class ArchSpec {
284282
kCore_mips64el_last = eCore_mips64r6el,
285283

286284
kCore_mips_first = eCore_mips32,
287-
kCore_mips_last = eCore_mips64r6el,
285+
kCore_mips_last = eCore_mips64r6el
288286

289-
kCore_nvsass_first = eCore_nvsass,
290-
kCore_nvsass_last = eCore_nvsass,
291287
};
292288

293289
/// Default constructor.

lldb/source/Utility/ArchSpec.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,6 @@ static constexpr const CoreDefinition g_core_definitions[] = {
248248

249249
{eByteOrderLittle, 4, 1, 4, llvm::Triple::wasm32, ArchSpec::eCore_wasm32,
250250
"wasm32"},
251-
252-
{eByteOrderLittle, 8, 4, 4, llvm::Triple::nvsass, ArchSpec::eCore_nvsass,
253-
"nvsass"},
254251
};
255252

256253
// Ensure that we have an entry in the g_core_definitions for each core. If you
@@ -415,7 +412,6 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
415412
{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV, ArchSpec::eRISCVSubType_riscv64}, // riscv64
416413
{ArchSpec::eCore_loongarch32, llvm::ELF::EM_LOONGARCH, ArchSpec::eLoongArchSubType_loongarch32}, // loongarch32
417414
{ArchSpec::eCore_loongarch64, llvm::ELF::EM_LOONGARCH, ArchSpec::eLoongArchSubType_loongarch64}, // loongarch64
418-
{ArchSpec::eCore_nvsass, llvm::ELF::EM_CUDA, }, // nvsass
419415
};
420416
// clang-format on
421417

llvm/include/llvm/Object/ELFObjectFile.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class LLVM_ABI ELFObjectFileBase : public ObjectFile {
6969
SubtargetFeatures getLoongArchFeatures() const;
7070

7171
StringRef getAMDGPUCPUName() const;
72-
StringRef getCUDACPUName() const;
72+
StringRef getNVPTXCPUName() const;
7373

7474
protected:
7575
ELFObjectFileBase(unsigned int Type, MemoryBufferRef Source);
@@ -1431,7 +1431,9 @@ template <class ELFT> Triple::ArchType ELFObjectFile<ELFT>::getArch() const {
14311431
}
14321432

14331433
case ELF::EM_CUDA: {
1434-
return Triple::nvsass;
1434+
if (EF.getHeader().e_ident[ELF::EI_CLASS] == ELF::ELFCLASS32)
1435+
return Triple::nvptx;
1436+
return Triple::nvptx64;
14351437
}
14361438

14371439
case ELF::EM_BPF:

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ class Triple {
110110
renderscript32, // 32-bit RenderScript
111111
renderscript64, // 64-bit RenderScript
112112
ve, // NEC SX-Aurora Vector Engine
113-
nvsass, // NVIDIA SASS
114113
LastArchType = ve
115114
};
116115
enum SubArchType {
@@ -906,8 +905,6 @@ class Triple {
906905

907906
bool isAMDGPU() const { return getArch() == Triple::r600 || isAMDGCN(); }
908907

909-
bool isNVSASS() const { return getArch() == Triple::nvsass; }
910-
911908
/// Tests whether the target is Thumb (little and big endian).
912909
bool isThumb() const {
913910
return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
@@ -1276,9 +1273,7 @@ class Triple {
12761273
LLVM_ABI bool isCompatibleWith(const Triple &Other) const;
12771274

12781275
/// Test whether the target triple is for a GPU.
1279-
bool isGPU() const {
1280-
return isSPIRV() || isNVPTX() || isAMDGPU() || isNVSASS();
1281-
}
1276+
bool isGPU() const { return isSPIRV() || isNVPTX() || isAMDGPU(); }
12821277

12831278
/// Merge target triples.
12841279
LLVM_ABI std::string merge(const Triple &Other) const;

llvm/lib/Object/ELFObjectFile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ std::optional<StringRef> ELFObjectFileBase::tryGetCPUName() const {
438438
case ELF::EM_AMDGPU:
439439
return getAMDGPUCPUName();
440440
case ELF::EM_CUDA:
441-
return getCUDACPUName();
441+
return getNVPTXCPUName();
442442
case ELF::EM_PPC:
443443
case ELF::EM_PPC64:
444444
return StringRef("future");
@@ -620,7 +620,7 @@ StringRef ELFObjectFileBase::getAMDGPUCPUName() const {
620620
}
621621
}
622622

623-
StringRef ELFObjectFileBase::getCUDACPUName() const {
623+
StringRef ELFObjectFileBase::getNVPTXCPUName() const {
624624
assert(getEMachine() == ELF::EM_CUDA);
625625
unsigned SM = getEIdentABIVersion() == ELF::ELFABIVERSION_CUDA_V1
626626
? getPlatformFlags() & ELF::EF_CUDA_SM

llvm/lib/Object/ObjectFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Triple ObjectFile::makeTriple() const {
139139
TheTriple.setObjectFormat(Triple::GOFF);
140140
} else if (TheTriple.isAMDGPU()) {
141141
TheTriple.setVendor(Triple::AMD);
142-
} else if (TheTriple.isNVPTX() || TheTriple.isNVSASS()) {
142+
} else if (TheTriple.isNVPTX()) {
143143
TheTriple.setVendor(Triple::NVIDIA);
144144
}
145145

llvm/lib/TargetParser/TargetDataLayout.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,6 @@ std::string Triple::computeDataLayout(StringRef ABIName) const {
618618
case Triple::shave:
619619
case Triple::renderscript32:
620620
case Triple::renderscript64:
621-
case Triple::nvsass:
622621
// These are all virtual ISAs with no LLVM backend, and therefore no fixed
623622
// LLVM data layout.
624623
return "";

llvm/lib/TargetParser/Triple.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ StringRef Triple::getArchTypeName(ArchType Kind) {
5454
case msp430: return "msp430";
5555
case nvptx64: return "nvptx64";
5656
case nvptx: return "nvptx";
57-
case nvsass:
58-
return "nvsass";
5957
case ppc64: return "powerpc64";
6058
case ppc64le: return "powerpc64le";
6159
case ppc: return "powerpc";
@@ -244,9 +242,6 @@ StringRef Triple::getArchTypePrefix(ArchType Kind) {
244242
case wasm32:
245243
case wasm64: return "wasm";
246244

247-
case nvsass:
248-
return "nvsass";
249-
250245
case riscv32:
251246
case riscv64:
252247
case riscv32be:
@@ -491,7 +486,6 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
491486
.Case("xcore", xcore)
492487
.Case("nvptx", nvptx)
493488
.Case("nvptx64", nvptx64)
494-
.Case("nvsass", nvsass)
495489
.Case("amdil", amdil)
496490
.Case("amdil64", amdil64)
497491
.Case("hsail", hsail)
@@ -633,7 +627,6 @@ static Triple::ArchType parseArch(StringRef ArchName) {
633627
.Case("xcore", Triple::xcore)
634628
.Case("nvptx", Triple::nvptx)
635629
.Case("nvptx64", Triple::nvptx64)
636-
.Case("nvsass", Triple::nvsass)
637630
.Case("amdil", Triple::amdil)
638631
.Case("amdil64", Triple::amdil64)
639632
.Case("hsail", Triple::hsail)
@@ -992,7 +985,6 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
992985
case Triple::msp430:
993986
case Triple::nvptx64:
994987
case Triple::nvptx:
995-
case Triple::nvsass:
996988
case Triple::ppc64le:
997989
case Triple::ppcle:
998990
case Triple::r600:
@@ -1753,9 +1745,6 @@ unsigned Triple::getArchPointerBitWidth(llvm::Triple::ArchType Arch) {
17531745
case llvm::Triple::mips64:
17541746
case llvm::Triple::mips64el:
17551747
case llvm::Triple::nvptx64:
1756-
// nvsass can represent both 32- and 64-bit pointers, but assume
1757-
// 64-bit for the triple
1758-
case llvm::Triple::nvsass:
17591748
case llvm::Triple::ppc64:
17601749
case llvm::Triple::ppc64le:
17611750
case llvm::Triple::renderscript64:
@@ -1834,7 +1823,6 @@ Triple Triple::get32BitArchVariant() const {
18341823
case Triple::mips:
18351824
case Triple::mipsel:
18361825
case Triple::nvptx:
1837-
case Triple::nvsass:
18381826
case Triple::ppc:
18391827
case Triple::ppcle:
18401828
case Triple::r600:
@@ -1922,7 +1910,6 @@ Triple Triple::get64BitArchVariant() const {
19221910
case Triple::mips64:
19231911
case Triple::mips64el:
19241912
case Triple::nvptx64:
1925-
case Triple::nvsass:
19261913
case Triple::ppc64:
19271914
case Triple::ppc64le:
19281915
case Triple::renderscript64:
@@ -1993,7 +1980,6 @@ Triple Triple::getBigEndianArchVariant() const {
19931980
case Triple::msp430:
19941981
case Triple::nvptx64:
19951982
case Triple::nvptx:
1996-
case Triple::nvsass:
19971983
case Triple::r600:
19981984
case Triple::renderscript32:
19991985
case Triple::renderscript64:
@@ -2109,7 +2095,6 @@ bool Triple::isLittleEndian() const {
21092095
case Triple::msp430:
21102096
case Triple::nvptx64:
21112097
case Triple::nvptx:
2112-
case Triple::nvsass:
21132098
case Triple::ppcle:
21142099
case Triple::ppc64le:
21152100
case Triple::r600:

llvm/unittests/Object/ELFObjectFileTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ TEST(ELFObjectFileTest, CheckOSAndTriple) {
295295
{ELF::EM_X86_64, ELF::ELFOSABI_AIX, "x86_64--aix"},
296296
{ELF::EM_X86_64, ELF::ELFOSABI_FREEBSD, "x86_64--freebsd"},
297297
{ELF::EM_X86_64, ELF::ELFOSABI_OPENBSD, "x86_64--openbsd"},
298-
{ELF::EM_CUDA, ELF::ELFOSABI_CUDA, "nvsass-nvidia-cuda"}};
298+
{ELF::EM_CUDA, ELF::ELFOSABI_CUDA, "nvptx64-nvidia-cuda"}};
299299
for (auto [Machine, OS, Triple] : Formats) {
300300
const DataForTest D(ELF::ELFCLASS64, ELF::ELFDATA2LSB, Machine, OS,
301301
ELF::EF_AMDGPU_MACH_AMDGCN_LAST);

0 commit comments

Comments
 (0)