[llvm] [DXIL][Analysis] Add DXILMetadataAnalysis pass (PR #102079)
S. Bharadwaj Yadavalli via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 08:36:09 PDT 2024
================
@@ -0,0 +1,106 @@
+//=- DXILMetadataAnalysis.cpp - 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Analysis/DXILMetadataAnalysis.h"
+#include "llvm/ADT/APInt.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Module.h"
+#include "llvm/InitializePasses.h"
+
+#define DEBUG_TYPE "dxil-metadata-analysis"
+
+using namespace llvm;
+using namespace dxil;
+
+void ModuleMetadataInfo::print(raw_ostream &OS) const {
+ OS << "Shader Model Version : " << ShaderModelVersion.getAsString() << "\n";
+ OS << "DXIL Version : " << DXILVersion.getAsString() << "\n";
+ OS << "Shader Stage : " << Triple::getEnvironmentTypeName(ShaderStage)
+ << "\n";
+ OS << "Validator Version : " << ValidatorVersion.getAsString() << "\n";
+}
+
+ModuleMetadataInfo::ModuleMetadataInfo(Module &M) {
+ Triple TT(Triple(M.getTargetTriple()));
+ DXILVersion = TT.getDXILVersion();
+ ShaderModelVersion = TT.getOSVersion();
+ ShaderStage = TT.getEnvironment();
+ NamedMDNode *Entry = M.getOrInsertNamedMetadata("dx.valver");
----------------
bharadwajy wrote:
...
> ...I think there’s a valid argument to leaving this out of this change and having a discussion about what the correct behaviour here actually is before adding it.
Excluded validator version information from `struct ModuleMetadataInfo`
https://github.com/llvm/llvm-project/pull/102079
More information about the llvm-commits
mailing list