[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(OldParameterStmt)
READ_FEATURE(OmpAlignedClause)
READ_FEATURE(OmpBeginBlockDirective)
READ_FEATURE(OmpBeginDirective)
READ_FEATURE(OmpBeginLoopDirective)
READ_FEATURE(OmpBeginSectionsDirective)
READ_FEATURE(OmpBlockDirective)
READ_FEATURE(OmpClause)
READ_FEATURE(OmpClauseList)
READ_FEATURE(OmpCriticalDirective)
@ -472,7 +471,7 @@ public:
READ_FEATURE(OmpIteration)
READ_FEATURE(OmpIterationOffset)
READ_FEATURE(OmpIterationVector)
READ_FEATURE(OmpEndBlockDirective)
READ_FEATURE(OmpEndDirective)
READ_FEATURE(OmpEndCriticalDirective)
READ_FEATURE(OmpEndLoopDirective)
READ_FEATURE(OmpEndSectionsDirective)

View File

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

View File

@ -68,11 +68,6 @@ struct DirectiveNameScope {
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) {
auto &dir{std::get<OmpLoopDirective>(x.t)};
return MakeName(dir.source, dir.v);
@ -106,10 +101,8 @@ struct DirectiveNameScope {
return GetOmpDirectiveName(x.v);
}
} else if constexpr (TupleTrait<T>) {
if constexpr (std::is_same_v<T, OpenMPAllocatorsConstruct> ||
std::is_same_v<T, OpenMPAtomicConstruct> ||
std::is_same_v<T, OpenMPDispatchConstruct>) {
return std::get<OmpDirectiveSpecification>(x.t).DirName();
if constexpr (std::is_base_of_v<OmpBlockConstruct, T>) {
return std::get<OmpBeginDirective>(x.t).DirName();
} else if constexpr (std::is_same_v<T, OmpAssumeDirective> ||
std::is_same_v<T, OmpCriticalDirective> ||
std::is_same_v<T, OmpDeclareVariantDirective> ||

View File

@ -3469,6 +3469,12 @@ WRAPPER_CLASS(PauseStmt, std::optional<StopCode>);
// --- 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) \
BOILERPLATE(classname); \
using basename::basename; \
@ -4750,6 +4756,33 @@ struct OmpDirectiveSpecification {
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 {
TUPLE_CLASS_BOILERPLATE(OmpMetadirectiveDirective);
std::tuple<Verbatim, OmpClauseList> t;
@ -4854,12 +4887,6 @@ struct OpenMPSectionsConstruct {
t;
};
// OpenMP directive beginning or ending a block
struct OmpBlockDirective {
WRAPPER_CLASS_BOILERPLATE(OmpBlockDirective, llvm::omp::Directive);
CharBlock source;
};
struct OmpDeclareVariantDirective {
TUPLE_CLASS_BOILERPLATE(OmpDeclareVariantDirective);
CharBlock source;
@ -4984,12 +5011,9 @@ struct OpenMPExecutableAllocate {
// ALLOCATORS [allocate-clause...]
// block
// [END ALLOCATORS]
struct OpenMPAllocatorsConstruct {
TUPLE_CLASS_BOILERPLATE(OpenMPAllocatorsConstruct);
CharBlock source;
std::tuple<OmpDirectiveSpecification, Block,
std::optional<OmpDirectiveSpecification>>
t;
struct OpenMPAllocatorsConstruct : public OmpBlockConstruct {
INHERITED_TUPLE_CLASS_BOILERPLATE(
OpenMPAllocatorsConstruct, OmpBlockConstruct);
};
// 2.17.7 Atomic construct/2.17.8 Flush construct [OpenMP 5.0]
@ -5003,15 +5027,11 @@ struct OmpMemoryOrderClause {
CharBlock source;
};
struct OpenMPAtomicConstruct {
struct OpenMPAtomicConstruct : public OmpBlockConstruct {
llvm::omp::Clause GetKind() const;
bool IsCapture() const;
bool IsCompare() const;
TUPLE_CLASS_BOILERPLATE(OpenMPAtomicConstruct);
CharBlock source;
std::tuple<OmpDirectiveSpecification, Block,
std::optional<OmpDirectiveSpecification>>
t;
INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPAtomicConstruct, OmpBlockConstruct);
// Information filled out during semantic checks to avoid duplication
// of analyses.
@ -5075,12 +5095,8 @@ struct OpenMPDepobjConstruct {
// nocontext-clause |
// novariants-clause |
// nowait-clause
struct OpenMPDispatchConstruct {
TUPLE_CLASS_BOILERPLATE(OpenMPDispatchConstruct);
CharBlock source;
std::tuple<OmpDirectiveSpecification, Block,
std::optional<OmpDirectiveSpecification>>
t;
struct OpenMPDispatchConstruct : public OmpBlockConstruct {
INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPDispatchConstruct, OmpBlockConstruct);
};
// [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;
};
struct OmpBeginBlockDirective {
TUPLE_CLASS_BOILERPLATE(OmpBeginBlockDirective);
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;
struct OpenMPBlockConstruct : public OmpBlockConstruct {
INHERITED_TUPLE_CLASS_BOILERPLATE(OpenMPBlockConstruct, OmpBlockConstruct);
};
// OpenMP directives enclosing do loop

View File

@ -707,7 +707,7 @@ void Fortran::lower::omp::lowerAtomic(
};
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);
lower::StatementContext stmtCtx;

View File

@ -407,16 +407,9 @@ static void processHostEvalClauses(lower::AbstractConverter &converter,
common::visit(
common::visitors{
[&](const parser::OpenMPBlockConstruct &ompConstruct) {
const auto &beginDirective =
std::get<parser::OmpBeginBlockDirective>(ompConstruct.t);
beginClauseList =
&std::get<parser::OmpClauseList>(beginDirective.t);
if (auto &endDirective =
std::get<std::optional<parser::OmpEndBlockDirective>>(
ompConstruct.t)) {
endClauseList =
&std::get<parser::OmpClauseList>(endDirective->t);
}
beginClauseList = &ompConstruct.BeginDir().Clauses();
if (auto &endSpec = ompConstruct.EndDir())
endClauseList = &endSpec->Clauses();
},
[&](const parser::OpenMPLoopConstruct &ompConstruct) {
const auto &beginDirective =
@ -3733,25 +3726,16 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
lower::pft::Evaluation &eval,
const parser::OpenMPBlockConstruct &blockConstruct) {
const auto &beginBlockDirective =
std::get<parser::OmpBeginBlockDirective>(blockConstruct.t);
mlir::Location currentLocation =
converter.genLocation(beginBlockDirective.source);
const auto origDirective =
std::get<parser::OmpBlockDirective>(beginBlockDirective.t).v;
List<Clause> clauses = makeClauses(
std::get<parser::OmpClauseList>(beginBlockDirective.t), semaCtx);
const parser::OmpDirectiveSpecification &beginSpec =
blockConstruct.BeginDir();
List<Clause> clauses = makeClauses(beginSpec.Clauses(), semaCtx);
if (auto &endSpec = blockConstruct.EndDir())
clauses.append(makeClauses(endSpec->Clauses(), semaCtx));
if (const auto &endBlockDirective =
std::get<std::optional<parser::OmpEndBlockDirective>>(
blockConstruct.t)) {
clauses.append(makeClauses(
std::get<parser::OmpClauseList>(endBlockDirective->t), semaCtx));
}
assert(llvm::omp::blockConstructSet.test(origDirective) &&
llvm::omp::Directive directive = beginSpec.DirId();
assert(llvm::omp::blockConstructSet.test(directive) &&
"Expected block construct");
(void)origDirective;
mlir::Location currentLocation = converter.genLocation(beginSpec.source);
for (const Clause &clause : clauses) {
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{
buildConstructQueue(converter.getFirOpBuilder().getModule(), semaCtx,
eval, source, directive, clauses)};
eval, beginSpec.source, directive, clauses)};
genOMPDispatch(converter, symTable, semaCtx, eval, currentLocation, queue,
queue.begin());
}
@ -4088,8 +4068,7 @@ bool Fortran::lower::isOpenMPTargetConstruct(
const parser::OpenMPConstruct &omp) {
llvm::omp::Directive dir = llvm::omp::Directive::OMPD_unknown;
if (const auto *block = std::get_if<parser::OpenMPBlockConstruct>(&omp.u)) {
const auto &begin = std::get<parser::OmpBeginBlockDirective>(block->t);
dir = std::get<parser::OmpBlockDirective>(begin.t).v;
dir = block->BeginDir().DirId();
} else if (const auto *loop =
std::get_if<parser::OpenMPLoopConstruct>(&omp.u)) {
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>(
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 {
using resultType = OmpDirectiveSpecification;
constexpr OmpEndDirectiveParser(llvm::omp::Directive dir) : dir_(dir) {}
std::optional<resultType> Parse(ParseState &state) const {
if ((startOmpLine >> "END"_sptok).Parse(state)) {
auto &&dirSpec{Parser<OmpDirectiveSpecification>{}.Parse(state)};
if (dirSpec && dirSpec->DirId() == dir_) {
return std::move(dirSpec);
if (startOmpLine.Parse(state)) {
if (auto endToken{verbatim("END"_sptok).Parse(state)}) {
if (auto &&dirSpec{OmpBeginDirectiveParser(dir_).Parse(state)}) {
// 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;
@ -1400,57 +1425,67 @@ private:
llvm::omp::Directive dir_;
};
struct OmpAllocatorsConstructParser {
using resultType = OpenMPAllocatorsConstruct;
struct OmpStatementConstructParser {
using resultType = OmpBlockConstruct;
constexpr OmpStatementConstructParser(llvm::omp::Directive dir) : dir_(dir) {}
std::optional<resultType> Parse(ParseState &state) const {
auto dirSpec{Parser<OmpDirectiveSpecification>{}.Parse(state)};
if (!dirSpec || dirSpec->DirId() != llvm::omp::Directive::OMPD_allocators) {
return std::nullopt;
}
if (auto begin{OmpBeginDirectiveParser(dir_).Parse(state)}) {
Block body;
if (auto stmt{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) {
body.emplace_back(std::move(*stmt));
}
// Allow empty block. Check for this in semantics.
// This should be an allocate-stmt. That will be checked in semantics.
Block block;
if (auto stmt{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) {
block.emplace_back(std::move(*stmt));
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)); })};
}
// Allow empty block. Check for this in semantics.
auto end{OmpEndDirectiveParser{llvm::omp::Directive::OMPD_allocators}};
return OpenMPAllocatorsConstruct{
std::move(*dirSpec), std::move(block), *maybe(end).Parse(state)};
return std::nullopt;
}
private:
llvm::omp::Directive dir_;
};
TYPE_PARSER(sourced( //
construct<OpenMPAllocatorsConstruct>(
"ALLOCATORS"_tok >= OmpAllocatorsConstructParser{})))
struct OmpBlockConstructParser {
using resultType = OmpBlockConstruct;
struct OmpDispatchConstructParser {
using resultType = OpenMPDispatchConstruct;
constexpr OmpBlockConstructParser(llvm::omp::Directive dir) : dir_(dir) {}
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;
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)}};
}
}
}
// This should be a function call. That will be checked in semantics.
Block block;
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)};
return std::nullopt;
}
private:
llvm::omp::Directive dir_;
};
TYPE_PARSER(sourced( //
construct<OpenMPDispatchConstruct>(
"DISPATCH"_tok >= OmpDispatchConstructParser{})))
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.
//
@ -1515,8 +1550,10 @@ struct OmpAtomicConstructParser {
}
}
recursing_ = false;
return OpenMPAtomicConstruct{
std::move(*dirSpec), std::move(tail.first), std::move(tail.second)};
return OpenMPAtomicConstruct{OmpBeginDirective(std::move(*dirSpec)),
std::move(tail.first),
llvm::transformOptional(std::move(tail.second),
[](auto &&s) { return OmpEndDirective(std::move(s)); })};
}
recursing_ = false;
@ -1617,10 +1654,6 @@ TYPE_PARSER(sourced( //
predicated(OmpDirectiveNameParser{}, IsSimpleStandalone) >=
Parser<OmpDirectiveSpecification>{})))
static inline constexpr auto IsDirective(llvm::omp::Directive dir) {
return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; };
}
TYPE_PARSER(sourced( //
construct<OpenMPFlushConstruct>(
predicated(OmpDirectiveNameParser{},
@ -1671,40 +1704,6 @@ TYPE_PARSER(
Parser<OpenMPInteropConstruct>{})) /
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>{},
parenthesized(many(maybe(","_tok) >> Parser<ActualArgSpec>{}))))
@ -1854,12 +1853,27 @@ TYPE_PARSER(sourced(
block, maybe(Parser<OmpEndAssumeDirective>{} / endOmpLine))))
// Block Construct
#define MakeBlockConstruct(dir) \
construct<OpenMPBlockConstruct>(OmpBlockConstructParser{dir})
TYPE_PARSER( //
construct<OpenMPBlockConstruct>(Parser<OmpBeginBlockDirective>{},
StrictlyStructuredBlockParser{},
maybe(Parser<OmpEndBlockDirective>{})) ||
construct<OpenMPBlockConstruct>(Parser<OmpBeginBlockDirective>{},
LooselyStructuredBlockParser{}, Parser<OmpEndBlockDirective>{}))
MakeBlockConstruct(llvm::omp::Directive::OMPD_masked) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_master) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_ordered) ||
MakeBlockConstruct(llvm::omp::Directive::OMPD_parallel_masked) ||
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
TYPE_PARSER(construct<OmpSectionsDirective>(first(
@ -1914,12 +1928,6 @@ TYPE_CONTEXT_PARSER("OpenMP construct"_en_US,
construct<OpenMPConstruct>(Parser<OpenMPAssumeConstruct>{}),
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
TYPE_PARSER(
startOmpLine >> sourced(construct<OmpEndLoopDirective>(

View File

@ -322,7 +322,7 @@ std::string OmpTraitSetSelectorName::ToString() 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) {
switch (clause.Id()) {
case llvm::omp::Clause::OMPC_read:
@ -337,14 +337,14 @@ llvm::omp::Clause OpenMPAtomicConstruct::GetKind() 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 clause.Id() == llvm::omp::Clause::OMPC_capture;
});
}
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 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 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) {
Word(ToUpperCaseLetters(common::EnumToString(x)));
}
template <typename Construct> void UnparseBlockConstruct(const Construct &x) {
void Unparse(const OmpBeginDirective &x) {
BeginOpenMP();
Word("!$OMP ");
Walk(std::get<OmpDirectiveSpecification>(x.t));
Walk(static_cast<const OmpDirectiveSpecification &>(x));
Put("\n");
EndOpenMP();
}
void Unparse(const OmpEndDirective &x) {
BeginOpenMP();
Word("!$OMP END ");
Walk(static_cast<const OmpDirectiveSpecification &>(x));
Put("\n");
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<OmpDirectiveSpecification>>(x.t)}) {
BeginOpenMP();
Word("!$OMP END ");
if (auto &end{std::get<std::optional<OmpEndDirective>>(x.t)}) {
Walk(*end);
} else {
Put("\n");
EndOpenMP();
}
}
void Unparse(const OpenMPAtomicConstruct &x) { //
UnparseBlockConstruct(x);
Unparse(static_cast<const OmpBlockConstruct &>(x));
}
void Unparse(const OpenMPExecutableAllocate &x) {
@ -2624,7 +2576,7 @@ public:
EndOpenMP();
}
void Unparse(const OpenMPAllocatorsConstruct &x) { //
UnparseBlockConstruct(x);
Unparse(static_cast<const OmpBlockConstruct &>(x));
}
void Unparse(const OmpAssumeDirective &x) {
BeginOpenMP();
@ -2764,7 +2716,7 @@ public:
EndOpenMP();
}
void Unparse(const OpenMPDispatchConstruct &x) { //
UnparseBlockConstruct(x);
Unparse(static_cast<const OmpBlockConstruct &>(x));
}
void Unparse(const OpenMPRequiresConstruct &y) {
BeginOpenMP();
@ -2897,19 +2849,7 @@ public:
EndOpenMP();
}
void Unparse(const OpenMPBlockConstruct &x) {
BeginOpenMP();
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();
}
Unparse(static_cast<const OmpBlockConstruct &>(x));
}
void Unparse(const OpenMPLoopConstruct &x) {
BeginOpenMP();

View File

@ -1106,12 +1106,11 @@ void OmpStructureChecker::CheckAtomicRead(
// of the following forms:
// v = x
// v => x
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
auto &block{std::get<parser::Block>(x.t)};
// Read cannot be conditional or have a capture statement.
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);
return;
}
@ -1142,12 +1141,11 @@ void OmpStructureChecker::CheckAtomicRead(
void OmpStructureChecker::CheckAtomicWrite(
const parser::OpenMPAtomicConstruct &x) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
auto &block{std::get<parser::Block>(x.t)};
// Write cannot be conditional or have a capture statement.
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);
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)};
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_atomic);
llvm::omp::Clause kind{x.GetKind()};

View File

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

View File

@ -498,7 +498,7 @@ template <typename Checker> struct DirectiveSpellingVisitor {
template <typename... Ts>
static const parser::OmpDirectiveName &GetDirName(
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) {
@ -588,12 +588,14 @@ template <typename Checker> struct DirectiveSpellingVisitor {
checker_(std::get<parser::Verbatim>(x.t).source, Directive::OMPD_requires);
return false;
}
bool Pre(const parser::OmpBlockDirective &x) {
checker_(x.source, x.v);
bool Pre(const parser::OmpBeginDirective &x) {
checker_(x.DirName().source, x.DirId());
return false;
}
bool Pre(const parser::OmpEndDirective &x) {
checker_(x.DirName().source, x.DirId());
return false;
}
bool Pre(const parser::OmpLoopDirective &x) {
checker_(x.source, x.v);
return false;
@ -726,22 +728,22 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
// 2.12.5 Target Construct Restriction
bool eligibleTarget{true};
llvm::omp::Directive ineligibleTargetDir;
parser::CharBlock source;
common::visit(
common::visitors{
[&](const parser::OpenMPBlockConstruct &c) {
const auto &beginBlockDir{
std::get<parser::OmpBeginBlockDirective>(c.t)};
const auto &beginDir{
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
if (beginDir.v == llvm::omp::Directive::OMPD_target_data) {
const parser::OmpDirectiveSpecification &beginSpec{c.BeginDir()};
source = beginSpec.DirName().source;
if (beginSpec.DirId() == llvm::omp::Directive::OMPD_target_data) {
eligibleTarget = false;
ineligibleTargetDir = beginDir.v;
ineligibleTargetDir = beginSpec.DirId();
}
},
[&](const parser::OpenMPStandaloneConstruct &c) {
common::visit(
common::visitors{
[&](const parser::OpenMPSimpleStandaloneConstruct &c) {
source = c.v.DirName().source;
switch (llvm::omp::Directive dirId{c.v.DirId()}) {
case llvm::omp::Directive::OMPD_target_update:
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)};
const auto &beginDir{
std::get<parser::OmpLoopDirective>(beginLoopDir.t)};
source = beginLoopDir.source;
if (llvm::omp::allTargetSet.test(beginDir.v)) {
eligibleTarget = false;
ineligibleTargetDir = beginDir.v;
@ -771,8 +774,7 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
},
c.u);
if (!eligibleTarget) {
context_.Warn(common::UsageWarning::OpenMPUsage,
parser::FindSourceLocation(c),
context_.Warn(common::UsageWarning::OpenMPUsage, source,
"If %s directive is nested inside TARGET region, the behaviour is unspecified"_port_en_US,
parser::ToUpperCaseLetters(
getDirectiveName(ineligibleTargetDir).str()));
@ -780,25 +782,18 @@ void OmpStructureChecker::CheckTargetNest(const parser::OpenMPConstruct &c) {
}
void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
const auto &beginBlockDir{std::get<parser::OmpBeginBlockDirective>(x.t)};
const auto &endBlockDir{
std::get<std::optional<parser::OmpEndBlockDirective>>(x.t)};
const auto &beginDir{std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
const parser::OmpDirectiveSpecification &beginSpec{x.BeginDir()};
const std::optional<parser::OmpEndDirective> &endSpec{x.EndDir()};
const parser::Block &block{std::get<parser::Block>(x.t)};
if (endBlockDir) {
const auto &endDir{std::get<parser::OmpBlockDirective>(endBlockDir->t)};
CheckMatching<parser::OmpBlockDirective>(beginDir, endDir);
}
PushContextAndClauseSets(beginDir.source, beginDir.v);
PushContextAndClauseSets(beginSpec.DirName().source, beginSpec.DirId());
if (llvm::omp::allTargetSet.test(GetContext().directive)) {
EnterDirectiveNest(TargetNest);
}
if (CurrentDirectiveIsNested()) {
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) {
CheckMasterNesting(x);
@ -807,7 +802,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
// region or a target region.
if (GetContext().directive == llvm::omp::Directive::OMPD_teams &&
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 "
"region or TARGET region"_err_en_US,
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
// whether any such construct has been visited to later check that REQUIRES
// 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;
}
@ -839,8 +834,8 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
bool foundNowait{false};
parser::CharBlock NowaitSource;
auto catchCopyPrivateNowaitClauses = [&](const auto &dir, bool isEnd) {
for (auto &clause : std::get<parser::OmpClauseList>(dir.t).v) {
auto catchCopyPrivateNowaitClauses = [&](const auto &dirSpec, bool isEnd) {
for (auto &clause : dirSpec.Clauses().v) {
if (clause.Id() == llvm::omp::Clause::OMPC_copyprivate) {
for (const auto &ompObject : GetOmpObjectList(clause)->v) {
const auto *name{parser::Unwrap<parser::Name>(ompObject)};
@ -881,9 +876,9 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
}
}
};
catchCopyPrivateNowaitClauses(beginBlockDir, false);
if (endBlockDir) {
catchCopyPrivateNowaitClauses(*endBlockDir, true);
catchCopyPrivateNowaitClauses(beginSpec, false);
if (endSpec) {
catchCopyPrivateNowaitClauses(*endSpec, true);
}
unsigned version{context_.langOptions().OpenMPVersion};
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:
if (CheckTargetBlockOnlyTeams(block)) {
EnterDirectiveNest(TargetBlockOnlyTeams);
@ -901,27 +896,25 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
break;
case llvm::omp::OMPD_workshare:
case llvm::omp::OMPD_parallel_workshare:
CheckWorkshareBlockStmts(block, beginDir.source);
CheckWorkshareBlockStmts(block, beginSpec.source);
HasInvalidWorksharingNesting(
beginDir.source, llvm::omp::nestedWorkshareErrSet);
beginSpec.source, llvm::omp::nestedWorkshareErrSet);
break;
case llvm::omp::Directive::OMPD_scope:
case llvm::omp::Directive::OMPD_single:
// TODO: This check needs to be extended while implementing nesting of
// regions checks.
HasInvalidWorksharingNesting(
beginDir.source, llvm::omp::nestedWorkshareErrSet);
beginSpec.source, llvm::omp::nestedWorkshareErrSet);
break;
case llvm::omp::Directive::OMPD_task: {
const auto &clauses{std::get<parser::OmpClauseList>(beginBlockDir.t)};
for (const auto &clause : clauses.v) {
case llvm::omp::Directive::OMPD_task:
for (const auto &clause : beginSpec.Clauses().v) {
if (std::get_if<parser::OmpClause::Untied>(&clause.u)) {
OmpUnitedTaskDesignatorChecker check{context_};
parser::Walk(block, check);
}
}
break;
}
default:
break;
}
@ -934,7 +927,7 @@ void OmpStructureChecker::CheckMasterNesting(
// TODO: Expand the check to include `LOOP` construct as well when it is
// supported.
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`, "
"`LOOP`, `TASK`, `TASKLOOP`,"
" 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) {
case llvm::omp::Directive::OMPD_ordered:
// [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) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
const auto &block{std::get<parser::Block>(x.t)};
PushContextAndClauseSets(
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) {
isPredefinedAllocator = true;
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
auto &block{std::get<parser::Block>(x.t)};
PushContextAndClauseSets(
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) {
auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
for (const auto &clause : dirSpec.Clauses().v) {
if (const auto *allocClause{
@ -1737,7 +1730,7 @@ void OmpStructureChecker::CheckBarrierNesting(
// TODO: Expand the check to include `LOOP` construct as well when it is
// supported.
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`, "
"`LOOP`, `TASK`, `TASKLOOP`,"
"`CRITICAL`, `ORDERED`, `ATOMIC` or `MASTER` region."_err_en_US);
@ -2277,22 +2270,21 @@ void OmpStructureChecker::CheckCancellationNest(
}
}
void OmpStructureChecker::Enter(const parser::OmpEndBlockDirective &x) {
const auto &dir{std::get<parser::OmpBlockDirective>(x.t)};
ResetPartialContext(dir.source);
switch (dir.v) {
void OmpStructureChecker::Enter(const parser::OmpEndDirective &x) {
parser::CharBlock source{x.DirName().source};
ResetPartialContext(source);
switch (x.DirId()) {
case llvm::omp::Directive::OMPD_scope:
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_end_scope);
PushContextAndClauseSets(source, llvm::omp::Directive::OMPD_end_scope);
break;
// 2.7.3 end-single-clause -> copyprivate-clause |
// nowait-clause
case llvm::omp::Directive::OMPD_single:
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_end_single);
PushContextAndClauseSets(source, llvm::omp::Directive::OMPD_end_single);
break;
// 2.7.4 end-workshare -> END WORKSHARE [nowait-clause]
case llvm::omp::Directive::OMPD_workshare:
PushContextAndClauseSets(
dir.source, llvm::omp::Directive::OMPD_end_workshare);
PushContextAndClauseSets(source, llvm::omp::Directive::OMPD_end_workshare);
break;
default:
// 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
// end_workshareare popped as they are pushed while entering the
// EndBlockDirective.
void OmpStructureChecker::Leave(const parser::OmpEndBlockDirective &x) {
void OmpStructureChecker::Leave(const parser::OmpEndDirective &x) {
if ((GetContext().directive == llvm::omp::Directive::OMPD_end_scope) ||
(GetContext().directive == llvm::omp::Directive::OMPD_end_single) ||
(GetContext().directive == llvm::omp::Directive::OMPD_end_workshare)) {
@ -4358,11 +4350,8 @@ bool OmpStructureChecker::CheckTargetBlockOnlyTeams(
parser::Unwrap<parser::OpenMPConstruct>(*it)}) {
if (const auto *ompBlockConstruct{
std::get_if<parser::OpenMPBlockConstruct>(&ompConstruct->u)}) {
const auto &beginBlockDir{
std::get<parser::OmpBeginBlockDirective>(ompBlockConstruct->t)};
const auto &beginDir{
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
if (beginDir.v == llvm::omp::Directive::OMPD_teams) {
llvm::omp::Directive dirId{ompBlockConstruct->BeginDir().DirId()};
if (dirId == llvm::omp::Directive::OMPD_teams) {
nestedTeams = true;
}
}
@ -4408,11 +4397,7 @@ void OmpStructureChecker::CheckWorkshareBlockStmts(
auto currentDir{llvm::omp::Directive::OMPD_unknown};
if (const auto *ompBlockConstruct{
std::get_if<parser::OpenMPBlockConstruct>(&ompConstruct->u)}) {
const auto &beginBlockDir{
std::get<parser::OmpBeginBlockDirective>(ompBlockConstruct->t)};
const auto &beginDir{
std::get<parser::OmpBlockDirective>(beginBlockDir.t)};
currentDir = beginDir.v;
currentDir = ompBlockConstruct->BeginDir().DirId();
} else if (const auto *ompLoopConstruct{
std::get_if<parser::OpenMPLoopConstruct>(
&ompConstruct->u)}) {

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ end subroutine allocate
!CHECK-NEXT: ALLOCATE(arr2(5,3))
!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: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!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: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
!PARSE-TREE-NEXT: | OmpDirectiveSpecification
!PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!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: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAllocatorsConstruct
!PARSE-TREE-NEXT: | OmpDirectiveSpecification
!PARSE-TREE-NEXT: | OmpBeginDirective
!PARSE-TREE-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = allocators
!PARSE-TREE-NEXT: | | OmpClauseList -> OmpClause -> Allocate -> OmpAllocateClause
!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: | | | | AllocateShapeSpec
!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: | | OmpClauseList ->
!PARSE-TREE-NEXT: | | Flags = None

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ subroutine sub(x)
!UNPARSE: !$OMP END DISPATCH
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct
!PARSE-TREE: | OmpDirectiveSpecification
!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4'
@ -37,7 +37,7 @@ subroutine sub(x)
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
![...]
!PARSE-TREE: | OmpDirectiveSpecification
!PARSE-TREE: | OmpEndDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList ->
!PARSE-TREE: | | Flags = None
@ -51,7 +51,7 @@ subroutine sub(x)
!UNPARSE: r=func(a+1_4,b+2_4,c+3_4)
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPDispatchConstruct
!PARSE-TREE: | OmpDirectiveSpecification
!PARSE-TREE: | OmpBeginDirective
!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = dispatch
!PARSE-TREE: | | OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
!PARSE-TREE: | | | Scalar -> Integer -> Expr = '3_4'
@ -60,7 +60,7 @@ subroutine sub(x)
!PARSE-TREE: | | Flags = None
!PARSE-TREE: | Block
!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
!PARSE-TREE-NOT: OmpDirectiveSpecification
!PARSE-TREE-NOT: OmpEndDirective
!$omp dispatch device(3) is_device_ptr(x)
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
!$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-NEXT: OmpDirectiveName -> llvm::omp::Directive = target data
!$omp target data map(tofrom: i) if(target data: cond)
@ -45,7 +45,7 @@ program openmp_parse_if
end do
!$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: OmpDirectiveName -> llvm::omp::Directive = task
!$omp task if(task: cond)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,8 +15,8 @@ end
!UNPARSE: !$OMP END TASKGROUP
!UNPARSE: END SUBROUTINE
!PARSE-TREE: OmpBeginBlockDirective
!PARSE-TREE: | OmpBlockDirective -> llvm::omp::Directive = taskgroup
!PARSE-TREE: OmpBeginDirective
!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = taskgroup
!PARSE-TREE: | OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause
!PARSE-TREE: | | Modifier -> OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add
!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-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-UNPARSE: INTEGER(KIND=8_4) event

View File

@ -163,8 +163,7 @@ use omp_lib
!$omp parallel
do i = 1, N
enddo
!ERROR: Unmatched END TARGET directive
!$omp end target
!$omp end parallel
! OMP 5.0 - 2.6 Restriction point 1
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
sum = 0.0e0
!$omp target map(to:b,c) map(tofrom:sum)
!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+: sum&
!$OMP&)
!$omp teams num_teams(num_teams) thread_limit(block_threads) reduction(+: sum)
!$omp distribute
!DEF: /dotprod/OtherConstruct1/OtherConstruct1/OtherConstruct1/i0 (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
!REF: /dotprod/n