aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/check-omp-structure.h
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Semantics/check-omp-structure.h')
-rw-r--r--flang/lib/Semantics/check-omp-structure.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h
index 543642ff..7426559 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -19,7 +19,6 @@
#include "flang/Parser/parse-tree.h"
#include "flang/Semantics/openmp-directive-sets.h"
#include "flang/Semantics/semantics.h"
-#include "llvm/Frontend/OpenMP/OMPConstants.h"
using OmpClauseSet =
Fortran::common::EnumSet<llvm::omp::Clause, llvm::omp::Clause_enumSize>;
@@ -57,21 +56,32 @@ using SymbolSourceMap = std::multimap<const Symbol *, parser::CharBlock>;
using DirectivesClauseTriple = std::multimap<llvm::omp::Directive,
std::pair<llvm::omp::Directive, const OmpClauseSet>>;
-class OmpStructureChecker
- : public DirectiveStructureChecker<llvm::omp::Directive, llvm::omp::Clause,
- parser::OmpClause, llvm::omp::Clause_enumSize> {
+using OmpStructureCheckerBase = DirectiveStructureChecker<llvm::omp::Directive,
+ llvm::omp::Clause, parser::OmpClause, llvm::omp::Clause_enumSize>;
+
+class OmpStructureChecker : public OmpStructureCheckerBase {
public:
- using Base = DirectiveStructureChecker<llvm::omp::Directive,
- llvm::omp::Clause, parser::OmpClause, llvm::omp::Clause_enumSize>;
+ using Base = OmpStructureCheckerBase;
+
+ OmpStructureChecker(SemanticsContext &context);
- OmpStructureChecker(SemanticsContext &context)
- : DirectiveStructureChecker(context,
-#define GEN_FLANG_DIRECTIVE_CLAUSE_MAP
-#include "llvm/Frontend/OpenMP/OMP.inc"
- ) {
- }
using llvmOmpClause = const llvm::omp::Clause;
+ bool Enter(const parser::MainProgram &);
+ void Leave(const parser::MainProgram &);
+ bool Enter(const parser::BlockData &);
+ void Leave(const parser::BlockData &);
+ bool Enter(const parser::Module &);
+ void Leave(const parser::Module &);
+ bool Enter(const parser::Submodule &);
+ void Leave(const parser::Submodule &);
+ bool Enter(const parser::SubroutineStmt &);
+ bool Enter(const parser::EndSubroutineStmt &);
+ bool Enter(const parser::FunctionStmt &);
+ bool Enter(const parser::EndFunctionStmt &);
+ bool Enter(const parser::BlockConstruct &);
+ void Leave(const parser::BlockConstruct &);
+
void Enter(const parser::OpenMPConstruct &);
void Leave(const parser::OpenMPConstruct &);
void Enter(const parser::OpenMPInteropConstruct &);
@@ -178,10 +188,12 @@ private:
const parser::CharBlock &, const OmpDirectiveSet &);
bool IsCloselyNestedRegion(const OmpDirectiveSet &set);
bool IsNestedInDirective(llvm::omp::Directive directive);
+ bool InTargetRegion();
void HasInvalidTeamsNesting(
const llvm::omp::Directive &dir, const parser::CharBlock &source);
void HasInvalidDistributeNesting(const parser::OpenMPLoopConstruct &x);
void HasInvalidLoopBinding(const parser::OpenMPLoopConstruct &x);
+ bool HasRequires(llvm::omp::Clause req);
// specific clause related
void CheckAllowedMapTypes(
parser::OmpMapType::Value, llvm::ArrayRef<parser::OmpMapType::Value>);
@@ -251,6 +263,9 @@ private:
bool CheckTargetBlockOnlyTeams(const parser::Block &);
void CheckWorkshareBlockStmts(const parser::Block &, parser::CharBlock);
void CheckWorkdistributeBlockStmts(const parser::Block &, parser::CharBlock);
+ void CheckAllocateDirective(parser::CharBlock source,
+ const parser::OmpObjectList &objects,
+ const parser::OmpClauseList &clauses);
void CheckIteratorRange(const parser::OmpIteratorSpecifier &x);
void CheckIteratorModifier(const parser::OmpIterator &x);
@@ -347,8 +362,6 @@ private:
void CheckAllowedRequiresClause(llvmOmpClause clause);
bool deviceConstructFound_{false};
- void CheckAlignValue(const parser::OmpClause &);
-
void AddEndDirectiveClauses(const parser::OmpClauseList &clauses);
void EnterDirectiveNest(const int index) { directiveNest_[index]++; }
@@ -370,12 +383,15 @@ private:
};
int directiveNest_[LastType + 1] = {0};
+ bool inExecutableAllocate_{false};
parser::CharBlock visitedAtomicSource_;
SymbolSourceMap deferredNonVariables_;
using LoopConstruct = std::variant<const parser::DoConstruct *,
const parser::OpenMPLoopConstruct *>;
std::vector<LoopConstruct> loopStack_;
+ // Scopes for scoping units.
+ std::vector<const Scope *> scopeStack_;
};
/// Find a duplicate entry in the range, and return an iterator to it.