@@ -536,14 +536,6 @@ static constexpr FeatureInfo FeatureInfos[X86::CPU_FEATURE_MAX] = {
536536#include " llvm/Support/X86TargetParser.def"
537537};
538538
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-
547539void llvm::X86::getFeaturesForCPU (StringRef CPU,
548540 SmallVectorImpl<StringRef> &EnabledFeatures) {
549541 auto I = llvm::find_if (Processors,
@@ -557,7 +549,9 @@ void llvm::X86::getFeaturesForCPU(StringRef CPU,
557549 Bits &= ~Feature64BIT;
558550
559551 // 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 );
561555}
562556
563557// For each feature that is (transitively) implied by this feature, set it.
@@ -591,9 +585,9 @@ static void getImpliedDisabledFeatures(FeatureBitset &Bits, unsigned Value) {
591585 } while (Prev != Bits);
592586}
593587
594- void llvm::X86::getImpliedFeatures (
588+ void llvm::X86::updateImpliedFeatures (
595589 StringRef Feature, bool Enabled,
596- SmallVectorImpl<StringRef > &ImpliedFeatures ) {
590+ StringMap< bool > &Features ) {
597591 auto I = llvm::find_if (
598592 FeatureInfos, [&](const FeatureInfo &FI) { return FI.Name == Feature; });
599593 if (I == std::end (FeatureInfos)) {
@@ -609,6 +603,8 @@ void llvm::X86::getImpliedFeatures(
609603 getImpliedDisabledFeatures (ImpliedBits,
610604 std::distance (std::begin (FeatureInfos), I));
611605
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;
614610}
0 commit comments