LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.capi.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op C API Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10
11#include <limits>
12
13using namespace mlir;
14using namespace llvm;
15
16MlirOperation llzkCast_FeltToIndexOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue value, MlirAttribute overflow) {
17 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString("cast.toindex"), location);
18 mlirOperationStateEnableResultTypeInference(&state);
19 mlirOperationStateAddOperands(&state, 1, &value);
20 MlirContext ctx = mlirOpBuilderGetContext(builder);
21 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
22 if (!mlirAttributeIsNull(overflow)) {
23 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("overflow")), overflow));
24 }
25 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
26
27 return mlirOpBuilderInsert(builder, mlirOperationCreate(&state));
28}
29
30bool llzkOperationIsA_Cast_FeltToIndexOp(MlirOperation inp) {
31 return llvm::isa<FeltToIndexOp>(unwrap(inp));
32}
33
34MlirValue llzkCast_FeltToIndexOpGetValue(MlirOperation op) {
35 auto range = llvm::cast<FeltToIndexOp>(unwrap(op)).getODSOperandIndexAndLength(0);
36 assert(range.second == 1 && "expected fixed operand segment size");
37 assert(
38 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
39 "operand index exceeds intptr_t range"
40 );
41 return mlirOperationGetOperand(op, static_cast<intptr_t>(range.first));
42}
43
44void llzkCast_FeltToIndexOpSetValue(MlirOperation op, MlirValue value) {
45 auto range = llvm::cast<FeltToIndexOp>(unwrap(op)).getODSOperandIndexAndLength(0);
46 assert(range.second == 1 && "expected fixed operand segment size");
47 assert(
48 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
49 "operand index exceeds intptr_t range"
50 );
51 mlirOperationSetOperand(op, static_cast<intptr_t>(range.first), value);
52}
53
54MlirAttribute llzkCast_FeltToIndexOpGetOverflow(MlirOperation op) {
55 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString("overflow"));
56}
57
58void llzkCast_FeltToIndexOpSetOverflow(MlirOperation op, MlirAttribute attr) {
59 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString("overflow"), attr);
60}
61
62MlirValue llzkCast_FeltToIndexOpGetResult(MlirOperation op) {
63 return mlirOperationGetResult(op, 0);
64}
65
66MlirOperation llzkCast_IntToFeltOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue value, MlirAttribute overflow) {
67 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString("cast.tofelt"), location);
68 mlirOperationStateEnableResultTypeInference(&state);
69 mlirOperationStateAddOperands(&state, 1, &value);
70 MlirContext ctx = mlirOpBuilderGetContext(builder);
71 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
72 if (!mlirAttributeIsNull(overflow)) {
73 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString("overflow")), overflow));
74 }
75 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
76
77 return mlirOpBuilderInsert(builder, mlirOperationCreate(&state));
78}
79
80bool llzkOperationIsA_Cast_IntToFeltOp(MlirOperation inp) {
81 return llvm::isa<IntToFeltOp>(unwrap(inp));
82}
83
84MlirValue llzkCast_IntToFeltOpGetValue(MlirOperation op) {
85 auto range = llvm::cast<IntToFeltOp>(unwrap(op)).getODSOperandIndexAndLength(0);
86 assert(range.second == 1 && "expected fixed operand segment size");
87 assert(
88 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
89 "operand index exceeds intptr_t range"
90 );
91 return mlirOperationGetOperand(op, static_cast<intptr_t>(range.first));
92}
93
94void llzkCast_IntToFeltOpSetValue(MlirOperation op, MlirValue value) {
95 auto range = llvm::cast<IntToFeltOp>(unwrap(op)).getODSOperandIndexAndLength(0);
96 assert(range.second == 1 && "expected fixed operand segment size");
97 assert(
98 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
99 "operand index exceeds intptr_t range"
100 );
101 mlirOperationSetOperand(op, static_cast<intptr_t>(range.first), value);
102}
103
104MlirAttribute llzkCast_IntToFeltOpGetOverflow(MlirOperation op) {
105 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString("overflow"));
106}
107
108void llzkCast_IntToFeltOpSetOverflow(MlirOperation op, MlirAttribute attr) {
109 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString("overflow"), attr);
110}
111
112MlirValue llzkCast_IntToFeltOpGetResult(MlirOperation op) {
113 return mlirOperationGetResult(op, 0);
114}
MlirContext mlirOpBuilderGetContext(MlirOpBuilder builder)
Returns the MLIR context associated with builder.
Definition Builder.cpp:95
MlirOperation mlirOpBuilderInsert(MlirOpBuilder builder, MlirOperation op)
Inserts op at the current insertion point of builder and returns it.
Definition Builder.cpp:167
MlirValue llzkCast_FeltToIndexOpGetResult(MlirOperation op)
Get Result result from llzk::cast::FeltToIndexOp Operation.
void llzkCast_IntToFeltOpSetValue(MlirOperation op, MlirValue value)
Set Value operand of llzk::cast::IntToFeltOp Operation.
MlirValue llzkCast_FeltToIndexOpGetValue(MlirOperation op)
Get Value operand from llzk::cast::FeltToIndexOp Operation.
bool llzkOperationIsA_Cast_FeltToIndexOp(MlirOperation inp)
Returns true if the Operation is a llzk::cast::FeltToIndexOp.
bool llzkOperationIsA_Cast_IntToFeltOp(MlirOperation inp)
Returns true if the Operation is a llzk::cast::IntToFeltOp.
MlirValue llzkCast_IntToFeltOpGetResult(MlirOperation op)
Get Result result from llzk::cast::IntToFeltOp Operation.
MlirAttribute llzkCast_FeltToIndexOpGetOverflow(MlirOperation op)
Get Overflow attribute from llzk::cast::FeltToIndexOp Operation.
MlirOperation llzkCast_FeltToIndexOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue value, MlirAttribute overflow)
Build a llzk::cast::FeltToIndexOp Operation.
MlirOperation llzkCast_IntToFeltOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue value, MlirAttribute overflow)
Build a llzk::cast::IntToFeltOp Operation.
void llzkCast_FeltToIndexOpSetValue(MlirOperation op, MlirValue value)
Set Value operand of llzk::cast::FeltToIndexOp Operation.
void llzkCast_IntToFeltOpSetOverflow(MlirOperation op, MlirAttribute attr)
Set Overflow attribute of llzk::cast::IntToFeltOp Operation.
MlirValue llzkCast_IntToFeltOpGetValue(MlirOperation op)
Get Value operand from llzk::cast::IntToFeltOp Operation.
void llzkCast_FeltToIndexOpSetOverflow(MlirOperation op, MlirAttribute attr)
Set Overflow attribute of llzk::cast::FeltToIndexOp Operation.
MlirAttribute llzkCast_IntToFeltOpGetOverflow(MlirOperation op)
Get Overflow attribute from llzk::cast::IntToFeltOp Operation.