[llvm] [DXIL][Analysis] Add DXILMetadataAnalysis pass (PR #102079)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 22:55:55 PDT 2024
================
@@ -0,0 +1,85 @@
+//=- DXILMetadataAnalysis.h - Representation of Module metadata --*- C++ -*-=//
+//
+// 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 LLVM_ANALYSIS_DXILMETADATA_H
+#define LLVM_ANALYSIS_DXILMETADATA_H
+
+#include "llvm/ADT/MapVector.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/DXILABI.h"
+#include "llvm/Support/VersionTuple.h"
+#include "llvm/TargetParser/Triple.h"
+
+namespace llvm {
+
+namespace dxil {
+
+struct ModuleMetadataInfo {
+ VersionTuple DXILVersion{};
+ VersionTuple ValidatorVersion{};
+ VersionTuple ShaderModelVersion{};
+ Triple::EnvironmentType ShaderStage = Triple::UnknownEnvironment;
+
+ void init(Module &);
----------------
bogner wrote:
A constructor is still in the public interface, and the idea is really that we want the initialization to be internal to the analysis. It doesn’t make sense to create this object outside of the analysis, as the analysis is the way to get the analysis result.
Further, if the helper that builds this is static/anonymous, then if we need to make it depend on other analyses or something like that the changes can be contained in the cpp file, which is nice for encapsulation.
https://github.com/llvm/llvm-project/pull/102079
More information about the llvm-commits
mailing list