[llvm] [DXIL] Add support for root signature flag element in DXContainer (PR #123147)

Damyan Pepper via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 18:13:42 PST 2025


================
@@ -0,0 +1,91 @@
+//===- DXILRootSignature.h - DXIL Root Signature helper objects
+//---------------===//
+//
+// 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 contains helper objects and APIs for working with DXIL
+///       Root Signatures.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+#include <optional>
+
+namespace llvm {
+namespace dxil {
+
+enum class RootSignatureElementKind {
+  None = 0,
+  RootFlags = 1,
+  RootConstants = 2,
+  RootDescriptor = 3,
+  DescriptorTable = 4,
+  StaticSampler = 5
+};
+
+struct ModuleRootSignature {
+  uint32_t Flags = 0;
+  ModuleRootSignature() { Ctx = nullptr; };
+  static std::optional<ModuleRootSignature> analyzeModule(Module &M,
+                                                          const Function *F);
+
+private:
+  LLVMContext *Ctx;
----------------
damyanp wrote:

I'm not a fan of this `Ctx` member being here when it's only used as part of the parsing/validation stuff. Is there a good reason to keep this around?  (I've a feeling we've discussed something like this already?  Was that part of this PR?)

All of the private members here could actually just be in the cpp file.

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


More information about the llvm-commits mailing list