17 return llvm::isa<ApplyMapOp>(unwrap(inp));
21 auto range = llvm::cast<ApplyMapOp>(unwrap(op)).getODSOperandIndexAndLength(0);
26 auto range = llvm::cast<ApplyMapOp>(unwrap(op)).getODSOperandIndexAndLength(0);
27 assert(index >= 0 && index < range.second &&
"variadic operand index out of range");
29 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
30 "operand index exceeds intptr_t range"
32 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first) + index);
38 ::llvm::SmallVector<::mlir::Value> vals;
39 vals.reserve(
static_cast<size_t>(count));
40 for (intptr_t i = 0; i < count; ++i)
41 vals.push_back(unwrap(values[i]));
42 ::llvm::cast<ApplyMapOp>(unwrap(op)).getMapOperandsMutable().assign(vals);
46 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"map"));
50 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"map"), attr);
54 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"numDims"));
58 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"numDims"), attr);
62 return mlirOperationGetResult(op, 0);
66 return wrap(llvm::cast<ApplyMapOp>(unwrap(inp)).getAffineMap());
70 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"poly.read_const"), location);
71 mlirOperationStateAddResults(&state, 1, &valType);
73 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
74 if (!mlirAttributeIsNull(const_name)) {
75 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"const_name")), const_name));
77 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
83 return llvm::isa<ConstReadOp>(unwrap(inp));
87 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"const_name"));
91 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"const_name"), attr);
95 return mlirOperationGetResult(op, 0);
99 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"poly.expr"), location);
101 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
102 if (!mlirAttributeIsNull(
reinterpret_cast<MlirAttribute&
>(sym_name))) {
103 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"sym_name")),
reinterpret_cast<MlirAttribute&
>(sym_name)));
105 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
106 llvm::SmallVector<MlirRegion, 1> regions;
107 regions.push_back(mlirRegionCreate());
108 mlirOperationStateAddOwnedRegions(&state, regions.size(), regions.data());
114 return llvm::isa<TemplateExprOp>(unwrap(inp));
118 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
122 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
126 return mlirOperationGetRegion(op, 0);
130 return wrap(llvm::cast<TemplateExprOp>(unwrap(inp)).getType());
134 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"poly.template"), location);
136 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
137 if (!mlirAttributeIsNull(
reinterpret_cast<MlirAttribute&
>(sym_name))) {
138 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"sym_name")),
reinterpret_cast<MlirAttribute&
>(sym_name)));
140 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
141 llvm::SmallVector<MlirRegion, 1> regions;
142 regions.push_back(mlirRegionCreate());
143 mlirOperationStateAddOwnedRegions(&state, regions.size(), regions.data());
149 return llvm::isa<TemplateOp>(unwrap(inp));
153 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
157 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
161 return mlirOperationGetRegion(op, 0);
165 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"poly.param"), location);
167 llvm::SmallVector<MlirNamedAttribute, 2> attributes;
168 if (!mlirAttributeIsNull(
reinterpret_cast<MlirAttribute&
>(sym_name))) {
169 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"sym_name")),
reinterpret_cast<MlirAttribute&
>(sym_name)));
171 if (!mlirAttributeIsNull(type_opt)) {
172 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"type_opt")), type_opt));
174 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
180 return llvm::isa<TemplateParamOp>(unwrap(inp));
184 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
188 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
192 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"type_opt"));
196 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"type_opt"), attr);
200 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"poly.unifiable_cast"), location);
201 mlirOperationStateAddResults(&state, 1, &resultType);
202 mlirOperationStateAddOperands(&state, 1, &input);
208 return llvm::isa<UnifiableCastOp>(unwrap(inp));
212 auto range = llvm::cast<UnifiableCastOp>(unwrap(op)).getODSOperandIndexAndLength(0);
213 assert(range.second == 1 &&
"expected fixed operand segment size");
215 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
216 "operand index exceeds intptr_t range"
218 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
222 auto range = llvm::cast<UnifiableCastOp>(unwrap(op)).getODSOperandIndexAndLength(0);
223 assert(range.second == 1 &&
"expected fixed operand segment size");
225 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
226 "operand index exceeds intptr_t range"
228 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
232 return mlirOperationGetResult(op, 0);
236 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"poly.yield"), location);
237 mlirOperationStateAddOperands(&state, 1, &val);
243 return llvm::isa<YieldOp>(unwrap(inp));
247 auto range = llvm::cast<YieldOp>(unwrap(op)).getODSOperandIndexAndLength(0);
248 assert(range.second == 1 &&
"expected fixed operand segment size");
250 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
251 "operand index exceeds intptr_t range"
253 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
257 auto range = llvm::cast<YieldOp>(unwrap(op)).getODSOperandIndexAndLength(0);
258 assert(range.second == 1 &&
"expected fixed operand segment size");
260 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
261 "operand index exceeds intptr_t range"
263 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
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.
void llzkPoly_TemplateExprOpSetSymName(MlirOperation op, MlirAttribute attr)
Set SymName attribute of llzk::polymorphic::TemplateExprOp Operation.
void llzkPoly_TemplateParamOpSetSymName(MlirOperation op, MlirAttribute attr)
Set SymName attribute of llzk::polymorphic::TemplateParamOp Operation.
MlirRegion llzkPoly_TemplateOpGetBodyRegion(MlirOperation op)
Get BodyRegion region from llzk::polymorphic::TemplateOp Operation.
void llzkPoly_UnifiableCastOpSetInput(MlirOperation op, MlirValue value)
Set Input operand of llzk::polymorphic::UnifiableCastOp Operation.
bool llzkOperationIsA_Poly_TemplateExprOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::TemplateExprOp.
MlirAttribute llzkPoly_ConstReadOpGetConstName(MlirOperation op)
Get ConstName attribute from llzk::polymorphic::ConstReadOp Operation.
MlirValue llzkPoly_UnifiableCastOpGetResult(MlirOperation op)
Get Result result from llzk::polymorphic::UnifiableCastOp Operation.
MlirValue llzkPoly_YieldOpGetVal(MlirOperation op)
Get Val operand from llzk::polymorphic::YieldOp Operation.
void llzkPoly_YieldOpSetVal(MlirOperation op, MlirValue value)
Set Val operand of llzk::polymorphic::YieldOp Operation.
bool llzkOperationIsA_Poly_TemplateParamOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::TemplateParamOp.
MlirValue llzkPoly_UnifiableCastOpGetInput(MlirOperation op)
Get Input operand from llzk::polymorphic::UnifiableCastOp Operation.
MlirOperation llzkPoly_TemplateOpBuild(MlirOpBuilder builder, MlirLocation location, MlirIdentifier sym_name)
Build a llzk::polymorphic::TemplateOp Operation.
MlirValue llzkPoly_ApplyMapOpGetMapOperandsAt(MlirOperation op, intptr_t index)
Get MapOperands operand at index from llzk::polymorphic::ApplyMapOp Operation.
MlirAttribute llzkPoly_TemplateExprOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::polymorphic::TemplateExprOp Operation.
void llzkPoly_ApplyMapOpSetMapOperands(MlirOperation op, intptr_t count, MlirValue const *values)
Set MapOperands operands of llzk::polymorphic::ApplyMapOp Operation.
MlirAffineMap llzkPoly_ApplyMapOpGetAffineMap(MlirOperation inp)
Returns the affine map to be applied by this operation.
MlirAttribute llzkPoly_TemplateParamOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::polymorphic::TemplateParamOp Operation.
void llzkPoly_ApplyMapOpSetNumDims(MlirOperation op, MlirAttribute attr)
Set NumDims attribute of llzk::polymorphic::ApplyMapOp Operation.
intptr_t llzkPoly_ApplyMapOpGetMapOperandsCount(MlirOperation op)
Get number of MapOperands operands in llzk::polymorphic::ApplyMapOp Operation.
MlirType llzkPoly_TemplateExprOpGetType(MlirOperation inp)
Returns the type of the poly.yield op in the initializer region.
MlirAttribute llzkPoly_ApplyMapOpGetMap(MlirOperation op)
Get Map attribute from llzk::polymorphic::ApplyMapOp Operation.
MlirAttribute llzkPoly_ApplyMapOpGetNumDims(MlirOperation op)
Get NumDims attribute from llzk::polymorphic::ApplyMapOp Operation.
MlirOperation llzkPoly_UnifiableCastOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirValue input)
Build a llzk::polymorphic::UnifiableCastOp Operation.
void llzkPoly_ConstReadOpSetConstName(MlirOperation op, MlirAttribute attr)
Set ConstName attribute of llzk::polymorphic::ConstReadOp Operation.
MlirAttribute llzkPoly_TemplateOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::polymorphic::TemplateOp Operation.
void llzkPoly_ApplyMapOpSetMap(MlirOperation op, MlirAttribute attr)
Set Map attribute of llzk::polymorphic::ApplyMapOp Operation.
MlirValue llzkPoly_ConstReadOpGetVal(MlirOperation op)
Get Val result from llzk::polymorphic::ConstReadOp Operation.
bool llzkOperationIsA_Poly_ApplyMapOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::ApplyMapOp.
bool llzkOperationIsA_Poly_TemplateOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::TemplateOp.
MlirValue llzkPoly_ApplyMapOpGetResult0(MlirOperation op)
Get Result0 result from llzk::polymorphic::ApplyMapOp Operation.
void llzkPoly_TemplateOpSetSymName(MlirOperation op, MlirAttribute attr)
Set SymName attribute of llzk::polymorphic::TemplateOp Operation.
MlirOperation llzkPoly_ConstReadOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType valType, MlirAttribute const_name)
Build a llzk::polymorphic::ConstReadOp Operation.
MlirOperation llzkPoly_TemplateParamOpBuild(MlirOpBuilder builder, MlirLocation location, MlirIdentifier sym_name, MlirAttribute type_opt)
Build a llzk::polymorphic::TemplateParamOp Operation.
MlirAttribute llzkPoly_TemplateParamOpGetTypeOpt(MlirOperation op)
Get TypeOpt attribute from llzk::polymorphic::TemplateParamOp Operation.
bool llzkOperationIsA_Poly_YieldOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::YieldOp.
void llzkPoly_TemplateParamOpSetTypeOpt(MlirOperation op, MlirAttribute attr)
Set TypeOpt attribute of llzk::polymorphic::TemplateParamOp Operation.
MlirRegion llzkPoly_TemplateExprOpGetInitializerRegion(MlirOperation op)
Get InitializerRegion region from llzk::polymorphic::TemplateExprOp Operation.
bool llzkOperationIsA_Poly_UnifiableCastOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::UnifiableCastOp.
MlirOperation llzkPoly_YieldOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue val)
Build a llzk::polymorphic::YieldOp Operation.
MlirOperation llzkPoly_TemplateExprOpBuild(MlirOpBuilder builder, MlirLocation location, MlirIdentifier sym_name)
Build a llzk::polymorphic::TemplateExprOp Operation.
bool llzkOperationIsA_Poly_ConstReadOp(MlirOperation inp)
Returns true if the Operation is a llzk::polymorphic::ConstReadOp.