17 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"cast.toindex"), location);
18 mlirOperationStateEnableResultTypeInference(&state);
19 mlirOperationStateAddOperands(&state, 1, &value);
21 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
22 if (!mlirAttributeIsNull(overflow)) {
23 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"overflow")), overflow));
25 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
31 return llvm::isa<FeltToIndexOp>(unwrap(inp));
35 auto range = llvm::cast<FeltToIndexOp>(unwrap(op)).getODSOperandIndexAndLength(0);
36 assert(range.second == 1 &&
"expected fixed operand segment size");
38 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
39 "operand index exceeds intptr_t range"
41 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
45 auto range = llvm::cast<FeltToIndexOp>(unwrap(op)).getODSOperandIndexAndLength(0);
46 assert(range.second == 1 &&
"expected fixed operand segment size");
48 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
49 "operand index exceeds intptr_t range"
51 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
55 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"overflow"));
59 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"overflow"), attr);
63 return mlirOperationGetResult(op, 0);
67 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"cast.tofelt"), location);
68 mlirOperationStateEnableResultTypeInference(&state);
69 mlirOperationStateAddOperands(&state, 1, &value);
71 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
72 if (!mlirAttributeIsNull(overflow)) {
73 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"overflow")), overflow));
75 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
81 return llvm::isa<IntToFeltOp>(unwrap(inp));
85 auto range = llvm::cast<IntToFeltOp>(unwrap(op)).getODSOperandIndexAndLength(0);
86 assert(range.second == 1 &&
"expected fixed operand segment size");
88 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
89 "operand index exceeds intptr_t range"
91 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
95 auto range = llvm::cast<IntToFeltOp>(unwrap(op)).getODSOperandIndexAndLength(0);
96 assert(range.second == 1 &&
"expected fixed operand segment size");
98 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
99 "operand index exceeds intptr_t range"
101 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
105 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"overflow"));
109 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"overflow"), attr);
113 return mlirOperationGetResult(op, 0);
MlirContext mlirOpBuilderGetContext(MlirOpBuilder builder)
Returns the MLIR context associated with builder.
MlirOperation mlirOpBuilderInsert(MlirOpBuilder builder, MlirOperation op)
Inserts op at the current insertion point of builder and returns it.
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.