CIRCT 24.0.0git
Loading...
Searching...
No Matches
HWAggregateToComb.cpp
Go to the documentation of this file.
1//===- HWAggregateToComb.cpp - HW aggregate to comb -------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
13#include "mlir/Pass/Pass.h"
14#include "mlir/Transforms/DialectConversion.h"
15#include "llvm/ADT/APInt.h"
16
17namespace circt {
18namespace hw {
19#define GEN_PASS_DEF_HWAGGREGATETOCOMB
20#include "circt/Dialect/HW/Passes.h.inc"
21} // namespace hw
22} // namespace circt
23
24using namespace mlir;
25using namespace circt;
26
27namespace {
28
29// Lower hw.array_create and hw.array_concat to comb.concat.
30template <typename OpTy>
31struct HWArrayCreateLikeOpConversion : OpConversionPattern<OpTy> {
32 using OpConversionPattern<OpTy>::OpConversionPattern;
33 using OpAdaptor = typename OpConversionPattern<OpTy>::OpAdaptor;
34 LogicalResult
35 matchAndRewrite(OpTy op, OpAdaptor adaptor,
36 ConversionPatternRewriter &rewriter) const override {
37 rewriter.replaceOpWithNewOp<comb::ConcatOp>(op, adaptor.getInputs());
38 return success();
39 }
40};
41
42struct HWUnionCreateOpConversion
43 : public OpConversionPattern<hw::UnionCreateOp> {
44 using OpConversionPattern<hw::UnionCreateOp>::OpConversionPattern;
45 // hw.union_create -> hw.bitcast [ + comb.concat ]
46 LogicalResult
47 matchAndRewrite(hw::UnionCreateOp op, OpAdaptor adaptor,
48 ConversionPatternRewriter &rewriter) const override {
49 hw::UnionType unionTy = op.getType();
50 auto outputTy =
51 dyn_cast_or_null<IntegerType>(typeConverter->convertType(unionTy));
52 if (!outputTy)
53 return rewriter.notifyMatchFailure(op.getLoc(),
54 "Failed to convert union to integer");
55
56 auto inputBitWidth = hw::getBitWidth(adaptor.getInput().getType());
57 if (inputBitWidth < 0)
58 return rewriter.notifyMatchFailure(op.getLoc(),
59 "Failed to convert input to integer");
60
61 // Bitcast the input value to its integer representation.
62 auto inputIntTy = rewriter.getIntegerType(inputBitWidth);
63 Value inputAsInt = rewriter.createOrFold<hw::BitcastOp>(
64 op.getLoc(), inputIntTy, adaptor.getInput());
65
66 // The field shares the LSB of the union and is moved towards the MSB by
67 // its offset. The bits the field does not cover are undefined and filled
68 // with zeros.
69 int64_t bitOffset = unionTy.getElements()[op.getFieldIndex()].offset;
70 int64_t prePadding = outputTy.getWidth() - inputBitWidth - bitOffset;
71
72 auto createZeroCst = [&](Location loc, int64_t bitWidth) -> Value {
73 return hw::ConstantOp::create(rewriter, loc,
74 rewriter.getIntegerType(bitWidth), 0);
75 };
76
77 SmallVector<Value> concatOperands;
78 if (prePadding > 0)
79 concatOperands.push_back(createZeroCst(op.getLoc(), prePadding));
80 concatOperands.push_back(inputAsInt);
81 if (bitOffset > 0)
82 concatOperands.push_back(createZeroCst(op.getLoc(), bitOffset));
83
84 Value result =
85 rewriter.createOrFold<comb::ConcatOp>(op.getLoc(), concatOperands);
86 rewriter.replaceOp(op, result);
87 return success();
88 }
89};
90
91struct HWUnionExtractOpConversion
92 : public OpConversionPattern<hw::UnionExtractOp> {
93 using OpConversionPattern<hw::UnionExtractOp>::OpConversionPattern;
94 // hw.union_extract -> [ comb.extract + ] hw.bitcast
95 LogicalResult
96 matchAndRewrite(hw::UnionExtractOp op, OpAdaptor adaptor,
97 ConversionPatternRewriter &rewriter) const override {
98 hw::UnionType unionTy = op.getInput().getType();
99
100 auto inputTy = dyn_cast_or_null<IntegerType>(adaptor.getInput().getType());
101 if (!inputTy)
102 return rewriter.notifyMatchFailure(op.getLoc(),
103 "Failed to convert union to integer");
104 auto outputTy = typeConverter->convertType(op.getType());
105 if (!outputTy)
106 return rewriter.notifyMatchFailure(
107 op.getLoc(), "Failed to convert union extract result type");
108
109 auto resultFieldBits = hw::getBitWidth(outputTy);
110 assert(resultFieldBits >= 0);
111 auto integerValue = adaptor.getInput();
112
113 // If the output is narrower than the union, extract the active bits.
114 if (resultFieldBits < integerValue.getType().getIntOrFloatBitWidth()) {
115 auto bitOffset = unionTy.getElements()[op.getFieldIndex()].offset;
116 integerValue = comb::ExtractOp::create(
117 rewriter, op->getLoc(), rewriter.getIntegerType(resultFieldBits),
118 integerValue, bitOffset);
119 }
120
121 // Bitcast the extracted bits to the result. Fold inplace if outputTy ==
122 // inputTy.
123 auto bitcastOp = rewriter.createOrFold<hw::BitcastOp>(op.getLoc(), outputTy,
124 integerValue);
125
126 rewriter.replaceOp(op, bitcastOp);
127 return success();
128 }
129};
130
131struct HWAggregateConstantOpConversion
132 : OpConversionPattern<hw::AggregateConstantOp> {
133 using OpConversionPattern<hw::AggregateConstantOp>::OpConversionPattern;
134
135 LogicalResult
136 matchAndRewrite(hw::AggregateConstantOp op, OpAdaptor adaptor,
137 ConversionPatternRewriter &rewriter) const override {
138 // Lower to concat.
139 APInt intVal;
140 if (failed(hw::aggregateAttrToAPInt(op.getType(), adaptor.getFieldsAttr(),
141 intVal)))
142 return failure();
143 rewriter.replaceOpWithNewOp<hw::ConstantOp>(op, intVal);
144 return success();
145 }
146};
147
148struct HWArrayGetOpConversion : OpConversionPattern<hw::ArrayGetOp> {
149 using OpConversionPattern<hw::ArrayGetOp>::OpConversionPattern;
150
151 LogicalResult
152 matchAndRewrite(hw::ArrayGetOp op, OpAdaptor adaptor,
153 ConversionPatternRewriter &rewriter) const override {
154 SmallVector<Value> results;
155 auto arrayType = cast<hw::ArrayType>(op.getInput().getType());
156 auto elemType = arrayType.getElementType();
157 auto numElements = arrayType.getNumElements();
158 auto elemWidth = hw::getBitWidth(elemType);
159 if (elemWidth < 0)
160 return rewriter.notifyMatchFailure(op.getLoc(), "unknown element width");
161
162 auto lowered = adaptor.getInput();
163 auto index = adaptor.getIndex();
164 APInt constantIndex;
165 if (matchPattern(index, m_ConstantInt(&constantIndex))) {
166 int64_t maxIndex = std::numeric_limits<int32_t>::max() / elemWidth;
167 if (constantIndex.isSingleWord() &&
168 constantIndex.getZExtValue() <= static_cast<uint64_t>(maxIndex)) {
169 rewriter.replaceOpWithNewOp<comb::ExtractOp>(
170 op, lowered, constantIndex.getZExtValue() * elemWidth, elemWidth);
171 return success();
172 }
173 }
174
175 for (size_t i = 0; i < numElements; ++i)
176 results.push_back(rewriter.createOrFold<comb::ExtractOp>(
177 op.getLoc(), lowered, i * elemWidth, elemWidth));
178
179 SmallVector<Value> bits;
180 comb::extractBits(rewriter, index, bits);
181 auto result = comb::constructMuxTree(rewriter, op.getLoc(), bits, results,
182 results.back());
183
184 rewriter.replaceOp(op, result);
185 return success();
186 }
187};
188
189struct HWArraySliceOpConversion : OpConversionPattern<hw::ArraySliceOp> {
190 using OpConversionPattern<hw::ArraySliceOp>::OpConversionPattern;
191
192 LogicalResult
193 matchAndRewrite(hw::ArraySliceOp op, OpAdaptor adaptor,
194 ConversionPatternRewriter &rewriter) const override {
195 SmallVector<Value> results;
196 auto arrayType = cast<hw::ArrayType>(op.getInput().getType());
197 auto elemType = arrayType.getElementType();
198 auto numElements = arrayType.getNumElements();
199 auto elemWidth = hw::getBitWidth(elemType);
200 if (elemWidth < 0)
201 return rewriter.notifyMatchFailure(op.getLoc(), "unknown element width");
202 auto resultArrayType = cast<hw::ArrayType>(op.getResult().getType());
203 auto resultNumElements = resultArrayType.getNumElements();
204
205 auto lowered = adaptor.getInput();
206 auto index = adaptor.getLowIndex();
207 APInt constantIndex;
208 if (matchPattern(index, m_ConstantInt(&constantIndex))) {
209 int64_t maxIndex = std::numeric_limits<int32_t>::max() / elemWidth;
210 if (constantIndex.isSingleWord() &&
211 constantIndex.getZExtValue() <= static_cast<uint64_t>(maxIndex)) {
212 rewriter.replaceOpWithNewOp<comb::ExtractOp>(
213 op, lowered, constantIndex.getZExtValue() * elemWidth,
214 resultNumElements * elemWidth);
215 return success();
216 }
217 }
218
219 for (size_t i = 0; i <= numElements - resultNumElements; ++i)
220 results.push_back(rewriter.createOrFold<comb::ExtractOp>(
221 op.getLoc(), lowered, i * elemWidth, resultNumElements * elemWidth));
222
223 SmallVector<Value> bits;
224 comb::extractBits(rewriter, index, bits);
225 auto result = comb::constructMuxTree(rewriter, op.getLoc(), bits, results,
226 results.back());
227
228 rewriter.replaceOp(op, result);
229 return success();
230 }
231};
232
233struct HWArrayInjectOpConversion : OpConversionPattern<hw::ArrayInjectOp> {
234 using OpConversionPattern<hw::ArrayInjectOp>::OpConversionPattern;
235
236 LogicalResult
237 matchAndRewrite(hw::ArrayInjectOp op, OpAdaptor adaptor,
238 ConversionPatternRewriter &rewriter) const override {
239 auto arrayType = cast<hw::ArrayType>(op.getInput().getType());
240 auto elemType = arrayType.getElementType();
241 auto numElements = arrayType.getNumElements();
242 auto elemWidth = hw::getBitWidth(elemType);
243 if (elemWidth < 0)
244 return rewriter.notifyMatchFailure(op.getLoc(), "unknown element width");
245
246 // Handle trivial cases.
247 if (elemWidth == 0) {
248 rewriter.replaceOp(op, adaptor.getInput());
249 return success();
250 }
251 if (numElements == 1) {
252 rewriter.replaceOp(op, adaptor.getElement());
253 return success();
254 }
255
256 // Special case for when the index is a constant.
257 APInt constantIndex;
258 if (matchPattern(adaptor.getIndex(), m_ConstantInt(&constantIndex))) {
259 uint64_t targetIdx = constantIndex.getZExtValue();
260 return emitConstantInject(targetIdx, op, adaptor, rewriter);
261 }
262
263 return emitLinearMuxChainInject(op, adaptor, rewriter);
264 }
265
266 // Emits a constant index inject with two extracts and one concat.
267 LogicalResult emitConstantInject(uint64_t targetIdx, hw::ArrayInjectOp op,
268 OpAdaptor adaptor,
269 ConversionPatternRewriter &rewriter) const {
270 auto arrayType = cast<hw::ArrayType>(op.getInput().getType());
271 auto elemType = arrayType.getElementType();
272 auto numElements = arrayType.getNumElements();
273 if (targetIdx >= numElements)
274 return rewriter.notifyMatchFailure(op.getLoc(), "out of bounds index");
275
276 auto elemWidth = hw::getBitWidth(elemType);
277 if (elemWidth < 0)
278 return rewriter.notifyMatchFailure(op.getLoc(), "unknown element width");
279
280 int64_t totalWidth = numElements * elemWidth;
281 int64_t bitOffset = targetIdx * elemWidth;
282 int64_t upperBits = totalWidth - bitOffset - elemWidth;
283 SmallVector<Value, 3> concatOperands;
284 if (upperBits > 0)
285 concatOperands.push_back(rewriter.createOrFold<comb::ExtractOp>(
286 op.getLoc(), adaptor.getInput(), bitOffset + elemWidth, upperBits));
287 concatOperands.push_back(adaptor.getElement());
288 if (bitOffset > 0)
289 concatOperands.push_back(rewriter.createOrFold<comb::ExtractOp>(
290 op.getLoc(), adaptor.getInput(), 0, bitOffset));
291 Value result =
292 rewriter.createOrFold<comb::ConcatOp>(op.getLoc(), concatOperands);
293 rewriter.replaceOp(op, result);
294 return success();
295 }
296
297 // Emits a linear mux chain inject with a series of extracts and concats.
298 LogicalResult
299 emitLinearMuxChainInject(hw::ArrayInjectOp op, OpAdaptor adaptor,
300 ConversionPatternRewriter &rewriter) const {
301 auto arrayType = cast<hw::ArrayType>(op.getInput().getType());
302 Value index = adaptor.getIndex();
303 Location loc = op.getLoc();
304 size_t numElements = arrayType.getNumElements();
305 int64_t elemWidth = hw::getBitWidth(arrayType.getElementType());
306 if (elemWidth < 0)
307 return rewriter.notifyMatchFailure(op.getLoc(), "unknown element width");
308
309 // Extract all elements from the input array
310 SmallVector<Value> originalElements;
311 for (size_t i = 0; i < numElements; ++i) {
312 originalElements.push_back(rewriter.createOrFold<comb::ExtractOp>(
313 loc, adaptor.getInput(), i * elemWidth, elemWidth));
314 }
315
316 SmallVector<Value> rowElements;
317 rowElements.reserve(numElements);
318 for (int originalIdx = numElements - 1; originalIdx >= 0; --originalIdx) {
319 Value idxCst =
320 hw::ConstantOp::create(rewriter, loc, index.getType(), originalIdx);
321 Value cond = comb::ICmpOp::create(rewriter, loc, comb::ICmpPredicate::eq,
322 index, idxCst);
323 rowElements.push_back(comb::MuxOp::create(rewriter, loc, cond,
324 adaptor.getElement(),
325 originalElements[originalIdx]));
326 }
327 rewriter.replaceOpWithNewOp<comb::ConcatOp>(op, rowElements);
328 return success();
329 }
330};
331
332struct HWStructCreateOpConversion : OpConversionPattern<hw::StructCreateOp> {
333 using OpConversionPattern<hw::StructCreateOp>::OpConversionPattern;
334
335 LogicalResult
336 matchAndRewrite(hw::StructCreateOp op, OpAdaptor adaptor,
337 ConversionPatternRewriter &rewriter) const override {
338 // Lower struct_create to comb.concat. The first field occupies the MSBs, so
339 // we concatenate fields in order (comb.concat places first operand at MSB).
340 rewriter.replaceOpWithNewOp<comb::ConcatOp>(op, adaptor.getInput());
341 return success();
342 }
343};
344
345static int64_t getFieldBitOffset(hw::StructType structType, size_t fieldIndex) {
346 int64_t totalBitWidth = hw::getBitWidth(structType);
347 if (totalBitWidth < 0)
348 return -1;
349
350 // Compute the bit offset from the MSB by summing the widths of all preceding
351 // fields. The first field occupies the MSBs.
352 int64_t consumedBits = 0;
353 for (size_t i = 0; i < fieldIndex; ++i) {
354 int64_t fieldWidth = hw::getBitWidth(structType.getElements()[i].type);
355 assert(fieldWidth >= 0 &&
356 "must be failed before if field width is unknown");
357 consumedBits += fieldWidth;
358 }
359
360 int64_t fieldWidth =
361 hw::getBitWidth(structType.getElements()[fieldIndex].type);
362 return totalBitWidth - consumedBits - fieldWidth;
363}
364
365struct HWStructExtractOpConversion : OpConversionPattern<hw::StructExtractOp> {
366 using OpConversionPattern<hw::StructExtractOp>::OpConversionPattern;
367
368 LogicalResult
369 matchAndRewrite(hw::StructExtractOp op, OpAdaptor adaptor,
370 ConversionPatternRewriter &rewriter) const override {
371 auto structType = cast<hw::StructType>(op.getInput().getType());
372 auto fieldIndex = op.getFieldIndex();
373 auto elements = structType.getElements();
374
375 int64_t bitOffset = getFieldBitOffset(structType, fieldIndex);
376 if (bitOffset < 0)
377 return rewriter.notifyMatchFailure(op.getLoc(), "unknown struct width");
378
379 int64_t fieldWidth = hw::getBitWidth(elements[fieldIndex].type);
380 assert(fieldWidth >= 0 &&
381 "must be failed before if field width is unknown");
382
383 // Extract the field using comb.extract. Offset is from LSB.
384 rewriter.replaceOpWithNewOp<comb::ExtractOp>(op, adaptor.getInput(),
385 bitOffset, fieldWidth);
386 return success();
387 }
388};
389
390struct HWStructInjectOpConversion : OpConversionPattern<hw::StructInjectOp> {
391 using OpConversionPattern<hw::StructInjectOp>::OpConversionPattern;
392
393 LogicalResult
394 matchAndRewrite(hw::StructInjectOp op, OpAdaptor adaptor,
395 ConversionPatternRewriter &rewriter) const override {
396 auto structType = cast<hw::StructType>(op.getInput().getType());
397 auto fieldIndex = op.getFieldIndex();
398 auto elements = structType.getElements();
399
400 int64_t bitOffset = getFieldBitOffset(structType, fieldIndex);
401 if (bitOffset < 0)
402 return rewriter.notifyMatchFailure(op.getLoc(), "unknown struct width");
403
404 int64_t fieldWidth = hw::getBitWidth(elements[fieldIndex].type);
405 assert(fieldWidth >= 0 &&
406 "must be failed before if field width is unknown");
407
408 if (fieldWidth == 0) {
409 rewriter.replaceOp(op, adaptor.getInput());
410 return success();
411 }
412
413 int64_t totalBitWidth = hw::getBitWidth(structType);
414 int64_t upperBits = totalBitWidth - bitOffset - fieldWidth;
415
416 SmallVector<Value, 3> concatOperands;
417 if (upperBits > 0)
418 concatOperands.push_back(rewriter.createOrFold<comb::ExtractOp>(
419 op.getLoc(), adaptor.getInput(), bitOffset + fieldWidth, upperBits));
420 concatOperands.push_back(adaptor.getNewValue());
421 if (bitOffset > 0)
422 concatOperands.push_back(rewriter.createOrFold<comb::ExtractOp>(
423 op.getLoc(), adaptor.getInput(), 0, bitOffset));
424
425 Value result =
426 rewriter.createOrFold<comb::ConcatOp>(op.getLoc(), concatOperands);
427 rewriter.replaceOp(op, result);
428 return success();
429 }
430};
431
432struct BitcastOpConversion : OpConversionPattern<hw::BitcastOp> {
433 using OpConversionPattern<hw::BitcastOp>::OpConversionPattern;
434 // Recreate bitcast with legalized types.
435 LogicalResult
436 matchAndRewrite(hw::BitcastOp op, OpAdaptor adaptor,
437 ConversionPatternRewriter &rewriter) const override {
438 auto inputTy = adaptor.getInput().getType();
439 auto outputTy = typeConverter->convertType(op.getType());
440 if (!outputTy)
441 return rewriter.notifyMatchFailure(op, "Failed to convert result type.");
442
443 auto inBits = hw::getBitWidth(inputTy);
444 auto outBits = hw::getBitWidth(outputTy);
445 if (inBits != outBits)
446 return rewriter.notifyMatchFailure(
447 op, "Width of converted types does not match.");
448 if (inBits < 0)
449 return rewriter.notifyMatchFailure(op, "Unknown bitwidth.");
450
451 auto bitcastOp = rewriter.createOrFold<hw::BitcastOp>(op.getLoc(), outputTy,
452 adaptor.getInput());
453 rewriter.replaceOp(op, bitcastOp);
454 return success();
455 }
456};
457
458struct MuxOpConversion : OpConversionPattern<comb::MuxOp> {
459 using OpConversionPattern<comb::MuxOp>::OpConversionPattern;
460
461 LogicalResult
462 matchAndRewrite(comb::MuxOp op, OpAdaptor adaptor,
463 ConversionPatternRewriter &rewriter) const override {
464 // Re-create Mux with legalized types.
465 rewriter.replaceOpWithNewOp<comb::MuxOp>(
466 op, adaptor.getCond(), adaptor.getTrueValue(), adaptor.getFalseValue());
467 return success();
468 }
469};
470
471/// A type converter is needed to perform the in-flight materialization of
472/// aggregate types to integer types.
473class AggregateTypeConverter : public TypeConverter {
474public:
475 AggregateTypeConverter() {
476 addConversion([](Type type) -> Type { return type; });
477 addConversion([](hw::ArrayType t) -> Type {
478 auto bitWidth = t.getBitWidth();
479 if (!bitWidth)
480 return {};
481 return IntegerType::get(t.getContext(), *bitWidth);
482 });
483 addConversion([](hw::StructType t) -> Type {
484 auto bitWidth = t.getBitWidth();
485 if (!bitWidth)
486 return {};
487 return IntegerType::get(t.getContext(), *bitWidth);
488 });
489 addConversion([](hw::UnionType t) -> Type {
490 auto bitWidth = t.getBitWidth();
491 if (!bitWidth)
492 return {};
493 return IntegerType::get(t.getContext(), *bitWidth);
494 });
495 addTargetMaterialization([](mlir::OpBuilder &builder, mlir::Type resultType,
496 mlir::ValueRange inputs,
497 mlir::Location loc) -> mlir::Value {
498 if (inputs.size() != 1)
499 return Value();
500
501 return hw::BitcastOp::create(builder, loc, resultType, inputs[0])
502 ->getResult(0);
503 });
504
505 addSourceMaterialization([](mlir::OpBuilder &builder, mlir::Type resultType,
506 mlir::ValueRange inputs,
507 mlir::Location loc) -> mlir::Value {
508 if (inputs.size() != 1)
509 return Value();
510
511 return hw::BitcastOp::create(builder, loc, resultType, inputs[0])
512 ->getResult(0);
513 });
514 }
515};
516} // namespace
517
519 RewritePatternSet &patterns, AggregateTypeConverter &typeConverter) {
520 patterns.add<HWArrayGetOpConversion,
521 HWArrayCreateLikeOpConversion<hw::ArrayCreateOp>,
522 HWArrayCreateLikeOpConversion<hw::ArrayConcatOp>,
523 HWAggregateConstantOpConversion, HWArraySliceOpConversion,
524 HWArrayInjectOpConversion, HWStructCreateOpConversion,
525 HWStructExtractOpConversion, HWStructInjectOpConversion,
526 HWUnionCreateOpConversion, HWUnionExtractOpConversion,
527 BitcastOpConversion, MuxOpConversion>(typeConverter,
528 patterns.getContext());
529}
530
531namespace {
532struct HWAggregateToCombPass
533 : public hw::impl::HWAggregateToCombBase<HWAggregateToCombPass> {
534 void runOnOperation() override;
535 using HWAggregateToCombBase<HWAggregateToCombPass>::HWAggregateToCombBase;
536};
537} // namespace
538
539void HWAggregateToCombPass::runOnOperation() {
540 ConversionTarget target(getContext());
541
542 target.addIllegalOp<hw::ArrayGetOp, hw::ArrayCreateOp, hw::ArrayConcatOp,
543 hw::AggregateConstantOp, hw::ArrayInjectOp,
544 hw::ArraySliceOp, hw::StructCreateOp, hw::StructExtractOp,
545 hw::StructInjectOp, hw::UnionCreateOp,
546 hw::UnionExtractOp>();
547 target.addLegalDialect<hw::HWDialect, comb::CombDialect>();
548
549 RewritePatternSet patterns(&getContext());
550 AggregateTypeConverter typeConverter;
551 populateHWAggregateToCombOpConversionPatterns(patterns, typeConverter);
552
553 target.addDynamicallyLegalOp<comb::MuxOp, hw::BitcastOp>(
554 [&typeConverter](auto op) { return typeConverter.isLegal(op); });
555
556 if (failed(mlir::applyPartialConversion(getOperation(), target,
557 std::move(patterns))))
558 return signalPassFailure();
559}
assert(baseType &&"element must be base type")
MlirType uint64_t numElements
Definition CHIRRTL.cpp:30
static void populateHWAggregateToCombOpConversionPatterns(RewritePatternSet &patterns, AggregateTypeConverter &typeConverter)
false return failure()
Parse an optional keyword or string and set instance into 'result'.
return success()
create(low_bit, result_type, input=None)
Definition comb.py:187
create(data_type, value)
Definition hw.py:444
create(data_type, value)
Definition hw.py:433
int64_t getBitWidth(mlir::Type type)
Return the hardware bit width of a type.
Definition HWTypes.cpp:122
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.