LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.capi.test.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op C API Tests *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10class FunctionOperationLinkTests : public CAPITest {};
11
13TEST_F(FunctionOperationLinkTests, IsA_Function_CallOp) {
14 auto testOperation = createIndexOperation();
15
16 // This will always return false since `createIndex*` returns an MLIR builtin
17 EXPECT_FALSE(llzkOperationIsA_Function_CallOp(testOperation));
18
19 mlirOperationDestroy(testOperation);
20}
21
22TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetArgOperandsCount) {
23 auto testOp = createIndexOperation();
24
27 }
28
29 mlirOperationDestroy(testOp);
30}
31
32TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetArgOperandsAt) {
33 auto testOp = createIndexOperation();
34
37 }
38
39 mlirOperationDestroy(testOp);
40}
41
42TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetArgOperands_Variadic) {
43 auto testOp = createIndexOperation();
44
46 auto dummyValue = mlirOperationGetResult(testOp, 0);
47 MlirValue values[] = {dummyValue};
48 llzkFunction_CallOpSetArgOperands(testOp, 1, values);
49 }
50
51 mlirOperationDestroy(testOp);
52}
53
54TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetMapOperandsCount) {
55 auto testOp = createIndexOperation();
56
59 }
60
61 mlirOperationDestroy(testOp);
62}
63
64TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetMapOperandsAt) {
65 auto testOp = createIndexOperation();
66
69 }
70
71 mlirOperationDestroy(testOp);
72}
73
74TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetMapOperands_VariadicOfVariadic) {
75 auto testOp = createIndexOperation();
76
78 auto dummyValue = mlirOperationGetResult(testOp, 0);
79 MlirValueRange groups[1];
80 groups[0].values = &dummyValue;
81 groups[0].size = 1;
82 llzkFunction_CallOpSetMapOperands(testOp, 1, groups);
83 }
84
85 mlirOperationDestroy(testOp);
86}
87
88TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetCalleeAttr) {
89 auto testOp = createIndexOperation();
90
92 (void)llzkFunction_CallOpGetCallee(testOp);
93 }
94
95 mlirOperationDestroy(testOp);
96}
97
98TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetCalleeAttr) {
99 auto testOp = createIndexOperation();
100
102 llzkFunction_CallOpSetCallee(testOp, createIndexAttribute());
103 }
104
105 mlirOperationDestroy(testOp);
106}
107
108TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetTemplateParamsAttr) {
109 auto testOp = createIndexOperation();
110
113 }
114
115 mlirOperationDestroy(testOp);
116}
117
118TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetTemplateParamsAttr) {
119 auto testOp = createIndexOperation();
120
122 llzkFunction_CallOpSetTemplateParams(testOp, createIndexAttribute());
123 }
124
125 mlirOperationDestroy(testOp);
126}
127
128TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetNumDimsPerMapAttr) {
129 auto testOp = createIndexOperation();
130
133 }
134
135 mlirOperationDestroy(testOp);
136}
137
138TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetNumDimsPerMapAttr) {
139 auto testOp = createIndexOperation();
140
142 llzkFunction_CallOpSetNumDimsPerMap(testOp, createIndexAttribute());
143 }
144
145 mlirOperationDestroy(testOp);
146}
147
148TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetMapOpGroupSizesAttr) {
149 auto testOp = createIndexOperation();
150
153 }
154
155 mlirOperationDestroy(testOp);
156}
157
158TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetMapOpGroupSizesAttr) {
159 auto testOp = createIndexOperation();
160
162 llzkFunction_CallOpSetMapOpGroupSizes(testOp, createIndexAttribute());
163 }
164
165 mlirOperationDestroy(testOp);
166}
167
168TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetArgAttrsAttr) {
169 auto testOp = createIndexOperation();
170
172 (void)llzkFunction_CallOpGetArgAttrs(testOp);
173 }
174
175 mlirOperationDestroy(testOp);
176}
177
178TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetArgAttrsAttr) {
179 auto testOp = createIndexOperation();
180
182 llzkFunction_CallOpSetArgAttrs(testOp, createIndexAttribute());
183 }
184
185 mlirOperationDestroy(testOp);
186}
187
188TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetResAttrsAttr) {
189 auto testOp = createIndexOperation();
190
192 (void)llzkFunction_CallOpGetResAttrs(testOp);
193 }
194
195 mlirOperationDestroy(testOp);
196}
197
198TEST_F(FunctionOperationLinkTests, llzk_CallOp_SetResAttrsAttr) {
199 auto testOp = createIndexOperation();
200
202 llzkFunction_CallOpSetResAttrs(testOp, createIndexAttribute());
203 }
204
205 mlirOperationDestroy(testOp);
206}
207
208TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetResult0Count) {
209 auto testOp = createIndexOperation();
210
213 }
214
215 mlirOperationDestroy(testOp);
216}
217
218TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetResult0At) {
219 auto testOp = createIndexOperation();
220
222 (void)llzkFunction_CallOpGetResult0At(testOp, 0);
223 }
224
225 mlirOperationDestroy(testOp);
226}
227
229TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeContainsWitnessGen) {
230 auto testOperation = createIndexOperation();
231
232 if (llzkOperationIsA_Function_CallOp(testOperation)) {
233
235 }
236
237 mlirOperationDestroy(testOperation);
238}
239
241TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsStructCompute) {
242 auto testOperation = createIndexOperation();
243
244 if (llzkOperationIsA_Function_CallOp(testOperation)) {
245
246 (void)llzkFunction_CallOpCalleeIsStructCompute(testOperation);
247 }
248
249 mlirOperationDestroy(testOperation);
250}
251
253TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetSingleResultTypeOfCompute) {
254 auto testOperation = createIndexOperation();
255
256 if (llzkOperationIsA_Function_CallOp(testOperation)) {
257
259 }
260
261 mlirOperationDestroy(testOperation);
262}
263
265TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsStructConstrain) {
266 auto testOperation = createIndexOperation();
267
268 if (llzkOperationIsA_Function_CallOp(testOperation)) {
269
271 }
272
273 mlirOperationDestroy(testOperation);
274}
275
277TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetSelfValueFromConstrain) {
278 auto testOperation = createIndexOperation();
279
280 if (llzkOperationIsA_Function_CallOp(testOperation)) {
281
283 }
284
285 mlirOperationDestroy(testOperation);
286}
287
289TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsCompute) {
290 auto testOperation = createIndexOperation();
291
292 if (llzkOperationIsA_Function_CallOp(testOperation)) {
293
294 (void)llzkFunction_CallOpCalleeIsCompute(testOperation);
295 }
296
297 mlirOperationDestroy(testOperation);
298}
299
301TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsConstrain) {
302 auto testOperation = createIndexOperation();
303
304 if (llzkOperationIsA_Function_CallOp(testOperation)) {
305
306 (void)llzkFunction_CallOpCalleeIsConstrain(testOperation);
307 }
308
309 mlirOperationDestroy(testOperation);
310}
311
313TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsProduct) {
314 auto testOperation = createIndexOperation();
315
316 if (llzkOperationIsA_Function_CallOp(testOperation)) {
317
318 (void)llzkFunction_CallOpCalleeIsProduct(testOperation);
319 }
320
321 mlirOperationDestroy(testOperation);
322}
323
325TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsStructProduct) {
326 auto testOperation = createIndexOperation();
327
328 if (llzkOperationIsA_Function_CallOp(testOperation)) {
329
330 (void)llzkFunction_CallOpCalleeIsStructProduct(testOperation);
331 }
332
333 mlirOperationDestroy(testOperation);
334}
335
337TEST_F(FunctionOperationLinkTests, llzk_CallOp_CalleeIsInStruct) {
338 auto testOperation = createIndexOperation();
339
340 if (llzkOperationIsA_Function_CallOp(testOperation)) {
341
342 (void)llzkFunction_CallOpCalleeIsInStruct(testOperation);
343 }
344
345 mlirOperationDestroy(testOperation);
346}
347
349TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetSelfValueFromProduct) {
350 auto testOperation = createIndexOperation();
351
352 if (llzkOperationIsA_Function_CallOp(testOperation)) {
353
355 }
356
357 mlirOperationDestroy(testOperation);
358}
359
361TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetSelfValueFromCompute) {
362 auto testOperation = createIndexOperation();
363
364 if (llzkOperationIsA_Function_CallOp(testOperation)) {
365
367 }
368
369 mlirOperationDestroy(testOperation);
370}
371
373TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetSingleResultTypeOfWitnessGen) {
374 auto testOperation = createIndexOperation();
375
376 if (llzkOperationIsA_Function_CallOp(testOperation)) {
377
379 }
380
381 mlirOperationDestroy(testOperation);
382}
383
385TEST_F(FunctionOperationLinkTests, llzk_CallOp_ResolveCallable) {
386 auto testOperation = createIndexOperation();
387
388 if (llzkOperationIsA_Function_CallOp(testOperation)) {
389
390 (void)llzkFunction_CallOpResolveCallable(testOperation);
391 }
392
393 mlirOperationDestroy(testOperation);
394}
395
397TEST_F(FunctionOperationLinkTests, llzk_CallOp_GetSelfValue) {
398 auto testOperation = createIndexOperation();
399
400 if (llzkOperationIsA_Function_CallOp(testOperation)) {
401
402 (void)llzkFunction_CallOpGetSelfValue(testOperation);
403 }
404
405 mlirOperationDestroy(testOperation);
406}
407
409TEST_F(FunctionOperationLinkTests, IsA_Function_FuncDefOp) {
410 auto testOperation = createIndexOperation();
411
412 // This will always return false since `createIndex*` returns an MLIR builtin
413 EXPECT_FALSE(llzkOperationIsA_Function_FuncDefOp(testOperation));
414
415 mlirOperationDestroy(testOperation);
416}
417
419TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_Build) {
420 // Returns an `arith.constant` op, which will never match the FuncDefOp dialect check.
421 auto testOp = createIndexOperation();
422
423 // This condition is always false, so the function is never actually called.
424 // We only verify it compiles and links correctly.
426 MlirOpBuilder builder = mlirOpBuilderCreate(context);
427 MlirLocation location = mlirLocationUnknownGet(context);
428 auto dummyValue = mlirOperationGetResult(testOp, 0);
429 auto sym_nameAttr = mlirOperationGetName(testOp);
430 auto function_typeAttr = createIndexAttribute();
431 auto arg_attrsAttr = createIndexAttribute();
432 auto res_attrsAttr = createIndexAttribute();
433
434 (void)llzkFunction_FuncDefOpBuild(builder, location, sym_nameAttr, function_typeAttr, arg_attrsAttr, res_attrsAttr);
435 // No need to destroy builder or op since this code never runs.
436 }
437
438 mlirOperationDestroy(testOp);
439}
440
441struct FuncDefOpBuildFuncHelper : public TestAnyBuildFuncHelper<CAPITest> {
442 virtual bool callIsA(MlirOperation op) override { return llzkOperationIsA_Function_FuncDefOp(op); }
446 static std::unique_ptr<FuncDefOpBuildFuncHelper> get();
447
448protected:
450};
451
454TEST_F(CAPITest, Function_FuncDefOp_build_pass) { FuncDefOpBuildFuncHelper::get()->run(*this); }
455
456TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetSymNameAttr) {
457 auto testOp = createIndexOperation();
458
461 }
462
463 mlirOperationDestroy(testOp);
464}
465
466TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetSymNameAttr) {
467 auto testOp = createIndexOperation();
468
470 llzkFunction_FuncDefOpSetSymName(testOp, createIndexAttribute());
471 }
472
473 mlirOperationDestroy(testOp);
474}
475
476TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetFunctionTypeAttr) {
477 auto testOp = createIndexOperation();
478
481 }
482
483 mlirOperationDestroy(testOp);
484}
485
486TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetFunctionTypeAttr) {
487 auto testOp = createIndexOperation();
488
490 llzkFunction_FuncDefOpSetFunctionType(testOp, createIndexAttribute());
491 }
492
493 mlirOperationDestroy(testOp);
494}
495
496TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetArgAttrsAttr) {
497 auto testOp = createIndexOperation();
498
501 }
502
503 mlirOperationDestroy(testOp);
504}
505
506TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetArgAttrsAttr) {
507 auto testOp = createIndexOperation();
508
510 llzkFunction_FuncDefOpSetArgAttrs(testOp, createIndexAttribute());
511 }
512
513 mlirOperationDestroy(testOp);
514}
515
516TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetResAttrsAttr) {
517 auto testOp = createIndexOperation();
518
521 }
522
523 mlirOperationDestroy(testOp);
524}
525
526TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetResAttrsAttr) {
527 auto testOp = createIndexOperation();
528
530 llzkFunction_FuncDefOpSetResAttrs(testOp, createIndexAttribute());
531 }
532
533 mlirOperationDestroy(testOp);
534}
535
536TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetBodyRegion) {
537 auto testOp = createIndexOperation();
538
540 (void)llzkFunction_FuncDefOpGetBody(testOp);
541 }
542
543 mlirOperationDestroy(testOp);
544}
545
547TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetAllowNonNativeFieldOpsAttr) {
548 auto testOperation = createIndexOperation();
549
550 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
551 bool newValue = false;
552
553 (void)llzkFunction_FuncDefOpSetAllowNonNativeFieldOpsAttr(testOperation, newValue);
554 }
555
556 mlirOperationDestroy(testOperation);
557}
558
560TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_IsStructProduct) {
561 auto testOperation = createIndexOperation();
562
563 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
564
565 (void)llzkFunction_FuncDefOpIsStructProduct(testOperation);
566 }
567
568 mlirOperationDestroy(testOperation);
569}
570
572TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasAllowNonNativeFieldOpsAttr) {
573 auto testOperation = createIndexOperation();
574
575 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
576
578 }
579
580 mlirOperationDestroy(testOperation);
581}
582
584TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasArgPublicAttr) {
585 auto testOperation = createIndexOperation();
586
587 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
588 unsigned index = 0;
589
590 (void)llzkFunction_FuncDefOpHasArgPublicAttr(testOperation, index);
591 }
592
593 mlirOperationDestroy(testOperation);
594}
595
597TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_NameIsProduct) {
598 auto testOperation = createIndexOperation();
599
600 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
601
602 (void)llzkFunction_FuncDefOpNameIsProduct(testOperation);
603 }
604
605 mlirOperationDestroy(testOperation);
606}
607
609TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasAllowWitnessAttr) {
610 auto testOperation = createIndexOperation();
611
612 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
613
615 }
616
617 mlirOperationDestroy(testOperation);
618}
619
621TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasAllowVerifOpsAttr) {
622 auto testOperation = createIndexOperation();
623
624 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
625
627 }
628
629 mlirOperationDestroy(testOperation);
630}
631
633TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasResName) {
634 auto testOperation = createIndexOperation();
635
636 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
637 unsigned index = 0;
638
639 (void)llzkFunction_FuncDefOpHasResName(testOperation, index);
640 }
641
642 mlirOperationDestroy(testOperation);
643}
644
646TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_IsStructConstrain) {
647 auto testOperation = createIndexOperation();
648
649 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
650
651 (void)llzkFunction_FuncDefOpIsStructConstrain(testOperation);
652 }
653
654 mlirOperationDestroy(testOperation);
655}
656
658TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_NameIsCompute) {
659 auto testOperation = createIndexOperation();
660
661 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
662
663 (void)llzkFunction_FuncDefOpNameIsCompute(testOperation);
664 }
665
666 mlirOperationDestroy(testOperation);
667}
668
670TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_IsDeclaration) {
671 auto testOperation = createIndexOperation();
672
673 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
674
675 (void)llzkFunction_FuncDefOpIsDeclaration(testOperation);
676 }
677
678 mlirOperationDestroy(testOperation);
679}
680
682TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetSingleResultTypeOfCompute) {
683 auto testOperation = createIndexOperation();
684
685 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
686
688 }
689
690 mlirOperationDestroy(testOperation);
691}
692
694TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetSelfValueFromConstrain) {
695 auto testOperation = createIndexOperation();
696
697 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
698
700 }
701
702 mlirOperationDestroy(testOperation);
703}
704
706TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetAllowVerifOpsAttr) {
707 auto testOperation = createIndexOperation();
708
709 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
710 bool newValue = false;
711
712 (void)llzkFunction_FuncDefOpSetAllowVerifOpsAttr(testOperation, newValue);
713 }
714
715 mlirOperationDestroy(testOperation);
716}
717
719TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_NameIsConstrain) {
720 auto testOperation = createIndexOperation();
721
722 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
723
724 (void)llzkFunction_FuncDefOpNameIsConstrain(testOperation);
725 }
726
727 mlirOperationDestroy(testOperation);
728}
729
731TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetAllowConstraintAttr) {
732 auto testOperation = createIndexOperation();
733
734 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
735 bool newValue = false;
736
737 (void)llzkFunction_FuncDefOpSetAllowConstraintAttr(testOperation, newValue);
738 }
739
740 mlirOperationDestroy(testOperation);
741}
742
744TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetCallableRegion) {
745 auto testOperation = createIndexOperation();
746
747 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
748
749 (void)llzkFunction_FuncDefOpGetCallableRegion(testOperation);
750 }
751
752 mlirOperationDestroy(testOperation);
753}
754
756TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasAllowConstraintAttr) {
757 auto testOperation = createIndexOperation();
758
759 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
760
762 }
763
764 mlirOperationDestroy(testOperation);
765}
766
768TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_IsInStruct) {
769 auto testOperation = createIndexOperation();
770
771 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
772
773 (void)llzkFunction_FuncDefOpIsInStruct(testOperation);
774 }
775
776 mlirOperationDestroy(testOperation);
777}
778
780TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_IsStructCompute) {
781 auto testOperation = createIndexOperation();
782
783 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
784
785 (void)llzkFunction_FuncDefOpIsStructCompute(testOperation);
786 }
787
788 mlirOperationDestroy(testOperation);
789}
790
792TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_SetAllowWitnessAttr) {
793 auto testOperation = createIndexOperation();
794
795 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
796 bool newValue = false;
797
798 (void)llzkFunction_FuncDefOpSetAllowWitnessAttr(testOperation, newValue);
799 }
800
801 mlirOperationDestroy(testOperation);
802}
803
805TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetSelfValueFromCompute) {
806 auto testOperation = createIndexOperation();
807
808 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
809
811 }
812
813 mlirOperationDestroy(testOperation);
814}
815
817TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetSelfValueFromProduct) {
818 auto testOperation = createIndexOperation();
819
820 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
821
823 }
824
825 mlirOperationDestroy(testOperation);
826}
827
829TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_HasArgName) {
830 auto testOperation = createIndexOperation();
831
832 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
833 unsigned index = 0;
834
835 (void)llzkFunction_FuncDefOpHasArgName(testOperation, index);
836 }
837
838 mlirOperationDestroy(testOperation);
839}
840
842TEST_F(FunctionOperationLinkTests, llzk_FuncDefOp_GetFullyQualifiedName) {
843 auto testOperation = createIndexOperation();
844
845 if (llzkOperationIsA_Function_FuncDefOp(testOperation)) {
846 bool requireParent = false;
847
848 (void)llzkFunction_FuncDefOpGetFullyQualifiedName(testOperation, requireParent);
849 }
850
851 mlirOperationDestroy(testOperation);
852}
853
855TEST_F(FunctionOperationLinkTests, IsA_Function_ReturnOp) {
856 auto testOperation = createIndexOperation();
857
858 // This will always return false since `createIndex*` returns an MLIR builtin
859 EXPECT_FALSE(llzkOperationIsA_Function_ReturnOp(testOperation));
860
861 mlirOperationDestroy(testOperation);
862}
863
865TEST_F(FunctionOperationLinkTests, llzk_ReturnOp_Build) {
866 // Returns an `arith.constant` op, which will never match the ReturnOp dialect check.
867 auto testOp = createIndexOperation();
868
869 // This condition is always false, so the function is never actually called.
870 // We only verify it compiles and links correctly.
872 MlirOpBuilder builder = mlirOpBuilderCreate(context);
873 MlirLocation location = mlirLocationUnknownGet(context);
874 auto dummyValue = mlirOperationGetResult(testOp, 0);
875 MlirValue operandsValues[] = {dummyValue};
876 intptr_t operandsSize = 0;
877
878 (void)llzkFunction_ReturnOpBuild(builder, location, operandsSize, operandsValues);
879 // No need to destroy builder or op since this code never runs.
880 }
881
882 mlirOperationDestroy(testOp);
883}
884
885struct ReturnOpBuildFuncHelper : public TestAnyBuildFuncHelper<CAPITest> {
886 virtual bool callIsA(MlirOperation op) override { return llzkOperationIsA_Function_ReturnOp(op); }
890 static std::unique_ptr<ReturnOpBuildFuncHelper> get();
891
892protected:
894};
895
898TEST_F(CAPITest, Function_ReturnOp_build_pass) { ReturnOpBuildFuncHelper::get()->run(*this); }
899
900TEST_F(FunctionOperationLinkTests, llzk_ReturnOp_GetOperandsCount) {
901 auto testOp = createIndexOperation();
902
905 }
906
907 mlirOperationDestroy(testOp);
908}
909
910TEST_F(FunctionOperationLinkTests, llzk_ReturnOp_GetOperandsAt) {
911 auto testOp = createIndexOperation();
912
914 (void)llzkFunction_ReturnOpGetOperandsAt(testOp, 0);
915 }
916
917 mlirOperationDestroy(testOp);
918}
919
920TEST_F(FunctionOperationLinkTests, llzk_ReturnOp_SetOperands_Variadic) {
921 auto testOp = createIndexOperation();
922
924 auto dummyValue = mlirOperationGetResult(testOp, 0);
925 MlirValue values[] = {dummyValue};
926 llzkFunction_ReturnOpSetOperands(testOp, 1, values);
927 }
928
929 mlirOperationDestroy(testOp);
930}
TEST_F(ArrayOperationLinkTests, IsA_Array_ArrayLengthOp)
This test ensures llzkOperationIsA_Array_ArrayLengthOp links properly.
MlirOpBuilder mlirOpBuilderCreate(MlirContext ctx)
Creates a new OpBuilder for the given MLIR context.
Definition Builder.cpp:78
bool llzkFunction_FuncDefOpNameIsProduct(MlirOperation inp)
Return true iff the function name is FUNC_NAME_PRODUCT (if needed, a check that this FuncDefOp is loc...
MlirRegion llzkFunction_FuncDefOpGetCallableRegion(MlirOperation inp)
Required by FunctionOpInterface.
void llzkFunction_FuncDefOpSetResAttrs(MlirOperation op, MlirAttribute attr)
Set ResAttrs attribute of llzk::function::FuncDefOp Operation.
MlirOperation llzkFunction_FuncDefOpBuild(MlirOpBuilder builder, MlirLocation location, MlirIdentifier sym_name, MlirAttribute function_type, MlirAttribute arg_attrs, MlirAttribute res_attrs)
Build a llzk::function::FuncDefOp Operation.
MlirValue llzkFunction_ReturnOpGetOperandsAt(MlirOperation op, intptr_t index)
Get Operands operand at index from llzk::function::ReturnOp Operation.
bool llzkFunction_FuncDefOpIsStructProduct(MlirOperation inp)
Return true iff the function is within a StructDefOp and named FUNC_NAME_PRODUCT.
intptr_t llzkFunction_CallOpGetResult0Count(MlirOperation op)
Get number of Result0 results in llzk::function::CallOp Operation.
MlirAttribute llzkFunction_FuncDefOpGetFullyQualifiedName(MlirOperation inp, bool requireParent)
Return the full name for this function from the root module, including all surrounding symbol table n...
bool llzkFunction_CallOpCalleeIsStructConstrain(MlirOperation inp)
Return true iff the callee function name is FUNC_NAME_CONSTRAIN within a StructDefOp.
void llzkFunction_FuncDefOpSetFunctionType(MlirOperation op, MlirAttribute attr)
Set FunctionType attribute of llzk::function::FuncDefOp Operation.
MlirAttribute llzkFunction_CallOpGetResAttrs(MlirOperation op)
Get ResAttrs attribute from llzk::function::CallOp Operation.
void llzkFunction_CallOpSetResAttrs(MlirOperation op, MlirAttribute attr)
Set ResAttrs attribute of llzk::function::CallOp Operation.
MlirAttribute llzkFunction_CallOpGetMapOpGroupSizes(MlirOperation op)
Get MapOpGroupSizes attribute from llzk::function::CallOp Operation.
bool llzkFunction_CallOpCalleeIsCompute(MlirOperation inp)
Return true iff the callee function name is FUNC_NAME_COMPUTE (this does not check if the callee func...
void llzkFunction_CallOpSetArgAttrs(MlirOperation op, MlirAttribute attr)
Set ArgAttrs attribute of llzk::function::CallOp Operation.
MlirAttribute llzkFunction_CallOpGetTemplateParams(MlirOperation op)
Get TemplateParams attribute from llzk::function::CallOp Operation.
bool llzkFunction_FuncDefOpHasAllowVerifOpsAttr(MlirOperation inp)
Return true iff the function def has the allow_verif_ops attribute.
intptr_t llzkFunction_CallOpGetMapOperandsCount(MlirOperation op)
Get number of MapOperands operands in llzk::function::CallOp Operation.
intptr_t llzkFunction_CallOpGetArgOperandsCount(MlirOperation op)
Get number of ArgOperands operands in llzk::function::CallOp Operation.
MlirValue llzkFunction_CallOpGetSelfValueFromProduct(MlirOperation inp)
Return the "self" value (i.e.
void llzkFunction_CallOpSetMapOperands(MlirOperation op, intptr_t groupCount, MlirValueRange const *groups)
Set MapOperands operand groups of llzk::function::CallOp Operation.
void llzkFunction_ReturnOpSetOperands(MlirOperation op, intptr_t count, MlirValue const *values)
Set Operands operands of llzk::function::ReturnOp Operation.
bool llzkFunction_FuncDefOpHasAllowWitnessAttr(MlirOperation inp)
Return true iff the function def has the allow_witness attribute.
MlirValue llzkFunction_FuncDefOpGetSelfValueFromConstrain(MlirOperation inp)
Return the "self" value (i.e.
MlirValue llzkFunction_CallOpGetSelfValue(MlirOperation inp)
getSelfValue
MlirAttribute llzkFunction_FuncDefOpGetResAttrs(MlirOperation op)
Get ResAttrs attribute from llzk::function::FuncDefOp Operation.
MlirType llzkFunction_CallOpGetSingleResultTypeOfCompute(MlirOperation inp)
Assuming the callee is FUNC_NAME_COMPUTE, return the single StructType result.
MlirOperation llzkFunction_ReturnOpBuild(MlirOpBuilder builder, MlirLocation location, intptr_t operandsSize, MlirValue const *operands)
Build a llzk::function::ReturnOp Operation.
bool llzkFunction_FuncDefOpIsDeclaration(MlirOperation inp)
Required by SymbolOpInterface.
void llzkFunction_CallOpSetCallee(MlirOperation op, MlirAttribute attr)
Set Callee attribute of llzk::function::CallOp Operation.
bool llzkFunction_CallOpCalleeContainsWitnessGen(MlirOperation inp)
Return true iff the callee function can contain witness generation code (this does not check if the c...
bool llzkFunction_FuncDefOpHasAllowConstraintAttr(MlirOperation inp)
Return true iff the function def has the allow_constraint attribute.
bool llzkFunction_FuncDefOpIsInStruct(MlirOperation inp)
Return true iff the function is within a StructDefOp.
void llzkFunction_FuncDefOpSetArgAttrs(MlirOperation op, MlirAttribute attr)
Set ArgAttrs attribute of llzk::function::FuncDefOp Operation.
void llzkFunction_FuncDefOpSetAllowConstraintAttr(MlirOperation inp, bool newValue)
Add (resp. remove) the allow_constraint attribute to (resp. from) the function def.
MlirValue llzkFunction_FuncDefOpGetSelfValueFromProduct(MlirOperation inp)
Return the "self" value (i.e.
void llzkFunction_CallOpSetArgOperands(MlirOperation op, intptr_t count, MlirValue const *values)
Set ArgOperands operands of llzk::function::CallOp Operation.
bool llzkFunction_FuncDefOpHasArgName(MlirOperation inp, unsigned index)
Return true iff the argument at the given index has a function.arg_name attribute.
bool llzkFunction_CallOpCalleeIsInStruct(MlirOperation inp)
Return true iff the callee function is within a StructDefOp.
MlirValue llzkFunction_CallOpGetSelfValueFromConstrain(MlirOperation inp)
Return the "self" value (i.e.
bool llzkFunction_FuncDefOpHasArgPublicAttr(MlirOperation inp, unsigned index)
Return true iff the argument at the given index has pub attribute.
void llzkFunction_FuncDefOpSetAllowNonNativeFieldOpsAttr(MlirOperation inp, bool newValue)
Add (resp. remove) the allow_non_native_field_ops attribute to (resp. from) the function def.
bool llzkFunction_CallOpCalleeIsStructProduct(MlirOperation inp)
Return true iff the callee function name is FUNC_NAME_PRODUCT within a StructDefOp.
bool llzkFunction_FuncDefOpIsStructConstrain(MlirOperation inp)
Return true iff the function is within a StructDefOp and named FUNC_NAME_CONSTRAIN.
MlirValue llzkFunction_CallOpGetArgOperandsAt(MlirOperation op, intptr_t index)
Get ArgOperands operand at index from llzk::function::CallOp Operation.
MlirType llzkFunction_FuncDefOpGetSingleResultTypeOfCompute(MlirOperation inp)
Assuming the name is FUNC_NAME_COMPUTE, return the single StructType result.
void llzkFunction_CallOpSetTemplateParams(MlirOperation op, MlirAttribute attr)
Set TemplateParams attribute of llzk::function::CallOp Operation.
void llzkFunction_CallOpSetNumDimsPerMap(MlirOperation op, MlirAttribute attr)
Set NumDimsPerMap attribute of llzk::function::CallOp Operation.
bool llzkOperationIsA_Function_ReturnOp(MlirOperation inp)
Returns true if the Operation is a llzk::function::ReturnOp.
bool llzkOperationIsA_Function_CallOp(MlirOperation inp)
Returns true if the Operation is a llzk::function::CallOp.
MlirAttribute llzkFunction_CallOpGetCallee(MlirOperation op)
Get Callee attribute from llzk::function::CallOp Operation.
MlirType llzkFunction_CallOpGetSingleResultTypeOfWitnessGen(MlirOperation inp)
Assuming the callee contains witness generation code, return the single StructType result.
MlirAttribute llzkFunction_FuncDefOpGetArgAttrs(MlirOperation op)
Get ArgAttrs attribute from llzk::function::FuncDefOp Operation.
bool llzkFunction_FuncDefOpNameIsConstrain(MlirOperation inp)
Return true iff the function name is FUNC_NAME_CONSTRAIN (if needed, a check that this FuncDefOp is l...
MlirValue llzkFunction_FuncDefOpGetSelfValueFromCompute(MlirOperation inp)
Return the "self" value (i.e.
bool llzkFunction_FuncDefOpIsStructCompute(MlirOperation inp)
Return true iff the function is within a StructDefOp and named FUNC_NAME_COMPUTE.
void llzkFunction_FuncDefOpSetAllowWitnessAttr(MlirOperation inp, bool newValue)
Add (resp. remove) the allow_witness attribute to (resp. from) the function def.
intptr_t llzkFunction_ReturnOpGetOperandsCount(MlirOperation op)
Get number of Operands operands in llzk::function::ReturnOp Operation.
MlirValue llzkFunction_CallOpGetMapOperandsAt(MlirOperation op, intptr_t index)
Get MapOperands operand at index from llzk::function::CallOp Operation.
bool llzkFunction_FuncDefOpHasAllowNonNativeFieldOpsAttr(MlirOperation inp)
Return true iff the function def has the allow_non_native_field_ops attribute.
bool llzkFunction_CallOpCalleeIsProduct(MlirOperation inp)
Return true iff the callee function name is FUNC_NAME_PRODUCT (this does not check if the callee func...
void llzkFunction_FuncDefOpSetSymName(MlirOperation op, MlirAttribute attr)
Set SymName attribute of llzk::function::FuncDefOp Operation.
MlirRegion llzkFunction_FuncDefOpGetBody(MlirOperation op)
Get Body region from llzk::function::FuncDefOp Operation.
MlirValue llzkFunction_CallOpGetSelfValueFromCompute(MlirOperation inp)
Return the "self" value (i.e.
bool llzkFunction_CallOpCalleeIsStructCompute(MlirOperation inp)
Return true iff the callee function name is FUNC_NAME_COMPUTE within a StructDefOp.
MlirAttribute llzkFunction_FuncDefOpGetFunctionType(MlirOperation op)
Get FunctionType attribute from llzk::function::FuncDefOp Operation.
bool llzkFunction_FuncDefOpHasResName(MlirOperation inp, unsigned index)
Return true iff the result at the given index has a function.res_name attribute.
MlirValue llzkFunction_CallOpGetResult0At(MlirOperation op, intptr_t index)
Get Result0 result at index from llzk::function::CallOp Operation.
MlirOperation llzkFunction_CallOpResolveCallable(MlirOperation inp)
resolveCallable
bool llzkFunction_FuncDefOpNameIsCompute(MlirOperation inp)
Return true iff the function name is FUNC_NAME_COMPUTE (if needed, a check that this FuncDefOp is loc...
bool llzkOperationIsA_Function_FuncDefOp(MlirOperation inp)
Returns true if the Operation is a llzk::function::FuncDefOp.
void llzkFunction_FuncDefOpSetAllowVerifOpsAttr(MlirOperation inp, bool newValue)
Add (resp. remove) the allow_verif_ops attribute to (resp. from) the function def.
void llzkFunction_CallOpSetMapOpGroupSizes(MlirOperation op, MlirAttribute attr)
Set MapOpGroupSizes attribute of llzk::function::CallOp Operation.
MlirAttribute llzkFunction_CallOpGetNumDimsPerMap(MlirOperation op)
Get NumDimsPerMap attribute from llzk::function::CallOp Operation.
MlirAttribute llzkFunction_FuncDefOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::function::FuncDefOp Operation.
bool llzkFunction_CallOpCalleeIsConstrain(MlirOperation inp)
Return true iff the callee function name is FUNC_NAME_CONSTRAIN (this does not check if the callee fu...
MlirAttribute llzkFunction_CallOpGetArgAttrs(MlirOperation op)
Get ArgAttrs attribute from llzk::function::CallOp Operation.
static std::unique_ptr< FuncDefOpBuildFuncHelper > get()
This method must be implemented to return a subclass of FuncDefOpBuildFuncHelper that at least implem...
virtual bool callIsA(MlirOperation op) override
FuncDefOpBuildFuncHelper()=default
Representation of an mlir::ValueRange.
Definition Support.h:47
MlirValue const * values
Pointer to the first value in the range.
Definition Support.h:49
intptr_t size
Number of values in the range.
Definition Support.h:51
ReturnOpBuildFuncHelper()=default
static std::unique_ptr< ReturnOpBuildFuncHelper > get()
This method must be implemented to return a subclass of ReturnOpBuildFuncHelper that at least impleme...
virtual bool callIsA(MlirOperation op) override