1//===- SPIRVOpDefinition.h - SPIR-V op implementation helpers --*- C++ -*-===//
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#ifndef MLIR_LIB_DIALECT_SPIRV_IR_SPIRVOPDEFINITION_H
10#define MLIR_LIB_DIALECT_SPIRV_IR_SPIRVOPDEFINITION_H
11
12#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
13
14namespace mlir::spirv {
15
16bool isNestedInFunctionOpInterface(Operation *op);
17bool isNestedInGraphARMOpInterface(Operation *op);
18bool isDirectInModuleLikeOp(Operation *op);
19Type getMatchingBoolType(Type operandType);
20
21ParseResult parseImageOperands(OpAsmParser &parser,
22 spirv::ImageOperandsAttr &attr);
23void printImageOperands(OpAsmPrinter &printer, Operation *imageOp,
24 spirv::ImageOperandsAttr attr);
25
26ParseResult parseSwitchOpCases(
27 OpAsmParser &parser, Type &selectorType, Block *&defaultTarget,
28 SmallVectorImpl<OpAsmParser::UnresolvedOperand> &defaultOperands,
29 SmallVectorImpl<Type> &defaultOperandTypes, DenseIntElementsAttr &literals,
30 SmallVectorImpl<Block *> &targets,
31 SmallVectorImpl<SmallVector<OpAsmParser::UnresolvedOperand>>
32 &targetOperands,
33 SmallVectorImpl<SmallVector<Type>> &targetOperandTypes);
34void printSwitchOpCases(OpAsmPrinter &p, SwitchOp op, Type selectorType,
35 Block *defaultTarget, OperandRange defaultOperands,
36 TypeRange defaultOperandTypes,
37 DenseIntElementsAttr literals, SuccessorRange targets,
38 OperandRangeRange targetOperands,
39 const TypeRangeRange &targetOperandTypes);
40
41} // namespace mlir::spirv
42
43#endif // MLIR_LIB_DIALECT_SPIRV_IR_SPIRVOPDEFINITION_H
44