LLZK 0.1.0
Veridise's ZK Language IR
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_SYMBOLDEFTREEPRINTERPASS
10#define GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
11#undef GEN_PASS_DECL
12#endif // GEN_PASS_DECL
13
14//===----------------------------------------------------------------------===//
15// CallGraphPrinterPass
16//===----------------------------------------------------------------------===//
17#ifdef GEN_PASS_DECL_CALLGRAPHPRINTERPASS
18#undef GEN_PASS_DECL_CALLGRAPHPRINTERPASS
19#endif // GEN_PASS_DECL_CALLGRAPHPRINTERPASS
20#ifdef GEN_PASS_DEF_CALLGRAPHPRINTERPASS
21namespace impl {
22
23template <typename DerivedT>
24class CallGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
25public:
26 using Base = CallGraphPrinterPassBase;
27
28 CallGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
29 CallGraphPrinterPassBase(const CallGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
30
32 static constexpr ::llvm::StringLiteral getArgumentName() {
33 return ::llvm::StringLiteral("llzk-print-call-graph");
34 }
35 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph"; }
36
37 ::llvm::StringRef getDescription() const override { return "Print the LLZK module's call graph."; }
38
40 static constexpr ::llvm::StringLiteral getPassName() {
41 return ::llvm::StringLiteral("CallGraphPrinterPass");
42 }
43 ::llvm::StringRef getName() const override { return "CallGraphPrinterPass"; }
44
46 static bool classof(const ::mlir::Pass *pass) {
47 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
48 }
49
51 std::unique_ptr<::mlir::Pass> clonePass() const override {
52 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
53 }
54
56 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
57 registry.insert<llzk::LLZKDialect>();
58 registry.insert<llzk::boolean::BoolDialect>();
59 registry.insert<llzk::array::ArrayDialect>();
60 registry.insert<llzk::component::StructDialect>();
61 registry.insert<llzk::constrain::ConstrainDialect>();
62 registry.insert<llzk::felt::FeltDialect>();
63 registry.insert<llzk::global::GlobalDialect>();
64 registry.insert<llzk::include::IncludeDialect>();
65 registry.insert<llzk::function::FunctionDialect>();
66 registry.insert<llzk::string::StringDialect>();
67 registry.insert<llzk::polymorphic::PolymorphicDialect>();
68 registry.insert<llzk::undef::UndefDialect>();
69 registry.insert<mlir::arith::ArithDialect>();
70 registry.insert<mlir::scf::SCFDialect>();
71 }
72
76 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphPrinterPassBase<DerivedT>)
77
78protected:
79private:
80};
81} // namespace impl
82#undef GEN_PASS_DEF_CALLGRAPHPRINTERPASS
83#endif // GEN_PASS_DEF_CALLGRAPHPRINTERPASS
84
85//===----------------------------------------------------------------------===//
86// CallGraphSCCsPrinterPass
87//===----------------------------------------------------------------------===//
88#ifdef GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
89#undef GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
90#endif // GEN_PASS_DECL_CALLGRAPHSCCSPRINTERPASS
91#ifdef GEN_PASS_DEF_CALLGRAPHSCCSPRINTERPASS
92namespace impl {
93
94template <typename DerivedT>
95class CallGraphSCCsPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
96public:
97 using Base = CallGraphSCCsPrinterPassBase;
98
99 CallGraphSCCsPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
100 CallGraphSCCsPrinterPassBase(const CallGraphSCCsPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
101
103 static constexpr ::llvm::StringLiteral getArgumentName() {
104 return ::llvm::StringLiteral("llzk-print-call-graph-sccs");
105 }
106 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph-sccs"; }
107
108 ::llvm::StringRef getDescription() const override { return "Print the SCCs from the LLZK module's call graph."; }
109
111 static constexpr ::llvm::StringLiteral getPassName() {
112 return ::llvm::StringLiteral("CallGraphSCCsPrinterPass");
113 }
114 ::llvm::StringRef getName() const override { return "CallGraphSCCsPrinterPass"; }
115
117 static bool classof(const ::mlir::Pass *pass) {
118 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
119 }
120
122 std::unique_ptr<::mlir::Pass> clonePass() const override {
123 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
124 }
125
127 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
128 registry.insert<llzk::LLZKDialect>();
129 registry.insert<llzk::boolean::BoolDialect>();
130 registry.insert<llzk::array::ArrayDialect>();
131 registry.insert<llzk::component::StructDialect>();
132 registry.insert<llzk::constrain::ConstrainDialect>();
133 registry.insert<llzk::felt::FeltDialect>();
134 registry.insert<llzk::global::GlobalDialect>();
135 registry.insert<llzk::include::IncludeDialect>();
136 registry.insert<llzk::function::FunctionDialect>();
137 registry.insert<llzk::string::StringDialect>();
138 registry.insert<llzk::polymorphic::PolymorphicDialect>();
139 registry.insert<llzk::undef::UndefDialect>();
140 registry.insert<mlir::arith::ArithDialect>();
141 registry.insert<mlir::scf::SCFDialect>();
142 }
143
147 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphSCCsPrinterPassBase<DerivedT>)
148
149protected:
150private:
151};
152} // namespace impl
153#undef GEN_PASS_DEF_CALLGRAPHSCCSPRINTERPASS
154#endif // GEN_PASS_DEF_CALLGRAPHSCCSPRINTERPASS
155
156//===----------------------------------------------------------------------===//
157// ConstraintDependencyGraphPrinterPass
158//===----------------------------------------------------------------------===//
159#ifdef GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
160struct ConstraintDependencyGraphPrinterPassOptions {
161 bool runIntraprocedural = false;
162};
163#undef GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
164#endif // GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
165#ifdef GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
166namespace impl {
167
168template <typename DerivedT>
169class ConstraintDependencyGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
170public:
171 using Base = ConstraintDependencyGraphPrinterPassBase;
172
173 ConstraintDependencyGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
174 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
175
177 static constexpr ::llvm::StringLiteral getArgumentName() {
178 return ::llvm::StringLiteral("llzk-print-constraint-dependency-graphs");
179 }
180 ::llvm::StringRef getArgument() const override { return "llzk-print-constraint-dependency-graphs"; }
181
182 ::llvm::StringRef getDescription() const override { return "Print constraint dependency graph for all LLZK structs."; }
183
185 static constexpr ::llvm::StringLiteral getPassName() {
186 return ::llvm::StringLiteral("ConstraintDependencyGraphPrinterPass");
187 }
188 ::llvm::StringRef getName() const override { return "ConstraintDependencyGraphPrinterPass"; }
189
191 static bool classof(const ::mlir::Pass *pass) {
192 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
193 }
194
196 std::unique_ptr<::mlir::Pass> clonePass() const override {
197 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
198 }
199
201 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
202 registry.insert<llzk::LLZKDialect>();
203 registry.insert<llzk::boolean::BoolDialect>();
204 registry.insert<llzk::array::ArrayDialect>();
205 registry.insert<llzk::component::StructDialect>();
206 registry.insert<llzk::constrain::ConstrainDialect>();
207 registry.insert<llzk::felt::FeltDialect>();
208 registry.insert<llzk::global::GlobalDialect>();
209 registry.insert<llzk::include::IncludeDialect>();
210 registry.insert<llzk::function::FunctionDialect>();
211 registry.insert<llzk::string::StringDialect>();
212 registry.insert<llzk::polymorphic::PolymorphicDialect>();
213 registry.insert<llzk::undef::UndefDialect>();
214 registry.insert<mlir::arith::ArithDialect>();
215 registry.insert<mlir::scf::SCFDialect>();
216 }
217
221 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstraintDependencyGraphPrinterPassBase<DerivedT>)
222
223 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassOptions &options) : ConstraintDependencyGraphPrinterPassBase() {
224 runIntraprocedural = options.runIntraprocedural;
225 }
226protected:
227 ::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)};
228private:
229};
230} // namespace impl
231#undef GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
232#endif // GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
233
234//===----------------------------------------------------------------------===//
235// IntervalAnalysisPrinterPass
236//===----------------------------------------------------------------------===//
237#ifdef GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
238struct IntervalAnalysisPrinterPassOptions {
239 std::string fieldName = "bn128";
240 bool propagateInputConstraints = false;
241 bool printSolverConstraints = false;
242 bool printComputeIntervals = false;
243};
244#undef GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
245#endif // GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
246#ifdef GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
247namespace impl {
248
249template <typename DerivedT>
250class IntervalAnalysisPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
251public:
252 using Base = IntervalAnalysisPrinterPassBase;
253
254 IntervalAnalysisPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
255 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
256
258 static constexpr ::llvm::StringLiteral getArgumentName() {
259 return ::llvm::StringLiteral("llzk-print-interval-analysis");
260 }
261 ::llvm::StringRef getArgument() const override { return "llzk-print-interval-analysis"; }
262
263 ::llvm::StringRef getDescription() const override { return "Print interval analysis results for all LLZK structs."; }
264
266 static constexpr ::llvm::StringLiteral getPassName() {
267 return ::llvm::StringLiteral("IntervalAnalysisPrinterPass");
268 }
269 ::llvm::StringRef getName() const override { return "IntervalAnalysisPrinterPass"; }
270
272 static bool classof(const ::mlir::Pass *pass) {
273 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
274 }
275
277 std::unique_ptr<::mlir::Pass> clonePass() const override {
278 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
279 }
280
282 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
283 registry.insert<llzk::LLZKDialect>();
284 registry.insert<llzk::boolean::BoolDialect>();
285 registry.insert<llzk::array::ArrayDialect>();
286 registry.insert<llzk::component::StructDialect>();
287 registry.insert<llzk::constrain::ConstrainDialect>();
288 registry.insert<llzk::felt::FeltDialect>();
289 registry.insert<llzk::global::GlobalDialect>();
290 registry.insert<llzk::include::IncludeDialect>();
291 registry.insert<llzk::function::FunctionDialect>();
292 registry.insert<llzk::string::StringDialect>();
293 registry.insert<llzk::polymorphic::PolymorphicDialect>();
294 registry.insert<llzk::undef::UndefDialect>();
295 registry.insert<mlir::arith::ArithDialect>();
296 registry.insert<mlir::scf::SCFDialect>();
297 }
298
302 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IntervalAnalysisPrinterPassBase<DerivedT>)
303
304 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassOptions &options) : IntervalAnalysisPrinterPassBase() {
305 fieldName = options.fieldName;
306 propagateInputConstraints = options.propagateInputConstraints;
307 printSolverConstraints = options.printSolverConstraints;
308 printComputeIntervals = options.printComputeIntervals;
309 }
310protected:
311 ::mlir::Pass::Option<std::string> fieldName{*this, "field", ::llvm::cl::desc("The field to use for interval analysis. Supported fields: bn128/bn254, babybear, goldilocks, mersenne31"), ::llvm::cl::init("bn128")};
312 ::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)};
313 ::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)};
314 ::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)};
315private:
316};
317} // namespace impl
318#undef GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
319#endif // GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
320
321//===----------------------------------------------------------------------===//
322// SymbolDefTreePrinterPass
323//===----------------------------------------------------------------------===//
324#ifdef GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
325struct SymbolDefTreePrinterPassOptions {
327 bool saveDotGraph = false;
328};
329#undef GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
330#endif // GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
331#ifdef GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
332namespace impl {
333
334template <typename DerivedT>
335class SymbolDefTreePrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
336public:
337 using Base = SymbolDefTreePrinterPassBase;
338
339 SymbolDefTreePrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
340 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
341
343 static constexpr ::llvm::StringLiteral getArgumentName() {
344 return ::llvm::StringLiteral("llzk-print-symbol-def-tree");
345 }
346 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-def-tree"; }
347
348 ::llvm::StringRef getDescription() const override { return "Print symbol definition tree."; }
349
351 static constexpr ::llvm::StringLiteral getPassName() {
352 return ::llvm::StringLiteral("SymbolDefTreePrinterPass");
353 }
354 ::llvm::StringRef getName() const override { return "SymbolDefTreePrinterPass"; }
355
357 static bool classof(const ::mlir::Pass *pass) {
358 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
359 }
360
362 std::unique_ptr<::mlir::Pass> clonePass() const override {
363 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
364 }
365
367 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
368 registry.insert<llzk::LLZKDialect>();
369 registry.insert<llzk::boolean::BoolDialect>();
370 registry.insert<llzk::array::ArrayDialect>();
371 registry.insert<llzk::component::StructDialect>();
372 registry.insert<llzk::constrain::ConstrainDialect>();
373 registry.insert<llzk::felt::FeltDialect>();
374 registry.insert<llzk::global::GlobalDialect>();
375 registry.insert<llzk::include::IncludeDialect>();
376 registry.insert<llzk::function::FunctionDialect>();
377 registry.insert<llzk::string::StringDialect>();
378 registry.insert<llzk::polymorphic::PolymorphicDialect>();
379 registry.insert<llzk::undef::UndefDialect>();
380 registry.insert<mlir::arith::ArithDialect>();
381 registry.insert<mlir::scf::SCFDialect>();
382 }
383
387 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDefTreePrinterPassBase<DerivedT>)
388
389 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassOptions &options) : SymbolDefTreePrinterPassBase() {
390 outputStream = options.outputStream;
391 saveDotGraph = options.saveDotGraph;
392 }
393protected:
394 ::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(
396 "Print pass output to 'llvm::outs()'"),
398 "Print pass output to 'llvm::errs()'"),
400 "Print pass output to 'llvm::dbgs()'")
401 )};
402 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
403private:
404};
405} // namespace impl
406#undef GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
407#endif // GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
408
409//===----------------------------------------------------------------------===//
410// SymbolUseGraphPrinterPass
411//===----------------------------------------------------------------------===//
412#ifdef GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
413struct SymbolUseGraphPrinterPassOptions {
415 bool saveDotGraph = false;
416};
417#undef GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
418#endif // GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
419#ifdef GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
420namespace impl {
421
422template <typename DerivedT>
423class SymbolUseGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
424public:
425 using Base = SymbolUseGraphPrinterPassBase;
426
427 SymbolUseGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
428 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
429
431 static constexpr ::llvm::StringLiteral getArgumentName() {
432 return ::llvm::StringLiteral("llzk-print-symbol-use-graph");
433 }
434 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-use-graph"; }
435
436 ::llvm::StringRef getDescription() const override { return "Print symbol use graph."; }
437
439 static constexpr ::llvm::StringLiteral getPassName() {
440 return ::llvm::StringLiteral("SymbolUseGraphPrinterPass");
441 }
442 ::llvm::StringRef getName() const override { return "SymbolUseGraphPrinterPass"; }
443
445 static bool classof(const ::mlir::Pass *pass) {
446 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
447 }
448
450 std::unique_ptr<::mlir::Pass> clonePass() const override {
451 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
452 }
453
455 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
456 registry.insert<llzk::LLZKDialect>();
457 registry.insert<llzk::boolean::BoolDialect>();
458 registry.insert<llzk::array::ArrayDialect>();
459 registry.insert<llzk::component::StructDialect>();
460 registry.insert<llzk::constrain::ConstrainDialect>();
461 registry.insert<llzk::felt::FeltDialect>();
462 registry.insert<llzk::global::GlobalDialect>();
463 registry.insert<llzk::include::IncludeDialect>();
464 registry.insert<llzk::function::FunctionDialect>();
465 registry.insert<llzk::string::StringDialect>();
466 registry.insert<llzk::polymorphic::PolymorphicDialect>();
467 registry.insert<llzk::undef::UndefDialect>();
468 registry.insert<mlir::arith::ArithDialect>();
469 registry.insert<mlir::scf::SCFDialect>();
470 }
471
475 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolUseGraphPrinterPassBase<DerivedT>)
476
477 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassOptions &options) : SymbolUseGraphPrinterPassBase() {
478 outputStream = options.outputStream;
479 saveDotGraph = options.saveDotGraph;
480 }
481protected:
482 ::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(
484 "Print pass output to 'llvm::outs()'"),
486 "Print pass output to 'llvm::errs()'"),
488 "Print pass output to 'llvm::dbgs()'")
489 )};
490 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
491private:
492};
493} // namespace impl
494#undef GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
495#endif // GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
496#ifdef GEN_PASS_REGISTRATION
497
498//===----------------------------------------------------------------------===//
499// CallGraphPrinterPass Registration
500//===----------------------------------------------------------------------===//
501
502inline void registerCallGraphPrinterPass() {
503 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
504 return llzk::createCallGraphPrinterPass(llvm::errs());
505 });
506}
507
508// Old registration code, kept for temporary backwards compatibility.
510 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
511 return llzk::createCallGraphPrinterPass(llvm::errs());
512 });
513}
514
515//===----------------------------------------------------------------------===//
516// CallGraphSCCsPrinterPass Registration
517//===----------------------------------------------------------------------===//
518
520 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
521 return llzk::createCallGraphSCCsPrinterPass(llvm::errs());
522 });
523}
524
525// Old registration code, kept for temporary backwards compatibility.
527 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
528 return llzk::createCallGraphSCCsPrinterPass(llvm::errs());
529 });
530}
531
532//===----------------------------------------------------------------------===//
533// ConstraintDependencyGraphPrinterPass Registration
534//===----------------------------------------------------------------------===//
535
537 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
539 });
540}
541
542// Old registration code, kept for temporary backwards compatibility.
544 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
546 });
547}
548
549//===----------------------------------------------------------------------===//
550// IntervalAnalysisPrinterPass Registration
551//===----------------------------------------------------------------------===//
552
554 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
555 return llzk::createIntervalAnalysisPrinterPass(llvm::errs());
556 });
557}
558
559// Old registration code, kept for temporary backwards compatibility.
561 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
562 return llzk::createIntervalAnalysisPrinterPass(llvm::errs());
563 });
564}
565
566//===----------------------------------------------------------------------===//
567// SymbolDefTreePrinterPass Registration
568//===----------------------------------------------------------------------===//
569
571 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
573 });
574}
575
576// Old registration code, kept for temporary backwards compatibility.
578 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
580 });
581}
582
583//===----------------------------------------------------------------------===//
584// SymbolUseGraphPrinterPass Registration
585//===----------------------------------------------------------------------===//
586
588 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
590 });
591}
592
593// Old registration code, kept for temporary backwards compatibility.
595 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
597 });
598}
599
600//===----------------------------------------------------------------------===//
601// Analysis Registration
602//===----------------------------------------------------------------------===//
603
604inline void registerAnalysisPasses() {
611}
612#undef GEN_PASS_REGISTRATION
613#endif // GEN_PASS_REGISTRATION
614// Deprecated. Please use the new per-pass macros.
615#ifdef GEN_PASS_CLASSES
616
617template <typename DerivedT>
618class CallGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
619public:
620 using Base = CallGraphPrinterPassBase;
621
622 CallGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
623 CallGraphPrinterPassBase(const CallGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
624
626 static constexpr ::llvm::StringLiteral getArgumentName() {
627 return ::llvm::StringLiteral("llzk-print-call-graph");
628 }
629 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph"; }
630
631 ::llvm::StringRef getDescription() const override { return "Print the LLZK module's call graph."; }
632
634 static constexpr ::llvm::StringLiteral getPassName() {
635 return ::llvm::StringLiteral("CallGraphPrinterPass");
636 }
637 ::llvm::StringRef getName() const override { return "CallGraphPrinterPass"; }
638
640 static bool classof(const ::mlir::Pass *pass) {
641 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
642 }
643
645 std::unique_ptr<::mlir::Pass> clonePass() const override {
646 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
647 }
648
650 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
651 registry.insert<llzk::LLZKDialect>();
652 registry.insert<llzk::boolean::BoolDialect>();
653 registry.insert<llzk::array::ArrayDialect>();
654 registry.insert<llzk::component::StructDialect>();
655 registry.insert<llzk::constrain::ConstrainDialect>();
656 registry.insert<llzk::felt::FeltDialect>();
657 registry.insert<llzk::global::GlobalDialect>();
658 registry.insert<llzk::include::IncludeDialect>();
659 registry.insert<llzk::function::FunctionDialect>();
660 registry.insert<llzk::string::StringDialect>();
661 registry.insert<llzk::polymorphic::PolymorphicDialect>();
662 registry.insert<llzk::undef::UndefDialect>();
663 registry.insert<mlir::arith::ArithDialect>();
664 registry.insert<mlir::scf::SCFDialect>();
665 }
666
670 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphPrinterPassBase<DerivedT>)
671
672protected:
673};
674
675template <typename DerivedT>
676class CallGraphSCCsPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
677public:
678 using Base = CallGraphSCCsPrinterPassBase;
679
680 CallGraphSCCsPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
681 CallGraphSCCsPrinterPassBase(const CallGraphSCCsPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
682
684 static constexpr ::llvm::StringLiteral getArgumentName() {
685 return ::llvm::StringLiteral("llzk-print-call-graph-sccs");
686 }
687 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph-sccs"; }
688
689 ::llvm::StringRef getDescription() const override { return "Print the SCCs from the LLZK module's call graph."; }
690
692 static constexpr ::llvm::StringLiteral getPassName() {
693 return ::llvm::StringLiteral("CallGraphSCCsPrinterPass");
694 }
695 ::llvm::StringRef getName() const override { return "CallGraphSCCsPrinterPass"; }
696
698 static bool classof(const ::mlir::Pass *pass) {
699 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
700 }
701
703 std::unique_ptr<::mlir::Pass> clonePass() const override {
704 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
705 }
706
708 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
709 registry.insert<llzk::LLZKDialect>();
710 registry.insert<llzk::boolean::BoolDialect>();
711 registry.insert<llzk::array::ArrayDialect>();
712 registry.insert<llzk::component::StructDialect>();
713 registry.insert<llzk::constrain::ConstrainDialect>();
714 registry.insert<llzk::felt::FeltDialect>();
715 registry.insert<llzk::global::GlobalDialect>();
716 registry.insert<llzk::include::IncludeDialect>();
717 registry.insert<llzk::function::FunctionDialect>();
718 registry.insert<llzk::string::StringDialect>();
719 registry.insert<llzk::polymorphic::PolymorphicDialect>();
720 registry.insert<llzk::undef::UndefDialect>();
721 registry.insert<mlir::arith::ArithDialect>();
722 registry.insert<mlir::scf::SCFDialect>();
723 }
724
728 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphSCCsPrinterPassBase<DerivedT>)
729
730protected:
731};
732
733template <typename DerivedT>
734class ConstraintDependencyGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
735public:
736 using Base = ConstraintDependencyGraphPrinterPassBase;
737
738 ConstraintDependencyGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
739 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
740
742 static constexpr ::llvm::StringLiteral getArgumentName() {
743 return ::llvm::StringLiteral("llzk-print-constraint-dependency-graphs");
744 }
745 ::llvm::StringRef getArgument() const override { return "llzk-print-constraint-dependency-graphs"; }
746
747 ::llvm::StringRef getDescription() const override { return "Print constraint dependency graph for all LLZK structs."; }
748
750 static constexpr ::llvm::StringLiteral getPassName() {
751 return ::llvm::StringLiteral("ConstraintDependencyGraphPrinterPass");
752 }
753 ::llvm::StringRef getName() const override { return "ConstraintDependencyGraphPrinterPass"; }
754
756 static bool classof(const ::mlir::Pass *pass) {
757 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
758 }
759
761 std::unique_ptr<::mlir::Pass> clonePass() const override {
762 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
763 }
764
766 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
767 registry.insert<llzk::LLZKDialect>();
768 registry.insert<llzk::boolean::BoolDialect>();
769 registry.insert<llzk::array::ArrayDialect>();
770 registry.insert<llzk::component::StructDialect>();
771 registry.insert<llzk::constrain::ConstrainDialect>();
772 registry.insert<llzk::felt::FeltDialect>();
773 registry.insert<llzk::global::GlobalDialect>();
774 registry.insert<llzk::include::IncludeDialect>();
775 registry.insert<llzk::function::FunctionDialect>();
776 registry.insert<llzk::string::StringDialect>();
777 registry.insert<llzk::polymorphic::PolymorphicDialect>();
778 registry.insert<llzk::undef::UndefDialect>();
779 registry.insert<mlir::arith::ArithDialect>();
780 registry.insert<mlir::scf::SCFDialect>();
781 }
782
786 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstraintDependencyGraphPrinterPassBase<DerivedT>)
787
788protected:
789 ::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)};
790};
791
792template <typename DerivedT>
793class IntervalAnalysisPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
794public:
795 using Base = IntervalAnalysisPrinterPassBase;
796
797 IntervalAnalysisPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
798 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
799
801 static constexpr ::llvm::StringLiteral getArgumentName() {
802 return ::llvm::StringLiteral("llzk-print-interval-analysis");
803 }
804 ::llvm::StringRef getArgument() const override { return "llzk-print-interval-analysis"; }
805
806 ::llvm::StringRef getDescription() const override { return "Print interval analysis results for all LLZK structs."; }
807
809 static constexpr ::llvm::StringLiteral getPassName() {
810 return ::llvm::StringLiteral("IntervalAnalysisPrinterPass");
811 }
812 ::llvm::StringRef getName() const override { return "IntervalAnalysisPrinterPass"; }
813
815 static bool classof(const ::mlir::Pass *pass) {
816 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
817 }
818
820 std::unique_ptr<::mlir::Pass> clonePass() const override {
821 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
822 }
823
825 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
826 registry.insert<llzk::LLZKDialect>();
827 registry.insert<llzk::boolean::BoolDialect>();
828 registry.insert<llzk::array::ArrayDialect>();
829 registry.insert<llzk::component::StructDialect>();
830 registry.insert<llzk::constrain::ConstrainDialect>();
831 registry.insert<llzk::felt::FeltDialect>();
832 registry.insert<llzk::global::GlobalDialect>();
833 registry.insert<llzk::include::IncludeDialect>();
834 registry.insert<llzk::function::FunctionDialect>();
835 registry.insert<llzk::string::StringDialect>();
836 registry.insert<llzk::polymorphic::PolymorphicDialect>();
837 registry.insert<llzk::undef::UndefDialect>();
838 registry.insert<mlir::arith::ArithDialect>();
839 registry.insert<mlir::scf::SCFDialect>();
840 }
841
845 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IntervalAnalysisPrinterPassBase<DerivedT>)
846
847protected:
848 ::mlir::Pass::Option<std::string> fieldName{*this, "field", ::llvm::cl::desc("The field to use for interval analysis. Supported fields: bn128/bn254, babybear, goldilocks, mersenne31"), ::llvm::cl::init("bn128")};
849 ::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)};
850 ::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)};
851 ::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)};
852};
853
854template <typename DerivedT>
855class SymbolDefTreePrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
856public:
857 using Base = SymbolDefTreePrinterPassBase;
858
859 SymbolDefTreePrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
860 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
861
863 static constexpr ::llvm::StringLiteral getArgumentName() {
864 return ::llvm::StringLiteral("llzk-print-symbol-def-tree");
865 }
866 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-def-tree"; }
867
868 ::llvm::StringRef getDescription() const override { return "Print symbol definition tree."; }
869
871 static constexpr ::llvm::StringLiteral getPassName() {
872 return ::llvm::StringLiteral("SymbolDefTreePrinterPass");
873 }
874 ::llvm::StringRef getName() const override { return "SymbolDefTreePrinterPass"; }
875
877 static bool classof(const ::mlir::Pass *pass) {
878 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
879 }
880
882 std::unique_ptr<::mlir::Pass> clonePass() const override {
883 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
884 }
885
887 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
888 registry.insert<llzk::LLZKDialect>();
889 registry.insert<llzk::boolean::BoolDialect>();
890 registry.insert<llzk::array::ArrayDialect>();
891 registry.insert<llzk::component::StructDialect>();
892 registry.insert<llzk::constrain::ConstrainDialect>();
893 registry.insert<llzk::felt::FeltDialect>();
894 registry.insert<llzk::global::GlobalDialect>();
895 registry.insert<llzk::include::IncludeDialect>();
896 registry.insert<llzk::function::FunctionDialect>();
897 registry.insert<llzk::string::StringDialect>();
898 registry.insert<llzk::polymorphic::PolymorphicDialect>();
899 registry.insert<llzk::undef::UndefDialect>();
900 registry.insert<mlir::arith::ArithDialect>();
901 registry.insert<mlir::scf::SCFDialect>();
902 }
903
907 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDefTreePrinterPassBase<DerivedT>)
908
909protected:
910 ::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(
912 "Print pass output to 'llvm::outs()'"),
914 "Print pass output to 'llvm::errs()'"),
916 "Print pass output to 'llvm::dbgs()'")
917 )};
918 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
919};
920
921template <typename DerivedT>
922class SymbolUseGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
923public:
924 using Base = SymbolUseGraphPrinterPassBase;
925
926 SymbolUseGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
927 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
928
930 static constexpr ::llvm::StringLiteral getArgumentName() {
931 return ::llvm::StringLiteral("llzk-print-symbol-use-graph");
932 }
933 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-use-graph"; }
934
935 ::llvm::StringRef getDescription() const override { return "Print symbol use graph."; }
936
938 static constexpr ::llvm::StringLiteral getPassName() {
939 return ::llvm::StringLiteral("SymbolUseGraphPrinterPass");
940 }
941 ::llvm::StringRef getName() const override { return "SymbolUseGraphPrinterPass"; }
942
944 static bool classof(const ::mlir::Pass *pass) {
945 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
946 }
947
949 std::unique_ptr<::mlir::Pass> clonePass() const override {
950 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
951 }
952
954 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
955 registry.insert<llzk::LLZKDialect>();
956 registry.insert<llzk::boolean::BoolDialect>();
957 registry.insert<llzk::array::ArrayDialect>();
958 registry.insert<llzk::component::StructDialect>();
959 registry.insert<llzk::constrain::ConstrainDialect>();
960 registry.insert<llzk::felt::FeltDialect>();
961 registry.insert<llzk::global::GlobalDialect>();
962 registry.insert<llzk::include::IncludeDialect>();
963 registry.insert<llzk::function::FunctionDialect>();
964 registry.insert<llzk::string::StringDialect>();
965 registry.insert<llzk::polymorphic::PolymorphicDialect>();
966 registry.insert<llzk::undef::UndefDialect>();
967 registry.insert<mlir::arith::ArithDialect>();
968 registry.insert<mlir::scf::SCFDialect>();
969 }
970
974 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolUseGraphPrinterPassBase<DerivedT>)
975
976protected:
977 ::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(
979 "Print pass output to 'llvm::outs()'"),
981 "Print pass output to 'llvm::errs()'"),
983 "Print pass output to 'llvm::dbgs()'")
984 )};
985 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
986};
987#undef GEN_PASS_CLASSES
988#endif // GEN_PASS_CLASSES
void registerIntervalAnalysisPrinterPassPass()
void registerSymbolDefTreePrinterPassPass()
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 registerCallGraphSCCsPrinterPass()
void registerConstraintDependencyGraphPrinterPassPass()
void registerCallGraphSCCsPrinterPassPass()
void registerAnalysisPasses()
void registerSymbolDefTreePrinterPass()