================ @@ -150,3 +153,137 @@ void AArch64::PrintSupportedExtensions(StringMap<StringRef> DescMap) { } } } + +const llvm::AArch64::ExtensionInfo & +lookupExtensionByID(llvm::AArch64::ArchExtKind ExtID) { + for (const auto &E : llvm::AArch64::Extensions) + if (E.ID == ExtID) + return E; + assert(false && "Invalid extension ID"); +} + +void AArch64::ExtensionSet::enable(ArchExtKind E) { + if (Enabled.test(E)) + return; + + LLVM_DEBUG(llvm::dbgs() << "Enable " << lookupExtensionByID(E).Name << "\n"); + + Touched.set(E); + Enabled.set(E); + + // Recursively enable all features that this one depends on. This handles all + // of the simple cases, where the behaviour doesn't depend on the base + // architecture version. + for (auto Dep : ExtensionDependencies) + if (E == Dep.Later) + enable(Dep.Earlier); ---------------- tmatheson-arm wrote:
One concern I have is that `ExtensionDependencies` expresses the dependencies as a directed graph, but in reality we probably just want a tree, as this code assumes. https://github.com/llvm/llvm-project/pull/78270 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits