1 //===- SPIRVEnums.h - MLIR SPIR-V Enums -------------------------*- 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 C/C++ enums from SPIR-V spec. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef MLIR_DIALECT_SPIRV_IR_SPIRVENUMS_H_ 14 #define MLIR_DIALECT_SPIRV_IR_SPIRVENUMS_H_ 15 16 #include "mlir/IR/BuiltinAttributes.h" 17 #include "mlir/Support/LLVM.h" 18 #include "llvm/ADT/DenseMapInfo.h" 19 #include "llvm/ADT/StringRef.h" 20 21 // Forward declare enum classes related to op availability. Their definitions 22 // are in the TableGen'erated SPIRVEnums.h.inc and can be referenced by other 23 // declarations in SPIRVEnums.h.inc. 24 namespace mlir { 25 namespace spirv { 26 enum class Version : uint32_t; 27 enum class Extension : uint32_t; 28 enum class Capability : uint32_t; 29 } // namespace spirv 30 } // namespace mlir 31 32 // Pull in all enum type definitions and utility function declarations 33 #include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h.inc" 34 35 // Pull in all enum type availability query function declarations 36 #include "mlir/Dialect/SPIRV/IR/SPIRVEnumAvailability.h.inc" 37 38 namespace mlir { 39 namespace spirv { 40 /// Returns the implied extensions for the given version. These extensions are 41 /// incorporated into the current version so they are implicitly declared when 42 /// targeting the given version. 43 ArrayRef<Extension> getImpliedExtensions(Version version); 44 45 /// Returns the directly implied capabilities for the given capability. These 46 /// capabilities are implicitly declared by the given capability. 47 ArrayRef<Capability> getDirectImpliedCapabilities(Capability cap); 48 /// Returns the recursively implied capabilities for the given capability. These 49 /// capabilities are implicitly declared by the given capability. Compared to 50 /// the above function, this function collects implied capabilities recursively: 51 /// if an implicitly declared capability implicitly declares a third one, the 52 /// third one will also be returned. 53 SmallVector<Capability, 0> getRecursiveImpliedCapabilities(Capability cap); 54 55 } // namespace spirv 56 } // namespace mlir 57 58 #endif // MLIR_DIALECT_SPIRV_IR_SPIRVENUMS_H_ 59