================ @@ -116,6 +115,44 @@ void llvm::riscvExtensionsHelp(StringMap<StringRef> DescMap) { "For example, clang -march=rv32i_v1p0\n"; } +void RISCVISAInfo::printEnabledExtensions( + bool IsRV64, std::set<StringRef> &EnabledFeatureNames, + StringMap<StringRef> &DescMap) { + outs() << "Extensions enabled for the given RISC-V target\n\n"; + PrintExtension("Name", "Version", (DescMap.empty() ? "" : "Description")); + + RISCVISAUtils::OrderedExtensionMap FullExtMap; + RISCVISAUtils::OrderedExtensionMap ExtMap; + for (const auto &E : SupportedExtensions) + if (EnabledFeatureNames.count(E.Name) != 0) { + FullExtMap[E.Name] = {E.Version.Major, E.Version.Minor}; + ExtMap[E.Name] = {E.Version.Major, E.Version.Minor}; + } + for (const auto &E : ExtMap) { + std::string Version = + std::to_string(E.second.Major) + "." + std::to_string(E.second.Minor); + PrintExtension(E.first, Version, DescMap[E.first]); + } + + outs() << "\nExperimental extensions\n"; + ExtMap.clear(); + for (const auto &E : SupportedExperimentalExtensions) { + StringRef Name(E.Name); + if (EnabledFeatureNames.count("experimental-" + Name.str()) != 0) { + FullExtMap[E.Name] = {E.Version.Major, E.Version.Minor}; + ExtMap[E.Name] = {E.Version.Major, E.Version.Minor}; + } + } + for (const auto &E : ExtMap) { + std::string Version = + std::to_string(E.second.Major) + "." + std::to_string(E.second.Minor); + PrintExtension(E.first, Version, DescMap["experimental-" + E.first]); + } + + unsigned XLen = IsRV64 ? 64 : 32; + outs() << "\nISA String: " << RISCVISAInfo(XLen, FullExtMap).toString(); ---------------- topperc wrote:
I'm going to remove this RISCVISAInfo constructor in factor of a new static function in RISCVISAInfo. It's only used in lld before this patch and I don't like the division of responsibilities there. https://github.com/llvm/llvm-project/pull/98207 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits