}];
let hasVerifier = 1;
+
+ let builders = [OpBuilder<(ins "mlir::ValueRange":$extents)>];
}
def fir_ShapeShiftOp : fir_Op<"shape_shift", [NoMemoryEffect]> {
llvm::SmallVector<mlir::Value> idxShape;
for (auto s : shape)
idxShape.push_back(builder.createConvert(loc, idxTy, s));
- auto shapeTy = fir::ShapeType::get(builder.getContext(), idxShape.size());
- return builder.create<fir::ShapeOp>(loc, shapeTy, idxShape);
+ return builder.create<fir::ShapeOp>(loc, idxShape);
}
fir::ShapeOp genShapeOp(llvm::ArrayRef<mlir::Value> shape) {
mlir::Value fir::FirOpBuilder::genShape(mlir::Location loc,
llvm::ArrayRef<mlir::Value> exts) {
- auto shapeType = fir::ShapeType::get(getContext(), exts.size());
- return create<fir::ShapeOp>(loc, shapeType, exts);
+ return create<fir::ShapeOp>(loc, exts);
}
mlir::Value fir::FirOpBuilder::genShape(mlir::Location loc,
mlir::Value shape;
if (!extents.empty()) {
if (lbounds.empty()) {
- auto shapeType =
- fir::ShapeType::get(builder.getContext(), extents.size());
- shape = builder.create<fir::ShapeOp>(loc, shapeType, extents);
+ shape = builder.create<fir::ShapeOp>(loc, extents);
} else {
llvm::SmallVector<mlir::Value> shapeShiftBounds;
for (auto [lb, extent] : llvm::zip(lbounds, extents)) {
return mlir::success();
}
+void fir::ShapeOp::build(mlir::OpBuilder &builder, mlir::OperationState &result,
+ mlir::ValueRange extents) {
+ auto type = fir::ShapeType::get(builder.getContext(), extents.size());
+ build(builder, result, type, extents);
+}
+
//===----------------------------------------------------------------------===//
// ShapeShiftOp
//===----------------------------------------------------------------------===//
}
mlir::Value createShape(llvm::ArrayRef<mlir::Value> extents) {
- mlir::Type shapeType = fir::ShapeType::get(&context, extents.size());
- return builder->create<fir::ShapeOp>(getLoc(), shapeType, extents);
+ return builder->create<fir::ShapeOp>(getLoc(), extents);
}
mlir::MLIRContext context;
std::unique_ptr<mlir::OpBuilder> builder;