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
21#include "mlir/IR/BuiltinOps.h"
22#include "llvm/Support/PointerLikeTypeTraits.h"
23
24// TableGen'erated operation interfaces for querying versions, extensions, and
25// capabilities.
26#include "mlir/Dialect/SPIRV/IR/SPIRVAvailability.h.inc"
27
28namespace mlir {
29class OpBuilder;
30
31namespace spirv {
32class VerCapExtAttr;
33class SPIRVDialect;
34} // namespace spirv
35} // namespace mlir
36
37// TablenGen'erated operation declarations.
38#define GET_OP_CLASSES
39#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h.inc"
40
41namespace llvm {
42
43/// Allow stealing the low bits of spirv::Function ops.
44template <>
45struct PointerLikeTypeTraits<mlir::spirv::FuncOp> {
46public:
47 static inline void *getAsVoidPointer(mlir::spirv::FuncOp i) {
48 return const_cast<void *>(i.getAsOpaquePointer());
49 }
50 static inline mlir::spirv::FuncOp getFromVoidPointer(void *p) {
51 return mlir::spirv::FuncOp::getFromOpaquePointer(p);
52 }
53 static constexpr int NumLowBitsAvailable = 3;
54};
55
56} // namespace llvm
57
58#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:229
Include the generated interface declarations.
static void * getAsVoidPointer(mlir::spirv::FuncOp i)
Definition SPIRVOps.h:47
static mlir::spirv::FuncOp getFromVoidPointer(void *p)
Definition SPIRVOps.h:50