mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 15:39:00 +00:00
Use StringReg in TargetParser APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a259671d73
commit
a47cbd993e
@ -111,17 +111,17 @@ unsigned getFPUNeonSupportLevel(unsigned FPUKind);
|
||||
unsigned getFPURestriction(unsigned FPUKind);
|
||||
|
||||
// FIXME: These should be moved to TargetTuple once it exists
|
||||
bool getFPUFeatures(unsigned FPUKind, std::vector<const char *> &Features);
|
||||
bool getHWDivFeatures(unsigned HWDivKind, std::vector<const char *> &Features);
|
||||
bool getFPUFeatures(unsigned FPUKind, std::vector<StringRef> &Features);
|
||||
bool getHWDivFeatures(unsigned HWDivKind, std::vector<StringRef> &Features);
|
||||
bool getExtensionFeatures(unsigned Extensions,
|
||||
std::vector<const char*> &Features);
|
||||
std::vector<StringRef> &Features);
|
||||
|
||||
StringRef getArchName(unsigned ArchKind);
|
||||
unsigned getArchAttr(unsigned ArchKind);
|
||||
StringRef getCPUAttr(unsigned ArchKind);
|
||||
StringRef getSubArch(unsigned ArchKind);
|
||||
StringRef getArchExtName(unsigned ArchExtKind);
|
||||
const char *getArchExtFeature(StringRef ArchExt);
|
||||
StringRef getArchExtFeature(StringRef ArchExt);
|
||||
StringRef getHWDivName(unsigned HWDivKind);
|
||||
|
||||
// Information by Name
|
||||
@ -174,17 +174,17 @@ unsigned getFPUNeonSupportLevel(unsigned FPUKind);
|
||||
unsigned getFPURestriction(unsigned FPUKind);
|
||||
|
||||
// FIXME: These should be moved to TargetTuple once it exists
|
||||
bool getFPUFeatures(unsigned FPUKind, std::vector<const char *> &Features);
|
||||
bool getFPUFeatures(unsigned FPUKind, std::vector<StringRef> &Features);
|
||||
bool getExtensionFeatures(unsigned Extensions,
|
||||
std::vector<const char*> &Features);
|
||||
bool getArchFeatures(unsigned ArchKind, std::vector<const char *> &Features);
|
||||
std::vector<StringRef> &Features);
|
||||
bool getArchFeatures(unsigned ArchKind, std::vector<StringRef> &Features);
|
||||
|
||||
StringRef getArchName(unsigned ArchKind);
|
||||
unsigned getArchAttr(unsigned ArchKind);
|
||||
StringRef getCPUAttr(unsigned ArchKind);
|
||||
StringRef getSubArch(unsigned ArchKind);
|
||||
StringRef getArchExtName(unsigned ArchExtKind);
|
||||
const char *getArchExtFeature(StringRef ArchExt);
|
||||
StringRef getArchExtFeature(StringRef ArchExt);
|
||||
unsigned checkArchVersion(StringRef Arch);
|
||||
|
||||
// Information by Name
|
||||
|
@ -200,7 +200,7 @@ unsigned llvm::ARM::getDefaultExtensions(StringRef CPU, unsigned ArchKind) {
|
||||
}
|
||||
|
||||
bool llvm::ARM::getHWDivFeatures(unsigned HWDivKind,
|
||||
std::vector<const char *> &Features) {
|
||||
std::vector<StringRef> &Features) {
|
||||
|
||||
if (HWDivKind == ARM::AEK_INVALID)
|
||||
return false;
|
||||
@ -219,7 +219,7 @@ bool llvm::ARM::getHWDivFeatures(unsigned HWDivKind,
|
||||
}
|
||||
|
||||
bool llvm::ARM::getExtensionFeatures(unsigned Extensions,
|
||||
std::vector<const char *> &Features) {
|
||||
std::vector<StringRef> &Features) {
|
||||
|
||||
if (Extensions == ARM::AEK_INVALID)
|
||||
return false;
|
||||
@ -238,7 +238,7 @@ bool llvm::ARM::getExtensionFeatures(unsigned Extensions,
|
||||
}
|
||||
|
||||
bool llvm::ARM::getFPUFeatures(unsigned FPUKind,
|
||||
std::vector<const char *> &Features) {
|
||||
std::vector<StringRef> &Features) {
|
||||
|
||||
if (FPUKind >= ARM::FK_LAST || FPUKind == ARM::FK_INVALID)
|
||||
return false;
|
||||
@ -351,20 +351,20 @@ StringRef llvm::ARM::getArchExtName(unsigned ArchExtKind) {
|
||||
return StringRef();
|
||||
}
|
||||
|
||||
const char *llvm::ARM::getArchExtFeature(StringRef ArchExt) {
|
||||
StringRef llvm::ARM::getArchExtFeature(StringRef ArchExt) {
|
||||
if (ArchExt.startswith("no")) {
|
||||
StringRef ArchExtBase(ArchExt.substr(2));
|
||||
for (const auto AE : ARCHExtNames) {
|
||||
if (AE.NegFeature && ArchExtBase == AE.getName())
|
||||
return AE.NegFeature;
|
||||
return StringRef(AE.NegFeature);
|
||||
}
|
||||
}
|
||||
for (const auto AE : ARCHExtNames) {
|
||||
if (AE.Feature && ArchExt == AE.getName())
|
||||
return AE.Feature;
|
||||
return StringRef(AE.Feature);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return StringRef();
|
||||
}
|
||||
|
||||
StringRef llvm::ARM::getHWDivName(unsigned HWDivKind) {
|
||||
@ -429,7 +429,7 @@ unsigned llvm::AArch64::getDefaultExtensions(StringRef CPU, unsigned ArchKind) {
|
||||
}
|
||||
|
||||
bool llvm::AArch64::getExtensionFeatures(unsigned Extensions,
|
||||
std::vector<const char *> &Features) {
|
||||
std::vector<StringRef> &Features) {
|
||||
|
||||
if (Extensions == AArch64::AEK_INVALID)
|
||||
return false;
|
||||
@ -453,12 +453,12 @@ bool llvm::AArch64::getExtensionFeatures(unsigned Extensions,
|
||||
}
|
||||
|
||||
bool llvm::AArch64::getFPUFeatures(unsigned FPUKind,
|
||||
std::vector<const char *> &Features) {
|
||||
std::vector<StringRef> &Features) {
|
||||
return ARM::getFPUFeatures(FPUKind, Features);
|
||||
}
|
||||
|
||||
bool llvm::AArch64::getArchFeatures(unsigned ArchKind,
|
||||
std::vector<const char *> &Features) {
|
||||
std::vector<StringRef> &Features) {
|
||||
if (ArchKind == static_cast<unsigned>(AArch64::ArchKind::AK_ARMV8_1A))
|
||||
Features.push_back("+v8.1a");
|
||||
if (ArchKind == static_cast<unsigned>(AArch64::ArchKind::AK_ARMV8_2A))
|
||||
@ -501,19 +501,19 @@ StringRef llvm::AArch64::getArchExtName(unsigned ArchExtKind) {
|
||||
return StringRef();
|
||||
}
|
||||
|
||||
const char *llvm::AArch64::getArchExtFeature(StringRef ArchExt) {
|
||||
StringRef llvm::AArch64::getArchExtFeature(StringRef ArchExt) {
|
||||
if (ArchExt.startswith("no")) {
|
||||
StringRef ArchExtBase(ArchExt.substr(2));
|
||||
for (const auto &AE : AArch64ARCHExtNames) {
|
||||
if (AE.NegFeature && ArchExtBase == AE.getName())
|
||||
return AE.NegFeature;
|
||||
return StringRef(AE.NegFeature);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &AE : AArch64ARCHExtNames)
|
||||
if (AE.Feature && ArchExt == AE.getName())
|
||||
return AE.Feature;
|
||||
return nullptr;
|
||||
return StringRef(AE.Feature);
|
||||
return StringRef();
|
||||
}
|
||||
|
||||
StringRef llvm::AArch64::getDefaultCPU(StringRef Arch) {
|
||||
|
@ -4217,7 +4217,7 @@ bool AArch64AsmParser::parseDirectiveArch(SMLoc L) {
|
||||
}
|
||||
|
||||
// Get the architecture and extension features.
|
||||
std::vector<const char *> AArch64Features;
|
||||
std::vector<StringRef> AArch64Features;
|
||||
AArch64::getArchFeatures(ID, AArch64Features);
|
||||
AArch64::getExtensionFeatures(AArch64::getDefaultExtensions("generic", ID),
|
||||
AArch64Features);
|
||||
|
@ -9729,7 +9729,7 @@ bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
|
||||
StringRef FPU = getParser().parseStringToEndOfStatement().trim();
|
||||
|
||||
unsigned ID = ARM::parseFPU(FPU);
|
||||
std::vector<const char *> Features;
|
||||
std::vector<StringRef> Features;
|
||||
if (!ARM::getFPUFeatures(ID, Features)) {
|
||||
Error(FPUNameLoc, "Unknown FPU name");
|
||||
return false;
|
||||
|
@ -179,7 +179,7 @@ TEST(TargetParserTest, ARMDefaultExtensions) {
|
||||
}
|
||||
|
||||
TEST(TargetParserTest, ARMExtensionFeatures) {
|
||||
std::vector<const char *> Features;
|
||||
std::vector<StringRef> Features;
|
||||
unsigned Extensions = ARM::AEK_CRC | ARM::AEK_CRYPTO | ARM::AEK_DSP |
|
||||
ARM::AEK_HWDIVARM | ARM::AEK_HWDIV | ARM::AEK_MP |
|
||||
ARM::AEK_SEC | ARM::AEK_VIRT | ARM::AEK_RAS;
|
||||
@ -190,7 +190,7 @@ TEST(TargetParserTest, ARMExtensionFeatures) {
|
||||
}
|
||||
|
||||
TEST(TargetParserTest, ARMFPUFeatures) {
|
||||
std::vector<const char *> Features;
|
||||
std::vector<StringRef> Features;
|
||||
for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);
|
||||
FK <= ARM::FPUKind::FK_LAST;
|
||||
FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))
|
||||
@ -227,8 +227,8 @@ TEST(TargetParserTest, ARMArchExtFeature) {
|
||||
{"xscale", "noxscale", nullptr, nullptr}};
|
||||
|
||||
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
|
||||
EXPECT_STREQ(ArchExt[i][2], ARM::getArchExtFeature(ArchExt[i][0]));
|
||||
EXPECT_STREQ(ArchExt[i][3], ARM::getArchExtFeature(ArchExt[i][1]));
|
||||
EXPECT_EQ(StringRef(ArchExt[i][2]), ARM::getArchExtFeature(ArchExt[i][0]));
|
||||
EXPECT_EQ(StringRef(ArchExt[i][3]), ARM::getArchExtFeature(ArchExt[i][1]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ TEST(TargetParserTest, AArch64DefaultExt) {
|
||||
}
|
||||
|
||||
TEST(TargetParserTest, AArch64ExtensionFeatures) {
|
||||
std::vector<const char *> Features;
|
||||
std::vector<StringRef> Features;
|
||||
unsigned Extensions = AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
|
||||
AArch64::AEK_FP | AArch64::AEK_SIMD |
|
||||
AArch64::AEK_FP16 | AArch64::AEK_PROFILE |
|
||||
@ -443,7 +443,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
|
||||
}
|
||||
|
||||
TEST(TargetParserTest, AArch64ArchFeatures) {
|
||||
std::vector<const char *> Features;
|
||||
std::vector<StringRef> Features;
|
||||
|
||||
for (unsigned AK = 0; AK < static_cast<unsigned>(AArch64::ArchKind::AK_LAST);
|
||||
AK++)
|
||||
@ -507,8 +507,8 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
|
||||
{"ras", "noras", "+ras", "-ras"}};
|
||||
|
||||
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
|
||||
EXPECT_STREQ(ArchExt[i][2], AArch64::getArchExtFeature(ArchExt[i][0]));
|
||||
EXPECT_STREQ(ArchExt[i][3], AArch64::getArchExtFeature(ArchExt[i][1]));
|
||||
EXPECT_EQ(StringRef(ArchExt[i][2]), AArch64::getArchExtFeature(ArchExt[i][0]));
|
||||
EXPECT_EQ(StringRef(ArchExt[i][3]), AArch64::getArchExtFeature(ArchExt[i][1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user