mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 10:06:05 +00:00

This interface is implemented by memref.dim and tensor.dim. This change makes it possible to remove a build dependency of the Affine dialect on the Tensor dialect (and maybe also the MemRef dialect in the future). Differential Revision: https://reviews.llvm.org/D133595
27 lines
1010 B
C++
27 lines
1010 B
C++
//===- ShapedOpInterfaces.cpp - Interfaces for Shaped Ops -----------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Interfaces/ShapedOpInterfaces.h"
|
|
|
|
using namespace mlir;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ShapedDimOpInterface
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
LogicalResult mlir::detail::verifyShapedDimOpInterface(Operation *op) {
|
|
if (op->getNumResults() != 1)
|
|
return op->emitError("expected single op result");
|
|
if (!op->getResult(0).getType().isIndex())
|
|
return op->emitError("expect index result type");
|
|
return success();
|
|
}
|
|
|
|
/// Include the definitions of the interface.
|
|
#include "mlir/Interfaces/ShapedOpInterfaces.cpp.inc"
|