Skip to content

Commit d45ce60

Browse files
rnkarsenms-barannikov
authored
Apply suggestions from code review
Co-authored-by: Matt Arsenault <[email protected]> Co-authored-by: Sergei Barannikov <[email protected]>
1 parent b77e745 commit d45ce60

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/TargetParser/TargetDataLayout.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <cstring>
1414
using namespace llvm;
1515

16-
static const char *getManglingComponent(const Triple &T) {
16+
static StringRef getManglingComponent(const Triple &T) {
1717
if (T.isOSBinFormatGOFF())
1818
return "-m:l";
1919
if (T.isOSBinFormatMachO())
@@ -122,9 +122,9 @@ static std::string computeCSKYDataLayout(const Triple &TT) {
122122
}
123123

124124
static std::string computeLoongArchDataLayout(const Triple &TT) {
125-
if (TT.isArch64Bit())
125+
if (TT.isLoongArch64())
126126
return "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128";
127-
assert(TT.isArch32Bit() && "only LA32 and LA64 are currently supported");
127+
assert(TT.isLoongArch32() && "only LA32 and LA64 are currently supported");
128128
return "e-m:e-p:32:32-i64:64-n32-S128";
129129
}
130130

@@ -215,7 +215,7 @@ static std::string computeMipsDataLayout(const Triple &TT, StringRef ABIName) {
215215
}
216216

217217
static std::string computePowerDataLayout(const Triple &T) {
218-
bool is64Bit = T.getArch() == Triple::ppc64 || T.getArch() == Triple::ppc64le;
218+
bool is64Bit = T.isPPC64();
219219
std::string Ret;
220220

221221
// Most PPC* platforms are big endian, PPC(64)LE is little endian.
@@ -291,11 +291,11 @@ static std::string computeRISCVDataLayout(const Triple &TT, StringRef ABIName) {
291291
Ret += "-m:e";
292292

293293
// Pointer and integer sizes.
294-
if (TT.isArch64Bit()) {
294+
if (TT.isRISCV64()) {
295295
Ret += "-p:64:64-i64:64-i128:128";
296296
Ret += "-n32:64";
297297
} else {
298-
assert(TT.isArch32Bit() && "only RV32 and RV64 are currently supported");
298+
assert(TT.isRISCV32() && "only RV32 and RV64 are currently supported");
299299
Ret += "-p:32:32-i64:64";
300300
Ret += "-n32";
301301
}
@@ -313,7 +313,7 @@ static std::string computeRISCVDataLayout(const Triple &TT, StringRef ABIName) {
313313
}
314314

315315
static std::string computeSparcDataLayout(const Triple &T) {
316-
const bool is64Bit = T.isSPARC64();
316+
const bool Is64Bit = T.isSPARC64();
317317

318318
// Sparc is typically big endian, but some are little.
319319
std::string Ret = T.getArch() == Triple::sparcel ? "e" : "E";
@@ -627,5 +627,5 @@ std::string Triple::computeDataLayout(StringRef ABIName) const {
627627
case Triple::UnknownArch:
628628
return "";
629629
}
630-
return "";
630+
llvm_unreachable("Invalid arch");
631631
}

0 commit comments

Comments
 (0)