MCPcopy Create free account
hub / github.com/MegEngine/MegCC / createOp

Function createOp

compiler/lib/Conversion/MGBToKernel/MGBToKernel.cpp:95–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94template <typename OpType>
95LogicalResult 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
110void setOperandSegmentAttr(
111 MLIRContext* context, SmallVector<NamedAttribute, 4>& attrs,

Callers

nothing calls this directly

Calls 1

prepareOperandsFunction · 0.85

Tested by

no test coverage detected