[clang] [llvm] [Frontend] Add leaf constructs and association to OpenMP/ACC directives (PR #83625)
Krzysztof Parzyszek via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 14:04:49 PST 2024
================
@@ -665,60 +619,44 @@ bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) {
}
bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) {
- return DKind == OMPD_teams || DKind == OMPD_teams_distribute ||
- DKind == OMPD_teams_distribute_simd ||
- DKind == OMPD_teams_distribute_parallel_for_simd ||
- DKind == OMPD_teams_distribute_parallel_for ||
- DKind == OMPD_teams_loop;
+ if (DKind == OMPD_teams)
+ return true;
+ auto leafs = getLeafConstructs(DKind);
+ return !leafs.empty() && leafs.front() == OMPD_teams;
}
bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) {
- return isOpenMPNestingTeamsDirective(DKind) || DKind == OMPD_target_teams ||
- DKind == OMPD_target_teams_distribute ||
- DKind == OMPD_target_teams_distribute_parallel_for ||
- DKind == OMPD_target_teams_distribute_parallel_for_simd ||
- DKind == OMPD_target_teams_distribute_simd ||
- DKind == OMPD_target_teams_loop;
+ return DKind == OMPD_teams ||
+ llvm::is_contained(getLeafConstructs(DKind), OMPD_teams);
}
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
- return DKind == OMPD_simd || DKind == OMPD_for_simd ||
- DKind == OMPD_parallel_for_simd || DKind == OMPD_taskloop_simd ||
- DKind == OMPD_master_taskloop_simd ||
- DKind == OMPD_masked_taskloop_simd ||
- DKind == OMPD_parallel_master_taskloop_simd ||
- DKind == OMPD_parallel_masked_taskloop_simd ||
- DKind == OMPD_distribute_parallel_for_simd ||
- DKind == OMPD_distribute_simd || DKind == OMPD_target_simd ||
- DKind == OMPD_teams_distribute_simd ||
- DKind == OMPD_teams_distribute_parallel_for_simd ||
- DKind == OMPD_target_teams_distribute_parallel_for_simd ||
- DKind == OMPD_target_teams_distribute_simd ||
- DKind == OMPD_target_parallel_for_simd;
+ // Avoid OMPD_declare_simd
+ if (DKind == OMPD_end_do_simd ||
+ getDirectiveAssociation(DKind) != Association::Loop)
+ return false;
+
+ return DKind == OMPD_simd ||
+ llvm::is_contained(getLeafConstructs(DKind), OMPD_simd);
}
bool clang::isOpenMPNestingDistributeDirective(OpenMPDirectiveKind Kind) {
- return Kind == OMPD_distribute || Kind == OMPD_distribute_parallel_for ||
- Kind == OMPD_distribute_parallel_for_simd ||
- Kind == OMPD_distribute_simd;
- // TODO add next directives.
+ if (Kind == OMPD_distribute)
+ return true;
+ auto leafs = getLeafConstructs(Kind);
----------------
kparzysz wrote:
Done
https://github.com/llvm/llvm-project/pull/83625
More information about the cfe-commits
mailing list