MLIR 22.0.0git
ShapedOpInterfaces.cpp
Go to the documentation of this file.
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
10
11using namespace mlir;
12
13//===----------------------------------------------------------------------===//
14// ShapedDimOpInterface
15//===----------------------------------------------------------------------===//
16
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"
return success()
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
OpResult getResult(unsigned idx)
Get the 'idx'th result of this operation.
Definition Operation.h:407
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
unsigned getNumResults()
Return the number of results held by this operation.
Definition Operation.h:404
bool isIndex() const
Definition Types.cpp:54
Type getType() const
Return the type of this value.
Definition Value.h:105
LogicalResult verifyShapedDimOpInterface(Operation *op)
Verify invariants of ops that implement the ShapedDimOpInterface.
Include the generated interface declarations.