[flang][OpenMP] Make all block constructs share the same structure (#150956)

The structure is
- OmpBeginDirective (aka OmpDirectiveSpecification)
- Block
- optional<OmpEndDirective> (aka optional<OmpDirectiveSpecification>)

The OmpBeginDirective and OmpEndDirective are effectively different
names for OmpDirectiveSpecification. They exist to allow the semantic
analyses to distinguish between the beginning and the ending of a block
construct without maintaining additional context.

The actual changes are in the parser: parse-tree.h and openmp-parser.cpp
in particular. The rest is simply changing the way the directive/clause
information is accessed (typically for the simpler).

All standalone and block constructs now use OmpDirectiveSpecification to
store the directive/clause information.
This commit is contained in:
Krzysztof Parzyszek 2025-08-01 07:52:59 -05:00 committed by GitHub
parent 1ee1bddd74
commit 6533ad04ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 459 additions and 556 deletions

View File

@ -445,10 +445,9 @@ public:
READ_FEATURE(ObjectDecl) READ_FEATURE(ObjectDecl)
READ_FEATURE(OldParameterStmt) READ_FEATURE(OldParameterStmt)
READ_FEATURE(OmpAlignedClause) READ_FEATURE(OmpAlignedClause)
READ_FEATURE(OmpBeginBlockDirective) READ_FEATURE(OmpBeginDirective)
READ_FEATURE(OmpBeginLoopDirective) READ_FEATURE(OmpBeginLoopDirective)
READ_FEATURE(OmpBeginSectionsDirective) READ_FEATURE(OmpBeginSectionsDirective)
READ_FEATURE(OmpBlockDirective)
READ_FEATURE(OmpClause) READ_FEATURE(OmpClause)
READ_FEATURE(OmpClauseList) READ_FEATURE(OmpClauseList)
READ_FEATURE(OmpCriticalDirective) READ_FEATURE(OmpCriticalDirective)
@ -472,7 +471,7 @@ public:
READ_FEATURE(OmpIteration) READ_FEATURE(OmpIteration)
READ_FEATURE(OmpIterationOffset) READ_FEATURE(OmpIterationOffset)
READ_FEATURE(OmpIterationVector) READ_FEATURE(OmpIterationVector)
READ_FEATURE(OmpEndBlockDirective) READ_FEATURE(OmpEndDirective)
READ_FEATURE(OmpEndCriticalDirective) READ_FEATURE(OmpEndCriticalDirective)
READ_FEATURE(OmpEndLoopDirective) READ_FEATURE(OmpEndLoopDirective)
READ_FEATURE(OmpEndSectionsDirective) READ_FEATURE(OmpEndSectionsDirective)

View File

@ -534,10 +534,8 @@ public:
NODE(parser, OmpAtClause) NODE(parser, OmpAtClause)
NODE_ENUM(OmpAtClause, ActionTime) NODE_ENUM(OmpAtClause, ActionTime)
NODE_ENUM(OmpSeverityClause, Severity) NODE_ENUM(OmpSeverityClause, Severity)
NODE(parser, OmpBeginBlockDirective)
NODE(parser, OmpBeginLoopDirective) NODE(parser, OmpBeginLoopDirective)
NODE(parser, OmpBeginSectionsDirective) NODE(parser, OmpBeginSectionsDirective)
NODE(parser, OmpBlockDirective)
static std::string GetNodeName(const llvm::omp::Directive &x) { static std::string GetNodeName(const llvm::omp::Directive &x) {
return llvm::Twine("llvm::omp::Directive = ", return llvm::Twine("llvm::omp::Directive = ",
llvm::omp::getOpenMPDirectiveName(x, llvm::omp::FallbackVersion)) llvm::omp::getOpenMPDirectiveName(x, llvm::omp::FallbackVersion))
@ -586,7 +584,6 @@ public:
NODE(parser, OmpDetachClause) NODE(parser, OmpDetachClause)
NODE(parser, OmpDoacrossClause) NODE(parser, OmpDoacrossClause)
NODE(parser, OmpDestroyClause) NODE(parser, OmpDestroyClause)
NODE(parser, OmpEndBlockDirective)
NODE(parser, OmpEndCriticalDirective) NODE(parser, OmpEndCriticalDirective)
NODE(parser, OmpEndLoopDirective) NODE(parser, OmpEndLoopDirective)
NODE(parser, OmpEndSectionsDirective) NODE(parser, OmpEndSectionsDirective)
@ -708,6 +705,8 @@ public:
NODE(parser, OpenMPDeclarativeAssumes) NODE(parser, OpenMPDeclarativeAssumes)
NODE(parser, OmpAssumeDirective) NODE(parser, OmpAssumeDirective)
NODE(parser, OmpEndAssumeDirective) NODE(parser, OmpEndAssumeDirective)
NODE(parser, OmpBeginDirective)
NODE(parser, OmpEndDirective)
NODE(parser, OpenMPAtomicConstruct) NODE(parser, OpenMPAtomicConstruct)
NODE(parser, OpenMPBlockConstruct) NODE(parser, OpenMPBlockConstruct)
NODE(parser, OpenMPCancelConstruct) NODE(parser, OpenMPCancelConstruct)

View File

@ -68,11 +68,6 @@ struct DirectiveNameScope {
return MakeName(x.source, llvm::omp::Directive::OMPD_nothing); return MakeName(x.source, llvm::omp::Directive::OMPD_nothing);
} }
static OmpDirectiveName GetOmpDirectiveName(const OmpBeginBlockDirective &x) {
auto &dir{std::get<OmpBlockDirective>(x.t)};
return MakeName(dir.source, dir.v);
}
static OmpDirectiveName GetOmpDirectiveName(const OmpBeginLoopDirective &x) { static OmpDirectiveName GetOmpDirectiveName(const OmpBeginLoopDirective &x) {
auto &dir{std::get<OmpLoopDirective>(x.t)}; auto &dir{std::get<OmpLoopDirective>(x.t)};
return MakeName(dir.source, dir.v); return MakeName(dir.source, dir.v);
@ -106,10 +101,8 @@ struct DirectiveNameScope {
return GetOmpDirectiveName(x.v); return GetOmpDirectiveName(x.v);
} }
} else if constexpr (TupleTrait<T>) { } else if constexpr (TupleTrait<T>) {
if constexpr (std::is_same_v<T, OpenMPAllocatorsConstruct> || if constexpr (std::is_base_of_v<OmpBlockConstruct, T>) {
std::is_same_v<T, OpenMPAtomicConstruct> || return std::get<OmpBeginDirective>(x.t).DirName();
std::is_same_v<T, OpenMPDispatchConstruct>) {
return std::get<OmpDirectiveSpecification>(x.t).DirName();
} else if constexpr (std::is_same_v<T, OmpAssumeDirective> || } else if constexpr (std::is_same_v<T, OmpAssumeDirective> ||
std::is_same_v<T, OmpCriticalDirective> || std::is_same_v<T, OmpCriticalDirective> ||
std::is_same_v<T, OmpDeclareVariantDirective> || std::is_same_v<T, OmpDeclareVariantDirective> ||

View File

@ -3469,6 +3469,12 @@ WRAPPER_CLASS(PauseStmt, std::optional<StopCode>);
// --- Common definitions // --- Common definitions
#define INHERITED_TUPLE_CLASS_BOILERPLATE(classname, basename) \
using basename::basename; \
classname(basename &&b) : basename(std::move(b)) {} \
using TupleTrait = std::true_type; \
BOILERPLATE(classname)
#define INHERITED_WRAPPER_CLASS_BOILERPLATE(classname, basename) \ #define INHERITED_WRAPPER_CLASS_BOILERPLATE(classname, basename) \
BOILERPLATE(classname); \ BOILERPLATE(classname); \
using basename::basename; \ using basename::basename; \
@ -4750,6 +4756,33 @@ struct OmpDirectiveSpecification {
t; t;
}; };
// OmpBeginDirective and OmpEndDirective are needed for semantic analysis,
// where some checks are done specifically for either the begin or the end
// directive. The structure of both is identical, but the diffent types
// allow to distinguish them in the type-based parse-tree visitor.
struct OmpBeginDirective : public OmpDirectiveSpecification {
INHERITED_TUPLE_CLASS_BOILERPLATE(
OmpBeginDirective, OmpDirectiveSpecification);
};
struct OmpEndDirective : public OmpDirectiveSpecification {
INHERITED_TUPLE_CLASS_BOILERPLATE(OmpEndDirective, OmpDirectiveSpecification);
};
// Common base class for block-associated constructs.
struct OmpBlockConstruct {
TUPLE_CLASS_BOILERPLATE(OmpBlockConstruct);
const OmpBeginDirective &BeginDir() const {
return std::get<OmpBeginDirective>(t);
}
const std::optional<OmpEndDirective> &EndDir() const {
return std::get<std::optional<OmpEndDirective>>(t);
}
CharBlock source;
std::tuple<OmpBeginDirective, Block, std::optional<OmpEndDirective>> t;
};
struct OmpMetadirectiveDirective { struct OmpMetadirectiveDirective {
TUPLE_CLASS_BOILERPLATE(OmpMetadirectiveDirective); TUPLE_CLASS_BOILERPLATE(OmpMetadirectiveDirective);
std::tuple<Verbatim, OmpClauseList> t; std::tuple<Verbatim, OmpClauseList> t;
@ -4854,12 +4887,6 @@ struct OpenMPSectionsConstruct {
t; t;
}; };
// OpenMP directive beginning or ending a block
struct OmpBlockDirective {
WRAPPER_CLASS_BOILERPLATE(OmpBlockDirective, llvm::omp::Directive);
CharBlock source;
};
struct OmpDeclareVariantDirective { struct OmpDeclareVariantDirective {
TUPLE_CLASS_BOILERPLATE(OmpDeclareVariantDirective); TUPLE_CLASS_BOILERPLATE(OmpDeclareVariantDirective);
CharBlock source; CharBlock source;
@ -4984,12 +5011,9 @@ struct OpenMPExecutableAllocate {
// ALLOCATORS [allocate-clause...] // ALLOCATORS [allocate-clause...]
// block // block
// [END ALLOCATORS] // [END ALLOCATORS]
struct OpenMPAllocatorsConstruct { struct OpenMPAllocatorsConstruct : public OmpBlockConstruct {
TUPLE_CLASS_BOILERPLATE(OpenMPAllocatorsConstruct); INHERITED_TUPLE_CLASS_BOILERPLATE(
CharBlock source; OpenMPAllocatorsConstruct, OmpBlockConstruct);
std::tuple<OmpDirectiveSpecification, Block,
std::optional<OmpDirectiveSpecification>>
t;
}; };
// 2.17.7 Atomic construct/2.17.8 Flush construct [OpenMP 5.0] // 2.17.7 Atomic construct/2.17.8 Flush construct [OpenMP 5.0]
@ -5003,15 +5027,11 @@ struct OmpMemoryOrderClause {
CharBlock source; CharBlock source;
}; };
struct OpenMPAtomicConstruct { struct OpenMPAtomicConstruct : public OmpBlockConstruct {
llvm::omp::Clause GetKind() const; llvm::omp::Clause GetKind() const;
bool IsCapture() const; bool IsCapture() const;
bool IsCompare() const; bool IsCompare() const;
TUPLE_CLASS_BOILERPLATE(OpenMPAtomicConstruct); INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPAtomicConstruct, OmpBlockConstruct);
CharBlock source;
std::tuple<OmpDirectiveSpecification, Block,
std::optional<OmpDirectiveSpecification>>
t;
// Information filled out during semantic checks to avoid duplication // Information filled out during semantic checks to avoid duplication
// of analyses. // of analyses.
@ -5075,12 +5095,8 @@ struct OpenMPDepobjConstruct {
// nocontext-clause | // nocontext-clause |
// novariants-clause | // novariants-clause |
// nowait-clause // nowait-clause
struct OpenMPDispatchConstruct { struct OpenMPDispatchConstruct : public OmpBlockConstruct {
TUPLE_CLASS_BOILERPLATE(OpenMPDispatchConstruct); INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPDispatchConstruct, OmpBlockConstruct);
CharBlock source;
std::tuple<OmpDirectiveSpecification, Block,
std::optional<OmpDirectiveSpecification>>
t;
}; };
// [4.5:162-165], [5.0:242-246], [5.1:275-279], [5.2:315-316], [6.0:498-500] // [4.5:162-165], [5.0:242-246], [5.1:275-279], [5.2:315-316], [6.0:498-500]
@ -5135,22 +5151,8 @@ struct OmpEndLoopDirective {
CharBlock source; CharBlock source;
}; };
struct OmpBeginBlockDirective { struct OpenMPBlockConstruct : public OmpBlockConstruct {
TUPLE_CLASS_BOILERPLATE(OmpBeginBlockDirective); INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPBlockConstruct, OmpBlockConstruct);
std::tuple<OmpBlockDirective, OmpClauseList> t;
CharBlock source;
};
struct OmpEndBlockDirective {
TUPLE_CLASS_BOILERPLATE(OmpEndBlockDirective);
std::tuple<OmpBlockDirective, OmpClauseList> t;
CharBlock source;
};
struct OpenMPBlockConstruct {
TUPLE_CLASS_BOILERPLATE(OpenMPBlockConstruct);
std::tuple<OmpBeginBlockDirective, Block, std::optional<OmpEndBlockDirective>>
t;
}; };
// OpenMP directives enclosing do loop // OpenMP directives enclosing do loop

View File

@ -707,7 +707,7 @@ void Fortran::lower::omp::lowerAtomic(
}; };
fir::FirOpBuilder &builder = converter.getFirOpBuilder(); fir::FirOpBuilder &builder = converter.getFirOpBuilder();
auto &dirSpec = std::get<parser::OmpDirectiveSpecification>(construct.t); const parser::OmpDirectiveSpecification &dirSpec = construct.BeginDir();
omp::List<omp::Clause> clauses = makeClauses(dirSpec.Clauses(), semaCtx); omp::List<omp::Clause> clauses = makeClauses(dirSpec.Clauses(), semaCtx);
lower::StatementContext stmtCtx; lower::StatementContext stmtCtx;

View File

@ -407,16 +407,9 @@ static void processHostEvalClauses(lower::AbstractConverter &converter,
common::visit( common::visit(
common::visitors{ common::visitors{
[&](const parser::OpenMPBlockConstruct &ompConstruct) { [&](const parser::OpenMPBlockConstruct &ompConstruct) {
const auto &beginDirective = beginClauseList = &ompConstruct.BeginDir().Clauses();
std::get<parser::OmpBeginBlockDirective>(ompConstruct.t); if (auto &endSpec = ompConstruct.EndDir())
beginClauseList = endClauseList = &endSpec->Clauses();
&std::get<parser::OmpClauseList>(beginDirective.t);
if (auto &endDirective =
std::get<std::optional<parser::OmpEndBlockDirective>>(
ompConstruct.t)) {
endClauseList =
&std::get<parser::OmpClauseList>(endDirective->t);
}
}, },
[&](const parser::OpenMPLoopConstruct &ompConstruct) { [&](const parser::OpenMPLoopConstruct &ompConstruct) {
const auto &beginDirective = const auto &beginDirective =
@ -3733,25 +3726,16 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx, semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval, lower::pft::Evaluation &eval,
const parser::OpenMPBlockConstruct &blockConstruct) { const parser::OpenMPBlockConstruct &blockConstruct) {
const auto &beginBlockDirective = const parser::OmpDirectiveSpecification &beginSpec =
std::get<parser::OmpBeginBlockDirective>(blockConstruct.t); blockConstruct.BeginDir();
mlir::Location currentLocation = List<Clause> clauses = makeClauses(beginSpec.Clauses(), semaCtx);
converter.genLocation(beginBlockDirective.source); if (auto &endSpec = blockConstruct.EndDir())
const auto origDirective = clauses.append(makeClauses(endSpec->Clauses(), semaCtx));
std::get<parser::OmpBlockDirective>(beginBlockDirective.t).v;
List<Clause> clauses = makeClauses(
std::get<parser::OmpClauseList>(beginBlockDirective.t), semaCtx);
if (const auto &endBlockDirective = llvm::omp::Directive directive = beginSpec.DirId();
std::get<std::optional<parser::OmpEndBlockDirective>>( assert(llvm::omp::blockConstructSet.test(directive) &&
blockConstruct.t)) {
clauses.append(makeClauses(
std::get<parser::OmpClauseList>(endBlockDirective->t), semaCtx));
}
assert(llvm::omp::blockConstructSet.test(origDirective) &&
"Expected block construct"); "Expected block construct");
(void)origDirective; mlir::Location currentLocation = converter.genLocation(beginSpec.source);
for (const Clause &clause : clauses) { for (const Clause &clause : clauses) {
mlir::Location clauseLocation = converter.genLocation(clause.source); mlir::Location clauseLocation = converter.genLocation(clause.source);
@ -3794,13 +3778,9 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
} }
} }
llvm::omp::Directive directive =
std::get<parser::OmpBlockDirective>(beginBlockDirective.t).v;
const parser::CharBlock &source =
std::get<parser::OmpBlockDirective>(beginBlockDirective.t).source;
ConstructQueue queue{ ConstructQueue queue{
buildConstructQueue(converter.getFirOpBuilder().getModule(), semaCtx, buildConstructQueue(converter.getFirOpBuilder().getModule(), semaCtx,
eval, source, directive, clauses)}; eval, beginSpec.source, directive, clauses)};
genOMPDispatch(converter, symTable, semaCtx, eval, currentLocation, queue, genOMPDispatch(converter, symTable, semaCtx, eval, currentLocation, queue,
queue.begin()); queue.begin());
} }
@ -4088,8 +4068,7 @@ bool Fortran::lower::isOpenMPTargetConstruct(
const parser::OpenMPConstruct &omp) { const parser::OpenMPConstruct &omp) {
llvm::omp::Directive dir = llvm::omp::Directive::OMPD_unknown; llvm::omp::Directive dir = llvm::omp::Directive::OMPD_unknown;
if (const auto *block = std::get_if<parser::OpenMPBlockConstruct>(&omp.u)) { if (const auto *block = std::get_if<parser::OpenMPBlockConstruct>(&omp.u)) {
const auto &begin = std::get<parser::OmpBeginBlockDirective>(block->t); dir = block->BeginDir().DirId();
dir = std::get<parser::OmpBlockDirective>(begin.t).v;
} else if (const auto *loop = } else if (const auto *loop =
std::get_if<parser::OpenMPLoopConstruct>(&omp.u)) { std::get_if<parser::OpenMPLoopConstruct>(&omp.u)) {
const auto &begin = std::get<parser::OmpBeginLoopDirective>(loop->t); const auto &begin = std::get<parser::OmpBeginLoopDirective>(loop->t);

View File

@ -1381,16 +1381,41 @@ TYPE_PARSER(sourced(construct<OmpLoopDirective>(first(
TYPE_PARSER(sourced(construct<OmpBeginLoopDirective>( TYPE_PARSER(sourced(construct<OmpBeginLoopDirective>(
sourced(Parser<OmpLoopDirective>{}), Parser<OmpClauseList>{}))) sourced(Parser<OmpLoopDirective>{}), Parser<OmpClauseList>{})))
static inline constexpr auto IsDirective(llvm::omp::Directive dir) {
return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; };
}
struct OmpBeginDirectiveParser {
using resultType = OmpDirectiveSpecification;
constexpr OmpBeginDirectiveParser(llvm::omp::Directive dir) : dir_(dir) {}
std::optional<resultType> Parse(ParseState &state) const {
auto &&p{predicated(Parser<OmpDirectiveName>{}, IsDirective(dir_)) >=
Parser<OmpDirectiveSpecification>{}};
return p.Parse(state);
}
private:
llvm::omp::Directive dir_;
};
struct OmpEndDirectiveParser { struct OmpEndDirectiveParser {
using resultType = OmpDirectiveSpecification; using resultType = OmpDirectiveSpecification;
constexpr OmpEndDirectiveParser(llvm::omp::Directive dir) : dir_(dir) {} constexpr OmpEndDirectiveParser(llvm::omp::Directive dir) : dir_(dir) {}
std::optional<resultType> Parse(ParseState &state) const { std::optional<resultType> Parse(ParseState &state) const {
if ((startOmpLine >> "END"_sptok).Parse(state)) { if (startOmpLine.Parse(state)) {
auto &&dirSpec{Parser<OmpDirectiveSpecification>{}.Parse(state)}; if (auto endToken{verbatim("END"_sptok).Parse(state)}) {
if (dirSpec && dirSpec->DirId() == dir_) { if (auto &&dirSpec{OmpBeginDirectiveParser(dir_).Parse(state)}) {
return std::move(dirSpec); // Extend the "source" on both the OmpDirectiveName and the
// OmpDirectiveNameSpecification.
CharBlock &nameSource{std::get<OmpDirectiveName>(dirSpec->t).source};
nameSource.ExtendToCover(endToken->source);
dirSpec->source.ExtendToCover(endToken->source);
return std::move(*dirSpec);
}
} }
} }
return std::nullopt; return std::nullopt;
@ -1400,57 +1425,67 @@ private:
llvm::omp::Directive dir_; llvm::omp::Directive dir_;
}; };
struct OmpAllocatorsConstructParser { struct OmpStatementConstructParser {
using resultType = OpenMPAllocatorsConstruct; using resultType = OmpBlockConstruct;
constexpr OmpStatementConstructParser(llvm::omp::Directive dir) : dir_(dir) {}
std::optional<resultType> Parse(ParseState &state) const { std::optional<resultType> Parse(ParseState &state) const {
auto dirSpec{Parser<OmpDirectiveSpecification>{}.Parse(state)}; if (auto begin{OmpBeginDirectiveParser(dir_).Parse(state)}) {
if (!dirSpec || dirSpec->DirId() != llvm::omp::Directive::OMPD_allocators) { Block body;
return std::nullopt;
}
// This should be an allocate-stmt. That will be checked in semantics.
Block block;
if (auto stmt{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) { if (auto stmt{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) {
block.emplace_back(std::move(*stmt)); body.emplace_back(std::move(*stmt));
} }
// Allow empty block. Check for this in semantics. // Allow empty block. Check for this in semantics.
auto end{OmpEndDirectiveParser{llvm::omp::Directive::OMPD_allocators}}; auto end{maybe(OmpEndDirectiveParser{dir_}).Parse(state)};
return OpenMPAllocatorsConstruct{ return OmpBlockConstruct{OmpBeginDirective(std::move(*begin)),
std::move(*dirSpec), std::move(block), *maybe(end).Parse(state)}; std::move(body),
llvm::transformOptional(std::move(*end),
[](auto &&s) { return OmpEndDirective(std::move(s)); })};
} }
};
TYPE_PARSER(sourced( //
construct<OpenMPAllocatorsConstruct>(
"ALLOCATORS"_tok >= OmpAllocatorsConstructParser{})))
struct OmpDispatchConstructParser {
using resultType = OpenMPDispatchConstruct;
std::optional<resultType> Parse(ParseState &state) const {
auto dirSpec{Parser<OmpDirectiveSpecification>{}.Parse(state)};
if (!dirSpec || dirSpec->DirId() != llvm::omp::Directive::OMPD_dispatch) {
return std::nullopt; return std::nullopt;
} }
// This should be a function call. That will be checked in semantics. private:
Block block; llvm::omp::Directive dir_;
if (auto stmt{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) {
block.emplace_back(std::move(*stmt));
}
// Allow empty block. Check for this in semantics.
auto end{OmpEndDirectiveParser{llvm::omp::Directive::OMPD_dispatch}};
return OpenMPDispatchConstruct{
std::move(*dirSpec), std::move(block), *maybe(end).Parse(state)};
}
}; };
TYPE_PARSER(sourced( // struct OmpBlockConstructParser {
construct<OpenMPDispatchConstruct>( using resultType = OmpBlockConstruct;
"DISPATCH"_tok >= OmpDispatchConstructParser{})))
constexpr OmpBlockConstructParser(llvm::omp::Directive dir) : dir_(dir) {}
std::optional<resultType> Parse(ParseState &state) const {
if (auto &&begin{OmpBeginDirectiveParser(dir_).Parse(state)}) {
if (auto &&body{attempt(StrictlyStructuredBlockParser{}).Parse(state)}) {
// Try strictly-structured block with an optional end-directive
auto end{maybe(OmpEndDirectiveParser{dir_}).Parse(state)};
return OmpBlockConstruct{OmpBeginDirective(std::move(*begin)),
std::move(*body),
llvm::transformOptional(std::move(*end),
[](auto &&s) { return OmpEndDirective(std::move(s)); })};
} else if (auto &&body{
attempt(LooselyStructuredBlockParser{}).Parse(state)}) {
// Try loosely-structured block with a mandatory end-directive
if (auto end{OmpEndDirectiveParser{dir_}.Parse(state)}) {
return OmpBlockConstruct{OmpBeginDirective(std::move(*begin)),
std::move(*body), OmpEndDirective{std::move(*end)}};
}
}
}
return std::nullopt;
}
private:
llvm::omp::Directive dir_;
};
TYPE_PARSER(sourced(construct<OpenMPAllocatorsConstruct>(
OmpStatementConstructParser{llvm::omp::Directive::OMPD_allocators})))
TYPE_PARSER(sourced(construct<OpenMPDispatchConstruct>(
OmpStatementConstructParser{llvm::omp::Directive::OMPD_dispatch})))
// Parser for an arbitrary OpenMP ATOMIC construct. // Parser for an arbitrary OpenMP ATOMIC construct.
// //
@ -1515,8 +1550,10 @@ struct OmpAtomicConstructParser {
} }
} }
recursing_ = false; recursing_ = false;
return OpenMPAtomicConstruct{ return OpenMPAtomicConstruct{OmpBeginDirective(std::move(*dirSpec)),
std::move(*dirSpec), std::move(tail.first), std::move(tail.second)}; std::move(tail.first),
llvm::transformOptional(std::move(tail.second),
[](auto &&s) { return OmpEndDirective(std::move(s)); })};
} }
recursing_ = false; recursing_ = false;
@ -1617,10 +1654,6 @@ TYPE_PARSER(sourced( //
predicated(OmpDirectiveNameParser{}, IsSimpleStandalone) >= predicated(OmpDirectiveNameParser{}, IsSimpleStandalone) >=
Parser<OmpDirectiveSpecification>{}))) Parser<OmpDirectiveSpecification>{})))
static inline constexpr auto IsDirective(llvm::omp::Directive dir) {
return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; };
}
TYPE_PARSER(sourced( // TYPE_PARSER(sourced( //
construct<OpenMPFlushConstruct>( construct<OpenMPFlushConstruct>(
predicated(OmpDirectiveNameParser{}, predicated(OmpDirectiveNameParser{},
@ -1671,40 +1704,6 @@ TYPE_PARSER(
Parser<OpenMPInteropConstruct>{})) / Parser<OpenMPInteropConstruct>{})) /
endOfLine) endOfLine)
// Directive names (of non-block constructs) whose prefix is a name of
// a block-associated construct. We need to exclude them from the block
// directive parser below to avoid parsing parts of them.
static constexpr auto StandaloneDirectiveLookahead{//
"TARGET ENTER DATA"_sptok || "TARGET_ENTER_DATA"_sptok || //
"TARGET EXIT DATA"_sptok || "TARGET_EXIT"_sptok || //
"TARGET UPDATE"_sptok || "TARGET_UPDATE"_sptok};
// Directives enclosing structured-block
TYPE_PARSER((!StandaloneDirectiveLookahead) >=
construct<OmpBlockDirective>(first(
"MASKED" >> pure(llvm::omp::Directive::OMPD_masked),
"MASTER" >> pure(llvm::omp::Directive::OMPD_master),
"ORDERED" >> pure(llvm::omp::Directive::OMPD_ordered),
"PARALLEL MASKED" >> pure(llvm::omp::Directive::OMPD_parallel_masked),
"PARALLEL MASTER" >> pure(llvm::omp::Directive::OMPD_parallel_master),
"PARALLEL WORKSHARE" >>
pure(llvm::omp::Directive::OMPD_parallel_workshare),
"PARALLEL" >> pure(llvm::omp::Directive::OMPD_parallel),
"SCOPE" >> pure(llvm::omp::Directive::OMPD_scope),
"SINGLE" >> pure(llvm::omp::Directive::OMPD_single),
"TARGET DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
"TARGET_DATA" >> pure(llvm::omp::Directive::OMPD_target_data),
"TARGET PARALLEL" >> pure(llvm::omp::Directive::OMPD_target_parallel),
"TARGET TEAMS" >> pure(llvm::omp::Directive::OMPD_target_teams),
"TARGET" >> pure(llvm::omp::Directive::OMPD_target),
"TASK"_id >> pure(llvm::omp::Directive::OMPD_task),
"TASKGROUP" >> pure(llvm::omp::Directive::OMPD_taskgroup),
"TEAMS" >> pure(llvm::omp::Directive::OMPD_teams),
"WORKSHARE" >> pure(llvm::omp::Directive::OMPD_workshare))))
TYPE_PARSER(sourced(construct<OmpBeginBlockDirective>(
sourced(Parser<OmpBlockDirective>{}), Parser<OmpClauseList>{})))
TYPE_PARSER(construct<OmpInitializerProc>(Parser<ProcedureDesignator>{}, TYPE_PARSER(construct<OmpInitializerProc>(Parser<ProcedureDesignator>{},
parenthesized(many(maybe(","_tok) >> Parser<ActualArgSpec>{})))) parenthesized(many(maybe(","_tok) >> Parser<ActualArgSpec>{}))))
@ -1854,12 +1853,27 @@ TYPE_PARSER(sourced(
block, maybe(Parser<OmpEndAssumeDirective>{} / endOmpLine)))) block, maybe(Parser<OmpEndAssumeDirective>{} / endOmpLine))))
// Block Construct // Block Construct
#define MakeBlockConstruct(dir) \
construct<OpenMPBlockConstruct>(OmpBlockConstructParser{dir})
TYPE_PARSER( // TYPE_PARSER( //
construct<OpenMPBlockConstruct>(Parser<OmpBeginBlockDirective>{}, MakeBlockConstruct(llvm::omp::Directive::OMPD_masked) ||
StrictlyStructuredBlockParser{}, MakeBlockConstruct(llvm::omp::Directive::OMPD_master) ||
maybe(Parser<OmpEndBlockDirective>{})) || MakeBlockConstruct(llvm::omp::Directive::OMPD_ordered) ||
construct<OpenMPBlockConstruct>(Parser<OmpBeginBlockDirective>{}, MakeBlockConstruct(llvm::omp::Directive::OMPD_parallel_masked) ||
LooselyStructuredBlockParser{}, Parser<OmpEndBlockDirective>{})) MakeBlockConstruct(llvm::omp::Directive::OMPD_parallel_master) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_parallel_workshare) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_parallel) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_scope) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_single) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_target_data) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_target_parallel) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_target_teams) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_target) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_task) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_taskgroup) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_teams) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_workshare))
#undef MakeBlockConstruct
// OMP SECTIONS Directive // OMP SECTIONS Directive
TYPE_PARSER(construct<OmpSectionsDirective>(first( TYPE_PARSER(construct<OmpSectionsDirective>(first(
@ -1914,12 +1928,6 @@ TYPE_CONTEXT_PARSER("OpenMP construct"_en_US,
construct<OpenMPConstruct>(Parser<OpenMPAssumeConstruct>{}), construct<OpenMPConstruct>(Parser<OpenMPAssumeConstruct>{}),
construct<OpenMPConstruct>(Parser<OpenMPCriticalConstruct>{})))) construct<OpenMPConstruct>(Parser<OpenMPCriticalConstruct>{}))))
// END OMP Block directives
TYPE_PARSER(
startOmpLine >> sourced(construct<OmpEndBlockDirective>(
sourced("END"_tok >> Parser<OmpBlockDirective>{}),
Parser<OmpClauseList>{})))
// END OMP Loop directives // END OMP Loop directives
TYPE_PARSER( TYPE_PARSER(
startOmpLine >> sourced(construct<OmpEndLoopDirective>( startOmpLine >> sourced(construct<OmpEndLoopDirective>(

View File

@ -322,7 +322,7 @@ std::string OmpTraitSetSelectorName::ToString() const {
} }
llvm::omp::Clause OpenMPAtomicConstruct::GetKind() const { llvm::omp::Clause OpenMPAtomicConstruct::GetKind() const {
auto &dirSpec{std::get<OmpDirectiveSpecification>(t)}; const OmpDirectiveSpecification &dirSpec{std::get<OmpBeginDirective>(t)};
for (auto &clause : dirSpec.Clauses().v) { for (auto &clause : dirSpec.Clauses().v) {
switch (clause.Id()) { switch (clause.Id()) {
case llvm::omp::Clause::OMPC_read: case llvm::omp::Clause::OMPC_read:
@ -337,14 +337,14 @@ llvm::omp::Clause OpenMPAtomicConstruct::GetKind() const {
} }
bool OpenMPAtomicConstruct::IsCapture() const { bool OpenMPAtomicConstruct::IsCapture() const {
auto &dirSpec{std::get<OmpDirectiveSpecification>(t)}; const OmpDirectiveSpecification &dirSpec{std::get<OmpBeginDirective>(t)};
return llvm::any_of(dirSpec.Clauses().v, [](auto &clause) { return llvm::any_of(dirSpec.Clauses().v, [](auto &clause) {
return clause.Id() == llvm::omp::Clause::OMPC_capture; return clause.Id() == llvm::omp::Clause::OMPC_capture;
}); });
} }
bool OpenMPAtomicConstruct::IsCompare() const { bool OpenMPAtomicConstruct::IsCompare() const {
auto &dirSpec{std::get<OmpDirectiveSpecification>(t)}; const OmpDirectiveSpecification &dirSpec{std::get<OmpBeginDirective>(t)};
return llvm::any_of(dirSpec.Clauses().v, [](auto &clause) { return llvm::any_of(dirSpec.Clauses().v, [](auto &clause) {
return clause.Id() == llvm::omp::Clause::OMPC_compare; return clause.Id() == llvm::omp::Clause::OMPC_compare;
}); });

View File

@ -2513,87 +2513,39 @@ public:
} }
} }
void Unparse(const OmpObjectList &x) { Walk(x.v, ","); } void Unparse(const OmpObjectList &x) { Walk(x.v, ","); }
void Unparse(const OmpBlockDirective &x) {
switch (x.v) {
case llvm::omp::Directive::OMPD_masked:
Word("MASKED");
break;
case llvm::omp::Directive::OMPD_master:
Word("MASTER");
break;
case llvm::omp::Directive::OMPD_ordered:
Word("ORDERED ");
break;
case llvm::omp::Directive::OMPD_parallel_masked:
Word("PARALLEL MASKED");
break;
case llvm::omp::Directive::OMPD_parallel_master:
Word("PARALLEL MASTER");
break;
case llvm::omp::Directive::OMPD_parallel_workshare:
Word("PARALLEL WORKSHARE ");
break;
case llvm::omp::Directive::OMPD_parallel:
Word("PARALLEL ");
break;
case llvm::omp::Directive::OMPD_scope:
Word("SCOPE ");
break;
case llvm::omp::Directive::OMPD_single:
Word("SINGLE ");
break;
case llvm::omp::Directive::OMPD_target_data:
Word("TARGET DATA ");
break;
case llvm::omp::Directive::OMPD_target_parallel:
Word("TARGET PARALLEL ");
break;
case llvm::omp::Directive::OMPD_target_teams:
Word("TARGET TEAMS ");
break;
case llvm::omp::Directive::OMPD_target:
Word("TARGET ");
break;
case llvm::omp::Directive::OMPD_taskgroup:
Word("TASKGROUP ");
break;
case llvm::omp::Directive::OMPD_task:
Word("TASK ");
break;
case llvm::omp::Directive::OMPD_teams:
Word("TEAMS ");
break;
case llvm::omp::Directive::OMPD_workshare:
Word("WORKSHARE ");
break;
default:
// Nothing to be done
break;
}
}
void Unparse(const common::OmpMemoryOrderType &x) { void Unparse(const common::OmpMemoryOrderType &x) {
Word(ToUpperCaseLetters(common::EnumToString(x))); Word(ToUpperCaseLetters(common::EnumToString(x)));
} }
template <typename Construct> void UnparseBlockConstruct(const Construct &x) { void Unparse(const OmpBeginDirective &x) {
BeginOpenMP(); BeginOpenMP();
Word("!$OMP "); Word("!$OMP ");
Walk(std::get<OmpDirectiveSpecification>(x.t)); Walk(static_cast<const OmpDirectiveSpecification &>(x));
Put("\n"); Put("\n");
EndOpenMP(); EndOpenMP();
Walk(std::get<Block>(x.t), ""); }
if (auto &end{std::get<std::optional<OmpDirectiveSpecification>>(x.t)}) {
void Unparse(const OmpEndDirective &x) {
BeginOpenMP(); BeginOpenMP();
Word("!$OMP END "); Word("!$OMP END ");
Walk(*end); Walk(static_cast<const OmpDirectiveSpecification &>(x));
Put("\n"); Put("\n");
EndOpenMP(); EndOpenMP();
} }
void Unparse(const OmpBlockConstruct &x) {
Walk(std::get<OmpBeginDirective>(x.t));
Walk(std::get<Block>(x.t), "");
if (auto &end{std::get<std::optional<OmpEndDirective>>(x.t)}) {
Walk(*end);
} else {
Put("\n");
}
} }
void Unparse(const OpenMPAtomicConstruct &x) { // void Unparse(const OpenMPAtomicConstruct &x) { //
UnparseBlockConstruct(x); Unparse(static_cast<const OmpBlockConstruct &>(x));
} }
void Unparse(const OpenMPExecutableAllocate &x) { void Unparse(const OpenMPExecutableAllocate &x) {
@ -2624,7 +2576,7 @@ public:
EndOpenMP(); EndOpenMP();
} }
void Unparse(const OpenMPAllocatorsConstruct &x) { // void Unparse(const OpenMPAllocatorsConstruct &x) { //
UnparseBlockConstruct(x); Unparse(static_cast<const OmpBlockConstruct &>(x));
} }
void Unparse(const OmpAssumeDirective &x) { void Unparse(const OmpAssumeDirective &x) {
BeginOpenMP(); BeginOpenMP();
@ -2764,7 +2716,7 @@ public:
EndOpenMP(); EndOpenMP();
} }
void Unparse(const OpenMPDispatchConstruct &x) { // void Unparse(const OpenMPDispatchConstruct &x) { //
UnparseBlockConstruct(x); Unparse(static_cast<const OmpBlockConstruct &>(x));
} }
void Unparse(const OpenMPRequiresConstruct &y) { void Unparse(const OpenMPRequiresConstruct &y) {
BeginOpenMP(); BeginOpenMP();
@ -2897,19 +2849,7 @@ public:
EndOpenMP(); EndOpenMP();
} }
void Unparse(const OpenMPBlockConstruct &x) { void Unparse(const OpenMPBlockConstruct &x) {
BeginOpenMP(); Unparse(static_cast<const OmpBlockConstruct &>(x));
Word("!$OMP ");
Walk(std::get<OmpBeginBlockDirective>(x.t));
Put("\n");
EndOpenMP();
Walk(std::get<Block>(x.t), "");
if (auto &&end{std::get<std::optional<OmpEndBlockDirective>>(x.t)}) {
BeginOpenMP();
Word("!$OMP END ");
Walk(*end);
Put("\n");
EndOpenMP();
}
} }
void Unparse(const OpenMPLoopConstruct &x) { void Unparse(const OpenMPLoopConstruct &x) {
BeginOpenMP(); BeginOpenMP();

View File

@ -1106,12 +1106,11 @@ void OmpStructureChecker::CheckAtomicRead(
// of the following forms: // of the following forms:
// v = x // v = x
// v => x // v => x
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
auto &block{std::get<parser::Block>(x.t)}; auto &block{std::get<parser::Block>(x.t)};
// Read cannot be conditional or have a capture statement. // Read cannot be conditional or have a capture statement.
if (x.IsCompare() || x.IsCapture()) { if (x.IsCompare() || x.IsCapture()) {
context_.Say(dirSpec.source, context_.Say(x.BeginDir().source,
"ATOMIC READ cannot have COMPARE or CAPTURE clauses"_err_en_US); "ATOMIC READ cannot have COMPARE or CAPTURE clauses"_err_en_US);
return; return;
} }
@ -1142,12 +1141,11 @@ void OmpStructureChecker::CheckAtomicRead(
void OmpStructureChecker::CheckAtomicWrite( void OmpStructureChecker::CheckAtomicWrite(
const parser::OpenMPAtomicConstruct &x) { const parser::OpenMPAtomicConstruct &x) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
auto &block{std::get<parser::Block>(x.t)}; auto &block{std::get<parser::Block>(x.t)};
// Write cannot be conditional or have a capture statement. // Write cannot be conditional or have a capture statement.
if (x.IsCompare() || x.IsCapture()) { if (x.IsCompare() || x.IsCapture()) {
context_.Say(dirSpec.source, context_.Say(x.BeginDir().source,
"ATOMIC WRITE cannot have COMPARE or CAPTURE clauses"_err_en_US); "ATOMIC WRITE cannot have COMPARE or CAPTURE clauses"_err_en_US);
return; return;
} }
@ -1235,7 +1233,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPAtomicConstruct &x) {
} }
}}; }};
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
auto &dir{std::get<parser::OmpDirectiveName>(dirSpec.t)}; auto &dir{std::get<parser::OmpDirectiveName>(dirSpec.t)};
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_atomic); PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_atomic);
llvm::omp::Clause kind{x.GetKind()}; llvm::omp::Clause kind{x.GetKind()};

View File

@ -18,6 +18,7 @@
#include "flang/Common/idioms.h" #include "flang/Common/idioms.h"
#include "flang/Common/visit.h" #include "flang/Common/visit.h"
#include "flang/Parser/char-block.h" #include "flang/Parser/char-block.h"
#include "flang/Parser/openmp-utils.h"
#include "flang/Parser/parse-tree-visitor.h" #include "flang/Parser/parse-tree-visitor.h"
#include "flang/Parser/parse-tree.h" #include "flang/Parser/parse-tree.h"
#include "flang/Parser/tools.h" #include "flang/Parser/tools.h"
@ -196,14 +197,9 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
common::visitors{ common::visitors{
// Allow `!$OMP ORDERED SIMD` // Allow `!$OMP ORDERED SIMD`
[&](const parser::OpenMPBlockConstruct &c) { [&](const parser::OpenMPBlockConstruct &c) {
const auto &beginBlockDir{ const parser::OmpDirectiveSpecification &beginSpec{c.BeginDir()};
std::get<parser::OmpBeginBlockDirective>(c.t)}; if (beginSpec.DirId() == llvm::omp::Directive::OMPD_ordered) {
const auto &beginDir{ for (const auto &clause : beginSpec.Clauses().v) {
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
if (beginDir.v == llvm::omp::Directive::OMPD_ordered) {
const auto &clauses{
std::get<parser::OmpClauseList>(beginBlockDir.t)};
for (const auto &clause : clauses.v) {
if (std::get_if<parser::OmpClause::Simd>(&clause.u)) { if (std::get_if<parser::OmpClause::Simd>(&clause.u)) {
eligibleSIMD = true; eligibleSIMD = true;
break; break;
@ -247,7 +243,7 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
}, },
c.u); c.u);
if (!eligibleSIMD) { if (!eligibleSIMD) {
context_.Say(parser::FindSourceLocation(c), context_.Say(parser::omp::GetOmpDirectiveName(c).source,
"The only OpenMP constructs that can be encountered during execution " "The only OpenMP constructs that can be encountered during execution "
"of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, " "of a 'SIMD' region are the `ATOMIC` construct, the `LOOP` construct, "
"the `SIMD` construct, the `SCAN` construct and the `ORDERED` " "the `SIMD` construct, the `SCAN` construct and the `ORDERED` "

View File

@ -498,7 +498,7 @@ template <typename Checker> struct DirectiveSpellingVisitor {
template <typename... Ts> template <typename... Ts>
static const parser::OmpDirectiveName &GetDirName( static const parser::OmpDirectiveName &GetDirName(
const std::tuple<Ts...> &t) { const std::tuple<Ts...> &t) {
return std::get<parser::OmpDirectiveSpecification>(t).DirName(); return std::get<parser::OmpBeginDirective>(t).DirName();
} }
bool Pre(const parser::OmpSectionsDirective &x) { bool Pre(const parser::OmpSectionsDirective &x) {
@ -588,12 +588,14 @@ template <typename Checker> struct DirectiveSpellingVisitor {
checker_(std::get<parser::Verbatim>(x.t).source, Directive::OMPD_requires); checker_(std::get<parser::Verbatim>(x.t).source, Directive::OMPD_requires);
return false; return false;
} }
bool Pre(const parser::OmpBeginDirective &x) {
bool Pre(const parser::OmpBlockDirective &x) { checker_(x.DirName().source, x.DirId());
checker_(x.source, x.v); return false;
}
bool Pre(const parser::OmpEndDirective &x) {
checker_(x.DirName().source, x.DirId());
return false; return false;
} }
bool Pre(const parser::OmpLoopDirective &x) { bool Pre(const parser::OmpLoopDirective &x) {
checker_(x.source, x.v); checker_(x.source, x.v);
return false; return false;
@ -726,22 +728,22 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
// 2.12.5 Target Construct Restriction // 2.12.5 Target Construct Restriction
bool eligibleTarget{true}; bool eligibleTarget{true};
llvm::omp::Directive ineligibleTargetDir; llvm::omp::Directive ineligibleTargetDir;
parser::CharBlock source;
common::visit( common::visit(
common::visitors{ common::visitors{
[&](const parser::OpenMPBlockConstruct &c) { [&](const parser::OpenMPBlockConstruct &c) {
const auto &beginBlockDir{ const parser::OmpDirectiveSpecification &beginSpec{c.BeginDir()};
std::get<parser::OmpBeginBlockDirective>(c.t)}; source = beginSpec.DirName().source;
const auto &beginDir{ if (beginSpec.DirId() == llvm::omp::Directive::OMPD_target_data) {
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
if (beginDir.v == llvm::omp::Directive::OMPD_target_data) {
eligibleTarget = false; eligibleTarget = false;
ineligibleTargetDir = beginDir.v; ineligibleTargetDir = beginSpec.DirId();
} }
}, },
[&](const parser::OpenMPStandaloneConstruct &c) { [&](const parser::OpenMPStandaloneConstruct &c) {
common::visit( common::visit(
common::visitors{ common::visitors{
[&](const parser::OpenMPSimpleStandaloneConstruct &c) { [&](const parser::OpenMPSimpleStandaloneConstruct &c) {
source = c.v.DirName().source;
switch (llvm::omp::Directive dirId{c.v.DirId()}) { switch (llvm::omp::Directive dirId{c.v.DirId()}) {
case llvm::omp::Directive::OMPD_target_update: case llvm::omp::Directive::OMPD_target_update:
case llvm::omp::Directive::OMPD_target_enter_data: case llvm::omp::Directive::OMPD_target_enter_data:
@ -762,6 +764,7 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
std::get<parser::OmpBeginLoopDirective>(c.t)}; std::get<parser::OmpBeginLoopDirective>(c.t)};
const auto &beginDir{ const auto &beginDir{
std::get<parser::OmpLoopDirective>(beginLoopDir.t)}; std::get<parser::OmpLoopDirective>(beginLoopDir.t)};
source = beginLoopDir.source;
if (llvm::omp::allTargetSet.test(beginDir.v)) { if (llvm::omp::allTargetSet.test(beginDir.v)) {
eligibleTarget = false; eligibleTarget = false;
ineligibleTargetDir = beginDir.v; ineligibleTargetDir = beginDir.v;
@ -771,8 +774,7 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
}, },
c.u); c.u);
if (!eligibleTarget) { if (!eligibleTarget) {
context_.Warn(common::UsageWarning::OpenMPUsage, context_.Warn(common::UsageWarning::OpenMPUsage, source,
parser::FindSourceLocation(c),
"If %s directive is nested inside TARGET region, the behaviour is unspecified"_port_en_US, "If %s directive is nested inside TARGET region, the behaviour is unspecified"_port_en_US,
parser::ToUpperCaseLetters( parser::ToUpperCaseLetters(
getDirectiveName(ineligibleTargetDir).str())); getDirectiveName(ineligibleTargetDir).str()));
@ -780,25 +782,18 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
} }
void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) { void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)}; const parser::OmpDirectiveSpecification &beginSpec{x.BeginDir()};
const auto &endBlockDir{ const std::optional<parser::OmpEndDirective> &endSpec{x.EndDir()};
std::get<std::optional<parser::OmpEndBlockDirective>>(x.t)};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
const parser::Block &block{std::get<parser::Block>(x.t)}; const parser::Block &block{std::get<parser::Block>(x.t)};
if (endBlockDir) { PushContextAndClauseSets(beginSpec.DirName().source, beginSpec.DirId());
const auto &endDir{std::get<parser::OmpBlockDirective>(endBlockDir->t)};
CheckMatching<parser::OmpBlockDirective>(beginDir, endDir);
}
PushContextAndClauseSets(beginDir.source, beginDir.v);
if (llvm::omp::allTargetSet.test(GetContext().directive)) { if (llvm::omp::allTargetSet.test(GetContext().directive)) {
EnterDirectiveNest(TargetNest); EnterDirectiveNest(TargetNest);
} }
if (CurrentDirectiveIsNested()) { if (CurrentDirectiveIsNested()) {
if (llvm::omp::bottomTeamsSet.test(GetContextParent().directive)) { if (llvm::omp::bottomTeamsSet.test(GetContextParent().directive)) {
HasInvalidTeamsNesting(beginDir.v, beginDir.source); HasInvalidTeamsNesting(beginSpec.DirId(), beginSpec.source);
} }
if (GetContext().directive == llvm::omp::Directive::OMPD_master) { if (GetContext().directive == llvm::omp::Directive::OMPD_master) {
CheckMasterNesting(x); CheckMasterNesting(x);
@ -807,7 +802,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
// region or a target region. // region or a target region.
if (GetContext().directive == llvm::omp::Directive::OMPD_teams && if (GetContext().directive == llvm::omp::Directive::OMPD_teams &&
GetContextParent().directive != llvm::omp::Directive::OMPD_target) { GetContextParent().directive != llvm::omp::Directive::OMPD_target) {
context_.Say(parser::FindSourceLocation(x), context_.Say(x.BeginDir().DirName().source,
"%s region can only be strictly nested within the implicit parallel " "%s region can only be strictly nested within the implicit parallel "
"region or TARGET region"_err_en_US, "region or TARGET region"_err_en_US,
ContextDirectiveAsFortran()); ContextDirectiveAsFortran());
@ -824,12 +819,12 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
} }
} }
CheckNoBranching(block, beginDir.v, beginDir.source); CheckNoBranching(block, beginSpec.DirId(), beginSpec.source);
// Target block constructs are target device constructs. Keep track of // Target block constructs are target device constructs. Keep track of
// whether any such construct has been visited to later check that REQUIRES // whether any such construct has been visited to later check that REQUIRES
// directives for target-related options don't appear after them. // directives for target-related options don't appear after them.
if (llvm::omp::allTargetSet.test(beginDir.v)) { if (llvm::omp::allTargetSet.test(beginSpec.DirId())) {
deviceConstructFound_ = true; deviceConstructFound_ = true;
} }
@ -839,8 +834,8 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
bool foundNowait{false}; bool foundNowait{false};
parser::CharBlock NowaitSource; parser::CharBlock NowaitSource;
auto catchCopyPrivateNowaitClauses = [&](const auto &dir, bool isEnd) { auto catchCopyPrivateNowaitClauses = [&](const auto &dirSpec, bool isEnd) {
for (auto &clause : std::get<parser::OmpClauseList>(dir.t).v) { for (auto &clause : dirSpec.Clauses().v) {
if (clause.Id() == llvm::omp::Clause::OMPC_copyprivate) { if (clause.Id() == llvm::omp::Clause::OMPC_copyprivate) {
for (const auto &ompObject : GetOmpObjectList(clause)->v) { for (const auto &ompObject : GetOmpObjectList(clause)->v) {
const auto *name{parser::Unwrap<parser::Name>(ompObject)}; const auto *name{parser::Unwrap<parser::Name>(ompObject)};
@ -881,9 +876,9 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
} }
} }
}; };
catchCopyPrivateNowaitClauses(beginBlockDir, false); catchCopyPrivateNowaitClauses(beginSpec, false);
if (endBlockDir) { if (endSpec) {
catchCopyPrivateNowaitClauses(*endBlockDir, true); catchCopyPrivateNowaitClauses(*endSpec, true);
} }
unsigned version{context_.langOptions().OpenMPVersion}; unsigned version{context_.langOptions().OpenMPVersion};
if (version <= 52 && NowaitSource.ToString().size() && if (version <= 52 && NowaitSource.ToString().size() &&
@ -893,7 +888,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
} }
} }
switch (beginDir.v) { switch (beginSpec.DirId()) {
case llvm::omp::Directive::OMPD_target: case llvm::omp::Directive::OMPD_target:
if (CheckTargetBlockOnlyTeams(block)) { if (CheckTargetBlockOnlyTeams(block)) {
EnterDirectiveNest(TargetBlockOnlyTeams); EnterDirectiveNest(TargetBlockOnlyTeams);
@ -901,27 +896,25 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
break; break;
case llvm::omp::OMPD_workshare: case llvm::omp::OMPD_workshare:
case llvm::omp::OMPD_parallel_workshare: case llvm::omp::OMPD_parallel_workshare:
CheckWorkshareBlockStmts(block, beginDir.source); CheckWorkshareBlockStmts(block, beginSpec.source);
HasInvalidWorksharingNesting( HasInvalidWorksharingNesting(
beginDir.source, llvm::omp::nestedWorkshareErrSet); beginSpec.source, llvm::omp::nestedWorkshareErrSet);
break; break;
case llvm::omp::Directive::OMPD_scope: case llvm::omp::Directive::OMPD_scope:
case llvm::omp::Directive::OMPD_single: case llvm::omp::Directive::OMPD_single:
// TODO: This check needs to be extended while implementing nesting of // TODO: This check needs to be extended while implementing nesting of
// regions checks. // regions checks.
HasInvalidWorksharingNesting( HasInvalidWorksharingNesting(
beginDir.source, llvm::omp::nestedWorkshareErrSet); beginSpec.source, llvm::omp::nestedWorkshareErrSet);
break; break;
case llvm::omp::Directive::OMPD_task: { case llvm::omp::Directive::OMPD_task:
const auto &clauses{std::get<parser::OmpClauseList>(beginBlockDir.t)}; for (const auto &clause : beginSpec.Clauses().v) {
for (const auto &clause : clauses.v) {
if (std::get_if<parser::OmpClause::Untied>(&clause.u)) { if (std::get_if<parser::OmpClause::Untied>(&clause.u)) {
OmpUnitedTaskDesignatorChecker check{context_}; OmpUnitedTaskDesignatorChecker check{context_};
parser::Walk(block, check); parser::Walk(block, check);
} }
} }
break; break;
}
default: default:
break; break;
} }
@ -934,7 +927,7 @@ void OmpStructureChecker::CheckMasterNesting(
// TODO: Expand the check to include `LOOP` construct as well when it is // TODO: Expand the check to include `LOOP` construct as well when it is
// supported. // supported.
if (IsCloselyNestedRegion(llvm::omp::nestedMasterErrSet)) { if (IsCloselyNestedRegion(llvm::omp::nestedMasterErrSet)) {
context_.Say(parser::FindSourceLocation(x), context_.Say(x.BeginDir().source,
"`MASTER` region may not be closely nested inside of `WORKSHARING`, " "`MASTER` region may not be closely nested inside of `WORKSHARING`, "
"`LOOP`, `TASK`, `TASKLOOP`," "`LOOP`, `TASK`, `TASKLOOP`,"
" or `ATOMIC` region."_err_en_US); " or `ATOMIC` region."_err_en_US);
@ -1034,7 +1027,7 @@ void OmpStructureChecker::ChecksOnOrderedAsBlock() {
} }
} }
void OmpStructureChecker::Leave(const parser::OmpBeginBlockDirective &) { void OmpStructureChecker::Leave(const parser::OmpBeginDirective &) {
switch (GetContext().directive) { switch (GetContext().directive) {
case llvm::omp::Directive::OMPD_ordered: case llvm::omp::Directive::OMPD_ordered:
// [5.1] 2.19.9 Ordered Construct Restriction // [5.1] 2.19.9 Ordered Construct Restriction
@ -1601,7 +1594,7 @@ void OmpStructureChecker::Enter(const parser::OmpErrorDirective &x) {
} }
void OmpStructureChecker::Enter(const parser::OpenMPDispatchConstruct &x) { void OmpStructureChecker::Enter(const parser::OpenMPDispatchConstruct &x) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
const auto &block{std::get<parser::Block>(x.t)}; const auto &block{std::get<parser::Block>(x.t)};
PushContextAndClauseSets( PushContextAndClauseSets(
dirSpec.DirName().source, llvm::omp::Directive::OMPD_dispatch); dirSpec.DirName().source, llvm::omp::Directive::OMPD_dispatch);
@ -1672,7 +1665,7 @@ void OmpStructureChecker::Leave(const parser::OpenMPExecutableAllocate &x) {
void OmpStructureChecker::Enter(const parser::OpenMPAllocatorsConstruct &x) { void OmpStructureChecker::Enter(const parser::OpenMPAllocatorsConstruct &x) {
isPredefinedAllocator = true; isPredefinedAllocator = true;
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
auto &block{std::get<parser::Block>(x.t)}; auto &block{std::get<parser::Block>(x.t)};
PushContextAndClauseSets( PushContextAndClauseSets(
dirSpec.DirName().source, llvm::omp::Directive::OMPD_allocators); dirSpec.DirName().source, llvm::omp::Directive::OMPD_allocators);
@ -1703,7 +1696,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPAllocatorsConstruct &x) {
} }
void OmpStructureChecker::Leave(const parser::OpenMPAllocatorsConstruct &x) { void OmpStructureChecker::Leave(const parser::OpenMPAllocatorsConstruct &x) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
for (const auto &clause : dirSpec.Clauses().v) { for (const auto &clause : dirSpec.Clauses().v) {
if (const auto *allocClause{ if (const auto *allocClause{
@ -1737,7 +1730,7 @@ void OmpStructureChecker::CheckBarrierNesting(
// TODO: Expand the check to include `LOOP` construct as well when it is // TODO: Expand the check to include `LOOP` construct as well when it is
// supported. // supported.
if (IsCloselyNestedRegion(llvm::omp::nestedBarrierErrSet)) { if (IsCloselyNestedRegion(llvm::omp::nestedBarrierErrSet)) {
context_.Say(parser::FindSourceLocation(x), context_.Say(x.v.DirName().source,
"`BARRIER` region may not be closely nested inside of `WORKSHARING`, " "`BARRIER` region may not be closely nested inside of `WORKSHARING`, "
"`LOOP`, `TASK`, `TASKLOOP`," "`LOOP`, `TASK`, `TASKLOOP`,"
"`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region."_err_en_US); "`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region."_err_en_US);
@ -2277,22 +2270,21 @@ void OmpStructureChecker::CheckCancellationNest(
} }
} }
void OmpStructureChecker::Enter(const parser::OmpEndBlockDirective &x) { void OmpStructureChecker::Enter(const parser::OmpEndDirective &x) {
const auto &dir{std::get<parser::OmpBlockDirective>(x.t)}; parser::CharBlock source{x.DirName().source};
ResetPartialContext(dir.source); ResetPartialContext(source);
switch (dir.v) { switch (x.DirId()) {
case llvm::omp::Directive::OMPD_scope: case llvm::omp::Directive::OMPD_scope:
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_end_scope); PushContextAndClauseSets(source, llvm::omp::Directive::OMPD_end_scope);
break; break;
// 2.7.3 end-single-clause -> copyprivate-clause | // 2.7.3 end-single-clause -> copyprivate-clause |
// nowait-clause // nowait-clause
case llvm::omp::Directive::OMPD_single: case llvm::omp::Directive::OMPD_single:
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_end_single); PushContextAndClauseSets(source, llvm::omp::Directive::OMPD_end_single);
break; break;
// 2.7.4 end-workshare -> END WORKSHARE [nowait-clause] // 2.7.4 end-workshare -> END WORKSHARE [nowait-clause]
case llvm::omp::Directive::OMPD_workshare: case llvm::omp::Directive::OMPD_workshare:
PushContextAndClauseSets( PushContextAndClauseSets(source, llvm::omp::Directive::OMPD_end_workshare);
dir.source, llvm::omp::Directive::OMPD_end_workshare);
break; break;
default: default:
// no clauses are allowed // no clauses are allowed
@ -2305,7 +2297,7 @@ void OmpStructureChecker::Enter(const parser::OmpEndBlockDirective &x) {
// constructs unless a nowait clause is specified. Only OMPD_end_single and // constructs unless a nowait clause is specified. Only OMPD_end_single and
// end_workshareare popped as they are pushed while entering the // end_workshareare popped as they are pushed while entering the
// EndBlockDirective. // EndBlockDirective.
void OmpStructureChecker::Leave(const parser::OmpEndBlockDirective &x) { void OmpStructureChecker::Leave(const parser::OmpEndDirective &x) {
if ((GetContext().directive == llvm::omp::Directive::OMPD_end_scope) || if ((GetContext().directive == llvm::omp::Directive::OMPD_end_scope) ||
(GetContext().directive == llvm::omp::Directive::OMPD_end_single) || (GetContext().directive == llvm::omp::Directive::OMPD_end_single) ||
(GetContext().directive == llvm::omp::Directive::OMPD_end_workshare)) { (GetContext().directive == llvm::omp::Directive::OMPD_end_workshare)) {
@ -4358,11 +4350,8 @@ bool OmpStructureChecker::CheckTargetBlockOnlyTeams(
parser::Unwrap<parser::OpenMPConstruct>(*it)}) { parser::Unwrap<parser::OpenMPConstruct>(*it)}) {
if (const auto *ompBlockConstruct{ if (const auto *ompBlockConstruct{
std::get_if<parser::OpenMPBlockConstruct>(&ompConstruct->u)}) { std::get_if<parser::OpenMPBlockConstruct>(&ompConstruct->u)}) {
const auto &beginBlockDir{ llvm::omp::Directive dirId{ompBlockConstruct->BeginDir().DirId()};
std::get<parser::OmpBeginBlockDirective>(ompBlockConstruct->t)}; if (dirId == llvm::omp::Directive::OMPD_teams) {
const auto &beginDir{
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
if (beginDir.v == llvm::omp::Directive::OMPD_teams) {
nestedTeams = true; nestedTeams = true;
} }
} }
@ -4408,11 +4397,7 @@ void OmpStructureChecker::CheckWorkshareBlockStmts(
auto currentDir{llvm::omp::Directive::OMPD_unknown}; auto currentDir{llvm::omp::Directive::OMPD_unknown};
if (const auto *ompBlockConstruct{ if (const auto *ompBlockConstruct{
std::get_if<parser::OpenMPBlockConstruct>(&ompConstruct->u)}) { std::get_if<parser::OpenMPBlockConstruct>(&ompConstruct->u)}) {
const auto &beginBlockDir{ currentDir = ompBlockConstruct->BeginDir().DirId();
std::get<parser::OmpBeginBlockDirective>(ompBlockConstruct->t)};
const auto &beginDir{
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
currentDir = beginDir.v;
} else if (const auto *ompLoopConstruct{ } else if (const auto *ompLoopConstruct{
std::get_if<parser::OpenMPLoopConstruct>( std::get_if<parser::OpenMPLoopConstruct>(
&ompConstruct->u)}) { &ompConstruct->u)}) {

View File

@ -90,9 +90,9 @@ public:
void Leave(const parser::OpenMPDeclarativeAssumes &); void Leave(const parser::OpenMPDeclarativeAssumes &);
void Enter(const parser::OpenMPBlockConstruct &); void Enter(const parser::OpenMPBlockConstruct &);
void Leave(const parser::OpenMPBlockConstruct &); void Leave(const parser::OpenMPBlockConstruct &);
void Leave(const parser::OmpBeginBlockDirective &); void Leave(const parser::OmpBeginDirective &);
void Enter(const parser::OmpEndBlockDirective &); void Enter(const parser::OmpEndDirective &);
void Leave(const parser::OmpEndBlockDirective &); void Leave(const parser::OmpEndDirective &);
void Enter(const parser::OpenMPSectionsConstruct &); void Enter(const parser::OpenMPSectionsConstruct &);
void Leave(const parser::OpenMPSectionsConstruct &); void Leave(const parser::OpenMPSectionsConstruct &);

View File

@ -378,7 +378,7 @@ public:
bool Pre(const parser::OpenMPBlockConstruct &); bool Pre(const parser::OpenMPBlockConstruct &);
void Post(const parser::OpenMPBlockConstruct &); void Post(const parser::OpenMPBlockConstruct &);
void Post(const parser::OmpBeginBlockDirective &) { void Post(const parser::OmpBeginDirective &x) {
GetContext().withinConstruct = true; GetContext().withinConstruct = true;
} }
@ -519,6 +519,9 @@ public:
bool Pre(const parser::OpenMPDeclarativeAllocate &); bool Pre(const parser::OpenMPDeclarativeAllocate &);
void Post(const parser::OpenMPDeclarativeAllocate &) { PopContext(); } void Post(const parser::OpenMPDeclarativeAllocate &) { PopContext(); }
bool Pre(const parser::OpenMPAtomicConstruct &);
void Post(const parser::OpenMPAtomicConstruct &) { PopContext(); }
bool Pre(const parser::OpenMPDispatchConstruct &); bool Pre(const parser::OpenMPDispatchConstruct &);
void Post(const parser::OpenMPDispatchConstruct &) { PopContext(); } void Post(const parser::OpenMPDispatchConstruct &) { PopContext(); }
@ -1698,9 +1701,9 @@ static std::string ScopeSourcePos(const Fortran::semantics::Scope &scope);
#endif #endif
bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) { bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)}; llvm::omp::Directive dirId{dirSpec.DirId()};
switch (beginDir.v) { switch (dirId) {
case llvm::omp::Directive::OMPD_masked: case llvm::omp::Directive::OMPD_masked:
case llvm::omp::Directive::OMPD_parallel_masked: case llvm::omp::Directive::OMPD_parallel_masked:
case llvm::omp::Directive::OMPD_master: case llvm::omp::Directive::OMPD_master:
@ -1718,15 +1721,15 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
case llvm::omp::Directive::OMPD_parallel_workshare: case llvm::omp::Directive::OMPD_parallel_workshare:
case llvm::omp::Directive::OMPD_target_teams: case llvm::omp::Directive::OMPD_target_teams:
case llvm::omp::Directive::OMPD_target_parallel: case llvm::omp::Directive::OMPD_target_parallel:
PushContext(beginDir.source, beginDir.v); PushContext(dirSpec.source, dirId);
break; break;
default: default:
// TODO others // TODO others
break; break;
} }
if (beginDir.v == llvm::omp::Directive::OMPD_master || if (dirId == llvm::omp::Directive::OMPD_master ||
beginDir.v == llvm::omp::Directive::OMPD_parallel_master) dirId == llvm::omp::Directive::OMPD_parallel_master)
IssueNonConformanceWarning(beginDir.v, beginDir.source, 52); IssueNonConformanceWarning(dirId, dirSpec.source, 52);
ClearDataSharingAttributeObjects(); ClearDataSharingAttributeObjects();
ClearPrivateDataSharingAttributeObjects(); ClearPrivateDataSharingAttributeObjects();
ClearAllocateNames(); ClearAllocateNames();
@ -1734,9 +1737,9 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPBlockConstruct &x) {
} }
void OmpAttributeVisitor::Post(const parser::OpenMPBlockConstruct &x) { void OmpAttributeVisitor::Post(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)}; llvm::omp::Directive dirId{dirSpec.DirId()};
switch (beginDir.v) { switch (dirId) {
case llvm::omp::Directive::OMPD_masked: case llvm::omp::Directive::OMPD_masked:
case llvm::omp::Directive::OMPD_master: case llvm::omp::Directive::OMPD_master:
case llvm::omp::Directive::OMPD_parallel_masked: case llvm::omp::Directive::OMPD_parallel_masked:
@ -2185,6 +2188,11 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPDeclarativeAllocate &x) {
return false; return false;
} }
bool OmpAttributeVisitor::Pre(const parser::OpenMPAtomicConstruct &x) {
PushContext(x.source, llvm::omp::Directive::OMPD_atomic);
return true;
}
bool OmpAttributeVisitor::Pre(const parser::OpenMPDispatchConstruct &x) { bool OmpAttributeVisitor::Pre(const parser::OpenMPDispatchConstruct &x) {
PushContext(x.source, llvm::omp::Directive::OMPD_dispatch); PushContext(x.source, llvm::omp::Directive::OMPD_dispatch);
return true; return true;
@ -2202,7 +2210,7 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPExecutableAllocate &x) {
} }
bool OmpAttributeVisitor::Pre(const parser::OpenMPAllocatorsConstruct &x) { bool OmpAttributeVisitor::Pre(const parser::OpenMPAllocatorsConstruct &x) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
PushContext(x.source, dirSpec.DirId()); PushContext(x.source, dirSpec.DirId());
for (const auto &clause : dirSpec.Clauses().v) { for (const auto &clause : dirSpec.Clauses().v) {
@ -2288,7 +2296,7 @@ void OmpAttributeVisitor::Post(const parser::OpenMPExecutableAllocate &x) {
} }
void OmpAttributeVisitor::Post(const parser::OpenMPAllocatorsConstruct &x) { void OmpAttributeVisitor::Post(const parser::OpenMPAllocatorsConstruct &x) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)}; const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
auto &block{std::get<parser::Block>(x.t)}; auto &block{std::get<parser::Block>(x.t)};
omp::SourcedActionStmt action{omp::GetActionStmt(block)}; omp::SourcedActionStmt action{omp::GetActionStmt(block)};

View File

@ -1484,18 +1484,18 @@ public:
} }
bool Pre(const parser::OpenMPBlockConstruct &); bool Pre(const parser::OpenMPBlockConstruct &);
void Post(const parser::OpenMPBlockConstruct &); void Post(const parser::OpenMPBlockConstruct &);
bool Pre(const parser::OmpBeginBlockDirective &x) { bool Pre(const parser::OmpBeginDirective &x) {
AddOmpSourceRange(x.source); AddOmpSourceRange(x.source);
return true; return true;
} }
void Post(const parser::OmpBeginBlockDirective &) { void Post(const parser::OmpBeginDirective &) {
messageHandler().set_currStmtSource(std::nullopt); messageHandler().set_currStmtSource(std::nullopt);
} }
bool Pre(const parser::OmpEndBlockDirective &x) { bool Pre(const parser::OmpEndDirective &x) {
AddOmpSourceRange(x.source); AddOmpSourceRange(x.source);
return true; return true;
} }
void Post(const parser::OmpEndBlockDirective &) { void Post(const parser::OmpEndDirective &) {
messageHandler().set_currStmtSource(std::nullopt); messageHandler().set_currStmtSource(std::nullopt);
} }
@ -1725,9 +1725,7 @@ private:
}; };
bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) { bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)}; switch (x.BeginDir().DirId()) {
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
switch (beginDir.v) {
case llvm::omp::Directive::OMPD_master: case llvm::omp::Directive::OMPD_master:
case llvm::omp::Directive::OMPD_ordered: case llvm::omp::Directive::OMPD_ordered:
return false; return false;

View File

@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TASK !UNPARSE: !$OMP END TASK
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = task !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
@ -34,8 +34,8 @@ end
!UNPARSE: !$OMP END TASK !UNPARSE: !$OMP END TASK
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = task !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> ArrayElement !PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> ArrayElement
!PARSE-TREE: | | | DataRef -> Name = 'x' !PARSE-TREE: | | | DataRef -> Name = 'x'
@ -60,8 +60,8 @@ end
!UNPARSE: !$OMP END TASK !UNPARSE: !$OMP END TASK
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = task !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Affinity -> OmpAffinityClause
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier !PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
!PARSE-TREE: | | | TypeDeclarationStmt !PARSE-TREE: | | | TypeDeclarationStmt

View File

@ -28,7 +28,7 @@ end subroutine allocate
!CHECK-NEXT: ALLOCATE(arr2(5,3)) !CHECK-NEXT: ALLOCATE(arr2(5,3))
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
!PARSE-TREE-NEXT: | OmpDirectiveSpecification !PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators !PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause !PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!PARSE-TREE-NEXT: | | | Modifier -> OmpAllocatorSimpleModifier -> Scalar -> Integer -> Expr -> Designator -> DataRef -> Name = 'omp_default_mem_alloc' !PARSE-TREE-NEXT: | | | Modifier -> OmpAllocatorSimpleModifier -> Scalar -> Integer -> Expr -> Designator -> DataRef -> Name = 'omp_default_mem_alloc'
@ -40,7 +40,7 @@ end subroutine allocate
!PARSE-TREE-NEXT: | | | | AllocateObject -> Name = 'arr1' !PARSE-TREE-NEXT: | | | | AllocateObject -> Name = 'arr1'
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
!PARSE-TREE-NEXT: | OmpDirectiveSpecification !PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators !PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause !PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!PARSE-TREE-NEXT: | | | Modifier -> OmpAllocatorComplexModifier -> Scalar -> Integer -> Expr -> Designator -> DataRef -> Name = 'omp_default_mem_alloc' !PARSE-TREE-NEXT: | | | Modifier -> OmpAllocatorComplexModifier -> Scalar -> Integer -> Expr -> Designator -> DataRef -> Name = 'omp_default_mem_alloc'
@ -56,7 +56,7 @@ end subroutine allocate
!PARSE-TREE-NEXT: | | | | AllocateObject -> Name = 'arr1' !PARSE-TREE-NEXT: | | | | AllocateObject -> Name = 'arr1'
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
!PARSE-TREE-NEXT: | OmpDirectiveSpecification !PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators !PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause !PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!PARSE-TREE-NEXT: | | | Modifier -> OmpAlignModifier -> Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '32' !PARSE-TREE-NEXT: | | | Modifier -> OmpAlignModifier -> Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '32'
@ -70,7 +70,7 @@ end subroutine allocate
!PARSE-TREE-NEXT: | | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '5' !PARSE-TREE-NEXT: | | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '5'
!PARSE-TREE-NEXT: | | | | AllocateShapeSpec !PARSE-TREE-NEXT: | | | | AllocateShapeSpec
!PARSE-TREE-NEXT: | | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '3' !PARSE-TREE-NEXT: | | | | | Scalar -> Integer -> Expr -> LiteralConstant -> IntLiteralConstant = '3'
!PARSE-TREE-NEXT: | OmpDirectiveSpecification !PARSE-TREE-NEXT: | OmpEndDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators !PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> !PARSE-TREE-NEXT: | | OmpClauseList ->
!PARSE-TREE-NEXT: | | Flags = None !PARSE-TREE-NEXT: | | Flags = None

View File

@ -16,7 +16,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update -> !PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Compare !PARSE-TREE: | | OmpClause -> Compare
@ -54,7 +54,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update -> !PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Compare !PARSE-TREE: | | OmpClause -> Compare
@ -108,7 +108,7 @@ end
!PARSE-TREE: | | | Expr = 'a' !PARSE-TREE: | | | Expr = 'a'
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'a' !PARSE-TREE: | | | | Designator -> DataRef -> Name = 'a'
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update -> !PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Compare !PARSE-TREE: | | OmpClause -> Compare
@ -145,7 +145,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update -> !PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Capture !PARSE-TREE: | | OmpClause -> Capture
@ -169,7 +169,7 @@ end
!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr = 'b' !PARSE-TREE: | | | | Expr = 'b'
!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'b' !PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'b'
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
@ -197,7 +197,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update -> !PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Capture !PARSE-TREE: | | OmpClause -> Capture
@ -224,7 +224,7 @@ end
!PARSE-TREE: | | | | | Expr = 'b' !PARSE-TREE: | | | | | Expr = 'b'
!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b' !PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b'
!PARSE-TREE: | | | EndIfStmt -> !PARSE-TREE: | | | EndIfStmt ->
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
@ -254,7 +254,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update -> !PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->
!PARSE-TREE: | | OmpClause -> Capture !PARSE-TREE: | | OmpClause -> Capture
@ -284,7 +284,7 @@ end
!PARSE-TREE: | | | | | | Expr = 'x' !PARSE-TREE: | | | | | | Expr = 'x'
!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | EndIfStmt -> !PARSE-TREE: | | | EndIfStmt ->
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None

View File

@ -16,7 +16,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Read !PARSE-TREE: | | OmpClauseList -> OmpClause -> Read
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
@ -26,7 +26,7 @@ end
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v' !PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v'
!PARSE-TREE: | | | Expr = 'x' !PARSE-TREE: | | | Expr = 'x'
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
@ -47,7 +47,7 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Read !PARSE-TREE: | | OmpClauseList -> OmpClause -> Read
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
@ -57,7 +57,7 @@ end
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v' !PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v'
!PARSE-TREE: | | | Expr = 'x' !PARSE-TREE: | | | Expr = 'x'
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None

View File

@ -20,8 +20,8 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y' !PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y'
@ -45,8 +45,8 @@ end
!PARSE-TREE: | | | | | | LiteralConstant -> IntLiteralConstant = '2' !PARSE-TREE: | | | | | | LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: | | | | | Expr = 'x' !PARSE-TREE: | | | | | Expr = 'x'
!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
@ -72,8 +72,8 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y' !PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y'
@ -129,8 +129,8 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y' !PARSE-TREE: | | | OmpObject -> Designator -> DataRef -> Name = 'y'
@ -160,6 +160,6 @@ end
!PARSE-TREE: | | | | | | | Expr = 'x' !PARSE-TREE: | | | | | | | Expr = 'x'
!PARSE-TREE: | | | | | | | | Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | | | | | Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | EndBlockStmt -> !PARSE-TREE: | | | EndBlockStmt ->
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->

View File

@ -27,13 +27,13 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block !PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | | | OmpBeginBlockDirective !PARSE-TREE: | | | OmpBeginDirective
!PARSE-TREE: | | | | OmpBlockDirective -> llvm::omp::Directive = target data !PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | | bool = 'true' !PARSE-TREE: | | | | | bool = 'true'
@ -43,11 +43,11 @@ end
!PARSE-TREE: | | | | | Expr -> Add !PARSE-TREE: | | | | | Expr -> Add
!PARSE-TREE: | | | | | | Expr -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: | | | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: | | | OmpEndBlockDirective !PARSE-TREE: | | | OmpEndDirective
!PARSE-TREE: | | | | OmpBlockDirective -> llvm::omp::Directive = target data !PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | | | OmpClauseList -> !PARSE-TREE: | | | | OmpClauseList ->
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
@ -70,8 +70,8 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block !PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification
@ -85,8 +85,8 @@ end
!PARSE-TREE: | | | Expr -> Add !PARSE-TREE: | | | Expr -> Add
!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
@ -109,8 +109,8 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block !PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification
@ -124,8 +124,8 @@ end
!PARSE-TREE: | | | Expr -> Add !PARSE-TREE: | | | Expr -> Add
!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
@ -148,8 +148,8 @@ end
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | Block !PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification
@ -163,6 +163,6 @@ end
!PARSE-TREE: | | | Expr -> Add !PARSE-TREE: | | | Expr -> Add
!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->

View File

@ -11,8 +11,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = From !PARSE-TREE: | | ImplicitBehavior = From
!PARSE-TREE: Block !PARSE-TREE: Block
@ -27,8 +27,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Firstprivate !PARSE-TREE: | | ImplicitBehavior = Firstprivate
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Aggregate !PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Aggregate
@ -43,8 +43,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Alloc !PARSE-TREE: | | ImplicitBehavior = Alloc
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = All !PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = All
@ -61,8 +61,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Alloc !PARSE-TREE: | | ImplicitBehavior = Alloc
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Allocatable !PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Allocatable
@ -77,8 +77,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Tofrom !PARSE-TREE: | | ImplicitBehavior = Tofrom
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Scalar
@ -93,8 +93,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: | | ImplicitBehavior = Present !PARSE-TREE: | | ImplicitBehavior = Present
!PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: | | Modifier -> OmpVariableCategory -> Value = Scalar

View File

@ -34,8 +34,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Tofrom !PARSE-TREE: ImplicitBehavior = Tofrom
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@ -46,8 +46,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Alloc !PARSE-TREE: ImplicitBehavior = Alloc
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@ -58,8 +58,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = None !PARSE-TREE: ImplicitBehavior = None
@ -69,8 +69,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = None !PARSE-TREE: ImplicitBehavior = None
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@ -81,8 +81,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = To !PARSE-TREE: ImplicitBehavior = To
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@ -93,8 +93,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Firstprivate !PARSE-TREE: ImplicitBehavior = Firstprivate
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Scalar
@ -108,8 +108,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Tofrom !PARSE-TREE: ImplicitBehavior = Tofrom
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Aggregate !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Aggregate
@ -120,8 +120,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Tofrom !PARSE-TREE: ImplicitBehavior = Tofrom
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Allocatable !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Allocatable
@ -134,8 +134,8 @@ program main
!CHECK: !$omp end target !CHECK: !$omp end target
!$omp end target !$omp end target
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Defaultmap -> OmpDefaultmapClause
!PARSE-TREE: ImplicitBehavior = Default !PARSE-TREE: ImplicitBehavior = Default
!PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Pointer !PARSE-TREE: Modifier -> OmpVariableCategory -> Value = Pointer

View File

@ -18,7 +18,7 @@ subroutine sub(x)
!UNPARSE: !$OMP END DISPATCH !UNPARSE: !$OMP END DISPATCH
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4' !PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4'
@ -37,7 +37,7 @@ subroutine sub(x)
!PARSE-TREE: | Block !PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
![...] ![...]
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
@ -51,7 +51,7 @@ subroutine sub(x)
!UNPARSE: r=func(a+1_4,b+2_4,c+3_4) !UNPARSE: r=func(a+1_4,b+2_4,c+3_4)
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct
!PARSE-TREE: | OmpDirectiveSpecification !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4' !PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4'
@ -60,7 +60,7 @@ subroutine sub(x)
!PARSE-TREE: | | Flags = None !PARSE-TREE: | | Flags = None
!PARSE-TREE: | Block !PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
!PARSE-TREE-NOT: OmpDirectiveSpecification !PARSE-TREE-NOT: OmpEndDirective
!$omp dispatch device(3) is_device_ptr(x) !$omp dispatch device(3) is_device_ptr(x)
r = func(a+1, b+2, c+3) r = func(a+1, b+2, c+3)

View File

@ -24,7 +24,7 @@ program openmp_parse_if
! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = target exit data ! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = target exit data
!$omp target exit data map(from: i) if(target exit data: cond) !$omp target exit data map(from: i) if(target exit data: cond)
! CHECK: OmpBlockDirective -> llvm::omp::Directive = target data ! CHECK: OmpDirectiveName -> llvm::omp::Directive = target data
! CHECK: OmpClause -> If -> OmpIfClause ! CHECK: OmpClause -> If -> OmpIfClause
! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = target data ! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = target data
!$omp target data map(tofrom: i) if(target data: cond) !$omp target data map(tofrom: i) if(target data: cond)
@ -45,7 +45,7 @@ program openmp_parse_if
end do end do
!$omp end target teams distribute parallel do simd !$omp end target teams distribute parallel do simd
! CHECK: OmpBlockDirective -> llvm::omp::Directive = task ! CHECK: OmpDirectiveName -> llvm::omp::Directive = task
! CHECK-NEXT: OmpClause -> If -> OmpIfClause ! CHECK-NEXT: OmpClause -> If -> OmpIfClause
! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = task ! CHECK-NEXT: OmpDirectiveName -> llvm::omp::Directive = task
!$omp task if(task: cond) !$omp task if(task: cond)

View File

@ -29,13 +29,13 @@ subroutine omp_in_reduction_taskgroup()
end subroutine omp_in_reduction_taskgroup end subroutine omp_in_reduction_taskgroup
!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE-NEXT: OmpBeginBlockDirective !PARSE-TREE-NEXT: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = taskgroup !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = taskgroup
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause
!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE-NEXT: OmpBeginBlockDirective !PARSE-TREE-NEXT: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = task !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = task
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> InReduction -> OmpInReductionClause !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> InReduction -> OmpInReductionClause
!PARSE-TREE-NEXT: OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add !PARSE-TREE-NEXT: OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
!PARSE-TREE-NEXT: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'z' !PARSE-TREE-NEXT: OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'z'
@ -66,8 +66,8 @@ subroutine omp_in_reduction_parallel()
end subroutine omp_in_reduction_parallel end subroutine omp_in_reduction_parallel
!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE-NEXT: OmpBeginBlockDirective !PARSE-TREE-NEXT: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause
!PARSE-TREE: OpenMPConstruct -> OpenMPLoopConstruct !PARSE-TREE: OpenMPConstruct -> OpenMPLoopConstruct

View File

@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpAlwaysModifier -> Value = Always !PARSE-TREE: | | Modifier -> OmpAlwaysModifier -> Value = Always
!PARSE-TREE: | | Modifier -> OmpCloseModifier -> Value = Close !PARSE-TREE: | | Modifier -> OmpCloseModifier -> Value = Close
@ -38,8 +38,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpSelfModifier -> Value = Self !PARSE-TREE: | | Modifier -> OmpSelfModifier -> Value = Self
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = Storage !PARSE-TREE: | | Modifier -> OmpMapType -> Value = Storage
@ -60,8 +60,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptr !PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptr
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To !PARSE-TREE: | | Modifier -> OmpMapType -> Value = To
@ -82,8 +82,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptee !PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptee
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To !PARSE-TREE: | | Modifier -> OmpMapType -> Value = To
@ -104,8 +104,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptr_Ptee !PARSE-TREE: | | Modifier -> OmpRefModifier -> Value = Ref_Ptr_Ptee
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To !PARSE-TREE: | | Modifier -> OmpMapType -> Value = To

View File

@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@ -40,8 +40,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@ -64,8 +64,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = From !PARSE-TREE: | | Modifier -> OmpMapType -> Value = From
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
@ -85,8 +85,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'
!PARSE-TREE: | | bool = 'true' !PARSE-TREE: | | bool = 'true'
@ -105,8 +105,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@ -130,8 +130,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Ompx_Hold
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Always
@ -155,8 +155,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier !PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@ -190,8 +190,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier !PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@ -225,8 +225,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier !PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@ -283,8 +283,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present !PARSE-TREE: | | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier !PARSE-TREE: | | Modifier -> OmpIterator -> OmpIteratorSpecifier
@ -334,8 +334,8 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | Modifier -> OmpMapper -> Name = 'xx' !PARSE-TREE: | | Modifier -> OmpMapper -> Name = 'xx'
!PARSE-TREE: | | Modifier -> OmpMapType -> Value = From !PARSE-TREE: | | Modifier -> OmpMapType -> Value = From
@ -355,7 +355,7 @@ end
!UNPARSE: !$OMP END TARGET !UNPARSE: !$OMP END TARGET
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | Modifier -> OmpMapTypeModifier -> Value = Present !PARSE-TREE: | Modifier -> OmpMapTypeModifier -> Value = Present
!PARSE-TREE: | Modifier -> OmpIterator -> OmpIteratorSpecifier !PARSE-TREE: | Modifier -> OmpIterator -> OmpIteratorSpecifier

View File

@ -6,14 +6,14 @@
subroutine test_masked() subroutine test_masked()
integer :: c = 1 integer :: c = 1
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = masked
!CHECK: !$omp masked !CHECK: !$omp masked
!$omp masked !$omp masked
c = c + 1 c = c + 1
!$omp end masked !$omp end masked
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = masked !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = masked
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '1_4' !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE-NEXT: LiteralConstant -> IntLiteralConstant = '1'
!CHECK: !$omp masked filter(1_4) !CHECK: !$omp masked filter(1_4)
@ -51,8 +51,8 @@ end subroutine
subroutine test_parallel_masked subroutine test_parallel_masked
integer, parameter :: i = 1, j = 1 integer, parameter :: i = 1, j = 1
integer :: c = 2 integer :: c = 2
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel masked !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel masked
!PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4' !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Filter -> Scalar -> Integer -> Expr = '2_4'
!PARSE-TREE-NEXT: Add !PARSE-TREE-NEXT: Add
!PARSE-TREE-NEXT: Expr = '1_4' !PARSE-TREE-NEXT: Expr = '1_4'

View File

@ -6,8 +6,8 @@
subroutine test_master() subroutine test_master()
integer :: c = 1 integer :: c = 1
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = master !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = master
!CHECK: !$omp master !CHECK: !$omp master
!$omp master !$omp master
c = c + 1 c = c + 1
@ -40,8 +40,8 @@ end subroutine
subroutine test_parallel_master subroutine test_parallel_master
integer :: c = 2 integer :: c = 2
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE-NEXT: OmpBlockDirective -> llvm::omp::Directive = parallel master !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel master
!CHECK: !$omp parallel master !CHECK: !$omp parallel master
!$omp parallel master !$omp parallel master
c = c + 2 c = c + 2

View File

@ -170,14 +170,14 @@ end
!UNPARSE: SUBROUTINE f06 !UNPARSE: SUBROUTINE f06
!UNPARSE: IMPLICIT NONE !UNPARSE: IMPLICIT NONE
!UNPARSE: INTEGER i !UNPARSE: INTEGER i
!UNPARSE: !$OMP TARGET DATA MAP(TOFROM: i) !UNPARSE: !$OMP TARGET_DATA MAP(TOFROM: i)
!UNPARSE: i=0_4 !UNPARSE: i=0_4
!UNPARSE: !$OMP END TARGET DATA !UNPARSE: !$OMP END TARGET_DATA
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: | OmpBeginBlockDirective !PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target data !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause
!PARSE-TREE: | | | Modifier -> OmpMapType -> Value = Tofrom !PARSE-TREE: | | | Modifier -> OmpMapType -> Value = Tofrom
!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' !PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i'
@ -188,8 +188,8 @@ end
!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'i' !PARSE-TREE: | | | | Designator -> DataRef -> Name = 'i'
!PARSE-TREE: | | | Expr = '0_4' !PARSE-TREE: | | | Expr = '0_4'
!PARSE-TREE: | | | | LiteralConstant -> IntLiteralConstant = '0' !PARSE-TREE: | | | | LiteralConstant -> IntLiteralConstant = '0'
!PARSE-TREE: | OmpEndBlockDirective !PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target data !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target data
!PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | | OmpClauseList ->
subroutine f07 subroutine f07

View File

@ -4,8 +4,8 @@
! CHECK: !$OMP PARALLEL PROC_BIND(PRIMARY) ! CHECK: !$OMP PARALLEL PROC_BIND(PRIMARY)
! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct ! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
! PARSE-TREE: OmpBeginBlockDirective ! PARSE-TREE: OmpBeginDirective
! PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = parallel ! PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel
! PARSE-TREE: OmpClauseList -> OmpClause -> ProcBind -> OmpProcBindClause -> AffinityPolicy = Primary ! PARSE-TREE: OmpClauseList -> OmpClause -> ProcBind -> OmpProcBindClause -> AffinityPolicy = Primary
subroutine sb1 subroutine sb1
!$omp parallel proc_bind(primary) !$omp parallel proc_bind(primary)

View File

@ -9,13 +9,13 @@ program omp_scope
!CHECK: !$OMP END SCOPE !CHECK: !$OMP END SCOPE
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = scope !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = scope
!PARSE-TREE: OmpClauseList -> OmpClause -> Private -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' !PARSE-TREE: OmpClauseList -> OmpClause -> Private -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i'
!PARSE-TREE: Block !PARSE-TREE: Block
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> PrintStmt !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> PrintStmt
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = scope !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = scope
!PARSE-TREE: OmpClauseList -> OmpClause -> Nowait !PARSE-TREE: OmpClauseList -> OmpClause -> Nowait
!$omp scope private(i) !$omp scope private(i)

View File

@ -20,13 +20,13 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4' !PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
!------------------------------------------------------ !------------------------------------------------------
@ -38,8 +38,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4' !PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: Subtract !PARSE-TREE: Subtract
@ -47,8 +47,8 @@ PROGRAM main
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2' !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: Expr = '1_4' !PARSE-TREE: Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
@ -61,13 +61,13 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = 'x' !PARSE-TREE: Scalar -> Integer -> Expr = 'x'
!PARSE-TREE: Designator -> DataRef -> Name = 'x' !PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
@ -80,8 +80,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y' !PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
!PARSE-TREE: Add !PARSE-TREE: Add
@ -89,8 +89,8 @@ PROGRAM main
!PARSE-TREE: Designator -> DataRef -> Name = 'x' !PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y' !PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y' !PARSE-TREE: Designator -> DataRef -> Name = 'y'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
!------------------------------------------------------ !------------------------------------------------------
@ -102,14 +102,14 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor !PARSE-TREE: OmpDeviceModifier -> Value = Ancestor
!PARSE-TREE: Scalar -> Integer -> Expr = '1_4' !PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1' !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
@ -122,14 +122,14 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num !PARSE-TREE: OmpDeviceModifier -> Value = Device_Num
!PARSE-TREE: Scalar -> Integer -> Expr = '2_4' !PARSE-TREE: Scalar -> Integer -> Expr = '2_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2' !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
@ -142,8 +142,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor !PARSE-TREE: OmpDeviceModifier -> Value = Ancestor
!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y' !PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
@ -152,8 +152,8 @@ PROGRAM main
!PARSE-TREE: Designator -> DataRef -> Name = 'x' !PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y' !PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y' !PARSE-TREE: Designator -> DataRef -> Name = 'y'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> !PARSE-TREE: OmpClauseList ->
@ -166,8 +166,8 @@ PROGRAM main
!CHECK: !$OMP END TARGET !CHECK: !$OMP END TARGET
!$OMP END TARGET !$OMP END TARGET
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num !PARSE-TREE: OmpDeviceModifier -> Value = Device_Num
!PARSE-TREE: Scalar -> Integer -> Expr = 'x-y' !PARSE-TREE: Scalar -> Integer -> Expr = 'x-y'
@ -176,6 +176,6 @@ PROGRAM main
!PARSE-TREE: Designator -> DataRef -> Name = 'x' !PARSE-TREE: Designator -> DataRef -> Name = 'x'
!PARSE-TREE: Expr = 'y' !PARSE-TREE: Expr = 'y'
!PARSE-TREE: Designator -> DataRef -> Name = 'y' !PARSE-TREE: Designator -> DataRef -> Name = 'y'
!PARSE-TREE: OmpEndBlockDirective !PARSE-TREE: OmpEndDirective
!PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target
END PROGRAM END PROGRAM

View File

@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TASKGROUP !UNPARSE: !$OMP END TASKGROUP
!UNPARSE: END SUBROUTINE !UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective !PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = taskgroup !PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = taskgroup
!PARSE-TREE: | OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause !PARSE-TREE: | OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause
!PARSE-TREE: | | Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add !PARSE-TREE: | | Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x' !PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'x'

View File

@ -2,7 +2,7 @@
! RUN: %flang_fc1 %openmp_flags -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case %s ! RUN: %flang_fc1 %openmp_flags -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 %openmp_flags -fdebug-unparse -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case --check-prefix="CHECK-UNPARSE" %s ! RUN: %flang_fc1 %openmp_flags -fdebug-unparse -fopenmp -fopenmp-version=50 %s | FileCheck --ignore-case --check-prefix="CHECK-UNPARSE" %s
!CHECK: OmpBlockDirective -> llvm::omp::Directive = task !CHECK: OmpDirectiveName -> llvm::omp::Directive = task
!CHECK: OmpClauseList -> OmpClause -> Detach -> OmpDetachClause -> OmpObject -> Designator -> DataRef -> Name = 'event' !CHECK: OmpClauseList -> OmpClause -> Detach -> OmpDetachClause -> OmpObject -> Designator -> DataRef -> Name = 'event'
!CHECK-UNPARSE: INTEGER(KIND=8_4) event !CHECK-UNPARSE: INTEGER(KIND=8_4) event

View File

@ -163,8 +163,7 @@ use omp_lib
!$omp parallel !$omp parallel
do i = 1, N do i = 1, N
enddo enddo
!ERROR: Unmatched END TARGET directive !$omp end parallel
!$omp end target
! OMP 5.0 - 2.6 Restriction point 1 ! OMP 5.0 - 2.6 Restriction point 1
outofparallel: do k =1, 10 outofparallel: do k =1, 10

View File

@ -130,8 +130,7 @@ subroutine dotprod (b, c, n, block_size, num_teams, block_threads)
!REF: /dotprod/sum !REF: /dotprod/sum
sum = 0.0e0 sum = 0.0e0
!$omp target map(to:b,c) map(tofrom:sum) !$omp target map(to:b,c) map(tofrom:sum)
!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+: sum& !$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+: sum)
!$OMP&)
!$omp distribute !$omp distribute
!DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4) !DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /dotprod/n !REF: /dotprod/n