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