[llvm] [HLSL] Add in-memory representation of Semantic Signatures (PR #209907)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 22:00:11 PDT 2026


================
@@ -0,0 +1,202 @@
+//===- SemanticSignatures.cpp - HLSL Semantic Signature helpers -----------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file This file implements a library for working with HLSL shader input and
+/// output semantic signatures and their DirectX metadata representation.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Frontend/HLSL/SemanticSignatures.h"
+#include "llvm/ADT/STLForwardCompat.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Type.h"
+
+using namespace llvm;
+using namespace llvm::hlsl;
+
+namespace {
+
+// Inclusive upper bounds of the operand enums
+constexpr uint32_t MaxCompType =
+    static_cast<uint32_t>(dxil::ElementType::PackedU8x32);
----------------
bogner wrote:

I don't know that we can justify more robust enum reflection for this, but should we at least add a `LastEntry` value that aliases `PackedU8x32` in the `ElementType` enum so that this is more obviously correct at a glance?

https://github.com/llvm/llvm-project/pull/209907


More information about the llvm-commits mailing list