[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:
Valentin Clement 2021-09-30 16:26:29 +02:00
parent ccc0f62d1b
commit afb30fcdf6
No known key found for this signature in database
GPG Key ID: 086D54783C928776
2 changed files with 14 additions and 8 deletions

View File

@ -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() {

View File

@ -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
//===----------------------------------------------------------------------===//