17 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"struct.new"), location);
18 mlirOperationStateAddResults(&state, 1, &resultType);
24 return llvm::isa<CreateStructOp>(unwrap(inp));
28 return mlirOperationGetResult(op, 0);
32 return llvm::isa<MemberDefOp>(unwrap(inp));
36 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
40 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
44 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"type"));
48 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"type"), attr);
52 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"column"));
56 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"column"), attr);
60 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"signal"));
64 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"signal"), attr);
68 llvm::cast<MemberDefOp>(unwrap(inp)).setPublicAttr(newValue);
72 return llvm::cast<MemberDefOp>(unwrap(inp)).hasPublicAttr();
76 return llvm::isa<MemberReadOp>(unwrap(inp));
80 auto range = llvm::cast<MemberReadOp>(unwrap(op)).getODSOperandIndexAndLength(0);
81 assert(range.second == 1 &&
"expected fixed operand segment size");
83 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
84 "operand index exceeds intptr_t range"
86 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
90 auto range = llvm::cast<MemberReadOp>(unwrap(op)).getODSOperandIndexAndLength(0);
91 assert(range.second == 1 &&
"expected fixed operand segment size");
93 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
94 "operand index exceeds intptr_t range"
96 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
100 auto range = llvm::cast<MemberReadOp>(unwrap(op)).getODSOperandIndexAndLength(1);
105 auto range = llvm::cast<MemberReadOp>(unwrap(op)).getODSOperandIndexAndLength(1);
106 assert(index >= 0 && index < range.second &&
"variadic operand index out of range");
108 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
109 "operand index exceeds intptr_t range"
111 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first) + index);
118 ::llvm::SmallVector<::mlir::Value> vals;
119 for (intptr_t g = 0; g < groupCount; ++g) {
120 assert(groups[g].size >= 0 &&
"group size must be non-negative");
121 for (intptr_t i = 0; i < groups[g].
size; ++i) {
122 vals.push_back(unwrap(groups[g].values[i]));
125 ::llvm::cast<MemberReadOp>(unwrap(op)).getMapOperandsMutable().join().assign(vals);
127 ::llvm::SmallVector<int32_t> newGroupSizes;
128 newGroupSizes.reserve(
static_cast<size_t>(groupCount));
129 for (intptr_t g = 0; g < groupCount; ++g) {
131 groups[g].size <=
static_cast<intptr_t
>(std::numeric_limits<int32_t>::max()) &&
132 "group size exceeds int32_t range"
134 newGroupSizes.push_back(
static_cast<int32_t
>(groups[g].size));
136 MlirContext ctx = mlirOperationGetContext(op);
138 newGroupSizes.size() <=
static_cast<size_t>(std::numeric_limits<intptr_t>::max()) &&
139 "group count exceeds intptr_t range"
141 mlirOperationSetAttributeByName(
142 op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"),
143 mlirDenseI32ArrayGet(ctx,
static_cast<intptr_t
>(newGroupSizes.size()), newGroupSizes.data())
148 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"));
152 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"), attr);
156 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"tableOffset"));
160 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"tableOffset"), attr);
164 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"numDimsPerMap"));
168 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"numDimsPerMap"), attr);
172 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"));
176 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"), attr);
180 return mlirOperationGetResult(op, 0);
184 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"struct.writem"), location);
185 mlirOperationStateAddOperands(&state, 1, &component);
186 mlirOperationStateAddOperands(&state, 1, &val);
188 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
189 if (!mlirAttributeIsNull(member_name)) {
190 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"member_name")), member_name));
192 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
198 return llvm::isa<MemberWriteOp>(unwrap(inp));
202 auto range = llvm::cast<MemberWriteOp>(unwrap(op)).getODSOperandIndexAndLength(0);
203 assert(range.second == 1 &&
"expected fixed operand segment size");
205 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
206 "operand index exceeds intptr_t range"
208 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
212 auto range = llvm::cast<MemberWriteOp>(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 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
222 auto range = llvm::cast<MemberWriteOp>(unwrap(op)).getODSOperandIndexAndLength(1);
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 return mlirOperationGetOperand(op,
static_cast<intptr_t
>(range.first));
232 auto range = llvm::cast<MemberWriteOp>(unwrap(op)).getODSOperandIndexAndLength(1);
233 assert(range.second == 1 &&
"expected fixed operand segment size");
235 static_cast<uintptr_t
>(range.first) <=
static_cast<uintptr_t
>(std::numeric_limits<intptr_t>::max()) &&
236 "operand index exceeds intptr_t range"
238 mlirOperationSetOperand(op,
static_cast<intptr_t
>(range.first), value);
242 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"));
246 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"), attr);
250 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"struct.def"), location);
252 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
253 if (!mlirAttributeIsNull(
reinterpret_cast<MlirAttribute&
>(sym_name))) {
254 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"sym_name")),
reinterpret_cast<MlirAttribute&
>(sym_name)));
256 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
257 llvm::SmallVector<MlirRegion, 1> regions;
258 regions.push_back(mlirRegionCreate());
259 mlirOperationStateAddOwnedRegions(&state, regions.size(), regions.data());
265 return llvm::isa<StructDefOp>(unwrap(inp));
269 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
273 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
277 return mlirOperationGetRegion(op, 0);
281 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getComputeFuncOp());
285 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getProductFuncOp());
289 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getMemberDef(unwrap(memberName)));
293 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).hasColumns());
297 return llvm::cast<StructDefOp>(unwrap(inp)).hasComputeConstrain();
301 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getConstrainFuncOp());
305 return llvm::cast<StructDefOp>(unwrap(inp)).hasTemplateSymbolBindings();
309 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).hasSignals());
313 return llvm::cast<StructDefOp>(unwrap(inp)).isMainComponent();
317 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getFullyQualifiedName());
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.
MlirAttribute llzkStruct_MemberReadOpGetNumDimsPerMap(MlirOperation op)
Get NumDimsPerMap attribute from llzk::component::MemberReadOp Operation.
MlirRegion llzkStruct_StructDefOpGetBodyRegion(MlirOperation op)
Get BodyRegion region from llzk::component::StructDefOp Operation.
MlirOperation llzkStruct_MemberWriteOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue component, MlirValue val, MlirAttribute member_name)
Build a llzk::component::MemberWriteOp Operation.
bool llzkOperationIsA_Struct_CreateStructOp(MlirOperation inp)
Returns true if the Operation is a llzk::component::CreateStructOp.
MlirOperation llzkStruct_StructDefOpBuild(MlirOpBuilder builder, MlirLocation location, MlirIdentifier sym_name)
Build a llzk::component::StructDefOp Operation.
MlirValue llzkStruct_MemberWriteOpGetVal(MlirOperation op)
Get Val operand from llzk::component::MemberWriteOp Operation.
MlirOperation llzkStruct_StructDefOpGetConstrainFuncOp(MlirOperation inp)
Gets the FuncDefOp that defines the constrain function in this structure, if present,...
bool llzkStruct_StructDefOpHasComputeConstrain(MlirOperation inp)
Returns true iff this structure defines compute and constrain functions.
void llzkStruct_MemberWriteOpSetVal(MlirOperation op, MlirValue value)
Set Val operand of llzk::component::MemberWriteOp Operation.
intptr_t llzkStruct_MemberReadOpGetMapOperandsCount(MlirOperation op)
Get number of MapOperands operands in llzk::component::MemberReadOp Operation.
MlirOperation llzkStruct_StructDefOpGetProductFuncOp(MlirOperation inp)
Gets the FuncDefOp that defines the product function in this structure, if present,...
bool llzkOperationIsA_Struct_MemberReadOp(MlirOperation inp)
Returns true if the Operation is a llzk::component::MemberReadOp.
MlirValue llzkStruct_MemberReadOpGetMapOperandsAt(MlirOperation op, intptr_t index)
Get MapOperands operand at index from llzk::component::MemberReadOp Operation.
void llzkStruct_MemberReadOpSetTableOffset(MlirOperation op, MlirAttribute attr)
Set TableOffset attribute of llzk::component::MemberReadOp Operation.
void llzkStruct_MemberDefOpSetSymName(MlirOperation op, MlirAttribute attr)
Set SymName attribute of llzk::component::MemberDefOp Operation.
void llzkStruct_MemberDefOpSetType(MlirOperation op, MlirAttribute attr)
Set Type attribute of llzk::component::MemberDefOp Operation.
void llzkStruct_MemberWriteOpSetComponent(MlirOperation op, MlirValue value)
Set Component operand of llzk::component::MemberWriteOp Operation.
MlirAttribute llzkStruct_StructDefOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::component::StructDefOp Operation.
MlirValue llzkStruct_MemberWriteOpGetComponent(MlirOperation op)
Get Component operand from llzk::component::MemberWriteOp Operation.
void llzkStruct_MemberReadOpSetNumDimsPerMap(MlirOperation op, MlirAttribute attr)
Set NumDimsPerMap attribute of llzk::component::MemberReadOp Operation.
MlirAttribute llzkStruct_MemberReadOpGetMemberName(MlirOperation op)
Get MemberName attribute from llzk::component::MemberReadOp Operation.
bool llzkStruct_StructDefOpHasTemplateSymbolBindings(MlirOperation inp)
Return true iff the struct.def appears within a poly.template that defines constant parameters and/or...
MlirLogicalResult llzkStruct_StructDefOpHasSignals(MlirOperation inp)
Returns whether the struct defines members marked as signals.
MlirAttribute llzkStruct_MemberDefOpGetType(MlirOperation op)
Get Type attribute from llzk::component::MemberDefOp Operation.
void llzkStruct_MemberDefOpSetColumn(MlirOperation op, MlirAttribute attr)
Set Column attribute of llzk::component::MemberDefOp Operation.
void llzkStruct_MemberDefOpSetPublicAttr(MlirOperation inp, bool newValue)
setPublicAttr
bool llzkOperationIsA_Struct_MemberDefOp(MlirOperation inp)
Returns true if the Operation is a llzk::component::MemberDefOp.
MlirAttribute llzkStruct_MemberWriteOpGetMemberName(MlirOperation op)
Get MemberName attribute from llzk::component::MemberWriteOp Operation.
MlirAttribute llzkStruct_MemberReadOpGetTableOffset(MlirOperation op)
Get TableOffset attribute from llzk::component::MemberReadOp Operation.
void llzkStruct_MemberReadOpSetComponent(MlirOperation op, MlirValue value)
Set Component operand of llzk::component::MemberReadOp Operation.
MlirAttribute llzkStruct_MemberDefOpGetSignal(MlirOperation op)
Get Signal attribute from llzk::component::MemberDefOp Operation.
MlirValue llzkStruct_CreateStructOpGetResult(MlirOperation op)
Get Result result from llzk::component::CreateStructOp Operation.
MlirValue llzkStruct_MemberReadOpGetVal(MlirOperation op)
Get Val result from llzk::component::MemberReadOp Operation.
void llzkStruct_MemberDefOpSetSignal(MlirOperation op, MlirAttribute attr)
Set Signal attribute of llzk::component::MemberDefOp Operation.
void llzkStruct_MemberReadOpSetMapOpGroupSizes(MlirOperation op, MlirAttribute attr)
Set MapOpGroupSizes attribute of llzk::component::MemberReadOp Operation.
void llzkStruct_MemberWriteOpSetMemberName(MlirOperation op, MlirAttribute attr)
Set MemberName attribute of llzk::component::MemberWriteOp Operation.
MlirLogicalResult llzkStruct_StructDefOpHasColumns(MlirOperation inp)
Returns whether the struct defines members marked as columns.
bool llzkStruct_MemberDefOpHasPublicAttr(MlirOperation inp)
hasPublicAttr
bool llzkOperationIsA_Struct_MemberWriteOp(MlirOperation inp)
Returns true if the Operation is a llzk::component::MemberWriteOp.
bool llzkStruct_StructDefOpIsMainComponent(MlirOperation inp)
Return true iff this struct.def is the main struct. See llzk::MAIN_ATTR_NAME.
MlirOperation llzkStruct_CreateStructOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType)
Build a llzk::component::CreateStructOp Operation.
void llzkStruct_StructDefOpSetSymName(MlirOperation op, MlirAttribute attr)
Set SymName attribute of llzk::component::StructDefOp Operation.
MlirOperation llzkStruct_StructDefOpGetMemberDef(MlirOperation inp, MlirIdentifier memberName)
Gets the MemberDefOp that defines the member in this structure with the given name,...
void llzkStruct_MemberReadOpSetMemberName(MlirOperation op, MlirAttribute attr)
Set MemberName attribute of llzk::component::MemberReadOp Operation.
MlirAttribute llzkStruct_MemberDefOpGetColumn(MlirOperation op)
Get Column attribute from llzk::component::MemberDefOp Operation.
bool llzkOperationIsA_Struct_StructDefOp(MlirOperation inp)
Returns true if the Operation is a llzk::component::StructDefOp.
MlirValue llzkStruct_MemberReadOpGetComponent(MlirOperation op)
Get Component operand from llzk::component::MemberReadOp Operation.
MlirOperation llzkStruct_StructDefOpGetComputeFuncOp(MlirOperation inp)
Gets the FuncDefOp that defines the compute function in this structure, if present,...
MlirAttribute llzkStruct_StructDefOpGetFullyQualifiedName(MlirOperation inp)
Return the full name for this struct from the root module, including any surrounding module scopes.
MlirAttribute llzkStruct_MemberReadOpGetMapOpGroupSizes(MlirOperation op)
Get MapOpGroupSizes attribute from llzk::component::MemberReadOp Operation.
void llzkStruct_MemberReadOpSetMapOperands(MlirOperation op, intptr_t groupCount, MlirValueRange const *groups)
Set MapOperands operand groups of llzk::component::MemberReadOp Operation.
MlirAttribute llzkStruct_MemberDefOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::component::MemberDefOp Operation.
Representation of an mlir::ValueRange
intptr_t size
Number of values in the range.