forked from OSchip/llvm-project
[fir][NFC] Move fir.shape verifier to cpp file
Move verifier code to the .cpp file. Follow up to https://reviews.llvm.org/D110626. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D110826
This commit is contained in:
parent
ccc0f62d1b
commit
afb30fcdf6
|
@ -1841,14 +1841,7 @@ def fir_ShapeOp : fir_Op<"shape", [NoSideEffect]> {
|
|||
operands attr-dict `:` functional-type(operands, results)
|
||||
}];
|
||||
|
||||
let verifier = [{
|
||||
auto size = extents().size();
|
||||
auto shapeTy = getType().dyn_cast<fir::ShapeType>();
|
||||
assert(shapeTy && "must be a shape type");
|
||||
if (shapeTy.getRank() != size)
|
||||
return emitOpError("shape type rank mismatch");
|
||||
return mlir::success();
|
||||
}];
|
||||
let verifier = "return ::verify(*this);";
|
||||
|
||||
let extraClassDeclaration = [{
|
||||
std::vector<mlir::Value> getExtents() {
|
||||
|
|
|
@ -2606,6 +2606,19 @@ static mlir::LogicalResult verify(fir::SelectTypeOp &op) {
|
|||
return mlir::success();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ShapeOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static mlir::LogicalResult verify(fir::ShapeOp &op) {
|
||||
auto size = op.extents().size();
|
||||
auto shapeTy = op.getType().dyn_cast<fir::ShapeType>();
|
||||
assert(shapeTy && "must be a shape type");
|
||||
if (shapeTy.getRank() != size)
|
||||
return op.emitOpError("shape type rank mismatch");
|
||||
return mlir::success();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ShapeShiftOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue