forked from OSchip/llvm-project
[flang] Lower PAUSE statement
Lower the PAUSE statement to a runtime call. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: kiranchandramohan, schweitz Differential Revision: https://reviews.llvm.org/D118699 Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> Co-authored-by: Jean Perier <jperier@nvidia.com>
This commit is contained in:
parent
e80c52986e
commit
db01b123d0
|
@ -547,7 +547,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void genFIR(const Fortran::parser::PauseStmt &stmt) {
|
void genFIR(const Fortran::parser::PauseStmt &stmt) {
|
||||||
TODO(toLocation(), "PauseStmt lowering");
|
genPauseStatement(*this, stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void genFIR(const Fortran::parser::FailImageStmt &stmt) {
|
void genFIR(const Fortran::parser::FailImageStmt &stmt) {
|
||||||
|
|
|
@ -68,3 +68,13 @@ void Fortran::lower::genStopStatement(
|
||||||
builder.create<fir::CallOp>(loc, callee, operands);
|
builder.create<fir::CallOp>(loc, callee, operands);
|
||||||
genUnreachable(builder, loc);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue