Index: llvm/lib/MC/MCSubtargetInfo.cpp =================================================================== --- llvm/lib/MC/MCSubtargetInfo.cpp +++ llvm/lib/MC/MCSubtargetInfo.cpp @@ -147,6 +147,20 @@ PrintOnce = true; } +/// Display help for feature and mcpu choices. +static void PrintFullFeatureList(const FeatureBitset &FeatBits, + ArrayRef FeatTable, + bool EnabledOnly) { + errs() << "Current full feature list:\n"; + for (const SubtargetFeatureKV &Feat : FeatTable) { + bool IsSet = FeatBits.test(Feat.Value); + if (EnabledOnly && !IsSet) + continue; + errs() << "\t" << (IsSet ? '+' : '-') << Feat.Key << ":\t" << Feat.Desc + << '\n'; + } +} + static FeatureBitset getFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS, ArrayRef ProcDesc, ArrayRef ProcFeatures) { @@ -198,6 +212,10 @@ Help(ProcDesc, ProcFeatures); else if (Feature == "+cpuhelp") cpuHelp(ProcDesc); + else if (Feature == "+dump-all") + PrintFullFeatureList(Bits, ProcFeatures, /*EnabledOnly=*/false); + else if (Feature == "+dump-enabled") + PrintFullFeatureList(Bits, ProcFeatures, /*EnabledOnly=*/true); else ApplyFeatureFlag(Bits, Feature, ProcFeatures); }