MLIR 24.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
22#include "mlir/IR/BuiltinOps.h"
30#include "llvm/Support/PointerLikeTypeTraits.h"
31
32// TableGen'erated operation interfaces for querying versions, extensions, and
33// capabilities.
34#include "mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc"
35
36namespace mlir {
37class OpBuilder;
38
39namespace spirv {
40class VerCapExtAttr;
41class SPIRVDialect;
42} // namespace spirv
43} // namespace mlir
44
45// TablenGen'erated operation declarations.
46#define GET_OP_CLASSES
47#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc"
48
49namespace llvm {
50
51/// Allow stealing the low bits of spirv::Function ops.
52template <>
53struct PointerLikeTypeTraits<mlir::spirv::FuncOp> {
54public:
55 static inline void *getAsVoidPointer(mlir::spirv::FuncOp i) {
56 return const_cast<void *>(i.getAsOpaquePointer());
57 }
58 static inline mlir::spirv::FuncOp getFromVoidPointer(void *p) {
59 return mlir::spirv::FuncOp::getFromOpaquePointer(p);
60 }
61 static constexpr int NumLowBitsAvailable = 3;
62};
63
64} // namespace llvm
65
66#endif // MLIR_DIALECT_SPIRV_IR_SPIRVOPS_H_
This class helps build Operations.
Definition Builders.h:210
An attribute that specifies the SPIR-V (version, capabilities, extensions) triple.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:227
Include the generated interface declarations.
static void * getAsVoidPointer(mlir::spirv::FuncOp i)
Definition SPIRVOps.h:55
static mlir::spirv::FuncOp getFromVoidPointer(void *p)
Definition SPIRVOps.h:58