MLIR 24.0.0git
SPIRVOpDefinition.h
Go to the documentation of this file.
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
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
void printSwitchOpCases(OpAsmPrinter &p, SwitchOp op, Type selectorType, Block *defaultTarget, OperandRange defaultOperands, TypeRange defaultOperandTypes, DenseIntElementsAttr literals, SuccessorRange targets, OperandRangeRange targetOperands, const TypeRangeRange &targetOperandTypes)
void printImageOperands(OpAsmPrinter &printer, Operation *imageOp, spirv::ImageOperandsAttr attr)
bool isDirectInModuleLikeOp(Operation *op)
Returns true if the given op is an module-like op that maintains a symbol table.
bool isNestedInGraphARMOpInterface(Operation *op)
Returns true if the given op is a GraphARM op or nested in a GraphARM op without a module-like op in ...
Type getMatchingBoolType(Type operandType)
Returns a boolean scalar or vector type matching the shape of the given type.
ParseResult parseImageOperands(OpAsmParser &parser, spirv::ImageOperandsAttr &attr)
bool isNestedInFunctionOpInterface(Operation *op)
Returns true if the given op is a function-like op or nested in a function-like op without a module-l...
ParseResult parseSwitchOpCases(OpAsmParser &parser, Type &selectorType, Block *&defaultTarget, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &defaultOperands, SmallVectorImpl< Type > &defaultOperandTypes, DenseIntElementsAttr &literals, SmallVectorImpl< Block * > &targets, SmallVectorImpl< SmallVector< OpAsmParser::UnresolvedOperand > > &targetOperands, SmallVectorImpl< SmallVector< Type > > &targetOperandTypes)
Adapted from the cf.switch implementation.