| 93 | |
| 94 | template <typename OpType> |
| 95 | LogicalResult createOp( |
| 96 | Operation* op, ::mlir::ValueRange operands, ConversionPatternRewriter& rewriter, |
| 97 | llvm::ArrayRef<NamedAttribute> attributes = {}) { |
| 98 | SmallVector<Value> newOperands(operands.begin(), operands.end()); |
| 99 | if (succeeded(prepareOperands(op, newOperands, rewriter))) { |
| 100 | rewriter.create<OpType>( |
| 101 | rewriter.getUnknownLoc(), llvm::None, newOperands, attributes); |
| 102 | rewriter.replaceOp( |
| 103 | op, llvm::makeArrayRef( |
| 104 | newOperands.begin() + operands.size(), newOperands.end())); |
| 105 | return success(); |
| 106 | } |
| 107 | return failure(); |
| 108 | } |
| 109 | |
| 110 | void setOperandSegmentAttr( |
| 111 | MLIRContext* context, SmallVector<NamedAttribute, 4>& attrs, |
nothing calls this directly
no test coverage detected