================ @@ -2406,6 +2406,212 @@ OpFoldResult RotateOp::fold(FoldAdaptor adaptor) { return IntAttr::get(input.getContext(), input.getType(), resultValue); } +//===----------------------------------------------------------------------===// +// InlineAsmOp +//===----------------------------------------------------------------------===// + +void cir::InlineAsmOp::print(OpAsmPrinter &p) { + p << '(' << getAsmFlavor() << ", "; + p.increaseIndent(); + p.printNewline(); + + llvm::SmallVector<std::string, 3> names{"out", "in", "in_out"}; + auto *nameIt = names.begin(); + auto *attrIt = getOperandAttrs().begin(); + + for (mlir::OperandRange ops : getAsmOperands()) { + p << *nameIt << " = "; + + p << '['; + llvm::interleaveComma(llvm::make_range(ops.begin(), ops.end()), p, + [&](Value value) { + p.printOperand(value); + p << " : " << value.getType(); + if (*attrIt) + p << " (maybe_memory)"; + attrIt++; + }); + p << "],"; + p.printNewline(); + ++nameIt; + } + + p << "{"; + p.printString(getAsmString()); + p << " "; + p.printString(getConstraints()); + p << "}"; + p.decreaseIndent(); + p << ')'; + if (getSideEffects()) + p << " side_effects"; + + llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs; + elidedAttrs.push_back("asm_flavor"); + elidedAttrs.push_back("asm_string"); + elidedAttrs.push_back("constraints"); + elidedAttrs.push_back("operand_attrs"); + elidedAttrs.push_back("operands_segments"); + elidedAttrs.push_back("side_effects"); + p.printOptionalAttrDict(getOperation()->getAttrs(), elidedAttrs); ---------------- mmha wrote:
```suggestion std::array elidedAttrs{ llvm::StringRef("asm_flavor"), llvm::StringRef("asm_string"), llvm::StringRef("constraints"), llvm::StringRef("operand_attrs"), llvm::StringRef("operands_segments"), llvm::StringRef("side_effects")}; p.printOptionalAttrDict(getOperation()->getAttrs(), elidedAttrs); ``` That SmallVector is too small. https://github.com/llvm/llvm-project/pull/153362 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits