Skip to content

Commit 534b228

Browse files
committed
[flang] Lower some coarray statements to their runtime functions
This patch adds the lowering of coarray statements to the runtime functions. The runtime functions are currently not implemented. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D122466
1 parent 07f33a3 commit 534b228

File tree

2 files changed

+67
-9
lines changed

2 files changed

+67
-9
lines changed

flang/lib/Lower/Bridge.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,19 +1503,19 @@ class FirConverter : public Fortran::lower::AbstractConverter {
15031503
//===--------------------------------------------------------------------===//
15041504

15051505
void genFIR(const Fortran::parser::EventPostStmt &stmt) {
1506-
TODO(toLocation(), "EventPostStmt lowering");
1506+
genEventPostStatement(*this, stmt);
15071507
}
15081508

15091509
void genFIR(const Fortran::parser::EventWaitStmt &stmt) {
1510-
TODO(toLocation(), "EventWaitStmt lowering");
1510+
genEventWaitStatement(*this, stmt);
15111511
}
15121512

15131513
void genFIR(const Fortran::parser::FormTeamStmt &stmt) {
1514-
TODO(toLocation(), "FormTeamStmt lowering");
1514+
genFormTeamStatement(*this, getEval(), stmt);
15151515
}
15161516

15171517
void genFIR(const Fortran::parser::LockStmt &stmt) {
1518-
TODO(toLocation(), "LockStmt lowering");
1518+
genLockStatement(*this, stmt);
15191519
}
15201520

15211521
fir::ExtendedValue
@@ -1883,23 +1883,23 @@ class FirConverter : public Fortran::lower::AbstractConverter {
18831883
}
18841884

18851885
void genFIR(const Fortran::parser::SyncAllStmt &stmt) {
1886-
TODO(toLocation(), "SyncAllStmt lowering");
1886+
genSyncAllStatement(*this, stmt);
18871887
}
18881888

18891889
void genFIR(const Fortran::parser::SyncImagesStmt &stmt) {
1890-
TODO(toLocation(), "SyncImagesStmt lowering");
1890+
genSyncImagesStatement(*this, stmt);
18911891
}
18921892

18931893
void genFIR(const Fortran::parser::SyncMemoryStmt &stmt) {
1894-
TODO(toLocation(), "SyncMemoryStmt lowering");
1894+
genSyncMemoryStatement(*this, stmt);
18951895
}
18961896

18971897
void genFIR(const Fortran::parser::SyncTeamStmt &stmt) {
1898-
TODO(toLocation(), "SyncTeamStmt lowering");
1898+
genSyncTeamStatement(*this, stmt);
18991899
}
19001900

19011901
void genFIR(const Fortran::parser::UnlockStmt &stmt) {
1902-
TODO(toLocation(), "UnlockStmt lowering");
1902+
genUnlockStatement(*this, stmt);
19031903
}
19041904

19051905
void genFIR(const Fortran::parser::AssignStmt &stmt) {

flang/lib/Lower/Runtime.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,64 @@ void Fortran::lower::genStopStatement(
107107
genUnreachable(builder, loc);
108108
}
109109

110+
void Fortran::lower::genFailImageStatement(
111+
Fortran::lower::AbstractConverter &converter) {
112+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
113+
mlir::Location loc = converter.getCurrentLocation();
114+
mlir::FuncOp callee =
115+
fir::runtime::getRuntimeFunc<mkRTKey(FailImageStatement)>(loc, builder);
116+
builder.create<fir::CallOp>(loc, callee, llvm::None);
117+
genUnreachable(builder, loc);
118+
}
119+
120+
void Fortran::lower::genEventPostStatement(
121+
Fortran::lower::AbstractConverter &converter,
122+
const Fortran::parser::EventPostStmt &) {
123+
TODO(converter.getCurrentLocation(), "EVENT POST runtime");
124+
}
125+
126+
void Fortran::lower::genEventWaitStatement(
127+
Fortran::lower::AbstractConverter &converter,
128+
const Fortran::parser::EventWaitStmt &) {
129+
TODO(converter.getCurrentLocation(), "EVENT WAIT runtime");
130+
}
131+
132+
void Fortran::lower::genLockStatement(
133+
Fortran::lower::AbstractConverter &converter,
134+
const Fortran::parser::LockStmt &) {
135+
TODO(converter.getCurrentLocation(), "LOCK runtime");
136+
}
137+
138+
void Fortran::lower::genUnlockStatement(
139+
Fortran::lower::AbstractConverter &converter,
140+
const Fortran::parser::UnlockStmt &) {
141+
TODO(converter.getCurrentLocation(), "UNLOCK runtime");
142+
}
143+
144+
void Fortran::lower::genSyncAllStatement(
145+
Fortran::lower::AbstractConverter &converter,
146+
const Fortran::parser::SyncAllStmt &) {
147+
TODO(converter.getCurrentLocation(), "SYNC ALL runtime");
148+
}
149+
150+
void Fortran::lower::genSyncImagesStatement(
151+
Fortran::lower::AbstractConverter &converter,
152+
const Fortran::parser::SyncImagesStmt &) {
153+
TODO(converter.getCurrentLocation(), "SYNC IMAGES runtime");
154+
}
155+
156+
void Fortran::lower::genSyncMemoryStatement(
157+
Fortran::lower::AbstractConverter &converter,
158+
const Fortran::parser::SyncMemoryStmt &) {
159+
TODO(converter.getCurrentLocation(), "SYNC MEMORY runtime");
160+
}
161+
162+
void Fortran::lower::genSyncTeamStatement(
163+
Fortran::lower::AbstractConverter &converter,
164+
const Fortran::parser::SyncTeamStmt &) {
165+
TODO(converter.getCurrentLocation(), "SYNC TEAM runtime");
166+
}
167+
110168
void Fortran::lower::genPauseStatement(
111169
Fortran::lower::AbstractConverter &converter,
112170
const Fortran::parser::PauseStmt &) {

0 commit comments

Comments
 (0)