MLIR  16.0.0git
SPIRVOps.h
Go to the documentation of this file.
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 
19 #include "mlir/IR/BuiltinOps.h"
26 #include "llvm/Support/PointerLikeTypeTraits.h"
27 
28 // TableGen'erated operation interfaces for querying versions, extensions, and
29 // capabilities.
30 #include "mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc"
31 
32 namespace mlir {
33 class OpBuilder;
34 
35 namespace spirv {
36 class VerCapExtAttr;
37 } // namespace spirv
38 } // namespace mlir
39 
40 // TablenGen'erated operation declarations.
41 #define GET_OP_CLASSES
42 #include "mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc"
43 
44 namespace llvm {
45 
46 /// Allow stealing the low bits of spirv::Function ops.
47 template <>
48 struct PointerLikeTypeTraits<mlir::spirv::FuncOp> {
49 public:
50  static inline void *getAsVoidPointer(mlir::spirv::FuncOp i) {
51  return const_cast<void *>(i.getAsOpaquePointer());
52  }
53  static inline mlir::spirv::FuncOp getFromVoidPointer(void *p) {
54  return mlir::spirv::FuncOp::getFromOpaquePointer(p);
55  }
56  static constexpr int numLowBitsAvailable = 3;
57 };
58 
59 } // namespace llvm
60 
61 #endif // MLIR_DIALECT_SPIRV_IR_SPIRVOPS_H_
Include the generated interface declarations.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition: CallGraph.h:229
static void * getAsVoidPointer(mlir::spirv::FuncOp i)
Definition: SPIRVOps.h:50
static mlir::spirv::FuncOp getFromVoidPointer(void *p)
Definition: SPIRVOps.h:53