[flang-commits] [flang] [llvm] [OpenMP] Introduce descriptors for directives, clause groups and sets (PR #229522)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Thu Oct 8 03:56:29 PDT 2026
================
@@ -95,9 +147,54 @@ Clauses descriptor::ModifierSet::getClauses(Version V) const {
const descriptor::Clause &getDescriptor(Clause C) {
return getClauseMap().at(C);
}
+
+const descriptor::ClauseSet &getDescriptor(ClauseSet S) {
+ return getClauseSetMap().at(S);
+}
+
+const descriptor::Directive &getDescriptor(Directive D) {
+ ArrayRef<llvm::omp::Directive> Leafs = llvm::omp::getLeafConstructsOrSelf(D);
+ if (Leafs.size() == 1)
+ return getDirectiveMap().at(Leafs[0]);
+
+ static DenseMap<Directive, descriptor::Directive> Compound;
+ if (auto F = Compound.find(D); F != Compound.end())
+ return F->second;
+
+ // Combine details from all leafs into a single map and create a descriptor
+ // from it.
+ using Details = descriptor::details::Directive;
+ using DetailsMap = descriptor::DetailsMap<Details>;
+ DetailsMap Det;
+ llvm::omp::Version MaxV(0);
+
+ for (llvm::omp::Directive L : Leafs) {
+ const auto &Desc{getDescriptor(L)};
+ for (auto &[V, T] : Desc.getDetails()) {
+ MaxV = std::max(MaxV, V);
+ auto F = Det.insert({V, Details{}}).first;
----------------
tblah wrote:
Shouldn't this use MaxV?
https://github.com/llvm/llvm-project/pull/229522
More information about the flang-commits
mailing list