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 llzkRam_LoadOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType valType, MlirValue addr) {
17 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString("ram.load"), location);
18 mlirOperationStateAddResults(&state, 1, &valType);
19 mlirOperationStateAddOperands(&state, 1, &addr);
20
21 return mlirOpBuilderInsert(builder, mlirOperationCreate(&state));
22}
23
24bool llzkOperationIsA_Ram_LoadOp(MlirOperation inp) {
25 return llvm::isa<LoadOp>(unwrap(inp));
26}
27
28MlirValue llzkRam_LoadOpGetAddr(MlirOperation op) {
29 auto range = llvm::cast<LoadOp>(unwrap(op)).getODSOperandIndexAndLength(0);
30 assert(range.second == 1 && "expected fixed operand segment size");
31 assert(
32 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
33 "operand index exceeds intptr_t range"
34 );
35 return mlirOperationGetOperand(op, static_cast<intptr_t>(range.first));
36}
37
38void llzkRam_LoadOpSetAddr(MlirOperation op, MlirValue value) {
39 auto range = llvm::cast<LoadOp>(unwrap(op)).getODSOperandIndexAndLength(0);
40 assert(range.second == 1 && "expected fixed operand segment size");
41 assert(
42 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
43 "operand index exceeds intptr_t range"
44 );
45 mlirOperationSetOperand(op, static_cast<intptr_t>(range.first), value);
46}
47
48MlirValue llzkRam_LoadOpGetVal(MlirOperation op) {
49 return mlirOperationGetResult(op, 0);
50}
51
52MlirOperation llzkRam_StoreOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue addr, MlirValue val) {
53 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString("ram.store"), location);
54 mlirOperationStateAddOperands(&state, 1, &addr);
55 mlirOperationStateAddOperands(&state, 1, &val);
56
57 return mlirOpBuilderInsert(builder, mlirOperationCreate(&state));
58}
59
60bool llzkOperationIsA_Ram_StoreOp(MlirOperation inp) {
61 return llvm::isa<StoreOp>(unwrap(inp));
62}
63
64MlirValue llzkRam_StoreOpGetAddr(MlirOperation op) {
65 auto range = llvm::cast<StoreOp>(unwrap(op)).getODSOperandIndexAndLength(0);
66 assert(range.second == 1 && "expected fixed operand segment size");
67 assert(
68 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
69 "operand index exceeds intptr_t range"
70 );
71 return mlirOperationGetOperand(op, static_cast<intptr_t>(range.first));
72}
73
74void llzkRam_StoreOpSetAddr(MlirOperation op, MlirValue value) {
75 auto range = llvm::cast<StoreOp>(unwrap(op)).getODSOperandIndexAndLength(0);
76 assert(range.second == 1 && "expected fixed operand segment size");
77 assert(
78 static_cast<uintptr_t>(range.first) <= static_cast<uintptr_t>(std::numeric_limits<intptr_t>::max()) &&
79 "operand index exceeds intptr_t range"
80 );
81 mlirOperationSetOperand(op, static_cast<intptr_t>(range.first), value);
82}
83
84MlirValue llzkRam_StoreOpGetVal(MlirOperation op) {
85 auto range = llvm::cast<StoreOp>(unwrap(op)).getODSOperandIndexAndLength(1);
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 llzkRam_StoreOpSetVal(MlirOperation op, MlirValue value) {
95 auto range = llvm::cast<StoreOp>(unwrap(op)).getODSOperandIndexAndLength(1);
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}
MlirOperation mlirOpBuilderInsert(MlirOpBuilder builder, MlirOperation op)
Inserts op at the current insertion point of builder and returns it.
Definition Builder.cpp:167
MlirValue llzkRam_LoadOpGetVal(MlirOperation op)
Get Val result from llzk::ram::LoadOp Operation.
void llzkRam_StoreOpSetVal(MlirOperation op, MlirValue value)
Set Val operand of llzk::ram::StoreOp Operation.
bool llzkOperationIsA_Ram_StoreOp(MlirOperation inp)
Returns true if the Operation is a llzk::ram::StoreOp.
MlirOperation llzkRam_StoreOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue addr, MlirValue val)
Build a llzk::ram::StoreOp Operation.
MlirValue llzkRam_LoadOpGetAddr(MlirOperation op)
Get Addr operand from llzk::ram::LoadOp Operation.
void llzkRam_StoreOpSetAddr(MlirOperation op, MlirValue value)
Set Addr operand of llzk::ram::StoreOp Operation.
MlirOperation llzkRam_LoadOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType valType, MlirValue addr)
Build a llzk::ram::LoadOp Operation.
bool llzkOperationIsA_Ram_LoadOp(MlirOperation inp)
Returns true if the Operation is a llzk::ram::LoadOp.
void llzkRam_LoadOpSetAddr(MlirOperation op, MlirValue value)
Set Addr operand of llzk::ram::LoadOp Operation.
MlirValue llzkRam_StoreOpGetAddr(MlirOperation op)
Get Addr operand from llzk::ram::StoreOp Operation.
MlirValue llzkRam_StoreOpGetVal(MlirOperation op)
Get Val operand from llzk::ram::StoreOp Operation.