@@ -536,14 +536,6 @@ static constexpr FeatureInfo FeatureInfos[X86::CPU_FEATURE_MAX] = {
536
536
#include " llvm/Support/X86TargetParser.def"
537
537
};
538
538
539
- // Convert the set bits in FeatureBitset to a list of strings.
540
- static void getFeatureBitsAsStrings (const FeatureBitset &Bits,
541
- SmallVectorImpl<StringRef> &Features) {
542
- for (unsigned i = 0 ; i != CPU_FEATURE_MAX; ++i)
543
- if (Bits[i] && !FeatureInfos[i].Name .empty ())
544
- Features.push_back (FeatureInfos[i].Name );
545
- }
546
-
547
539
void llvm::X86::getFeaturesForCPU (StringRef CPU,
548
540
SmallVectorImpl<StringRef> &EnabledFeatures) {
549
541
auto I = llvm::find_if (Processors,
@@ -557,7 +549,9 @@ void llvm::X86::getFeaturesForCPU(StringRef CPU,
557
549
Bits &= ~Feature64BIT;
558
550
559
551
// Add the string version of all set bits.
560
- getFeatureBitsAsStrings (Bits, EnabledFeatures);
552
+ for (unsigned i = 0 ; i != CPU_FEATURE_MAX; ++i)
553
+ if (Bits[i] && !FeatureInfos[i].Name .empty ())
554
+ EnabledFeatures.push_back (FeatureInfos[i].Name );
561
555
}
562
556
563
557
// For each feature that is (transitively) implied by this feature, set it.
@@ -591,9 +585,9 @@ static void getImpliedDisabledFeatures(FeatureBitset &Bits, unsigned Value) {
591
585
} while (Prev != Bits);
592
586
}
593
587
594
- void llvm::X86::getImpliedFeatures (
588
+ void llvm::X86::updateImpliedFeatures (
595
589
StringRef Feature, bool Enabled,
596
- SmallVectorImpl<StringRef > &ImpliedFeatures ) {
590
+ StringMap< bool > &Features ) {
597
591
auto I = llvm::find_if (
598
592
FeatureInfos, [&](const FeatureInfo &FI) { return FI.Name == Feature; });
599
593
if (I == std::end (FeatureInfos)) {
@@ -609,6 +603,8 @@ void llvm::X86::getImpliedFeatures(
609
603
getImpliedDisabledFeatures (ImpliedBits,
610
604
std::distance (std::begin (FeatureInfos), I));
611
605
612
- // Convert all the found bits into strings.
613
- getFeatureBitsAsStrings (ImpliedBits, ImpliedFeatures);
606
+ // Update the map entry for all implied features.
607
+ for (unsigned i = 0 ; i != CPU_FEATURE_MAX; ++i)
608
+ if (ImpliedBits[i] && !FeatureInfos[i].Name .empty ())
609
+ Features[FeatureInfos[i].Name ] = Enabled;
614
610
}
0 commit comments