[clang] [HLSL] Implement `SpirvType` and `SpirvOpaqueType` (PR #134034)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 21 15:27:41 PDT 2025
================
@@ -0,0 +1,28 @@
+//===----- hlsl_spirv.h - HLSL definitions for SPIR-V target --------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _HLSL_HLSL_SPIRV_H_
+#define _HLSL_HLSL_SPIRV_H_
+
+namespace hlsl {
+namespace vk {
+template <typename T, T v> struct integral_constant {
+ static constexpr T value = v;
+};
+
+template <typename T> struct Literal {};
+
+template <uint Opcode, uint Size, uint Alignment, typename... Operands>
+using SpirvType = __hlsl_spirv_type<Opcode, Size, Alignment, Operands...>;
+
+template <uint Opcode, typename... Operands>
+using SpirvOpaqueType = __hlsl_spirv_type<Opcode, 0, 0, Operands...>;
----------------
llvm-beanz wrote:
Are `SpirvOpaqueType` objects "intangible" (i.e. sizeless), or are they zero-sized? I assume the former. Which may need some additional handling.
https://github.com/llvm/llvm-project/pull/134034
More information about the cfe-commits
mailing list