[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)
Lucas Duarte Prates via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 24 08:33:08 PDT 2024
================
@@ -154,17 +156,39 @@ std::optional<AArch64::CpuInfo> AArch64::parseCpu(StringRef Name) {
return {};
}
-void AArch64::PrintSupportedExtensions(StringMap<StringRef> DescMap) {
+void AArch64::PrintSupportedExtensions() {
outs() << "All available -march extensions for AArch64\n\n"
<< " " << left_justify("Name", 20)
- << (DescMap.empty() ? "\n" : "Description\n");
+ << left_justify("Architecture Feature(s)", 55)
+ << "Description\n";
for (const auto &Ext : Extensions) {
// Extensions without a feature cannot be used with -march.
- if (!Ext.Feature.empty()) {
- std::string Description = DescMap[Ext.Name].str();
+ if (!Ext.UserVisibleName.empty() && !Ext.PosTargetFeature.empty()) {
+ outs() << " "
+ << format(Ext.Description.empty() ? "%-20s%s\n" : "%-20s%-55s%s\n",
+ Ext.UserVisibleName.str().c_str(),
+ Ext.ArchFeatureName.str().c_str(),
+ Ext.Description.str().c_str());
+ }
+ }
+}
+
+void
+AArch64::printEnabledExtensions(std::vector<StringRef> EnabledFeatureNames) {
+ outs() << "Extensions enabled for the given AArch64 target\n\n"
+ << " " << left_justify("Architecture Feature(s)", 55)
+ << "Description\n";
+ auto IsEnabled = [&](const ExtensionInfo &Ext) {
+ StringRef FeatureName = Ext.PosTargetFeature.drop_front(); // drop '+' before comparing
----------------
pratlucas wrote:
No, the only `PosTargetFeature` was chosen as a reference here. `EnabledFeatureNames` captures the list of plain names - i.e. without the `+` or `-` prefixes, so we just need a fixed reference to compare them to.
https://github.com/llvm/llvm-project/pull/95805
More information about the cfe-commits
mailing list