xref: /llvm-project/flang/include/flang/Lower/IO.h (revision 7e32cada0105ec8756ce09a9fc07e2b10803d620)
1 //===-- Lower/IO.h -- lower IO statements -----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef FORTRAN_LOWER_IO_H
14 #define FORTRAN_LOWER_IO_H
15 
16 namespace mlir {
17 class Value;
18 } // namespace mlir
19 
20 namespace Fortran {
21 namespace parser {
22 struct BackspaceStmt;
23 struct CloseStmt;
24 struct EndfileStmt;
25 struct FlushStmt;
26 struct InquireStmt;
27 struct OpenStmt;
28 struct ReadStmt;
29 struct RewindStmt;
30 struct PrintStmt;
31 struct WaitStmt;
32 struct WriteStmt;
33 } // namespace parser
34 
35 namespace lower {
36 
37 class AbstractConverter;
38 
39 /// Generate IO call(s) for BACKSPACE; return the IOSTAT code
40 mlir::Value genBackspaceStatement(AbstractConverter &,
41                                   const parser::BackspaceStmt &);
42 
43 /// Generate IO call(s) for CLOSE; return the IOSTAT code
44 mlir::Value genCloseStatement(AbstractConverter &, const parser::CloseStmt &);
45 
46 /// Generate IO call(s) for ENDFILE; return the IOSTAT code
47 mlir::Value genEndfileStatement(AbstractConverter &,
48                                 const parser::EndfileStmt &);
49 
50 /// Generate IO call(s) for FLUSH; return the IOSTAT code
51 mlir::Value genFlushStatement(AbstractConverter &, const parser::FlushStmt &);
52 
53 /// Generate IO call(s) for INQUIRE; return the IOSTAT code
54 mlir::Value genInquireStatement(AbstractConverter &,
55                                 const parser::InquireStmt &);
56 
57 /// Generate IO call(s) for READ; return the IOSTAT code
58 mlir::Value genReadStatement(AbstractConverter &converter,
59                              const parser::ReadStmt &stmt);
60 
61 /// Generate IO call(s) for OPEN; return the IOSTAT code
62 mlir::Value genOpenStatement(AbstractConverter &, const parser::OpenStmt &);
63 
64 /// Generate IO call(s) for PRINT
65 void genPrintStatement(AbstractConverter &converter,
66                        const parser::PrintStmt &stmt);
67 
68 /// Generate IO call(s) for REWIND; return the IOSTAT code
69 mlir::Value genRewindStatement(AbstractConverter &, const parser::RewindStmt &);
70 
71 /// Generate IO call(s) for WAIT; return the IOSTAT code
72 mlir::Value genWaitStatement(AbstractConverter &, const parser::WaitStmt &);
73 
74 /// Generate IO call(s) for WRITE; return the IOSTAT code
75 mlir::Value genWriteStatement(AbstractConverter &converter,
76                               const parser::WriteStmt &stmt);
77 
78 } // namespace lower
79 } // namespace Fortran
80 
81 #endif // FORTRAN_LOWER_IO_H
82