1 //===- SPIRVOps.h - MLIR SPIR-V operations ----------------------*- 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 // This file declares the operations in the SPIR-V dialect. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef MLIR_DIALECT_SPIRV_IR_SPIRVOPS_H_ 14 #define MLIR_DIALECT_SPIRV_IR_SPIRVOPS_H_ 15 16 #include "mlir/Bytecode/BytecodeOpInterface.h" 17 #include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h" 18 #include "mlir/Dialect/SPIRV/IR/SPIRVOpTraits.h" 19 #include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h" 20 #include "mlir/IR/BuiltinOps.h" 21 #include "mlir/IR/OpImplementation.h" 22 #include "mlir/Interfaces/CallInterfaces.h" 23 #include "mlir/Interfaces/ControlFlowInterfaces.h" 24 #include "mlir/Interfaces/FunctionInterfaces.h" 25 #include "mlir/Interfaces/InferTypeOpInterface.h" 26 #include "mlir/Interfaces/SideEffectInterfaces.h" 27 #include "llvm/Support/PointerLikeTypeTraits.h" 28 29 // TableGen'erated operation interfaces for querying versions, extensions, and 30 // capabilities. 31 #include "mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc" 32 33 namespace mlir { 34 class OpBuilder; 35 36 namespace spirv { 37 class VerCapExtAttr; 38 } // namespace spirv 39 } // namespace mlir 40 41 // TablenGen'erated operation declarations. 42 #define GET_OP_CLASSES 43 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc" 44 45 namespace llvm { 46 47 /// Allow stealing the low bits of spirv::Function ops. 48 template <> 49 struct PointerLikeTypeTraits<mlir::spirv::FuncOp> { 50 public: 51 static inline void *getAsVoidPointer(mlir::spirv::FuncOp i) { 52 return const_cast<void *>(i.getAsOpaquePointer()); 53 } 54 static inline mlir::spirv::FuncOp getFromVoidPointer(void *p) { 55 return mlir::spirv::FuncOp::getFromOpaquePointer(p); 56 } 57 static constexpr int numLowBitsAvailable = 3; 58 }; 59 60 } // namespace llvm 61 62 #endif // MLIR_DIALECT_SPIRV_IR_SPIRVOPS_H_ 63