SubtargetFeatures::ApplyFeatureFlag to be static, so that
MCSubtargetInfo doesn't need to instantiate SubtargetFeatures
for nothing. Also change the return type to void, as it
wasn't ever used.
This is a partial commit of http://reviews.llvm.org/D15746
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256823
91177308-0d34-0410-b5e6-
96231b3b80d8
/// Adding Features.
void AddFeature(StringRef String, bool Enable = true);
- /// ToggleFeature - Toggle a feature and returns the newly updated feature
- /// bits.
- FeatureBitset ToggleFeature(FeatureBitset Bits, StringRef String,
- ArrayRef<SubtargetFeatureKV> FeatureTable);
-
- /// Apply the feature flag and return the newly updated feature bits.
- FeatureBitset ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
- ArrayRef<SubtargetFeatureKV> FeatureTable);
+ /// ToggleFeature - Toggle a feature and update the feature bits.
+ static void ToggleFeature(FeatureBitset &Bits, StringRef String,
+ ArrayRef<SubtargetFeatureKV> FeatureTable);
+
+ /// Apply the feature flag and update the feature bits.
+ static void ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature,
+ ArrayRef<SubtargetFeatureKV> FeatureTable);
/// Get feature bits of a CPU.
FeatureBitset getFeatureBits(StringRef CPU,
/// ToggleFeature - Toggle a feature and returns the re-computed feature
/// bits. This version will also change all implied bits.
FeatureBitset MCSubtargetInfo::ToggleFeature(StringRef FS) {
- SubtargetFeatures Features;
- FeatureBits = Features.ToggleFeature(FeatureBits, FS, ProcFeatures);
+ SubtargetFeatures::ToggleFeature(FeatureBits, FS, ProcFeatures);
return FeatureBits;
}
FeatureBitset MCSubtargetInfo::ApplyFeatureFlag(StringRef FS) {
- SubtargetFeatures Features;
- FeatureBits = Features.ApplyFeatureFlag(FeatureBits, FS, ProcFeatures);
+ SubtargetFeatures::ApplyFeatureFlag(FeatureBits, FS, ProcFeatures);
return FeatureBits;
}
}
}
-/// 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.
<< "' 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));
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);
<< "' is not a recognized feature for this target"
<< " (ignoring feature)\n";
}
-
- return Bits;
}
if (Feature == "+help")
Help(CPUTable, FeatureTable);
- Bits = ApplyFeatureFlag(Bits, Feature, FeatureTable);
+ ApplyFeatureFlag(Bits, Feature, FeatureTable);
}
return Bits;