6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
//
9
- // This file is contains the interface to the MLIR parser library .
9
+ // This file is contains a unified interface for parsing serialized MLIR .
10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
12
15
15
16
16
#include " mlir/IR/AsmState.h"
17
17
#include " mlir/IR/Builders.h"
18
- #include " mlir/IR/BuiltinOps .h"
18
+ #include " mlir/IR/OwningOpRef .h"
19
19
#include < cstddef>
20
20
21
21
namespace llvm {
@@ -25,9 +25,6 @@ class StringRef;
25
25
} // namespace llvm
26
26
27
27
namespace mlir {
28
- class AsmParserState ;
29
- class AsmParserCodeCompleteContext ;
30
-
31
28
namespace detail {
32
29
33
30
// / Given a block containing operations that have just been parsed, if the block
@@ -81,16 +78,10 @@ inline OwningOpRef<ContainerOpT> constructContainerOpForParserIfNecessary(
81
78
// / returned. Otherwise, an error message is emitted through the error handler
82
79
// / registered in the context, and failure is returned. If `sourceFileLoc` is
83
80
// / non-null, it is populated with a file location representing the start of the
84
- // / source file that is being parsed. If `asmState` is non-null, it is populated
85
- // / with detailed information about the parsed IR (including exact locations for
86
- // / SSA uses and definitions). `asmState` should only be provided if this
87
- // / detailed information is desired. If `codeCompleteContext` is non-null, it is
88
- // / used to signal tracking of a code completion event (generally only ever
89
- // / useful for LSP or other high level language tooling).
90
- LogicalResult parseSourceFile (
91
- const llvm::SourceMgr &sourceMgr, Block *block, const ParserConfig &config,
92
- LocationAttr *sourceFileLoc = nullptr , AsmParserState *asmState = nullptr ,
93
- AsmParserCodeCompleteContext *codeCompleteContext = nullptr );
81
+ // / source file that is being parsed.
82
+ LogicalResult parseSourceFile (const llvm::SourceMgr &sourceMgr, Block *block,
83
+ const ParserConfig &config,
84
+ LocationAttr *sourceFileLoc = nullptr );
94
85
95
86
// / This parses the file specified by the indicated filename and appends parsed
96
87
// / operations to the given block. If the block is non-empty, the operations are
@@ -109,15 +100,11 @@ LogicalResult parseSourceFile(llvm::StringRef filename, Block *block,
109
100
// / parsing is successful, success is returned. Otherwise, an error message is
110
101
// / emitted through the error handler registered in the context, and failure is
111
102
// / returned. If `sourceFileLoc` is non-null, it is populated with a file
112
- // / location representing the start of the source file that is being parsed. If
113
- // / `asmState` is non-null, it is populated with detailed information about the
114
- // / parsed IR (including exact locations for SSA uses and definitions).
115
- // / `asmState` should only be provided if this detailed information is desired.
103
+ // / location representing the start of the source file that is being parsed.
116
104
LogicalResult parseSourceFile (llvm::StringRef filename,
117
105
llvm::SourceMgr &sourceMgr, Block *block,
118
106
const ParserConfig &config,
119
- LocationAttr *sourceFileLoc = nullptr ,
120
- AsmParserState *asmState = nullptr );
107
+ LocationAttr *sourceFileLoc = nullptr );
121
108
122
109
// / This parses the IR string and appends parsed operations to the given block.
123
110
// / If the block is non-empty, the operations are placed before the current
@@ -208,48 +195,6 @@ inline OwningOpRef<ContainerOpT> parseSourceString(llvm::StringRef sourceStr,
208
195
&block, config.getContext (), sourceFileLoc);
209
196
}
210
197
211
- // / This parses a single MLIR attribute to an MLIR context if it was valid. If
212
- // / not, an error message is emitted through a new SourceMgrDiagnosticHandler
213
- // / constructed from a new SourceMgr with a single a MemoryBuffer wrapping
214
- // / `attrStr`. If the passed `attrStr` has additional tokens that were not part
215
- // / of the type, an error is emitted.
216
- // TODO: Improve diagnostic reporting.
217
- Attribute parseAttribute (llvm::StringRef attrStr, MLIRContext *context);
218
- Attribute parseAttribute (llvm::StringRef attrStr, Type type);
219
-
220
- // / This parses a single MLIR attribute to an MLIR context if it was valid. If
221
- // / not, an error message is emitted through a new SourceMgrDiagnosticHandler
222
- // / constructed from a new SourceMgr with a single a MemoryBuffer wrapping
223
- // / `attrStr`. The number of characters of `attrStr` parsed in the process is
224
- // / returned in `numRead`.
225
- Attribute parseAttribute (llvm::StringRef attrStr, MLIRContext *context,
226
- size_t &numRead);
227
- Attribute parseAttribute (llvm::StringRef attrStr, Type type, size_t &numRead);
228
-
229
- // / This parses a single MLIR type to an MLIR context if it was valid. If not,
230
- // / an error message is emitted through a new SourceMgrDiagnosticHandler
231
- // / constructed from a new SourceMgr with a single a MemoryBuffer wrapping
232
- // / `typeStr`. If the passed `typeStr` has additional tokens that were not part
233
- // / of the type, an error is emitted.
234
- // TODO: Improve diagnostic reporting.
235
- Type parseType (llvm::StringRef typeStr, MLIRContext *context);
236
-
237
- // / This parses a single MLIR type to an MLIR context if it was valid. If not,
238
- // / an error message is emitted through a new SourceMgrDiagnosticHandler
239
- // / constructed from a new SourceMgr with a single a MemoryBuffer wrapping
240
- // / `typeStr`. The number of characters of `typeStr` parsed in the process is
241
- // / returned in `numRead`.
242
- Type parseType (llvm::StringRef typeStr, MLIRContext *context, size_t &numRead);
243
-
244
- // / This parses a single IntegerSet to an MLIR context if it was valid. If not,
245
- // / an error message is emitted through a new SourceMgrDiagnosticHandler
246
- // / constructed from a new SourceMgr with a single MemoryBuffer wrapping
247
- // / `str`. If the passed `str` has additional tokens that were not part of the
248
- // / IntegerSet, a failure is returned. Diagnostics are printed on failure if
249
- // / `printDiagnosticInfo` is true.
250
- IntegerSet parseIntegerSet (llvm::StringRef str, MLIRContext *context,
251
- bool printDiagnosticInfo = true );
252
-
253
198
} // namespace mlir
254
199
255
200
#endif // MLIR_PARSER_PARSER_H
0 commit comments