[Frontend][OpenMP] Move isPrivatizingClause to OMP.h, NFC (#148644)
This commit is contained in:
parent
d26106dbf0
commit
face93e724
@ -795,25 +795,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
|
|||||||
// assigned to which leaf constructs.
|
// assigned to which leaf constructs.
|
||||||
|
|
||||||
// [5.2:340:33]
|
// [5.2:340:33]
|
||||||
auto canMakePrivateCopy = [](llvm::omp::Clause id) {
|
|
||||||
switch (id) {
|
|
||||||
// Clauses with "privatization" property:
|
|
||||||
case llvm::omp::Clause::OMPC_firstprivate:
|
|
||||||
case llvm::omp::Clause::OMPC_in_reduction:
|
|
||||||
case llvm::omp::Clause::OMPC_lastprivate:
|
|
||||||
case llvm::omp::Clause::OMPC_linear:
|
|
||||||
case llvm::omp::Clause::OMPC_private:
|
|
||||||
case llvm::omp::Clause::OMPC_reduction:
|
|
||||||
case llvm::omp::Clause::OMPC_task_reduction:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool applied = applyIf(node, [&](const auto &leaf) {
|
bool applied = applyIf(node, [&](const auto &leaf) {
|
||||||
return llvm::any_of(leaf.clauses, [&](const ClauseTy *n) {
|
return llvm::any_of(leaf.clauses, [&](const ClauseTy *n) {
|
||||||
return canMakePrivateCopy(n->id);
|
return llvm::omp::isPrivatizingClause(n->id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -48,6 +48,22 @@ static constexpr inline bool canHaveIterator(Clause C) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can clause C create a private copy of a variable.
|
||||||
|
static constexpr inline bool isPrivatizingClause(Clause C) {
|
||||||
|
switch (C) {
|
||||||
|
case OMPC_firstprivate:
|
||||||
|
case OMPC_in_reduction:
|
||||||
|
case OMPC_lastprivate:
|
||||||
|
case OMPC_linear:
|
||||||
|
case OMPC_private:
|
||||||
|
case OMPC_reduction:
|
||||||
|
case OMPC_task_reduction:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr unsigned FallbackVersion = 52;
|
static constexpr unsigned FallbackVersion = 52;
|
||||||
LLVM_ABI ArrayRef<unsigned> getOpenMPVersions();
|
LLVM_ABI ArrayRef<unsigned> getOpenMPVersions();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user