Skip to content

Commit b5bd257

Browse files
Leporacanthicuskiranchandramohan
authored andcommitted
Fix ASSUME -> ASSUMES and vice versa
1 parent dbe9e87 commit b5bd257

File tree

10 files changed

+46
-92
lines changed

10 files changed

+46
-92
lines changed

flang/include/flang/Parser/dump-parse-tree.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,8 @@ class ParseTreeDumper {
674674
NODE(parser, OpenACCWaitConstruct)
675675
NODE(parser, OpenMPAssumeConstruct)
676676
NODE(parser, OpenMPDeclarativeAssumes)
677-
NODE(parser, OmpAssumesPartConstruct)
678-
NODE(parser, OmpAssumesDirective)
679-
NODE(parser, OpenMPAssumesConstruct)
680-
NODE(parser, OmpEndAssumesDirective)
677+
NODE(parser, OmpAssumeDirective)
678+
NODE(parser, OmpEndAssumeDirective)
681679
NODE(parser, OpenMPAtomicConstruct)
682680
NODE(parser, OpenMPBlockConstruct)
683681
NODE(parser, OpenMPCancelConstruct)

flang/include/flang/Parser/parse-tree.h

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4446,44 +4446,36 @@ struct OpenMPUtilityConstruct {
44464446

44474447
// Ref: [5.2: 213-216]
44484448
//
4449-
// assume-construct ->
4450-
// ASSUME absent-clause | contains-clause | holds-clause | no-openmp-clause |
4449+
// assumes-construct ->
4450+
// ASSUMES absent-clause | contains-clause | holds-clause | no-openmp-clause |
44514451
// no-openmp-routines-clause | no-parallelism-clause
4452-
struct OpenMPAssumeConstruct {
4453-
TUPLE_CLASS_BOILERPLATE(OpenMPAssumeConstruct);
4454-
std::tuple<Verbatim, OmpClauseList> t;
4455-
CharBlock source;
4456-
};
4457-
44584452
struct OpenMPDeclarativeAssumes {
44594453
TUPLE_CLASS_BOILERPLATE(OpenMPDeclarativeAssumes);
44604454
std::tuple<Verbatim, OmpClauseList> t;
44614455
CharBlock source;
44624456
};
44634457

4464-
struct OmpAssumesDirective {
4465-
TUPLE_CLASS_BOILERPLATE(OmpAssumesDirective);
4458+
struct OmpAssumeDirective {
4459+
TUPLE_CLASS_BOILERPLATE(OmpAssumeDirective);
44664460
std::tuple<Verbatim, OmpClauseList> t;
44674461
CharBlock source;
44684462
};
44694463

4470-
struct OmpEndAssumesDirective {
4471-
WRAPPER_CLASS_BOILERPLATE(OmpEndAssumesDirective, Verbatim);
4464+
struct OmpEndAssumeDirective {
4465+
WRAPPER_CLASS_BOILERPLATE(OmpEndAssumeDirective, Verbatim);
44724466
CharBlock source;
44734467
};
44744468

4475-
// structured-block
4476-
// ...
4477-
struct OmpAssumesPartConstruct {
4478-
WRAPPER_CLASS_BOILERPLATE(OmpAssumesPartConstruct, Block);
4479-
CharBlock source;
4480-
};
4481-
4482-
struct OpenMPAssumesConstruct {
4483-
TUPLE_CLASS_BOILERPLATE(OpenMPAssumesConstruct);
4484-
std::tuple<OmpAssumesDirective, OmpAssumesPartConstruct,
4485-
OmpEndAssumesDirective>
4486-
t;
4469+
// Ref: [5.2: 213-216]
4470+
//
4471+
// assume-construct ->
4472+
// ASSUME absent-clause | contains-clause | holds_clause | no-openmp-clause
4473+
// no-openmp-routines-clause | no-parallelism-clause
4474+
// block
4475+
// [END ASSUME]
4476+
struct OpenMPAssumeConstruct {
4477+
TUPLE_CLASS_BOILERPLATE(OpenMPAssumeConstruct);
4478+
std::tuple<OmpAssumeDirective, Block, std::optional<OmpEndAssumeDirective>> t;
44874479
CharBlock source;
44884480
};
44894481

@@ -4620,7 +4612,7 @@ struct OpenMPDeclarativeAllocate {
46204612
struct OpenMPDeclarativeConstruct {
46214613
UNION_CLASS_BOILERPLATE(OpenMPDeclarativeConstruct);
46224614
CharBlock source;
4623-
std::variant<OpenMPDeclarativeAllocate, OpenMPAssumesConstruct, OpenMPDeclarativeAssume,
4615+
std::variant<OpenMPDeclarativeAllocate, OpenMPAssumeConstruct, OpenMPDeclarativeAssumes,
46244616
OpenMPDeclareMapperConstruct,
46254617
OpenMPDeclareReductionConstruct, OpenMPDeclareSimdConstruct,
46264618
OpenMPDeclareTargetConstruct, OpenMPThreadprivate,

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,20 +3385,10 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
33853385
semantics::SemanticsContext &semaCtx,
33863386
lower::pft::Evaluation &eval,
33873387
const parser::OpenMPAssumeConstruct &assumeConstruct) {
3388-
const auto &verbatim = std::get<parser::Verbatim>(assumeConstruct.t);
3389-
mlir::Location clauseLocation = converter.genLocation(verbatim.source);
3388+
mlir::Location clauseLocation = converter.genLocation(assumeConstruct.source);
33903389
TODO(clauseLocation, "OpenMP ASSUME construct");
33913390
}
33923391

3393-
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
3394-
semantics::SemanticsContext &semaCtx,
3395-
lower::pft::Evaluation &eval,
3396-
const parser::OpenMPAssumesConstruct &assumesConstruct) {
3397-
mlir::Location clauseLocation =
3398-
converter.genLocation(assumesConstruct.source);
3399-
TODO(clauseLocation, "OpenMP ASSUMES construct");
3400-
}
3401-
34023392
static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
34033393
semantics::SemanticsContext &semaCtx,
34043394
lower::pft::Evaluation &eval,

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,22 +1323,15 @@ TYPE_PARSER(startOmpLine >>
13231323
endOmpLine))
13241324

13251325
// Assume Construct
1326-
TYPE_PARSER(sourced(construct<OpenMPAssumeConstruct>(
1327-
verbatim("ASSUME"_tok), Parser<OmpClauseList>{}) /
1328-
endOmpLine))
1326+
TYPE_PARSER(sourced(construct<OmpAssumeDirective>(
1327+
verbatim("ASSUME"_tok), Parser<OmpClauseList>{})))
13291328

1330-
TYPE_PARSER(sourced(construct<OmpAssumesDirective>(
1331-
verbatim("ASSUMES"_tok), Parser<OmpClauseList>{})))
1332-
1333-
TYPE_PARSER(sourced(construct<OmpEndAssumesDirective>(
1334-
verbatim(startOmpLine >> "END ASSUMES"_tok))))
1329+
TYPE_PARSER(sourced(construct<OmpEndAssumeDirective>(
1330+
verbatim(startOmpLine >> "END ASSUME"_tok))))
13351331

1336-
TYPE_PARSER(construct<OmpAssumesPartConstruct>(block))
1337-
1338-
TYPE_PARSER(sourced(construct<OpenMPAssumesConstruct>(
1339-
Parser<OmpAssumesDirective>{} / endOmpLine,
1340-
Parser<OmpAssumesPartConstruct>{},
1341-
Parser<OmpEndAssumesDirective>{} / endOmpLine)))
1332+
TYPE_PARSER(sourced(
1333+
construct<OpenMPAssumeConstruct>(Parser<OmpAssumeDirective>{} / endOmpLine,
1334+
block, maybe(Parser<OmpEndAssumeDirective>{} / endOmpLine))))
13421335

13431336
// Block Construct
13441337
TYPE_PARSER(construct<OpenMPBlockConstruct>(
@@ -1387,7 +1380,6 @@ TYPE_CONTEXT_PARSER("OpenMP construct"_en_US,
13871380
construct<OpenMPConstruct>(Parser<OpenMPExecutableAllocate>{}),
13881381
construct<OpenMPConstruct>(Parser<OpenMPAllocatorsConstruct>{}),
13891382
construct<OpenMPConstruct>(Parser<OpenMPDeclarativeAllocate>{}),
1390-
construct<OpenMPConstruct>(Parser<OpenMPAssumesConstruct>{}),
13911383
construct<OpenMPConstruct>(Parser<OpenMPAssumeConstruct>{}),
13921384
construct<OpenMPConstruct>(Parser<OpenMPCriticalConstruct>{}))))
13931385

flang/lib/Parser/unparse.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,23 +2641,16 @@ class UnparseVisitor {
26412641
Walk(*end);
26422642
}
26432643
}
2644-
void Unparse(const OpenMPAssumeConstruct &x) {
2644+
void Unparse(const OmpAssumeDirective &x) {
26452645
BeginOpenMP();
26462646
Word("!$OMP ASSUME");
26472647
Walk(std::get<OmpClauseList>(x.t), ", ");
26482648
Put("\n");
26492649
EndOpenMP();
26502650
}
2651-
void Unparse(const OmpAssumesDirective &x) {
2651+
void Unparse(const OmpEndAssumeDirective &x) {
26522652
BeginOpenMP();
2653-
Word("!$OMP ASSUMES");
2654-
Walk(std::get<OmpClauseList>(x.t), ", ");
2655-
Put("\n");
2656-
EndOpenMP();
2657-
}
2658-
void Unparse(const OmpEndAssumesDirective &x) {
2659-
BeginOpenMP();
2660-
Word("!$OMP END ASSUMES\n");
2653+
Word("!$OMP END ASSUME\n");
26612654
EndOpenMP();
26622655
}
26632656
void Unparse(const OmpCriticalDirective &x) {

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,7 @@ void OmpStructureChecker::CheckMasterNesting(
12521252
}
12531253

12541254
void OmpStructureChecker::Enter(const parser::OpenMPAssumeConstruct &x) {
1255-
const auto &dir{std::get<parser::Verbatim>(x.t)};
1256-
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_assume);
1255+
PushContextAndClauseSets(x.source, llvm::omp::Directive::OMPD_assume);
12571256
}
12581257

12591258
void OmpStructureChecker::Leave(const parser::OpenMPAssumeConstruct &) {
@@ -1268,14 +1267,6 @@ void OmpStructureChecker::Leave(const parser::OpenMPDeclarativeAssumes &) {
12681267
dirContext_.pop_back();
12691268
}
12701269

1271-
void OmpStructureChecker::Enter(const parser::OpenMPAssumesConstruct &x) {
1272-
PushContextAndClauseSets(x.source, llvm::omp::Directive::OMPD_assumes);
1273-
}
1274-
1275-
void OmpStructureChecker::Leave(const parser::OpenMPAssumesConstruct &) {
1276-
dirContext_.pop_back();
1277-
}
1278-
12791270
void OmpStructureChecker::Leave(const parser::OpenMPBlockConstruct &) {
12801271
if (GetDirectiveNest(TargetBlockOnlyTeams)) {
12811272
ExitDirectiveNest(TargetBlockOnlyTeams);

flang/lib/Semantics/check-omp-structure.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ class OmpStructureChecker
8585
void Leave(const parser::OpenMPAssumeConstruct &);
8686
void Enter(const parser::OpenMPDeclarativeAssumes &);
8787
void Leave(const parser::OpenMPDeclarativeAssumes &);
88-
void Enter(const parser::OpenMPAssumesConstruct &);
89-
void Leave(const parser::OpenMPAssumesConstruct &);
9088
void Enter(const parser::OpenMPBlockConstruct &);
9189
void Leave(const parser::OpenMPBlockConstruct &);
9290
void Leave(const parser::OmpBeginBlockDirective &);

flang/test/Lower/OpenMP/Todo/assume.f90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22

33
! CHECK: not yet implemented: OpenMP ASSUME construct
44
program p
5-
!$omp assume no_openmp
5+
integer r
6+
r = 1
7+
!$omp assume no_parallelism
8+
print *,r
9+
!$omp end assume
610
end program p
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
22

3-
! CHECK: not yet implemented: OpenMP ASSUMES construct
3+
! CHECK: not yet implemented: OpenMP ASSUMES declaration
44
program p
5-
integer r
6-
r = 1
7-
!$omp assumes no_parallelism
8-
print *,r
9-
!$omp end assumes
5+
!$omp assumes no_openmp
106
end program p

flang/test/Parser/OpenMP/assumption.f90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ end subroutine sub1
3232
subroutine sub2
3333
integer :: r
3434
integer :: v
35-
!CHECK !$OMP ASSUMES NO_OPENMP
36-
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumesConstruct
37-
!PARSE-TREE: OmpAssumesDirective
35+
!CHECK !$OMP ASSUME NO_OPENMP
36+
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct
37+
!PARSE-TREE: OmpAssumeDirective
3838
!PARSE-TREE: Verbatim
3939
!PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp
40-
!PARSE-TREE: OmpAssumesPartConstruct -> Block
40+
!PARSE-TREE: Block
4141
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt
4242
!PARSE-TREE: Expr -> Add
43-
!PARSE-TREE: OmpEndAssumesDirective
43+
!PARSE-TREE: OmpEndAssumeDirective
4444
v = 87
45-
!$omp assumes no_openmp
45+
!$omp assume no_openmp
4646
r = r + 1
47-
!CHECK !$OMP END ASSUMES
48-
!$omp end assumes
47+
!CHECK !$OMP END ASSUME
48+
!$omp end assume
4949
end subroutine sub2
5050

5151
program p

0 commit comments

Comments
 (0)