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
160#undef GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
161#endif // GEN_PASS_DECL_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
162#ifdef GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
163namespace impl {
164
165template <typename DerivedT>
166class ConstraintDependencyGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
167public:
168 using Base = ConstraintDependencyGraphPrinterPassBase;
169
170 ConstraintDependencyGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
171 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
172
174 static constexpr ::llvm::StringLiteral getArgumentName() {
175 return ::llvm::StringLiteral("llzk-print-constraint-dependency-graphs");
176 }
177 ::llvm::StringRef getArgument() const override { return "llzk-print-constraint-dependency-graphs"; }
178
179 ::llvm::StringRef getDescription() const override { return "Print constraint dependency graph for all LLZK structs."; }
180
182 static constexpr ::llvm::StringLiteral getPassName() {
183 return ::llvm::StringLiteral("ConstraintDependencyGraphPrinterPass");
184 }
185 ::llvm::StringRef getName() const override { return "ConstraintDependencyGraphPrinterPass"; }
186
188 static bool classof(const ::mlir::Pass *pass) {
189 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
190 }
191
193 std::unique_ptr<::mlir::Pass> clonePass() const override {
194 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
195 }
196
198 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
199 registry.insert<llzk::LLZKDialect>();
200 registry.insert<llzk::boolean::BoolDialect>();
201 registry.insert<llzk::array::ArrayDialect>();
202 registry.insert<llzk::component::StructDialect>();
203 registry.insert<llzk::constrain::ConstrainDialect>();
204 registry.insert<llzk::felt::FeltDialect>();
205 registry.insert<llzk::global::GlobalDialect>();
206 registry.insert<llzk::include::IncludeDialect>();
207 registry.insert<llzk::function::FunctionDialect>();
208 registry.insert<llzk::string::StringDialect>();
209 registry.insert<llzk::polymorphic::PolymorphicDialect>();
210 registry.insert<llzk::undef::UndefDialect>();
211 registry.insert<mlir::arith::ArithDialect>();
212 registry.insert<mlir::scf::SCFDialect>();
213 }
214
218 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstraintDependencyGraphPrinterPassBase<DerivedT>)
219
220protected:
221private:
222};
223} // namespace impl
224#undef GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
225#endif // GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
226
227//===----------------------------------------------------------------------===//
228// IntervalAnalysisPrinterPass
229//===----------------------------------------------------------------------===//
230#ifdef GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
231struct IntervalAnalysisPrinterPassOptions {
232 std::string fieldName = "bn128";
233 bool printSolverConstraints = false;
234};
235#undef GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
236#endif // GEN_PASS_DECL_INTERVALANALYSISPRINTERPASS
237#ifdef GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
238namespace impl {
239
240template <typename DerivedT>
241class IntervalAnalysisPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
242public:
243 using Base = IntervalAnalysisPrinterPassBase;
244
245 IntervalAnalysisPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
246 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
247
249 static constexpr ::llvm::StringLiteral getArgumentName() {
250 return ::llvm::StringLiteral("llzk-print-interval-analysis");
251 }
252 ::llvm::StringRef getArgument() const override { return "llzk-print-interval-analysis"; }
253
254 ::llvm::StringRef getDescription() const override { return "Print interval analysis results for all LLZK structs."; }
255
257 static constexpr ::llvm::StringLiteral getPassName() {
258 return ::llvm::StringLiteral("IntervalAnalysisPrinterPass");
259 }
260 ::llvm::StringRef getName() const override { return "IntervalAnalysisPrinterPass"; }
261
263 static bool classof(const ::mlir::Pass *pass) {
264 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
265 }
266
268 std::unique_ptr<::mlir::Pass> clonePass() const override {
269 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
270 }
271
273 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
274 registry.insert<llzk::LLZKDialect>();
275 registry.insert<llzk::boolean::BoolDialect>();
276 registry.insert<llzk::array::ArrayDialect>();
277 registry.insert<llzk::component::StructDialect>();
278 registry.insert<llzk::constrain::ConstrainDialect>();
279 registry.insert<llzk::felt::FeltDialect>();
280 registry.insert<llzk::global::GlobalDialect>();
281 registry.insert<llzk::include::IncludeDialect>();
282 registry.insert<llzk::function::FunctionDialect>();
283 registry.insert<llzk::string::StringDialect>();
284 registry.insert<llzk::polymorphic::PolymorphicDialect>();
285 registry.insert<llzk::undef::UndefDialect>();
286 registry.insert<mlir::arith::ArithDialect>();
287 registry.insert<mlir::scf::SCFDialect>();
288 }
289
293 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IntervalAnalysisPrinterPassBase<DerivedT>)
294
295 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassOptions &options) : IntervalAnalysisPrinterPassBase() {
296 fieldName = options.fieldName;
297 printSolverConstraints = options.printSolverConstraints;
298 }
299protected:
300 ::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")};
301 ::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)};
302private:
303};
304} // namespace impl
305#undef GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
306#endif // GEN_PASS_DEF_INTERVALANALYSISPRINTERPASS
307
308//===----------------------------------------------------------------------===//
309// SymbolDefTreePrinterPass
310//===----------------------------------------------------------------------===//
311#ifdef GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
312struct SymbolDefTreePrinterPassOptions {
314 bool saveDotGraph = false;
315};
316#undef GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
317#endif // GEN_PASS_DECL_SYMBOLDEFTREEPRINTERPASS
318#ifdef GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
319namespace impl {
320
321template <typename DerivedT>
322class SymbolDefTreePrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
323public:
324 using Base = SymbolDefTreePrinterPassBase;
325
326 SymbolDefTreePrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
327 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
328
330 static constexpr ::llvm::StringLiteral getArgumentName() {
331 return ::llvm::StringLiteral("llzk-print-symbol-def-tree");
332 }
333 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-def-tree"; }
334
335 ::llvm::StringRef getDescription() const override { return "Print symbol definition tree."; }
336
338 static constexpr ::llvm::StringLiteral getPassName() {
339 return ::llvm::StringLiteral("SymbolDefTreePrinterPass");
340 }
341 ::llvm::StringRef getName() const override { return "SymbolDefTreePrinterPass"; }
342
344 static bool classof(const ::mlir::Pass *pass) {
345 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
346 }
347
349 std::unique_ptr<::mlir::Pass> clonePass() const override {
350 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
351 }
352
354 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
355 registry.insert<llzk::LLZKDialect>();
356 registry.insert<llzk::boolean::BoolDialect>();
357 registry.insert<llzk::array::ArrayDialect>();
358 registry.insert<llzk::component::StructDialect>();
359 registry.insert<llzk::constrain::ConstrainDialect>();
360 registry.insert<llzk::felt::FeltDialect>();
361 registry.insert<llzk::global::GlobalDialect>();
362 registry.insert<llzk::include::IncludeDialect>();
363 registry.insert<llzk::function::FunctionDialect>();
364 registry.insert<llzk::string::StringDialect>();
365 registry.insert<llzk::polymorphic::PolymorphicDialect>();
366 registry.insert<llzk::undef::UndefDialect>();
367 registry.insert<mlir::arith::ArithDialect>();
368 registry.insert<mlir::scf::SCFDialect>();
369 }
370
374 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDefTreePrinterPassBase<DerivedT>)
375
376 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassOptions &options) : SymbolDefTreePrinterPassBase() {
377 outputStream = options.outputStream;
378 saveDotGraph = options.saveDotGraph;
379 }
380protected:
381 ::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(
383 "Print pass output to 'llvm::outs()'"),
385 "Print pass output to 'llvm::errs()'"),
387 "Print pass output to 'llvm::dbgs()'")
388 )};
389 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
390private:
391};
392} // namespace impl
393#undef GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
394#endif // GEN_PASS_DEF_SYMBOLDEFTREEPRINTERPASS
395
396//===----------------------------------------------------------------------===//
397// SymbolUseGraphPrinterPass
398//===----------------------------------------------------------------------===//
399#ifdef GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
400struct SymbolUseGraphPrinterPassOptions {
402 bool saveDotGraph = false;
403};
404#undef GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
405#endif // GEN_PASS_DECL_SYMBOLUSEGRAPHPRINTERPASS
406#ifdef GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
407namespace impl {
408
409template <typename DerivedT>
410class SymbolUseGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
411public:
412 using Base = SymbolUseGraphPrinterPassBase;
413
414 SymbolUseGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
415 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
416
418 static constexpr ::llvm::StringLiteral getArgumentName() {
419 return ::llvm::StringLiteral("llzk-print-symbol-use-graph");
420 }
421 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-use-graph"; }
422
423 ::llvm::StringRef getDescription() const override { return "Print symbol use graph."; }
424
426 static constexpr ::llvm::StringLiteral getPassName() {
427 return ::llvm::StringLiteral("SymbolUseGraphPrinterPass");
428 }
429 ::llvm::StringRef getName() const override { return "SymbolUseGraphPrinterPass"; }
430
432 static bool classof(const ::mlir::Pass *pass) {
433 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
434 }
435
437 std::unique_ptr<::mlir::Pass> clonePass() const override {
438 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
439 }
440
442 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
443 registry.insert<llzk::LLZKDialect>();
444 registry.insert<llzk::boolean::BoolDialect>();
445 registry.insert<llzk::array::ArrayDialect>();
446 registry.insert<llzk::component::StructDialect>();
447 registry.insert<llzk::constrain::ConstrainDialect>();
448 registry.insert<llzk::felt::FeltDialect>();
449 registry.insert<llzk::global::GlobalDialect>();
450 registry.insert<llzk::include::IncludeDialect>();
451 registry.insert<llzk::function::FunctionDialect>();
452 registry.insert<llzk::string::StringDialect>();
453 registry.insert<llzk::polymorphic::PolymorphicDialect>();
454 registry.insert<llzk::undef::UndefDialect>();
455 registry.insert<mlir::arith::ArithDialect>();
456 registry.insert<mlir::scf::SCFDialect>();
457 }
458
462 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolUseGraphPrinterPassBase<DerivedT>)
463
464 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassOptions &options) : SymbolUseGraphPrinterPassBase() {
465 outputStream = options.outputStream;
466 saveDotGraph = options.saveDotGraph;
467 }
468protected:
469 ::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(
471 "Print pass output to 'llvm::outs()'"),
473 "Print pass output to 'llvm::errs()'"),
475 "Print pass output to 'llvm::dbgs()'")
476 )};
477 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
478private:
479};
480} // namespace impl
481#undef GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
482#endif // GEN_PASS_DEF_SYMBOLUSEGRAPHPRINTERPASS
483#ifdef GEN_PASS_REGISTRATION
484
485//===----------------------------------------------------------------------===//
486// CallGraphPrinterPass Registration
487//===----------------------------------------------------------------------===//
488
489inline void registerCallGraphPrinterPass() {
490 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
491 return llzk::createCallGraphPrinterPass(llvm::errs());
492 });
493}
494
495// Old registration code, kept for temporary backwards compatibility.
497 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
498 return llzk::createCallGraphPrinterPass(llvm::errs());
499 });
500}
501
502//===----------------------------------------------------------------------===//
503// CallGraphSCCsPrinterPass Registration
504//===----------------------------------------------------------------------===//
505
507 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
508 return llzk::createCallGraphSCCsPrinterPass(llvm::errs());
509 });
510}
511
512// Old registration code, kept for temporary backwards compatibility.
514 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
515 return llzk::createCallGraphSCCsPrinterPass(llvm::errs());
516 });
517}
518
519//===----------------------------------------------------------------------===//
520// ConstraintDependencyGraphPrinterPass Registration
521//===----------------------------------------------------------------------===//
522
524 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
526 });
527}
528
529// Old registration code, kept for temporary backwards compatibility.
531 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
533 });
534}
535
536//===----------------------------------------------------------------------===//
537// IntervalAnalysisPrinterPass Registration
538//===----------------------------------------------------------------------===//
539
541 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
542 return llzk::createIntervalAnalysisPrinterPass(llvm::errs());
543 });
544}
545
546// Old registration code, kept for temporary backwards compatibility.
548 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
549 return llzk::createIntervalAnalysisPrinterPass(llvm::errs());
550 });
551}
552
553//===----------------------------------------------------------------------===//
554// SymbolDefTreePrinterPass Registration
555//===----------------------------------------------------------------------===//
556
558 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
560 });
561}
562
563// Old registration code, kept for temporary backwards compatibility.
565 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
567 });
568}
569
570//===----------------------------------------------------------------------===//
571// SymbolUseGraphPrinterPass Registration
572//===----------------------------------------------------------------------===//
573
575 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
577 });
578}
579
580// Old registration code, kept for temporary backwards compatibility.
582 ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
584 });
585}
586
587//===----------------------------------------------------------------------===//
588// Analysis Registration
589//===----------------------------------------------------------------------===//
590
591inline void registerAnalysisPasses() {
598}
599#undef GEN_PASS_REGISTRATION
600#endif // GEN_PASS_REGISTRATION
601// Deprecated. Please use the new per-pass macros.
602#ifdef GEN_PASS_CLASSES
603
604template <typename DerivedT>
605class CallGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
606public:
607 using Base = CallGraphPrinterPassBase;
608
609 CallGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
610 CallGraphPrinterPassBase(const CallGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
611
613 static constexpr ::llvm::StringLiteral getArgumentName() {
614 return ::llvm::StringLiteral("llzk-print-call-graph");
615 }
616 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph"; }
617
618 ::llvm::StringRef getDescription() const override { return "Print the LLZK module's call graph."; }
619
621 static constexpr ::llvm::StringLiteral getPassName() {
622 return ::llvm::StringLiteral("CallGraphPrinterPass");
623 }
624 ::llvm::StringRef getName() const override { return "CallGraphPrinterPass"; }
625
627 static bool classof(const ::mlir::Pass *pass) {
628 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
629 }
630
632 std::unique_ptr<::mlir::Pass> clonePass() const override {
633 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
634 }
635
637 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
638 registry.insert<llzk::LLZKDialect>();
639 registry.insert<llzk::boolean::BoolDialect>();
640 registry.insert<llzk::array::ArrayDialect>();
641 registry.insert<llzk::component::StructDialect>();
642 registry.insert<llzk::constrain::ConstrainDialect>();
643 registry.insert<llzk::felt::FeltDialect>();
644 registry.insert<llzk::global::GlobalDialect>();
645 registry.insert<llzk::include::IncludeDialect>();
646 registry.insert<llzk::function::FunctionDialect>();
647 registry.insert<llzk::string::StringDialect>();
648 registry.insert<llzk::polymorphic::PolymorphicDialect>();
649 registry.insert<llzk::undef::UndefDialect>();
650 registry.insert<mlir::arith::ArithDialect>();
651 registry.insert<mlir::scf::SCFDialect>();
652 }
653
657 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphPrinterPassBase<DerivedT>)
658
659protected:
660};
661
662template <typename DerivedT>
663class CallGraphSCCsPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
664public:
665 using Base = CallGraphSCCsPrinterPassBase;
666
667 CallGraphSCCsPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
668 CallGraphSCCsPrinterPassBase(const CallGraphSCCsPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
669
671 static constexpr ::llvm::StringLiteral getArgumentName() {
672 return ::llvm::StringLiteral("llzk-print-call-graph-sccs");
673 }
674 ::llvm::StringRef getArgument() const override { return "llzk-print-call-graph-sccs"; }
675
676 ::llvm::StringRef getDescription() const override { return "Print the SCCs from the LLZK module's call graph."; }
677
679 static constexpr ::llvm::StringLiteral getPassName() {
680 return ::llvm::StringLiteral("CallGraphSCCsPrinterPass");
681 }
682 ::llvm::StringRef getName() const override { return "CallGraphSCCsPrinterPass"; }
683
685 static bool classof(const ::mlir::Pass *pass) {
686 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
687 }
688
690 std::unique_ptr<::mlir::Pass> clonePass() const override {
691 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
692 }
693
695 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
696 registry.insert<llzk::LLZKDialect>();
697 registry.insert<llzk::boolean::BoolDialect>();
698 registry.insert<llzk::array::ArrayDialect>();
699 registry.insert<llzk::component::StructDialect>();
700 registry.insert<llzk::constrain::ConstrainDialect>();
701 registry.insert<llzk::felt::FeltDialect>();
702 registry.insert<llzk::global::GlobalDialect>();
703 registry.insert<llzk::include::IncludeDialect>();
704 registry.insert<llzk::function::FunctionDialect>();
705 registry.insert<llzk::string::StringDialect>();
706 registry.insert<llzk::polymorphic::PolymorphicDialect>();
707 registry.insert<llzk::undef::UndefDialect>();
708 registry.insert<mlir::arith::ArithDialect>();
709 registry.insert<mlir::scf::SCFDialect>();
710 }
711
715 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CallGraphSCCsPrinterPassBase<DerivedT>)
716
717protected:
718};
719
720template <typename DerivedT>
721class ConstraintDependencyGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
722public:
723 using Base = ConstraintDependencyGraphPrinterPassBase;
724
725 ConstraintDependencyGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
726 ConstraintDependencyGraphPrinterPassBase(const ConstraintDependencyGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
727
729 static constexpr ::llvm::StringLiteral getArgumentName() {
730 return ::llvm::StringLiteral("llzk-print-constraint-dependency-graphs");
731 }
732 ::llvm::StringRef getArgument() const override { return "llzk-print-constraint-dependency-graphs"; }
733
734 ::llvm::StringRef getDescription() const override { return "Print constraint dependency graph for all LLZK structs."; }
735
737 static constexpr ::llvm::StringLiteral getPassName() {
738 return ::llvm::StringLiteral("ConstraintDependencyGraphPrinterPass");
739 }
740 ::llvm::StringRef getName() const override { return "ConstraintDependencyGraphPrinterPass"; }
741
743 static bool classof(const ::mlir::Pass *pass) {
744 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
745 }
746
748 std::unique_ptr<::mlir::Pass> clonePass() const override {
749 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
750 }
751
753 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
754 registry.insert<llzk::LLZKDialect>();
755 registry.insert<llzk::boolean::BoolDialect>();
756 registry.insert<llzk::array::ArrayDialect>();
757 registry.insert<llzk::component::StructDialect>();
758 registry.insert<llzk::constrain::ConstrainDialect>();
759 registry.insert<llzk::felt::FeltDialect>();
760 registry.insert<llzk::global::GlobalDialect>();
761 registry.insert<llzk::include::IncludeDialect>();
762 registry.insert<llzk::function::FunctionDialect>();
763 registry.insert<llzk::string::StringDialect>();
764 registry.insert<llzk::polymorphic::PolymorphicDialect>();
765 registry.insert<llzk::undef::UndefDialect>();
766 registry.insert<mlir::arith::ArithDialect>();
767 registry.insert<mlir::scf::SCFDialect>();
768 }
769
773 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstraintDependencyGraphPrinterPassBase<DerivedT>)
774
775protected:
776};
777
778template <typename DerivedT>
779class IntervalAnalysisPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
780public:
781 using Base = IntervalAnalysisPrinterPassBase;
782
783 IntervalAnalysisPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
784 IntervalAnalysisPrinterPassBase(const IntervalAnalysisPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
785
787 static constexpr ::llvm::StringLiteral getArgumentName() {
788 return ::llvm::StringLiteral("llzk-print-interval-analysis");
789 }
790 ::llvm::StringRef getArgument() const override { return "llzk-print-interval-analysis"; }
791
792 ::llvm::StringRef getDescription() const override { return "Print interval analysis results for all LLZK structs."; }
793
795 static constexpr ::llvm::StringLiteral getPassName() {
796 return ::llvm::StringLiteral("IntervalAnalysisPrinterPass");
797 }
798 ::llvm::StringRef getName() const override { return "IntervalAnalysisPrinterPass"; }
799
801 static bool classof(const ::mlir::Pass *pass) {
802 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
803 }
804
806 std::unique_ptr<::mlir::Pass> clonePass() const override {
807 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
808 }
809
811 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
812 registry.insert<llzk::LLZKDialect>();
813 registry.insert<llzk::boolean::BoolDialect>();
814 registry.insert<llzk::array::ArrayDialect>();
815 registry.insert<llzk::component::StructDialect>();
816 registry.insert<llzk::constrain::ConstrainDialect>();
817 registry.insert<llzk::felt::FeltDialect>();
818 registry.insert<llzk::global::GlobalDialect>();
819 registry.insert<llzk::include::IncludeDialect>();
820 registry.insert<llzk::function::FunctionDialect>();
821 registry.insert<llzk::string::StringDialect>();
822 registry.insert<llzk::polymorphic::PolymorphicDialect>();
823 registry.insert<llzk::undef::UndefDialect>();
824 registry.insert<mlir::arith::ArithDialect>();
825 registry.insert<mlir::scf::SCFDialect>();
826 }
827
831 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(IntervalAnalysisPrinterPassBase<DerivedT>)
832
833protected:
834 ::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")};
835 ::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)};
836};
837
838template <typename DerivedT>
839class SymbolDefTreePrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
840public:
841 using Base = SymbolDefTreePrinterPassBase;
842
843 SymbolDefTreePrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
844 SymbolDefTreePrinterPassBase(const SymbolDefTreePrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
845
847 static constexpr ::llvm::StringLiteral getArgumentName() {
848 return ::llvm::StringLiteral("llzk-print-symbol-def-tree");
849 }
850 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-def-tree"; }
851
852 ::llvm::StringRef getDescription() const override { return "Print symbol definition tree."; }
853
855 static constexpr ::llvm::StringLiteral getPassName() {
856 return ::llvm::StringLiteral("SymbolDefTreePrinterPass");
857 }
858 ::llvm::StringRef getName() const override { return "SymbolDefTreePrinterPass"; }
859
861 static bool classof(const ::mlir::Pass *pass) {
862 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
863 }
864
866 std::unique_ptr<::mlir::Pass> clonePass() const override {
867 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
868 }
869
871 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
872 registry.insert<llzk::LLZKDialect>();
873 registry.insert<llzk::boolean::BoolDialect>();
874 registry.insert<llzk::array::ArrayDialect>();
875 registry.insert<llzk::component::StructDialect>();
876 registry.insert<llzk::constrain::ConstrainDialect>();
877 registry.insert<llzk::felt::FeltDialect>();
878 registry.insert<llzk::global::GlobalDialect>();
879 registry.insert<llzk::include::IncludeDialect>();
880 registry.insert<llzk::function::FunctionDialect>();
881 registry.insert<llzk::string::StringDialect>();
882 registry.insert<llzk::polymorphic::PolymorphicDialect>();
883 registry.insert<llzk::undef::UndefDialect>();
884 registry.insert<mlir::arith::ArithDialect>();
885 registry.insert<mlir::scf::SCFDialect>();
886 }
887
891 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolDefTreePrinterPassBase<DerivedT>)
892
893protected:
894 ::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(
896 "Print pass output to 'llvm::outs()'"),
898 "Print pass output to 'llvm::errs()'"),
900 "Print pass output to 'llvm::dbgs()'")
901 )};
902 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
903};
904
905template <typename DerivedT>
906class SymbolUseGraphPrinterPassBase : public ::mlir::OperationPass<::mlir::ModuleOp> {
907public:
908 using Base = SymbolUseGraphPrinterPassBase;
909
910 SymbolUseGraphPrinterPassBase() : ::mlir::OperationPass<::mlir::ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
911 SymbolUseGraphPrinterPassBase(const SymbolUseGraphPrinterPassBase &other) : ::mlir::OperationPass<::mlir::ModuleOp>(other) {}
912
914 static constexpr ::llvm::StringLiteral getArgumentName() {
915 return ::llvm::StringLiteral("llzk-print-symbol-use-graph");
916 }
917 ::llvm::StringRef getArgument() const override { return "llzk-print-symbol-use-graph"; }
918
919 ::llvm::StringRef getDescription() const override { return "Print symbol use graph."; }
920
922 static constexpr ::llvm::StringLiteral getPassName() {
923 return ::llvm::StringLiteral("SymbolUseGraphPrinterPass");
924 }
925 ::llvm::StringRef getName() const override { return "SymbolUseGraphPrinterPass"; }
926
928 static bool classof(const ::mlir::Pass *pass) {
929 return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
930 }
931
933 std::unique_ptr<::mlir::Pass> clonePass() const override {
934 return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
935 }
936
938 void getDependentDialects(::mlir::DialectRegistry &registry) const override {
939 registry.insert<llzk::LLZKDialect>();
940 registry.insert<llzk::boolean::BoolDialect>();
941 registry.insert<llzk::array::ArrayDialect>();
942 registry.insert<llzk::component::StructDialect>();
943 registry.insert<llzk::constrain::ConstrainDialect>();
944 registry.insert<llzk::felt::FeltDialect>();
945 registry.insert<llzk::global::GlobalDialect>();
946 registry.insert<llzk::include::IncludeDialect>();
947 registry.insert<llzk::function::FunctionDialect>();
948 registry.insert<llzk::string::StringDialect>();
949 registry.insert<llzk::polymorphic::PolymorphicDialect>();
950 registry.insert<llzk::undef::UndefDialect>();
951 registry.insert<mlir::arith::ArithDialect>();
952 registry.insert<mlir::scf::SCFDialect>();
953 }
954
958 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SymbolUseGraphPrinterPassBase<DerivedT>)
959
960protected:
961 ::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(
963 "Print pass output to 'llvm::outs()'"),
965 "Print pass output to 'llvm::errs()'"),
967 "Print pass output to 'llvm::dbgs()'")
968 )};
969 ::mlir::Pass::Option<bool> saveDotGraph{*this, "saveDot", ::llvm::cl::desc("Whether to dump the graph to DOT format."), ::llvm::cl::init(false)};
970};
971#undef GEN_PASS_CLASSES
972#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()