1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

(NFC) Change SubtargetFeatures::ToggleFeature and

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

llvm-svn: 256823
This commit is contained in:
Artyom Skrobov 2016-01-05 10:25:56 +00:00
parent 57f2e5cc31
commit 3698d6d326
3 changed files with 14 additions and 23 deletions

View File

@ -103,14 +103,13 @@ public:
/// Adding Features. /// Adding Features.
void AddFeature(StringRef String, bool Enable = true); void AddFeature(StringRef String, bool Enable = true);
/// ToggleFeature - Toggle a feature and returns the newly updated feature /// ToggleFeature - Toggle a feature and update the feature bits.
/// bits. static void ToggleFeature(FeatureBitset &Bits, StringRef String,
FeatureBitset ToggleFeature(FeatureBitset Bits, StringRef String, ArrayRef<SubtargetFeatureKV> FeatureTable);
ArrayRef<SubtargetFeatureKV> FeatureTable);
/// Apply the feature flag and return the newly updated feature bits. /// Apply the feature flag and update the feature bits.
FeatureBitset ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature, static void ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature,
ArrayRef<SubtargetFeatureKV> FeatureTable); ArrayRef<SubtargetFeatureKV> FeatureTable);
/// Get feature bits of a CPU. /// Get feature bits of a CPU.
FeatureBitset getFeatureBits(StringRef CPU, FeatureBitset getFeatureBits(StringRef CPU,

View File

@ -63,14 +63,12 @@ FeatureBitset MCSubtargetInfo::ToggleFeature(const FeatureBitset &FB) {
/// ToggleFeature - Toggle a feature and returns the re-computed feature /// ToggleFeature - Toggle a feature and returns the re-computed feature
/// bits. This version will also change all implied bits. /// bits. This version will also change all implied bits.
FeatureBitset MCSubtargetInfo::ToggleFeature(StringRef FS) { FeatureBitset MCSubtargetInfo::ToggleFeature(StringRef FS) {
SubtargetFeatures Features; SubtargetFeatures::ToggleFeature(FeatureBits, FS, ProcFeatures);
FeatureBits = Features.ToggleFeature(FeatureBits, FS, ProcFeatures);
return FeatureBits; return FeatureBits;
} }
FeatureBitset MCSubtargetInfo::ApplyFeatureFlag(StringRef FS) { FeatureBitset MCSubtargetInfo::ApplyFeatureFlag(StringRef FS) {
SubtargetFeatures Features; SubtargetFeatures::ApplyFeatureFlag(FeatureBits, FS, ProcFeatures);
FeatureBits = Features.ApplyFeatureFlag(FeatureBits, FS, ProcFeatures);
return FeatureBits; return FeatureBits;
} }

View File

@ -160,10 +160,9 @@ void ClearImpliedBits(FeatureBitset &Bits,
} }
} }
/// ToggleFeature - Toggle a feature and returns the newly updated feature /// ToggleFeature - Toggle a feature and update the feature bits.
/// bits. void
FeatureBitset SubtargetFeatures::ToggleFeature(FeatureBitset &Bits, StringRef Feature,
SubtargetFeatures::ToggleFeature(FeatureBitset Bits, StringRef Feature,
ArrayRef<SubtargetFeatureKV> FeatureTable) { ArrayRef<SubtargetFeatureKV> FeatureTable) {
// Find feature in table. // Find feature in table.
@ -186,12 +185,9 @@ SubtargetFeatures::ToggleFeature(FeatureBitset Bits, StringRef Feature,
<< "' is not a recognized feature for this target" << "' is not a recognized feature for this target"
<< " (ignoring feature)\n"; << " (ignoring feature)\n";
} }
return Bits;
} }
FeatureBitset void SubtargetFeatures::ApplyFeatureFlag(FeatureBitset &Bits, StringRef Feature,
SubtargetFeatures::ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
ArrayRef<SubtargetFeatureKV> FeatureTable) { ArrayRef<SubtargetFeatureKV> FeatureTable) {
assert(hasFlag(Feature)); assert(hasFlag(Feature));
@ -203,7 +199,7 @@ SubtargetFeatures::ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
if (FeatureEntry) { if (FeatureEntry) {
// Enable/disable feature in bits // Enable/disable feature in bits
if (isEnabled(Feature)) { if (isEnabled(Feature)) {
Bits |= FeatureEntry->Value; Bits |= FeatureEntry->Value;
// For each feature that this implies, set it. // For each feature that this implies, set it.
SetImpliedBits(Bits, FeatureEntry, FeatureTable); SetImpliedBits(Bits, FeatureEntry, FeatureTable);
@ -218,8 +214,6 @@ SubtargetFeatures::ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature,
<< "' is not a recognized feature for this target" << "' is not a recognized feature for this target"
<< " (ignoring feature)\n"; << " (ignoring feature)\n";
} }
return Bits;
} }
@ -273,7 +267,7 @@ SubtargetFeatures::getFeatureBits(StringRef CPU,
if (Feature == "+help") if (Feature == "+help")
Help(CPUTable, FeatureTable); Help(CPUTable, FeatureTable);
Bits = ApplyFeatureFlag(Bits, Feature, FeatureTable); ApplyFeatureFlag(Bits, Feature, FeatureTable);
} }
return Bits; return Bits;