xref: /llvm-project/mlir/lib/Interfaces/ShapedOpInterfaces.cpp (revision 598f5275c16049b1e1b5bc934cbde447a82d485e)
1 //===- ShapedOpInterfaces.cpp - Interfaces for Shaped Ops -----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir/Interfaces/ShapedOpInterfaces.h"
10 
11 using namespace mlir;
12 
13 //===----------------------------------------------------------------------===//
14 // ShapedDimOpInterface
15 //===----------------------------------------------------------------------===//
16 
verifyShapedDimOpInterface(Operation * op)17 LogicalResult mlir::detail::verifyShapedDimOpInterface(Operation *op) {
18   if (op->getNumResults() != 1)
19     return op->emitError("expected single op result");
20   if (!op->getResult(0).getType().isIndex())
21     return op->emitError("expect index result type");
22   return success();
23 }
24 
25 /// Include the definitions of the interface.
26 #include "mlir/Interfaces/ShapedOpInterfaces.cpp.inc"
27