12 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"struct.new"), location);
13 mlirOperationStateAddResults(&state, 1, &resultType);
19 return llvm::isa<CreateStructOp>(unwrap(inp));
23 return mlirOperationGetResult(op, 0);
27 return llvm::isa<MemberDefOp>(unwrap(inp));
31 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
35 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
39 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"type"));
43 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"type"), attr);
47 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"column"));
51 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"column"), attr);
55 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"signal"));
59 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"signal"), attr);
63 llvm::cast<MemberDefOp>(unwrap(inp)).setPublicAttr(newValue);
67 return llvm::cast<MemberDefOp>(unwrap(inp)).hasPublicAttr();
71 return llvm::isa<MemberReadOp>(unwrap(inp));
75 return mlirOperationGetOperand(op, 0);
79 mlirOperationSetOperand(op, 0, value);
83 intptr_t count = mlirOperationGetNumOperands(op);
84 assert(count >= 1 &&
"operand count less than start index");
89 return mlirOperationGetOperand(op, 1 + index);
93 intptr_t numOperands = mlirOperationGetNumOperands(op);
94 intptr_t startIdx = 1;
97 if (startIdx < 0 || startIdx > numOperands) {
100 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
104 intptr_t oldCount = numOperands - startIdx;
105 intptr_t newNumOperands = startIdx + count;
107 std::vector<MlirValue> newOperands(newNumOperands);
110 for (intptr_t i = 0; i < startIdx; ++i) {
111 newOperands[i] = mlirOperationGetOperand(op, i);
115 for (intptr_t i = 0; i < count; ++i) {
116 newOperands[startIdx + i] = values[i];
120 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
121 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
124 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
128 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"));
132 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"), attr);
136 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"tableOffset"));
140 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"tableOffset"), attr);
144 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"numDimsPerMap"));
148 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"numDimsPerMap"), attr);
152 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"));
156 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"), attr);
160 return mlirOperationGetResult(op, 0);
164 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"struct.writem"), location);
165 mlirOperationStateAddOperands(&state, 1, &component);
166 mlirOperationStateAddOperands(&state, 1, &val);
168 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
169 if (!mlirAttributeIsNull(member_name)) {
170 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"member_name")), member_name));
172 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
178 return llvm::isa<MemberWriteOp>(unwrap(inp));
182 return mlirOperationGetOperand(op, 0);
186 mlirOperationSetOperand(op, 0, value);
190 return mlirOperationGetOperand(op, 1);
194 mlirOperationSetOperand(op, 1, value);
198 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"));
202 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"member_name"), attr);
206 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"struct.def"), location);
208 llvm::SmallVector<MlirNamedAttribute, 1> attributes;
209 if (!mlirAttributeIsNull(
reinterpret_cast<MlirAttribute&
>(sym_name))) {
210 attributes.push_back(mlirNamedAttributeGet(mlirIdentifierGet(ctx, mlirStringRefCreateFromCString(
"sym_name")),
reinterpret_cast<MlirAttribute&
>(sym_name)));
212 mlirOperationStateAddAttributes(&state, attributes.size(), attributes.data());
213 llvm::SmallVector<MlirRegion, 1> regions;
214 regions.push_back(mlirRegionCreate());
215 mlirOperationStateAddOwnedRegions(&state, regions.size(), regions.data());
221 return llvm::isa<StructDefOp>(unwrap(inp));
225 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"));
229 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"sym_name"), attr);
233 return mlirOperationGetRegion(op, 0);
237 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getComputeFuncOp());
241 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getProductFuncOp());
245 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getMemberDef(unwrap(memberName)));
249 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).hasColumns());
253 return llvm::cast<StructDefOp>(unwrap(inp)).hasComputeConstrain();
257 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).getConstrainFuncOp());
261 return llvm::cast<StructDefOp>(unwrap(inp)).hasTemplateSymbolBindings();
265 return wrap(llvm::cast<StructDefOp>(unwrap(inp)).hasSignals());
269 return llvm::cast<StructDefOp>(unwrap(inp)).isMainComponent();
273 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.
void llzkStruct_MemberReadOpSetMapOperands(MlirOperation op, intptr_t count, MlirValue const *values)
Set MapOperands operands of llzk::component::MemberReadOp Operation.
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.
MlirAttribute llzkStruct_MemberDefOpGetSymName(MlirOperation op)
Get SymName attribute from llzk::component::MemberDefOp Operation.