12 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"array.len"), location);
13 mlirOperationStateEnableResultTypeInference(&state);
14 mlirOperationStateAddOperands(&state, 1, &arr_ref);
15 mlirOperationStateAddOperands(&state, 1, &dim);
21 return llvm::isa<ArrayLengthOp>(unwrap(inp));
25 return mlirOperationGetOperand(op, 0);
29 mlirOperationSetOperand(op, 0, value);
33 return mlirOperationGetOperand(op, 1);
37 mlirOperationSetOperand(op, 1, value);
41 return mlirOperationGetResult(op, 0);
45 return wrap(llvm::cast<ArrayLengthOp>(unwrap(inp)).getArrRefType());
49 return llvm::isa<CreateArrayOp>(unwrap(inp));
53 intptr_t count = mlirOperationGetNumOperands(op);
54 assert(count >= 0 &&
"operand count less than start index");
59 return mlirOperationGetOperand(op, 0 + index);
63 intptr_t numOperands = mlirOperationGetNumOperands(op);
64 intptr_t startIdx = 0;
67 if (startIdx < 0 || startIdx > numOperands) {
70 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
74 intptr_t oldCount = numOperands - startIdx;
75 intptr_t newNumOperands = startIdx + count;
77 std::vector<MlirValue> newOperands(newNumOperands);
80 for (intptr_t i = 0; i < startIdx; ++i) {
81 newOperands[i] = mlirOperationGetOperand(op, i);
85 for (intptr_t i = 0; i < count; ++i) {
86 newOperands[startIdx + i] = values[i];
90 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
91 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
94 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
98 intptr_t count = mlirOperationGetNumOperands(op);
99 assert(count >= 1 &&
"operand count less than start index");
104 return mlirOperationGetOperand(op, 1 + index);
108 intptr_t numOperands = mlirOperationGetNumOperands(op);
109 intptr_t startIdx = 1;
112 if (startIdx < 0 || startIdx > numOperands) {
115 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
119 intptr_t oldCount = numOperands - startIdx;
120 intptr_t newNumOperands = startIdx + count;
122 std::vector<MlirValue> newOperands(newNumOperands);
125 for (intptr_t i = 0; i < startIdx; ++i) {
126 newOperands[i] = mlirOperationGetOperand(op, i);
130 for (intptr_t i = 0; i < count; ++i) {
131 newOperands[startIdx + i] = values[i];
135 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
136 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
139 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
143 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"numDimsPerMap"));
147 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"numDimsPerMap"), attr);
151 return mlirOperationGetAttributeByName(op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"));
155 mlirOperationSetAttributeByName(op, mlirStringRefCreateFromCString(
"mapOpGroupSizes"), attr);
159 return mlirOperationGetResult(op, 0);
162MlirOperation
llzkArray_ExtractArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirValue arr_ref, intptr_t indicesSize, MlirValue
const *indices) {
163 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"array.extract"), location);
164 mlirOperationStateAddResults(&state, 1, &resultType);
165 mlirOperationStateAddOperands(&state, 1, &arr_ref);
166 mlirOperationStateAddOperands(&state, indicesSize, indices);
172 return llvm::isa<ExtractArrayOp>(unwrap(inp));
176 return mlirOperationGetOperand(op, 0);
180 mlirOperationSetOperand(op, 0, value);
184 intptr_t count = mlirOperationGetNumOperands(op);
185 assert(count >= 1 &&
"operand count less than start index");
190 return mlirOperationGetOperand(op, 1 + index);
194 intptr_t numOperands = mlirOperationGetNumOperands(op);
195 intptr_t startIdx = 1;
198 if (startIdx < 0 || startIdx > numOperands) {
201 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
205 intptr_t oldCount = numOperands - startIdx;
206 intptr_t newNumOperands = startIdx + count;
208 std::vector<MlirValue> newOperands(newNumOperands);
211 for (intptr_t i = 0; i < startIdx; ++i) {
212 newOperands[i] = mlirOperationGetOperand(op, i);
216 for (intptr_t i = 0; i < count; ++i) {
217 newOperands[startIdx + i] = values[i];
221 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
222 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
225 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
229 return mlirOperationGetResult(op, 0);
233 return wrap(llvm::cast<ExtractArrayOp>(unwrap(inp)).getArrRefType());
236MlirOperation
llzkArray_InsertArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue arr_ref, intptr_t indicesSize, MlirValue
const *indices, MlirValue rvalue) {
237 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"array.insert"), location);
238 mlirOperationStateAddOperands(&state, 1, &arr_ref);
239 mlirOperationStateAddOperands(&state, indicesSize, indices);
240 mlirOperationStateAddOperands(&state, 1, &rvalue);
246 return llvm::isa<InsertArrayOp>(unwrap(inp));
250 return mlirOperationGetOperand(op, 0);
254 mlirOperationSetOperand(op, 0, value);
258 intptr_t count = mlirOperationGetNumOperands(op);
259 assert(count >= 1 &&
"operand count less than start index");
264 return mlirOperationGetOperand(op, 1 + index);
268 intptr_t numOperands = mlirOperationGetNumOperands(op);
269 intptr_t startIdx = 1;
272 if (startIdx < 0 || startIdx > numOperands) {
275 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
279 intptr_t oldCount = numOperands - startIdx;
280 intptr_t newNumOperands = startIdx + count;
282 std::vector<MlirValue> newOperands(newNumOperands);
285 for (intptr_t i = 0; i < startIdx; ++i) {
286 newOperands[i] = mlirOperationGetOperand(op, i);
290 for (intptr_t i = 0; i < count; ++i) {
291 newOperands[startIdx + i] = values[i];
295 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
296 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
299 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
303 return mlirOperationGetOperand(op, 2);
307 mlirOperationSetOperand(op, 2, value);
311 return wrap(llvm::cast<InsertArrayOp>(unwrap(inp)).getArrRefType());
314MlirOperation
llzkArray_ReadArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirValue arr_ref, intptr_t indicesSize, MlirValue
const *indices) {
315 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"array.read"), location);
316 mlirOperationStateAddResults(&state, 1, &resultType);
317 mlirOperationStateAddOperands(&state, 1, &arr_ref);
318 mlirOperationStateAddOperands(&state, indicesSize, indices);
324 return llvm::isa<ReadArrayOp>(unwrap(inp));
328 return mlirOperationGetOperand(op, 0);
332 mlirOperationSetOperand(op, 0, value);
336 intptr_t count = mlirOperationGetNumOperands(op);
337 assert(count >= 1 &&
"operand count less than start index");
342 return mlirOperationGetOperand(op, 1 + index);
346 intptr_t numOperands = mlirOperationGetNumOperands(op);
347 intptr_t startIdx = 1;
350 if (startIdx < 0 || startIdx > numOperands) {
353 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
357 intptr_t oldCount = numOperands - startIdx;
358 intptr_t newNumOperands = startIdx + count;
360 std::vector<MlirValue> newOperands(newNumOperands);
363 for (intptr_t i = 0; i < startIdx; ++i) {
364 newOperands[i] = mlirOperationGetOperand(op, i);
368 for (intptr_t i = 0; i < count; ++i) {
369 newOperands[startIdx + i] = values[i];
373 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
374 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
377 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
381 return mlirOperationGetResult(op, 0);
385 return wrap(llvm::cast<ReadArrayOp>(unwrap(inp)).getArrRefType());
388MlirOperation
llzkArray_WriteArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue arr_ref, intptr_t indicesSize, MlirValue
const *indices, MlirValue rvalue) {
389 MlirOperationState state = mlirOperationStateGet(mlirStringRefCreateFromCString(
"array.write"), location);
390 mlirOperationStateAddOperands(&state, 1, &arr_ref);
391 mlirOperationStateAddOperands(&state, indicesSize, indices);
392 mlirOperationStateAddOperands(&state, 1, &rvalue);
398 return llvm::isa<WriteArrayOp>(unwrap(inp));
402 return mlirOperationGetOperand(op, 0);
406 mlirOperationSetOperand(op, 0, value);
410 intptr_t count = mlirOperationGetNumOperands(op);
411 assert(count >= 1 &&
"operand count less than start index");
416 return mlirOperationGetOperand(op, 1 + index);
420 intptr_t numOperands = mlirOperationGetNumOperands(op);
421 intptr_t startIdx = 1;
424 if (startIdx < 0 || startIdx > numOperands) {
427 if (count < 0 || count > (std::numeric_limits<intptr_t>::max() - startIdx)) {
431 intptr_t oldCount = numOperands - startIdx;
432 intptr_t newNumOperands = startIdx + count;
434 std::vector<MlirValue> newOperands(newNumOperands);
437 for (intptr_t i = 0; i < startIdx; ++i) {
438 newOperands[i] = mlirOperationGetOperand(op, i);
442 for (intptr_t i = 0; i < count; ++i) {
443 newOperands[startIdx + i] = values[i];
447 for (intptr_t i = startIdx + oldCount; i < numOperands; ++i) {
448 newOperands[i - oldCount + count] = mlirOperationGetOperand(op, i);
451 mlirOperationSetOperands(op, newNumOperands, newOperands.data());
455 return mlirOperationGetOperand(op, 2);
459 mlirOperationSetOperand(op, 2, value);
463 return wrap(llvm::cast<WriteArrayOp>(unwrap(inp)).getArrRefType());
bool llzkOperationIsA_Array_InsertArrayOp(MlirOperation inp)
Returns true if the Operation is a llzk::array::InsertArrayOp.
MlirValue llzkArray_InsertArrayOpGetIndicesAt(MlirOperation op, intptr_t index)
Get Indices operand at index from llzk::array::InsertArrayOp Operation.
MlirValue llzkArray_WriteArrayOpGetRvalue(MlirOperation op)
Get Rvalue operand from llzk::array::WriteArrayOp Operation.
void llzkArray_CreateArrayOpSetNumDimsPerMap(MlirOperation op, MlirAttribute attr)
Set NumDimsPerMap attribute of llzk::array::CreateArrayOp Operation.
MlirValue llzkArray_ReadArrayOpGetArrRef(MlirOperation op)
Get ArrRef operand from llzk::array::ReadArrayOp Operation.
MlirType llzkArray_WriteArrayOpGetArrRefType(MlirOperation inp)
Gets the type of the referenced base array.
void llzkArray_InsertArrayOpSetRvalue(MlirOperation op, MlirValue value)
Set Rvalue operand of llzk::array::InsertArrayOp Operation.
void llzkArray_ArrayLengthOpSetArrRef(MlirOperation op, MlirValue value)
Set ArrRef operand of llzk::array::ArrayLengthOp Operation.
intptr_t llzkArray_CreateArrayOpGetElementsCount(MlirOperation op)
Get number of Elements operands in llzk::array::CreateArrayOp Operation.
void llzkArray_ExtractArrayOpSetArrRef(MlirOperation op, MlirValue value)
Set ArrRef operand of llzk::array::ExtractArrayOp Operation.
bool llzkOperationIsA_Array_ExtractArrayOp(MlirOperation inp)
Returns true if the Operation is a llzk::array::ExtractArrayOp.
void llzkArray_ArrayLengthOpSetDim(MlirOperation op, MlirValue value)
Set Dim operand of llzk::array::ArrayLengthOp Operation.
void llzkArray_CreateArrayOpSetMapOperands(MlirOperation op, intptr_t count, MlirValue const *values)
Set MapOperands operands of llzk::array::CreateArrayOp Operation.
MlirOperation llzkArray_ArrayLengthOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue arr_ref, MlirValue dim)
Build a llzk::array::ArrayLengthOp Operation.
void llzkArray_CreateArrayOpSetElements(MlirOperation op, intptr_t count, MlirValue const *values)
Set Elements operands of llzk::array::CreateArrayOp Operation.
void llzkArray_WriteArrayOpSetRvalue(MlirOperation op, MlirValue value)
Set Rvalue operand of llzk::array::WriteArrayOp Operation.
MlirValue llzkArray_InsertArrayOpGetRvalue(MlirOperation op)
Get Rvalue operand from llzk::array::InsertArrayOp Operation.
bool llzkOperationIsA_Array_ReadArrayOp(MlirOperation inp)
Returns true if the Operation is a llzk::array::ReadArrayOp.
intptr_t llzkArray_WriteArrayOpGetIndicesCount(MlirOperation op)
Get number of Indices operands in llzk::array::WriteArrayOp Operation.
MlirType llzkArray_ReadArrayOpGetArrRefType(MlirOperation inp)
Gets the type of the referenced base array.
MlirValue llzkArray_CreateArrayOpGetResult(MlirOperation op)
Get Result result from llzk::array::CreateArrayOp Operation.
intptr_t llzkArray_ReadArrayOpGetIndicesCount(MlirOperation op)
Get number of Indices operands in llzk::array::ReadArrayOp Operation.
void llzkArray_ReadArrayOpSetIndices(MlirOperation op, intptr_t count, MlirValue const *values)
Set Indices operands of llzk::array::ReadArrayOp Operation.
MlirValue llzkArray_ArrayLengthOpGetLength(MlirOperation op)
Get Length result from llzk::array::ArrayLengthOp Operation.
void llzkArray_InsertArrayOpSetIndices(MlirOperation op, intptr_t count, MlirValue const *values)
Set Indices operands of llzk::array::InsertArrayOp Operation.
MlirValue llzkArray_ExtractArrayOpGetArrRef(MlirOperation op)
Get ArrRef operand from llzk::array::ExtractArrayOp Operation.
intptr_t llzkArray_ExtractArrayOpGetIndicesCount(MlirOperation op)
Get number of Indices operands in llzk::array::ExtractArrayOp Operation.
MlirType llzkArray_ArrayLengthOpGetArrRefType(MlirOperation inp)
Gets the type of the referenced base array.
MlirOperation llzkArray_InsertArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue arr_ref, intptr_t indicesSize, MlirValue const *indices, MlirValue rvalue)
Build a llzk::array::InsertArrayOp Operation.
MlirOperation llzkArray_ExtractArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirValue arr_ref, intptr_t indicesSize, MlirValue const *indices)
Build a llzk::array::ExtractArrayOp Operation.
MlirValue llzkArray_ExtractArrayOpGetResult(MlirOperation op)
Get Result result from llzk::array::ExtractArrayOp Operation.
void llzkArray_ExtractArrayOpSetIndices(MlirOperation op, intptr_t count, MlirValue const *values)
Set Indices operands of llzk::array::ExtractArrayOp Operation.
MlirType llzkArray_InsertArrayOpGetArrRefType(MlirOperation inp)
Gets the type of the referenced base array.
MlirValue llzkArray_CreateArrayOpGetMapOperandsAt(MlirOperation op, intptr_t index)
Get MapOperands operand at index from llzk::array::CreateArrayOp Operation.
intptr_t llzkArray_InsertArrayOpGetIndicesCount(MlirOperation op)
Get number of Indices operands in llzk::array::InsertArrayOp Operation.
MlirAttribute llzkArray_CreateArrayOpGetMapOpGroupSizes(MlirOperation op)
Get MapOpGroupSizes attribute from llzk::array::CreateArrayOp Operation.
void llzkArray_WriteArrayOpSetIndices(MlirOperation op, intptr_t count, MlirValue const *values)
Set Indices operands of llzk::array::WriteArrayOp Operation.
MlirValue llzkArray_ExtractArrayOpGetIndicesAt(MlirOperation op, intptr_t index)
Get Indices operand at index from llzk::array::ExtractArrayOp Operation.
MlirAttribute llzkArray_CreateArrayOpGetNumDimsPerMap(MlirOperation op)
Get NumDimsPerMap attribute from llzk::array::CreateArrayOp Operation.
bool llzkOperationIsA_Array_WriteArrayOp(MlirOperation inp)
Returns true if the Operation is a llzk::array::WriteArrayOp.
void llzkArray_ReadArrayOpSetArrRef(MlirOperation op, MlirValue value)
Set ArrRef operand of llzk::array::ReadArrayOp Operation.
intptr_t llzkArray_CreateArrayOpGetMapOperandsCount(MlirOperation op)
Get number of MapOperands operands in llzk::array::CreateArrayOp Operation.
MlirOperation llzkArray_ReadArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirType resultType, MlirValue arr_ref, intptr_t indicesSize, MlirValue const *indices)
Build a llzk::array::ReadArrayOp Operation.
void llzkArray_WriteArrayOpSetArrRef(MlirOperation op, MlirValue value)
Set ArrRef operand of llzk::array::WriteArrayOp Operation.
MlirValue llzkArray_WriteArrayOpGetIndicesAt(MlirOperation op, intptr_t index)
Get Indices operand at index from llzk::array::WriteArrayOp Operation.
MlirOperation llzkArray_WriteArrayOpBuild(MlirOpBuilder builder, MlirLocation location, MlirValue arr_ref, intptr_t indicesSize, MlirValue const *indices, MlirValue rvalue)
Build a llzk::array::WriteArrayOp Operation.
MlirValue llzkArray_ArrayLengthOpGetArrRef(MlirOperation op)
Get ArrRef operand from llzk::array::ArrayLengthOp Operation.
MlirType llzkArray_ExtractArrayOpGetArrRefType(MlirOperation inp)
Gets the type of the referenced base array.
MlirValue llzkArray_WriteArrayOpGetArrRef(MlirOperation op)
Get ArrRef operand from llzk::array::WriteArrayOp Operation.
bool llzkOperationIsA_Array_CreateArrayOp(MlirOperation inp)
Returns true if the Operation is a llzk::array::CreateArrayOp.
void llzkArray_InsertArrayOpSetArrRef(MlirOperation op, MlirValue value)
Set ArrRef operand of llzk::array::InsertArrayOp Operation.
bool llzkOperationIsA_Array_ArrayLengthOp(MlirOperation inp)
Returns true if the Operation is a llzk::array::ArrayLengthOp.
MlirValue llzkArray_ReadArrayOpGetResult(MlirOperation op)
Get Result result from llzk::array::ReadArrayOp Operation.
MlirValue llzkArray_InsertArrayOpGetArrRef(MlirOperation op)
Get ArrRef operand from llzk::array::InsertArrayOp Operation.
void llzkArray_CreateArrayOpSetMapOpGroupSizes(MlirOperation op, MlirAttribute attr)
Set MapOpGroupSizes attribute of llzk::array::CreateArrayOp Operation.
MlirValue llzkArray_ReadArrayOpGetIndicesAt(MlirOperation op, intptr_t index)
Get Indices operand at index from llzk::array::ReadArrayOp Operation.
MlirValue llzkArray_CreateArrayOpGetElementsAt(MlirOperation op, intptr_t index)
Get Elements operand at index from llzk::array::CreateArrayOp Operation.
MlirValue llzkArray_ArrayLengthOpGetDim(MlirOperation op)
Get Dim operand from llzk::array::ArrayLengthOp Operation.
MlirOperation mlirOpBuilderInsert(MlirOpBuilder builder, MlirOperation op)
Inserts op at the current insertion point of builder and returns it.