summaryrefslogtreecommitdiffstats
path: root/lib/MC/SubtargetFeature.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-06 20:01:02 +0000
committerdim <dim@FreeBSD.org>2016-01-06 20:01:02 +0000
commitff2ba393a56d9d99dcb76ceada542233db28af9a (patch)
treeea70b740d40cffe568a990c7aecd1acb5f83f786 /lib/MC/SubtargetFeature.cpp
parent7c35321d839f2c4d0fc8510bfbd8954b07908b76 (diff)
downloadFreeBSD-src-ff2ba393a56d9d99dcb76ceada542233db28af9a.zip
FreeBSD-src-ff2ba393a56d9d99dcb76ceada542233db28af9a.tar.gz
Vendor import of llvm trunk r256945:
https://llvm.org/svn/llvm-project/llvm/trunk@256945
Diffstat (limited to 'lib/MC/SubtargetFeature.cpp')
-rw-r--r--lib/MC/SubtargetFeature.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/MC/SubtargetFeature.cpp b/lib/MC/SubtargetFeature.cpp
index b642f17..7cce0fe 100644
--- a/lib/MC/SubtargetFeature.cpp
+++ b/lib/MC/SubtargetFeature.cpp
@@ -160,10 +160,9 @@ void ClearImpliedBits(FeatureBitset &Bits,
}
}
-/// ToggleFeature - Toggle a feature and returns the newly updated feature
-/// bits.
-FeatureBitset
-SubtargetFeatures::ToggleFeature(FeatureBitset Bits, StringRef Feature,
+/// ToggleFeature - Toggle a feature and update the feature bits.
+void
+SubtargetFeatures::ToggleFeature(FeatureBitset &Bits, StringRef Feature,
ArrayRef<SubtargetFeatureKV> FeatureTable) {
// Find feature in table.
@@ -186,12 +185,9 @@ SubtargetFeatures::ToggleFeature(FeatureBitset Bits, StringRef Feature,
<< "' is not a recognized feature for this target"
<< " (ignoring feature)\n";
}
-
- return Bits;
}
-FeatureBitset
-SubtargetFeatures::ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
+void SubtargetFeatures::ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature,
ArrayRef<SubtargetFeatureKV> FeatureTable) {
assert(hasFlag(Feature));
@@ -203,7 +199,7 @@ SubtargetFeatures::ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
if (FeatureEntry) {
// Enable/disable feature in bits
if (isEnabled(Feature)) {
- Bits |= FeatureEntry->Value;
+ Bits |= FeatureEntry->Value;
// For each feature that this implies, set it.
SetImpliedBits(Bits, FeatureEntry, FeatureTable);
@@ -218,8 +214,6 @@ SubtargetFeatures::ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
<< "' is not a recognized feature for this target"
<< " (ignoring feature)\n";
}
-
- return Bits;
}
@@ -234,14 +228,10 @@ SubtargetFeatures::getFeatureBits(StringRef CPU,
return FeatureBitset();
#ifndef NDEBUG
- for (size_t i = 1, e = CPUTable.size(); i != e; ++i) {
- assert(strcmp(CPUTable[i - 1].Key, CPUTable[i].Key) < 0 &&
- "CPU table is not sorted");
- }
- for (size_t i = 1, e = FeatureTable.size(); i != e; ++i) {
- assert(strcmp(FeatureTable[i - 1].Key, FeatureTable[i].Key) < 0 &&
- "CPU features table is not sorted");
- }
+ assert(std::is_sorted(std::begin(CPUTable), std::end(CPUTable)) &&
+ "CPU table is not sorted");
+ assert(std::is_sorted(std::begin(FeatureTable), std::end(FeatureTable)) &&
+ "CPU features table is not sorted");
#endif
// Resulting bits
FeatureBitset Bits;
@@ -277,7 +267,7 @@ SubtargetFeatures::getFeatureBits(StringRef CPU,
if (Feature == "+help")
Help(CPUTable, FeatureTable);
- Bits = ApplyFeatureFlag(Bits, Feature, FeatureTable);
+ ApplyFeatureFlag(Bits, Feature, FeatureTable);
}
return Bits;
OpenPOWER on IntegriCloud