Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang][OpenMP][Lower] Refactor lowering of compound constructs #87070

Merged
merged 10 commits into from
Apr 17, 2024
57 changes: 44 additions & 13 deletions flang/include/flang/Semantics/openmp-directive-sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ static const OmpDirectiveSet topDistributeSet{

static const OmpDirectiveSet allDistributeSet{
OmpDirectiveSet{
llvm::omp::OMPD_target_teams_distribute,
llvm::omp::OMPD_target_teams_distribute_parallel_do,
llvm::omp::OMPD_target_teams_distribute_parallel_do_simd,
llvm::omp::OMPD_target_teams_distribute_simd,
llvm::omp::OMPD_teams_distribute,
llvm::omp::OMPD_teams_distribute_parallel_do,
llvm::omp::OMPD_teams_distribute_parallel_do_simd,
llvm::omp::OMPD_teams_distribute_simd,
Directive::OMPD_target_teams_distribute,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_target_teams_distribute_simd,
Directive::OMPD_teams_distribute,
Directive::OMPD_teams_distribute_parallel_do,
Directive::OMPD_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_simd,
} | topDistributeSet,
};

Expand All @@ -63,10 +63,24 @@ static const OmpDirectiveSet allDoSet{
} | topDoSet,
};

static const OmpDirectiveSet topLoopSet{
Directive::OMPD_loop,
};

static const OmpDirectiveSet allLoopSet{
OmpDirectiveSet{
Directive::OMPD_parallel_loop,
Directive::OMPD_target_parallel_loop,
Directive::OMPD_target_teams_loop,
Directive::OMPD_teams_loop,
} | topLoopSet,
};

static const OmpDirectiveSet topParallelSet{
Directive::OMPD_parallel,
Directive::OMPD_parallel_do,
Directive::OMPD_parallel_do_simd,
Directive::OMPD_parallel_loop,
Directive::OMPD_parallel_masked_taskloop,
Directive::OMPD_parallel_masked_taskloop_simd,
Directive::OMPD_parallel_master_taskloop,
Expand All @@ -82,6 +96,7 @@ static const OmpDirectiveSet allParallelSet{
Directive::OMPD_target_parallel,
Directive::OMPD_target_parallel_do,
Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_parallel_loop,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_parallel_do,
Expand Down Expand Up @@ -118,12 +133,14 @@ static const OmpDirectiveSet topTargetSet{
Directive::OMPD_target_parallel,
Directive::OMPD_target_parallel_do,
Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_parallel_loop,
Directive::OMPD_target_simd,
Directive::OMPD_target_teams,
Directive::OMPD_target_teams_distribute,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_target_teams_distribute_simd,
Directive::OMPD_target_teams_loop,
};

static const OmpDirectiveSet allTargetSet{topTargetSet};
Expand Down Expand Up @@ -156,11 +173,12 @@ static const OmpDirectiveSet topTeamsSet{

static const OmpDirectiveSet allTeamsSet{
OmpDirectiveSet{
llvm::omp::OMPD_target_teams,
llvm::omp::OMPD_target_teams_distribute,
llvm::omp::OMPD_target_teams_distribute_parallel_do,
llvm::omp::OMPD_target_teams_distribute_parallel_do_simd,
llvm::omp::OMPD_target_teams_distribute_simd,
Directive::OMPD_target_teams,
Directive::OMPD_target_teams_distribute,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_target_teams_distribute_simd,
Directive::OMPD_target_teams_loop,
} | topTeamsSet,
};

Expand All @@ -178,6 +196,14 @@ static const OmpDirectiveSet allDistributeSimdSet{
static const OmpDirectiveSet allDoSimdSet{allDoSet & allSimdSet};
static const OmpDirectiveSet allTaskloopSimdSet{allTaskloopSet & allSimdSet};

static const OmpDirectiveSet compositeConstructSet{
Directive::OMPD_distribute_parallel_do,
Directive::OMPD_distribute_parallel_do_simd,
Directive::OMPD_distribute_simd,
Directive::OMPD_do_simd,
Directive::OMPD_taskloop_simd,
};

static const OmpDirectiveSet blockConstructSet{
Directive::OMPD_master,
Directive::OMPD_ordered,
Expand All @@ -201,30 +227,35 @@ static const OmpDirectiveSet loopConstructSet{
Directive::OMPD_distribute_simd,
Directive::OMPD_do,
Directive::OMPD_do_simd,
Directive::OMPD_loop,
Directive::OMPD_masked_taskloop,
Directive::OMPD_masked_taskloop_simd,
Directive::OMPD_master_taskloop,
Directive::OMPD_master_taskloop_simd,
Directive::OMPD_parallel_do,
Directive::OMPD_parallel_do_simd,
Directive::OMPD_parallel_loop,
Directive::OMPD_parallel_masked_taskloop,
Directive::OMPD_parallel_masked_taskloop_simd,
Directive::OMPD_parallel_master_taskloop,
Directive::OMPD_parallel_master_taskloop_simd,
Directive::OMPD_simd,
Directive::OMPD_target_parallel_do,
Directive::OMPD_target_parallel_do_simd,
Directive::OMPD_target_parallel_loop,
Directive::OMPD_target_simd,
Directive::OMPD_target_teams_distribute,
Directive::OMPD_target_teams_distribute_parallel_do,
Directive::OMPD_target_teams_distribute_parallel_do_simd,
Directive::OMPD_target_teams_distribute_simd,
Directive::OMPD_target_teams_loop,
Directive::OMPD_taskloop,
Directive::OMPD_taskloop_simd,
Directive::OMPD_teams_distribute,
Directive::OMPD_teams_distribute_parallel_do,
Directive::OMPD_teams_distribute_parallel_do_simd,
Directive::OMPD_teams_distribute_simd,
Directive::OMPD_teams_loop,
Directive::OMPD_tile,
Directive::OMPD_unroll,
};
Expand Down
Loading
Loading