MLIR  19.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 
11 using 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"
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:402
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
Definition: Operation.cpp:268
unsigned getNumResults()
Return the number of results held by this operation.
Definition: Operation.h:399
bool isIndex() const
Definition: Types.cpp:56
Type getType() const
Return the type of this value.
Definition: Value.h:125
LogicalResult verifyShapedDimOpInterface(Operation *op)
Verify invariants of ops that implement the ShapedDimOpInterface.
Include the generated interface declarations.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
Definition: LogicalResult.h:56
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26