[llvm] r253566 - llvm/lib/Support/TargetParser.cpp: Rework llvm::ARM::getArchExtFeature() to avoid abuse of Twine in r253470.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 07:03:11 PST 2015
Author: chapuni
Date: Thu Nov 19 09:03:11 2015
New Revision: 253566
URL: http://llvm.org/viewvc/llvm-project?rev=253566&view=rev
Log:
llvm/lib/Support/TargetParser.cpp: Rework llvm::ARM::getArchExtFeature() to avoid abuse of Twine in r253470.
Modified:
llvm/trunk/lib/Support/TargetParser.cpp
Modified: llvm/trunk/lib/Support/TargetParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=253566&r1=253565&r2=253566&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TargetParser.cpp (original)
+++ llvm/trunk/lib/Support/TargetParser.cpp Thu Nov 19 09:03:11 2015
@@ -87,7 +87,6 @@ static const struct {
const char *NegFeature;
StringRef getName() const { return StringRef(NameCStr, NameLength); }
- StringRef getNegName() const { return (Twine("no") + getName()).str(); }
} ARCHExtNames[] = {
#define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) \
{ NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE },
@@ -332,11 +331,16 @@ StringRef llvm::ARM::getArchExtName(unsi
}
const char *llvm::ARM::getArchExtFeature(StringRef ArchExt) {
+ if (ArchExt.substr(0, 2) == "no") {
+ StringRef ArchExtBase(ArchExt.substr(2));
+ for (const auto AE : ARCHExtNames) {
+ if (AE.NegFeature && ArchExtBase == AE.getName())
+ return AE.NegFeature;
+ }
+ }
for (const auto AE : ARCHExtNames) {
if (AE.Feature && ArchExt == AE.getName())
return AE.Feature;
- else if (AE.NegFeature && ArchExt == AE.getNegName())
- return AE.NegFeature;
}
return nullptr;
More information about the llvm-commits
mailing list