LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
AnalysisPasses.h.inc
Go to the documentation of this file.
1/* Autogenerated by mlir-tblgen; don't manually edit */
2
3#ifdef GEN_PASS_DECL
4// Generate declarations for all passes.
5#define GEN_PASS_DECL_CALLGRAPHPRINTERPASS
6#define GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
7#define GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
8#define GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
9#define GEN_PASS_DECL_PREDECESSORPRINTERPASS
10#define GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
11#define GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
12#undef GEN_PASS_DECL
13#endif // GEN_PASS_DECL
14
15//===----------------------------------------------------------------------===//
16// CallGraphPrinterPass
17//===----------------------------------------------------------------------===//
18#ifdef GEN_PASS_DECL_CALLGRAPHPRINTERPASS
19#undef GEN_PASS_DECL_CALLGRAPHPRINTERPASS
20#endif // GEN_PASS_DECL_CALLGRAPHPRINTERPASS
21#ifdef GEN_PASS_DEF_CALLGRAPHPRINTERPASS
22namespace impl {
23
24template <typename DerivedT>
25class CallGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
26public:
27 using Base = CallGraphPrinterPassBase;
28
29 CallGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
30 CallGraphPrinterPassBase(const CallGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
31 CallGraphPrinterPassBase& operator=(const CallGraphPrinterPassBase &) = delete;
32 CallGraphPrinterPassBase(CallGraphPrinterPassBase &&) = delete;
33 CallGraphPrinterPassBase& operator=(CallGraphPrinterPassBase &&) = delete;
34 ~CallGraphPrinterPassBase() = default;
35
37 static constexpr ::llvm::StringLiteral getArgumentName() {
38 return ::llvm::StringLiteral("llzk-print-call-graph");
39 }
40 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph"; }
41
42 ::llvm::StringRef getDescription() const override { return "Print the LLZK module's call graph."; }
43
45 static constexpr ::llvm::StringLiteral getPassName() {
46 return ::llvm::StringLiteral("CallGraphPrinterPass");
47 }
48 ::llvm::StringRef getName() const override { return "CallGraphPrinterPass"; }
49
51 static bool classof(const ::mlir::Pass *pass) {
52 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
53 }
54
56 std::unique_ptr<::mlir::Pass> clonePass() const override {
57 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
58 }
59
61 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
62 registry.insert<llzk::LLZKDialect>();
63 registry.insert<llzk::boolean::BoolDialect>();
64 registry.insert<llzk::array::ArrayDialect>();
65 registry.insert<llzk::component::StructDialect>();
66 registry.insert<llzk::constrain::ConstrainDialect>();
67 registry.insert<llzk::felt::FeltDialect>();
68 registry.insert<llzk::global::GlobalDialect>();
69 registry.insert<llzk::include::IncludeDialect>();
70 registry.insert<llzk::function::FunctionDialect>();
71 registry.insert<llzk::string::StringDialect>();
72 registry.insert<llzk::polymorphic::PolymorphicDialect>();
73 registry.insert<mlir::arith::ArithDialect>();
74 registry.insert<mlir::scf::SCFDialect>();
75 }
76
80 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphPrinterPassBase<DerivedT>)
81
82protected:
83private:
84};
85} // namespace impl
86#undef GEN_PASS_DEF_CALLGRAPHPRINTERPASS
87#endif // GEN_PASS_DEF_CALLGRAPHPRINTERPASS
88
89//===----------------------------------------------------------------------===//
90// CallGraphSCCsPrinterPass
91//===----------------------------------------------------------------------===//
92#ifdef GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
93#undef GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
94#endif // GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
95#ifdef GEN_PASS_DEF_CALLGRAPHSCCSPRINTERPASS
96namespace impl {
97
98template <typename DerivedT>
99class CallGraphSCCsPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
100public:
101 using Base = CallGraphSCCsPrinterPassBase;
102
103 CallGraphSCCsPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
104 CallGraphSCCsPrinterPassBase(const CallGraphSCCsPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
105 CallGraphSCCsPrinterPassBase& operator=(const CallGraphSCCsPrinterPassBase &) = delete;
106 CallGraphSCCsPrinterPassBase(CallGraphSCCsPrinterPassBase &&) = delete;
107 CallGraphSCCsPrinterPassBase& operator=(CallGraphSCCsPrinterPassBase &&) = delete;
108 ~CallGraphSCCsPrinterPassBase() = default;
109
111 static constexpr ::llvm::StringLiteral getArgumentName() {
112 return ::llvm::StringLiteral("llzk-print-call-graph-sccs");
113 }
114 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph-sccs"; }
115
116 ::llvm::StringRef getDescription() const override { return "Print the SCCs from the LLZK module's call graph."; }
117
119 static constexpr ::llvm::StringLiteral getPassName() {
120 return ::llvm::StringLiteral("CallGraphSCCsPrinterPass");
121 }
122 ::llvm::StringRef getName() const override { return "CallGraphSCCsPrinterPass"; }
123
125 static bool classof(const ::mlir::Pass *pass) {
126 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
127 }
128
130 std::unique_ptr<::mlir::Pass> clonePass() const override {
131 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
132 }
133
135 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
136 registry.insert<llzk::LLZKDialect>();
137 registry.insert<llzk::boolean::BoolDialect>();
138 registry.insert<llzk::array::ArrayDialect>();
139 registry.insert<llzk::component::StructDialect>();
140 registry.insert<llzk::constrain::ConstrainDialect>();
141 registry.insert<llzk::felt::FeltDialect>();
142 registry.insert<llzk::global::GlobalDialect>();
143 registry.insert<llzk::include::IncludeDialect>();
144 registry.insert<llzk::function::FunctionDialect>();
145 registry.insert<llzk::string::StringDialect>();
146 registry.insert<llzk::polymorphic::PolymorphicDialect>();
147 registry.insert<mlir::arith::ArithDialect>();
148 registry.insert<mlir::scf::SCFDialect>();
149 }
150
154 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphSCCsPrinterPassBase<DerivedT>)
155
156protected:
157private:
158};
159} // namespace impl
160#undef GEN_PASS_DEF_CALLGRAPHSCCSPRINTERPASS
161#endif // GEN_PASS_DEF_CALLGRAPHSCCSPRINTERPASS
162
163//===----------------------------------------------------------------------===//
164// ConstraintDependencyGraphPrinterPass
165//===----------------------------------------------------------------------===//
166#ifdef GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
167struct ConstraintDependencyGraphPrinterPassOptions {
168 bool runIntraprocedural = false;
169};
170#undef GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
171#endif // GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
172#ifdef GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
173namespace impl {
174
175template <typename DerivedT>
176class ConstraintDependencyGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
177public:
178 using Base = ConstraintDependencyGraphPrinterPassBase;
179
180 ConstraintDependencyGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
181 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
182 ConstraintDependencyGraphPrinterPassBase& operator=(const ConstraintDependencyGraphPrinterPassBase &) = delete;
183 ConstraintDependencyGraphPrinterPassBase(ConstraintDependencyGraphPrinterPassBase &&) = delete;
184 ConstraintDependencyGraphPrinterPassBase& operator=(ConstraintDependencyGraphPrinterPassBase &&) = delete;
185 ~ConstraintDependencyGraphPrinterPassBase() = default;
186
188 static constexpr ::llvm::StringLiteral getArgumentName() {
189 return ::llvm::StringLiteral("llzk-print-constraint-dependency-graphs");
190 }
191 ::llvm::StringRef getArgument() const override { return "llzk-print-constraint-dependency-graphs"; }
192
193 ::llvm::StringRef getDescription() const override { return "Print constraint dependency graph for all LLZK structs."; }
194
196 static constexpr ::llvm::StringLiteral getPassName() {
197 return ::llvm::StringLiteral("ConstraintDependencyGraphPrinterPass");
198 }
199 ::llvm::StringRef getName() const override { return "ConstraintDependencyGraphPrinterPass"; }
200
202 static bool classof(const ::mlir::Pass *pass) {
203 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
204 }
205
207 std::unique_ptr<::mlir::Pass> clonePass() const override {
208 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
209 }
210
212 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
213 registry.insert<llzk::LLZKDialect>();
214 registry.insert<llzk::boolean::BoolDialect>();
215 registry.insert<llzk::array::ArrayDialect>();
216 registry.insert<llzk::component::StructDialect>();
217 registry.insert<llzk::constrain::ConstrainDialect>();
218 registry.insert<llzk::felt::FeltDialect>();
219 registry.insert<llzk::global::GlobalDialect>();
220 registry.insert<llzk::include::IncludeDialect>();
221 registry.insert<llzk::function::FunctionDialect>();
222 registry.insert<llzk::string::StringDialect>();
223 registry.insert<llzk::polymorphic::PolymorphicDialect>();
224 registry.insert<mlir::arith::ArithDialect>();
225 registry.insert<mlir::scf::SCFDialect>();
226 }
227
231 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstraintDependencyGraphPrinterPassBase<DerivedT>)
232
233 ConstraintDependencyGraphPrinterPassBase(ConstraintDependencyGraphPrinterPassOptions options) : ConstraintDependencyGraphPrinterPassBase() {
234 runIntraprocedural = std::move(options.runIntraprocedural);
235 }
236protected:
237 ::mlir::Pass::Option<bool> runIntraprocedural{*this, "intraprocedural", ::llvm::cl::desc("Whether to run the analysis intra-procedurally only (default is false)."), ::llvm::cl::init(false)};
238private:
239};
240} // namespace impl
241#undef GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
242#endif // GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
243
244//===----------------------------------------------------------------------===//
245// IntervalAnalysisPrinterPass
246//===----------------------------------------------------------------------===//
247#ifdef GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
248struct IntervalAnalysisPrinterPassOptions {
249 std::string fieldName = "";
250 bool propagateInputConstraints = false;
251 bool printSolverConstraints = false;
252 bool printComputeIntervals = false;
253};
254#undef GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
255#endif // GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
256#ifdef GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
257namespace impl {
258
259template <typename DerivedT>
260class IntervalAnalysisPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
261public:
262 using Base = IntervalAnalysisPrinterPassBase;
263
264 IntervalAnalysisPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
265 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
266 IntervalAnalysisPrinterPassBase& operator=(const IntervalAnalysisPrinterPassBase &) = delete;
267 IntervalAnalysisPrinterPassBase(IntervalAnalysisPrinterPassBase &&) = delete;
268 IntervalAnalysisPrinterPassBase& operator=(IntervalAnalysisPrinterPassBase &&) = delete;
269 ~IntervalAnalysisPrinterPassBase() = default;
270
272 static constexpr ::llvm::StringLiteral getArgumentName() {
273 return ::llvm::StringLiteral("llzk-print-interval-analysis");
274 }
275 ::llvm::StringRef getArgument() const override { return "llzk-print-interval-analysis"; }
276
277 ::llvm::StringRef getDescription() const override { return "Print interval analysis results for all LLZK structs."; }
278
280 static constexpr ::llvm::StringLiteral getPassName() {
281 return ::llvm::StringLiteral("IntervalAnalysisPrinterPass");
282 }
283 ::llvm::StringRef getName() const override { return "IntervalAnalysisPrinterPass"; }
284
286 static bool classof(const ::mlir::Pass *pass) {
287 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
288 }
289
291 std::unique_ptr<::mlir::Pass> clonePass() const override {
292 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
293 }
294
296 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
297 registry.insert<llzk::LLZKDialect>();
298 registry.insert<llzk::boolean::BoolDialect>();
299 registry.insert<llzk::array::ArrayDialect>();
300 registry.insert<llzk::component::StructDialect>();
301 registry.insert<llzk::constrain::ConstrainDialect>();
302 registry.insert<llzk::felt::FeltDialect>();
303 registry.insert<llzk::global::GlobalDialect>();
304 registry.insert<llzk::include::IncludeDialect>();
305 registry.insert<llzk::function::FunctionDialect>();
306 registry.insert<llzk::string::StringDialect>();
307 registry.insert<llzk::polymorphic::PolymorphicDialect>();
308 registry.insert<mlir::arith::ArithDialect>();
309 registry.insert<mlir::scf::SCFDialect>();
310 }
311
315 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IntervalAnalysisPrinterPassBase<DerivedT>)
316
317 IntervalAnalysisPrinterPassBase(IntervalAnalysisPrinterPassOptions options) : IntervalAnalysisPrinterPassBase() {
318 fieldName = std::move(options.fieldName);
319 propagateInputConstraints = std::move(options.propagateInputConstraints);
320 printSolverConstraints = std::move(options.printSolverConstraints);
321 printComputeIntervals = std::move(options.printComputeIntervals);
322 }
323protected:
324 ::mlir::Pass::Option<std::string> fieldName{*this, "field", ::llvm::cl::desc("The field to use for interval analysis. If supplied, this always overrides the module's detected field. If omitted, the pass first tries to detect a single field from the enclosing module's felt usage and otherwise falls back to bn128. Supported fields: bn128/bn254, babybear, goldilocks, koalabear, mersenne31"), ::llvm::cl::init("")};
325 ::mlir::Pass::Option<bool> propagateInputConstraints{*this, "propagate-input-constraints", ::llvm::cl::desc("Whether to propagate constraints on inputs from @constrain to @compute functions. This allows for tighter intervals to possibly be found for computed values, assuming that the witness generator would include constraints as assertions during the computation."), ::llvm::cl::init(false)};
326 ::mlir::Pass::Option<bool> printSolverConstraints{*this, "print-solver-constraints", ::llvm::cl::desc("Whether to output SMT solver constraints along with intervals."), ::llvm::cl::init(false)};
327 ::mlir::Pass::Option<bool> printComputeIntervals{*this, "print-compute-intervals", ::llvm::cl::desc("Whether to print compute function intervals (default only prints constrain function intervals)."), ::llvm::cl::init(false)};
328private:
329};
330} // namespace impl
331#undef GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
332#endif // GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
333
334//===----------------------------------------------------------------------===//
335// PredecessorPrinterPass
336//===----------------------------------------------------------------------===//
337#ifdef GEN_PASS_DECL_PREDECESSORPRINTERPASS
338struct PredecessorPrinterPassOptions {
340 bool preRunRequiredAnalyses = false;
341};
342#undef GEN_PASS_DECL_PREDECESSORPRINTERPASS
343#endif // GEN_PASS_DECL_PREDECESSORPRINTERPASS
344#ifdef GEN_PASS_DEF_PREDECESSORPRINTERPASS
345namespace impl {
346
347template <typename DerivedT>
348class PredecessorPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
349public:
350 using Base = PredecessorPrinterPassBase;
351
352 PredecessorPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
353 PredecessorPrinterPassBase(const PredecessorPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
354 PredecessorPrinterPassBase& operator=(const PredecessorPrinterPassBase &) = delete;
355 PredecessorPrinterPassBase(PredecessorPrinterPassBase &&) = delete;
356 PredecessorPrinterPassBase& operator=(PredecessorPrinterPassBase &&) = delete;
357 ~PredecessorPrinterPassBase() = default;
358
360 static constexpr ::llvm::StringLiteral getArgumentName() {
361 return ::llvm::StringLiteral("llzk-print-predecessors");
362 }
363 ::llvm::StringRef getArgument() const override { return "llzk-print-predecessors"; }
364
365 ::llvm::StringRef getDescription() const override { return "Print the predecessors of all operations."; }
366
368 static constexpr ::llvm::StringLiteral getPassName() {
369 return ::llvm::StringLiteral("PredecessorPrinterPass");
370 }
371 ::llvm::StringRef getName() const override { return "PredecessorPrinterPass"; }
372
374 static bool classof(const ::mlir::Pass *pass) {
375 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
376 }
377
379 std::unique_ptr<::mlir::Pass> clonePass() const override {
380 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
381 }
382
384 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
385 registry.insert<llzk::LLZKDialect>();
386 registry.insert<llzk::boolean::BoolDialect>();
387 registry.insert<llzk::array::ArrayDialect>();
388 registry.insert<llzk::component::StructDialect>();
389 registry.insert<llzk::constrain::ConstrainDialect>();
390 registry.insert<llzk::felt::FeltDialect>();
391 registry.insert<llzk::global::GlobalDialect>();
392 registry.insert<llzk::include::IncludeDialect>();
393 registry.insert<llzk::function::FunctionDialect>();
394 registry.insert<llzk::string::StringDialect>();
395 registry.insert<llzk::polymorphic::PolymorphicDialect>();
396 registry.insert<mlir::arith::ArithDialect>();
397 registry.insert<mlir::scf::SCFDialect>();
398 }
399
403 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PredecessorPrinterPassBase<DerivedT>)
404
405 PredecessorPrinterPassBase(PredecessorPrinterPassOptions options) : PredecessorPrinterPassBase() {
406 outputStream = std::move(options.outputStream);
407 preRunRequiredAnalyses = std::move(options.preRunRequiredAnalyses);
408 }
409protected:
410 ::mlir::Pass::Option<::llzk::OutputStream> outputStream{*this, "stream", ::llvm::cl::desc("Specifies the stream to which the pass prints."), ::llvm::cl::init(::llzk::OutputStream::Errs), ::llvm::cl::values(
412 "Print pass output to 'llvm::outs()'"),
414 "Print pass output to 'llvm::errs()'"),
416 "Print pass output to 'llvm::dbgs()'")
417 )};
418 ::mlir::Pass::Option<bool> preRunRequiredAnalyses{*this, "prerun", ::llvm::cl::desc("Whether to pre-run the required dataflow analyses (e.g., liveness analysis)."), ::llvm::cl::init(false)};
419private:
420};
421} // namespace impl
422#undef GEN_PASS_DEF_PREDECESSORPRINTERPASS
423#endif // GEN_PASS_DEF_PREDECESSORPRINTERPASS
424
425//===----------------------------------------------------------------------===//
426// SymbolDefTreePrinterPass
427//===----------------------------------------------------------------------===//
428#ifdef GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
429struct SymbolDefTreePrinterPassOptions {
431 bool saveDotGraph = false;
432};
433#undef GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
434#endif // GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
435#ifdef GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
436namespace impl {
437
438template <typename DerivedT>
439class SymbolDefTreePrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
440public:
441 using Base = SymbolDefTreePrinterPassBase;
442
443 SymbolDefTreePrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
444 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
445 SymbolDefTreePrinterPassBase& operator=(const SymbolDefTreePrinterPassBase &) = delete;
446 SymbolDefTreePrinterPassBase(SymbolDefTreePrinterPassBase &&) = delete;
447 SymbolDefTreePrinterPassBase& operator=(SymbolDefTreePrinterPassBase &&) = delete;
448 ~SymbolDefTreePrinterPassBase() = default;
449
451 static constexpr ::llvm::StringLiteral getArgumentName() {
452 return ::llvm::StringLiteral("llzk-print-symbol-def-tree");
453 }
454 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-def-tree"; }
455
456 ::llvm::StringRef getDescription() const override { return "Print symbol definition tree."; }
457
459 static constexpr ::llvm::StringLiteral getPassName() {
460 return ::llvm::StringLiteral("SymbolDefTreePrinterPass");
461 }
462 ::llvm::StringRef getName() const override { return "SymbolDefTreePrinterPass"; }
463
465 static bool classof(const ::mlir::Pass *pass) {
466 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
467 }
468
470 std::unique_ptr<::mlir::Pass> clonePass() const override {
471 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
472 }
473
475 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
476 registry.insert<llzk::LLZKDialect>();
477 registry.insert<llzk::boolean::BoolDialect>();
478 registry.insert<llzk::array::ArrayDialect>();
479 registry.insert<llzk::component::StructDialect>();
480 registry.insert<llzk::constrain::ConstrainDialect>();
481 registry.insert<llzk::felt::FeltDialect>();
482 registry.insert<llzk::global::GlobalDialect>();
483 registry.insert<llzk::include::IncludeDialect>();
484 registry.insert<llzk::function::FunctionDialect>();
485 registry.insert<llzk::string::StringDialect>();
486 registry.insert<llzk::polymorphic::PolymorphicDialect>();
487 registry.insert<mlir::arith::ArithDialect>();
488 registry.insert<mlir::scf::SCFDialect>();
489 }
490
494 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDefTreePrinterPassBase<DerivedT>)
495
496 SymbolDefTreePrinterPassBase(SymbolDefTreePrinterPassOptions options) : SymbolDefTreePrinterPassBase() {
497 outputStream = std::move(options.outputStream);
498 saveDotGraph = std::move(options.saveDotGraph);
499 }
500protected:
501 ::mlir::Pass::Option<::llzk::OutputStream> outputStream{*this, "stream", ::llvm::cl::desc("Specifies the stream to which the pass prints."), ::llvm::cl::init(::llzk::OutputStream::Errs), ::llvm::cl::values(
503 "Print pass output to 'llvm::outs()'"),
505 "Print pass output to 'llvm::errs()'"),
507 "Print pass output to 'llvm::dbgs()'")
508 )};
509 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
510private:
511};
512} // namespace impl
513#undef GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
514#endif // GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
515
516//===----------------------------------------------------------------------===//
517// SymbolUseGraphPrinterPass
518//===----------------------------------------------------------------------===//
519#ifdef GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
520struct SymbolUseGraphPrinterPassOptions {
522 bool saveDotGraph = false;
523};
524#undef GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
525#endif // GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
526#ifdef GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
527namespace impl {
528
529template <typename DerivedT>
530class SymbolUseGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
531public:
532 using Base = SymbolUseGraphPrinterPassBase;
533
534 SymbolUseGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
535 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
536 SymbolUseGraphPrinterPassBase& operator=(const SymbolUseGraphPrinterPassBase &) = delete;
537 SymbolUseGraphPrinterPassBase(SymbolUseGraphPrinterPassBase &&) = delete;
538 SymbolUseGraphPrinterPassBase& operator=(SymbolUseGraphPrinterPassBase &&) = delete;
539 ~SymbolUseGraphPrinterPassBase() = default;
540
542 static constexpr ::llvm::StringLiteral getArgumentName() {
543 return ::llvm::StringLiteral("llzk-print-symbol-use-graph");
544 }
545 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-use-graph"; }
546
547 ::llvm::StringRef getDescription() const override { return "Print symbol use graph."; }
548
550 static constexpr ::llvm::StringLiteral getPassName() {
551 return ::llvm::StringLiteral("SymbolUseGraphPrinterPass");
552 }
553 ::llvm::StringRef getName() const override { return "SymbolUseGraphPrinterPass"; }
554
556 static bool classof(const ::mlir::Pass *pass) {
557 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
558 }
559
561 std::unique_ptr<::mlir::Pass> clonePass() const override {
562 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
563 }
564
566 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
567 registry.insert<llzk::LLZKDialect>();
568 registry.insert<llzk::boolean::BoolDialect>();
569 registry.insert<llzk::array::ArrayDialect>();
570 registry.insert<llzk::component::StructDialect>();
571 registry.insert<llzk::constrain::ConstrainDialect>();
572 registry.insert<llzk::felt::FeltDialect>();
573 registry.insert<llzk::global::GlobalDialect>();
574 registry.insert<llzk::include::IncludeDialect>();
575 registry.insert<llzk::function::FunctionDialect>();
576 registry.insert<llzk::string::StringDialect>();
577 registry.insert<llzk::polymorphic::PolymorphicDialect>();
578 registry.insert<mlir::arith::ArithDialect>();
579 registry.insert<mlir::scf::SCFDialect>();
580 }
581
585 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolUseGraphPrinterPassBase<DerivedT>)
586
587 SymbolUseGraphPrinterPassBase(SymbolUseGraphPrinterPassOptions options) : SymbolUseGraphPrinterPassBase() {
588 outputStream = std::move(options.outputStream);
589 saveDotGraph = std::move(options.saveDotGraph);
590 }
591protected:
592 ::mlir::Pass::Option<::llzk::OutputStream> outputStream{*this, "stream", ::llvm::cl::desc("Specifies the stream to which the pass prints."), ::llvm::cl::init(::llzk::OutputStream::Errs), ::llvm::cl::values(
594 "Print pass output to 'llvm::outs()'"),
596 "Print pass output to 'llvm::errs()'"),
598 "Print pass output to 'llvm::dbgs()'")
599 )};
600 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
601private:
602};
603} // namespace impl
604#undef GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
605#endif // GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
606#ifdef GEN_PASS_REGISTRATION
607
608//===----------------------------------------------------------------------===//
609// CallGraphPrinterPass Registration
610//===----------------------------------------------------------------------===//
611
612inline void registerCallGraphPrinterPass() {
613 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
614 return llzk::createCallGraphPrinterPass(llvm::errs());
615 });
616}
617
618// Old registration code, kept for temporary backwards compatibility.
620 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
621 return llzk::createCallGraphPrinterPass(llvm::errs());
622 });
623}
624
625//===----------------------------------------------------------------------===//
626// CallGraphSCCsPrinterPass Registration
627//===----------------------------------------------------------------------===//
628
630 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
631 return llzk::createCallGraphSCCsPrinterPass(llvm::errs());
632 });
633}
634
635// Old registration code, kept for temporary backwards compatibility.
637 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
638 return llzk::createCallGraphSCCsPrinterPass(llvm::errs());
639 });
640}
641
642//===----------------------------------------------------------------------===//
643// ConstraintDependencyGraphPrinterPass Registration
644//===----------------------------------------------------------------------===//
645
647 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
649 });
650}
651
652// Old registration code, kept for temporary backwards compatibility.
654 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
656 });
657}
658
659//===----------------------------------------------------------------------===//
660// IntervalAnalysisPrinterPass Registration
661//===----------------------------------------------------------------------===//
662
664 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
665 return llzk::createIntervalAnalysisPrinterPass(llvm::errs());
666 });
667}
668
669// Old registration code, kept for temporary backwards compatibility.
671 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
672 return llzk::createIntervalAnalysisPrinterPass(llvm::errs());
673 });
674}
675
676//===----------------------------------------------------------------------===//
677// PredecessorPrinterPass Registration
678//===----------------------------------------------------------------------===//
679
680inline void registerPredecessorPrinterPass() {
681 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
683 });
684}
685
686// Old registration code, kept for temporary backwards compatibility.
688 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
690 });
691}
692
693//===----------------------------------------------------------------------===//
694// SymbolDefTreePrinterPass Registration
695//===----------------------------------------------------------------------===//
696
698 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
700 });
701}
702
703// Old registration code, kept for temporary backwards compatibility.
705 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
707 });
708}
709
710//===----------------------------------------------------------------------===//
711// SymbolUseGraphPrinterPass Registration
712//===----------------------------------------------------------------------===//
713
715 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
717 });
718}
719
720// Old registration code, kept for temporary backwards compatibility.
722 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
724 });
725}
726
727//===----------------------------------------------------------------------===//
728// Analysis Registration
729//===----------------------------------------------------------------------===//
730
731inline void registerAnalysisPasses() {
739}
740#undef GEN_PASS_REGISTRATION
741#endif // GEN_PASS_REGISTRATION
742// Deprecated. Please use the new per-pass macros.
743#ifdef GEN_PASS_CLASSES
744
745template <typename DerivedT>
746class CallGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
747public:
748 using Base = CallGraphPrinterPassBase;
749
750 CallGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
751 CallGraphPrinterPassBase(const CallGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
752 CallGraphPrinterPassBase& operator=(const CallGraphPrinterPassBase &) = delete;
753 CallGraphPrinterPassBase(CallGraphPrinterPassBase &&) = delete;
754 CallGraphPrinterPassBase& operator=(CallGraphPrinterPassBase &&) = delete;
755 ~CallGraphPrinterPassBase() = default;
756
758 static constexpr ::llvm::StringLiteral getArgumentName() {
759 return ::llvm::StringLiteral("llzk-print-call-graph");
760 }
761 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph"; }
762
763 ::llvm::StringRef getDescription() const override { return "Print the LLZK module's call graph."; }
764
766 static constexpr ::llvm::StringLiteral getPassName() {
767 return ::llvm::StringLiteral("CallGraphPrinterPass");
768 }
769 ::llvm::StringRef getName() const override { return "CallGraphPrinterPass"; }
770
772 static bool classof(const ::mlir::Pass *pass) {
773 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
774 }
775
777 std::unique_ptr<::mlir::Pass> clonePass() const override {
778 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
779 }
780
782 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
783 registry.insert<llzk::LLZKDialect>();
784 registry.insert<llzk::boolean::BoolDialect>();
785 registry.insert<llzk::array::ArrayDialect>();
786 registry.insert<llzk::component::StructDialect>();
787 registry.insert<llzk::constrain::ConstrainDialect>();
788 registry.insert<llzk::felt::FeltDialect>();
789 registry.insert<llzk::global::GlobalDialect>();
790 registry.insert<llzk::include::IncludeDialect>();
791 registry.insert<llzk::function::FunctionDialect>();
792 registry.insert<llzk::string::StringDialect>();
793 registry.insert<llzk::polymorphic::PolymorphicDialect>();
794 registry.insert<mlir::arith::ArithDialect>();
795 registry.insert<mlir::scf::SCFDialect>();
796 }
797
801 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphPrinterPassBase<DerivedT>)
802
803protected:
804};
805
806template <typename DerivedT>
807class CallGraphSCCsPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
808public:
809 using Base = CallGraphSCCsPrinterPassBase;
810
811 CallGraphSCCsPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
812 CallGraphSCCsPrinterPassBase(const CallGraphSCCsPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
813 CallGraphSCCsPrinterPassBase& operator=(const CallGraphSCCsPrinterPassBase &) = delete;
814 CallGraphSCCsPrinterPassBase(CallGraphSCCsPrinterPassBase &&) = delete;
815 CallGraphSCCsPrinterPassBase& operator=(CallGraphSCCsPrinterPassBase &&) = delete;
816 ~CallGraphSCCsPrinterPassBase() = default;
817
819 static constexpr ::llvm::StringLiteral getArgumentName() {
820 return ::llvm::StringLiteral("llzk-print-call-graph-sccs");
821 }
822 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph-sccs"; }
823
824 ::llvm::StringRef getDescription() const override { return "Print the SCCs from the LLZK module's call graph."; }
825
827 static constexpr ::llvm::StringLiteral getPassName() {
828 return ::llvm::StringLiteral("CallGraphSCCsPrinterPass");
829 }
830 ::llvm::StringRef getName() const override { return "CallGraphSCCsPrinterPass"; }
831
833 static bool classof(const ::mlir::Pass *pass) {
834 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
835 }
836
838 std::unique_ptr<::mlir::Pass> clonePass() const override {
839 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
840 }
841
843 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
844 registry.insert<llzk::LLZKDialect>();
845 registry.insert<llzk::boolean::BoolDialect>();
846 registry.insert<llzk::array::ArrayDialect>();
847 registry.insert<llzk::component::StructDialect>();
848 registry.insert<llzk::constrain::ConstrainDialect>();
849 registry.insert<llzk::felt::FeltDialect>();
850 registry.insert<llzk::global::GlobalDialect>();
851 registry.insert<llzk::include::IncludeDialect>();
852 registry.insert<llzk::function::FunctionDialect>();
853 registry.insert<llzk::string::StringDialect>();
854 registry.insert<llzk::polymorphic::PolymorphicDialect>();
855 registry.insert<mlir::arith::ArithDialect>();
856 registry.insert<mlir::scf::SCFDialect>();
857 }
858
862 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphSCCsPrinterPassBase<DerivedT>)
863
864protected:
865};
866
867template <typename DerivedT>
868class ConstraintDependencyGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
869public:
870 using Base = ConstraintDependencyGraphPrinterPassBase;
871
872 ConstraintDependencyGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
873 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
874 ConstraintDependencyGraphPrinterPassBase& operator=(const ConstraintDependencyGraphPrinterPassBase &) = delete;
875 ConstraintDependencyGraphPrinterPassBase(ConstraintDependencyGraphPrinterPassBase &&) = delete;
876 ConstraintDependencyGraphPrinterPassBase& operator=(ConstraintDependencyGraphPrinterPassBase &&) = delete;
877 ~ConstraintDependencyGraphPrinterPassBase() = default;
878
880 static constexpr ::llvm::StringLiteral getArgumentName() {
881 return ::llvm::StringLiteral("llzk-print-constraint-dependency-graphs");
882 }
883 ::llvm::StringRef getArgument() const override { return "llzk-print-constraint-dependency-graphs"; }
884
885 ::llvm::StringRef getDescription() const override { return "Print constraint dependency graph for all LLZK structs."; }
886
888 static constexpr ::llvm::StringLiteral getPassName() {
889 return ::llvm::StringLiteral("ConstraintDependencyGraphPrinterPass");
890 }
891 ::llvm::StringRef getName() const override { return "ConstraintDependencyGraphPrinterPass"; }
892
894 static bool classof(const ::mlir::Pass *pass) {
895 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
896 }
897
899 std::unique_ptr<::mlir::Pass> clonePass() const override {
900 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
901 }
902
904 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
905 registry.insert<llzk::LLZKDialect>();
906 registry.insert<llzk::boolean::BoolDialect>();
907 registry.insert<llzk::array::ArrayDialect>();
908 registry.insert<llzk::component::StructDialect>();
909 registry.insert<llzk::constrain::ConstrainDialect>();
910 registry.insert<llzk::felt::FeltDialect>();
911 registry.insert<llzk::global::GlobalDialect>();
912 registry.insert<llzk::include::IncludeDialect>();
913 registry.insert<llzk::function::FunctionDialect>();
914 registry.insert<llzk::string::StringDialect>();
915 registry.insert<llzk::polymorphic::PolymorphicDialect>();
916 registry.insert<mlir::arith::ArithDialect>();
917 registry.insert<mlir::scf::SCFDialect>();
918 }
919
923 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstraintDependencyGraphPrinterPassBase<DerivedT>)
924
925protected:
926 ::mlir::Pass::Option<bool> runIntraprocedural{*this, "intraprocedural", ::llvm::cl::desc("Whether to run the analysis intra-procedurally only (default is false)."), ::llvm::cl::init(false)};
927};
928
929template <typename DerivedT>
930class IntervalAnalysisPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
931public:
932 using Base = IntervalAnalysisPrinterPassBase;
933
934 IntervalAnalysisPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
935 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
936 IntervalAnalysisPrinterPassBase& operator=(const IntervalAnalysisPrinterPassBase &) = delete;
937 IntervalAnalysisPrinterPassBase(IntervalAnalysisPrinterPassBase &&) = delete;
938 IntervalAnalysisPrinterPassBase& operator=(IntervalAnalysisPrinterPassBase &&) = delete;
939 ~IntervalAnalysisPrinterPassBase() = default;
940
942 static constexpr ::llvm::StringLiteral getArgumentName() {
943 return ::llvm::StringLiteral("llzk-print-interval-analysis");
944 }
945 ::llvm::StringRef getArgument() const override { return "llzk-print-interval-analysis"; }
946
947 ::llvm::StringRef getDescription() const override { return "Print interval analysis results for all LLZK structs."; }
948
950 static constexpr ::llvm::StringLiteral getPassName() {
951 return ::llvm::StringLiteral("IntervalAnalysisPrinterPass");
952 }
953 ::llvm::StringRef getName() const override { return "IntervalAnalysisPrinterPass"; }
954
956 static bool classof(const ::mlir::Pass *pass) {
957 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
958 }
959
961 std::unique_ptr<::mlir::Pass> clonePass() const override {
962 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
963 }
964
966 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
967 registry.insert<llzk::LLZKDialect>();
968 registry.insert<llzk::boolean::BoolDialect>();
969 registry.insert<llzk::array::ArrayDialect>();
970 registry.insert<llzk::component::StructDialect>();
971 registry.insert<llzk::constrain::ConstrainDialect>();
972 registry.insert<llzk::felt::FeltDialect>();
973 registry.insert<llzk::global::GlobalDialect>();
974 registry.insert<llzk::include::IncludeDialect>();
975 registry.insert<llzk::function::FunctionDialect>();
976 registry.insert<llzk::string::StringDialect>();
977 registry.insert<llzk::polymorphic::PolymorphicDialect>();
978 registry.insert<mlir::arith::ArithDialect>();
979 registry.insert<mlir::scf::SCFDialect>();
980 }
981
985 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IntervalAnalysisPrinterPassBase<DerivedT>)
986
987protected:
988 ::mlir::Pass::Option<std::string> fieldName{*this, "field", ::llvm::cl::desc("The field to use for interval analysis. If supplied, this always overrides the module's detected field. If omitted, the pass first tries to detect a single field from the enclosing module's felt usage and otherwise falls back to bn128. Supported fields: bn128/bn254, babybear, goldilocks, koalabear, mersenne31"), ::llvm::cl::init("")};
989 ::mlir::Pass::Option<bool> propagateInputConstraints{*this, "propagate-input-constraints", ::llvm::cl::desc("Whether to propagate constraints on inputs from @constrain to @compute functions. This allows for tighter intervals to possibly be found for computed values, assuming that the witness generator would include constraints as assertions during the computation."), ::llvm::cl::init(false)};
990 ::mlir::Pass::Option<bool> printSolverConstraints{*this, "print-solver-constraints", ::llvm::cl::desc("Whether to output SMT solver constraints along with intervals."), ::llvm::cl::init(false)};
991 ::mlir::Pass::Option<bool> printComputeIntervals{*this, "print-compute-intervals", ::llvm::cl::desc("Whether to print compute function intervals (default only prints constrain function intervals)."), ::llvm::cl::init(false)};
992};
993
994template <typename DerivedT>
995class PredecessorPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
996public:
997 using Base = PredecessorPrinterPassBase;
998
999 PredecessorPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
1000 PredecessorPrinterPassBase(const PredecessorPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
1001 PredecessorPrinterPassBase& operator=(const PredecessorPrinterPassBase &) = delete;
1002 PredecessorPrinterPassBase(PredecessorPrinterPassBase &&) = delete;
1003 PredecessorPrinterPassBase& operator=(PredecessorPrinterPassBase &&) = delete;
1004 ~PredecessorPrinterPassBase() = default;
1005
1007 static constexpr ::llvm::StringLiteral getArgumentName() {
1008 return ::llvm::StringLiteral("llzk-print-predecessors");
1009 }
1010 ::llvm::StringRef getArgument() const override { return "llzk-print-predecessors"; }
1011
1012 ::llvm::StringRef getDescription() const override { return "Print the predecessors of all operations."; }
1013
1015 static constexpr ::llvm::StringLiteral getPassName() {
1016 return ::llvm::StringLiteral("PredecessorPrinterPass");
1017 }
1018 ::llvm::StringRef getName() const override { return "PredecessorPrinterPass"; }
1019
1021 static bool classof(const ::mlir::Pass *pass) {
1022 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
1023 }
1024
1026 std::unique_ptr<::mlir::Pass> clonePass() const override {
1027 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
1028 }
1029
1031 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
1032 registry.insert<llzk::LLZKDialect>();
1033 registry.insert<llzk::boolean::BoolDialect>();
1034 registry.insert<llzk::array::ArrayDialect>();
1035 registry.insert<llzk::component::StructDialect>();
1036 registry.insert<llzk::constrain::ConstrainDialect>();
1037 registry.insert<llzk::felt::FeltDialect>();
1038 registry.insert<llzk::global::GlobalDialect>();
1039 registry.insert<llzk::include::IncludeDialect>();
1040 registry.insert<llzk::function::FunctionDialect>();
1041 registry.insert<llzk::string::StringDialect>();
1042 registry.insert<llzk::polymorphic::PolymorphicDialect>();
1043 registry.insert<mlir::arith::ArithDialect>();
1044 registry.insert<mlir::scf::SCFDialect>();
1045 }
1046
1050 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PredecessorPrinterPassBase<DerivedT>)
1051
1052protected:
1053 ::mlir::Pass::Option<::llzk::OutputStream> outputStream{*this, "stream", ::llvm::cl::desc("Specifies the stream to which the pass prints."), ::llvm::cl::init(::llzk::OutputStream::Errs), ::llvm::cl::values(
1055 "Print pass output to 'llvm::outs()'"),
1057 "Print pass output to 'llvm::errs()'"),
1059 "Print pass output to 'llvm::dbgs()'")
1060 )};
1061 ::mlir::Pass::Option<bool> preRunRequiredAnalyses{*this, "prerun", ::llvm::cl::desc("Whether to pre-run the required dataflow analyses (e.g., liveness analysis)."), ::llvm::cl::init(false)};
1062};
1063
1064template <typename DerivedT>
1065class SymbolDefTreePrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
1066public:
1067 using Base = SymbolDefTreePrinterPassBase;
1068
1069 SymbolDefTreePrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
1070 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
1071 SymbolDefTreePrinterPassBase& operator=(const SymbolDefTreePrinterPassBase &) = delete;
1072 SymbolDefTreePrinterPassBase(SymbolDefTreePrinterPassBase &&) = delete;
1073 SymbolDefTreePrinterPassBase& operator=(SymbolDefTreePrinterPassBase &&) = delete;
1074 ~SymbolDefTreePrinterPassBase() = default;
1075
1077 static constexpr ::llvm::StringLiteral getArgumentName() {
1078 return ::llvm::StringLiteral("llzk-print-symbol-def-tree");
1079 }
1080 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-def-tree"; }
1081
1082 ::llvm::StringRef getDescription() const override { return "Print symbol definition tree."; }
1083
1085 static constexpr ::llvm::StringLiteral getPassName() {
1086 return ::llvm::StringLiteral("SymbolDefTreePrinterPass");
1087 }
1088 ::llvm::StringRef getName() const override { return "SymbolDefTreePrinterPass"; }
1089
1091 static bool classof(const ::mlir::Pass *pass) {
1092 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
1093 }
1094
1096 std::unique_ptr<::mlir::Pass> clonePass() const override {
1097 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
1098 }
1099
1101 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
1102 registry.insert<llzk::LLZKDialect>();
1103 registry.insert<llzk::boolean::BoolDialect>();
1104 registry.insert<llzk::array::ArrayDialect>();
1105 registry.insert<llzk::component::StructDialect>();
1106 registry.insert<llzk::constrain::ConstrainDialect>();
1107 registry.insert<llzk::felt::FeltDialect>();
1108 registry.insert<llzk::global::GlobalDialect>();
1109 registry.insert<llzk::include::IncludeDialect>();
1110 registry.insert<llzk::function::FunctionDialect>();
1111 registry.insert<llzk::string::StringDialect>();
1112 registry.insert<llzk::polymorphic::PolymorphicDialect>();
1113 registry.insert<mlir::arith::ArithDialect>();
1114 registry.insert<mlir::scf::SCFDialect>();
1115 }
1116
1120 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDefTreePrinterPassBase<DerivedT>)
1121
1122protected:
1123 ::mlir::Pass::Option<::llzk::OutputStream> outputStream{*this, "stream", ::llvm::cl::desc("Specifies the stream to which the pass prints."), ::llvm::cl::init(::llzk::OutputStream::Errs), ::llvm::cl::values(
1125 "Print pass output to 'llvm::outs()'"),
1127 "Print pass output to 'llvm::errs()'"),
1129 "Print pass output to 'llvm::dbgs()'")
1130 )};
1131 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
1132};
1133
1134template <typename DerivedT>
1135class SymbolUseGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
1136public:
1137 using Base = SymbolUseGraphPrinterPassBase;
1138
1139 SymbolUseGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
1140 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
1141 SymbolUseGraphPrinterPassBase& operator=(const SymbolUseGraphPrinterPassBase &) = delete;
1142 SymbolUseGraphPrinterPassBase(SymbolUseGraphPrinterPassBase &&) = delete;
1143 SymbolUseGraphPrinterPassBase& operator=(SymbolUseGraphPrinterPassBase &&) = delete;
1144 ~SymbolUseGraphPrinterPassBase() = default;
1145
1147 static constexpr ::llvm::StringLiteral getArgumentName() {
1148 return ::llvm::StringLiteral("llzk-print-symbol-use-graph");
1149 }
1150 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-use-graph"; }
1151
1152 ::llvm::StringRef getDescription() const override { return "Print symbol use graph."; }
1153
1155 static constexpr ::llvm::StringLiteral getPassName() {
1156 return ::llvm::StringLiteral("SymbolUseGraphPrinterPass");
1157 }
1158 ::llvm::StringRef getName() const override { return "SymbolUseGraphPrinterPass"; }
1159
1161 static bool classof(const ::mlir::Pass *pass) {
1162 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
1163 }
1164
1166 std::unique_ptr<::mlir::Pass> clonePass() const override {
1167 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
1168 }
1169
1171 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
1172 registry.insert<llzk::LLZKDialect>();
1173 registry.insert<llzk::boolean::BoolDialect>();
1174 registry.insert<llzk::array::ArrayDialect>();
1175 registry.insert<llzk::component::StructDialect>();
1176 registry.insert<llzk::constrain::ConstrainDialect>();
1177 registry.insert<llzk::felt::FeltDialect>();
1178 registry.insert<llzk::global::GlobalDialect>();
1179 registry.insert<llzk::include::IncludeDialect>();
1180 registry.insert<llzk::function::FunctionDialect>();
1181 registry.insert<llzk::string::StringDialect>();
1182 registry.insert<llzk::polymorphic::PolymorphicDialect>();
1183 registry.insert<mlir::arith::ArithDialect>();
1184 registry.insert<mlir::scf::SCFDialect>();
1185 }
1186
1190 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolUseGraphPrinterPassBase<DerivedT>)
1191
1192protected:
1193 ::mlir::Pass::Option<::llzk::OutputStream> outputStream{*this, "stream", ::llvm::cl::desc("Specifies the stream to which the pass prints."), ::llvm::cl::init(::llzk::OutputStream::Errs), ::llvm::cl::values(
1195 "Print pass output to 'llvm::outs()'"),
1197 "Print pass output to 'llvm::errs()'"),
1199 "Print pass output to 'llvm::dbgs()'")
1200 )};
1201 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
1202};
1203#undef GEN_PASS_CLASSES
1204#endif // GEN_PASS_CLASSES
void registerIntervalAnalysisPrinterPassPass()
void registerSymbolDefTreePrinterPassPass()
std::unique_ptr< mlir::Pass > createPredecessorPrinterPass()
void registerPredecessorPrinterPassPass()
void registerIntervalAnalysisPrinterPass()
std::unique_ptr< mlir::Pass > createSymbolUseGraphPrinterPass()
void registerSymbolUseGraphPrinterPassPass()
std::unique_ptr< mlir::Pass > createConstraintDependencyGraphPrinterPass(llvm::raw_ostream &os=llvm::errs())
std::unique_ptr< mlir::Pass > createIntervalAnalysisPrinterPass(llvm::raw_ostream &os=llvm::errs())
void registerCallGraphPrinterPass()
void registerConstraintDependencyGraphPrinterPass()
void registerSymbolUseGraphPrinterPass()
std::unique_ptr< mlir::Pass > createSymbolDefTreePrinterPass()
std::unique_ptr< mlir::Pass > createCallGraphSCCsPrinterPass(llvm::raw_ostream &os=llvm::errs())
std::unique_ptr< mlir::Pass > createCallGraphPrinterPass(llvm::raw_ostream &os=llvm::errs())
void registerCallGraphPrinterPassPass()
::llvm::StringRef stringifyOutputStream(OutputStream val)
void registerPredecessorPrinterPass()
void registerCallGraphSCCsPrinterPass()
void registerConstraintDependencyGraphPrinterPassPass()
void registerCallGraphSCCsPrinterPassPass()
void registerAnalysisPasses()
void registerSymbolDefTreePrinterPass()