[PATCH] D118699: [flang] Lower PAUSE statement
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 23:16:37 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdb01b123d012: [flang] Lower PAUSE statement (authored by clementval).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118699/new/
https://reviews.llvm.org/D118699
Files:
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/Runtime.cpp
flang/test/Lower/pause-statement.f90
Index: flang/test/Lower/pause-statement.f90
===================================================================
--- /dev/null
+++ flang/test/Lower/pause-statement.f90
@@ -0,0 +1,8 @@
+! RUN: bbc %s -emit-fir --canonicalize -o - | FileCheck %s
+
+! CHECK-LABEL pause_test
+subroutine pause_test()
+ ! CHECK: fir.call @_Fortran{{.*}}PauseStatement()
+ ! CHECK-NEXT: return
+ pause
+end subroutine
Index: flang/lib/Lower/Runtime.cpp
===================================================================
--- flang/lib/Lower/Runtime.cpp
+++ flang/lib/Lower/Runtime.cpp
@@ -68,3 +68,13 @@
builder.create<fir::CallOp>(loc, callee, operands);
genUnreachable(builder, loc);
}
+
+void Fortran::lower::genPauseStatement(
+ Fortran::lower::AbstractConverter &converter,
+ const Fortran::parser::PauseStmt &) {
+ fir::FirOpBuilder &builder = converter.getFirOpBuilder();
+ mlir::Location loc = converter.getCurrentLocation();
+ mlir::FuncOp callee =
+ fir::runtime::getRuntimeFunc<mkRTKey(PauseStatement)>(loc, builder);
+ builder.create<fir::CallOp>(loc, callee, llvm::None);
+}
Index: flang/lib/Lower/Bridge.cpp
===================================================================
--- flang/lib/Lower/Bridge.cpp
+++ flang/lib/Lower/Bridge.cpp
@@ -547,7 +547,7 @@
}
void genFIR(const Fortran::parser::PauseStmt &stmt) {
- TODO(toLocation(), "PauseStmt lowering");
+ genPauseStatement(*this, stmt);
}
void genFIR(const Fortran::parser::FailImageStmt &stmt) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118699.405154.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220202/386b4bbe/attachment.bin>
More information about the llvm-commits
mailing list