[llvm] [DXIL][Analysis] Add DXILMetadataAnalysis pass (PR #102079)

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 13:55:22 PDT 2024


================
@@ -0,0 +1,93 @@
+//=- 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/DerivedTypes.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"
+
+using namespace llvm;
+using namespace dxil;
+
+void ModuleMetadataInfo::dump(raw_ostream &OS) {
+  OS << "Shader Model : " << Triple::getOSTypeName(ShaderModel) << "\n";
+  OS << "DXIL Version : " << DXILVersion.getAsString() << "\n";
+  OS << "Shader Stage : " << Triple::getEnvironmentTypeName(ShaderStage)
+     << "\n";
+}
+//===----------------------------------------------------------------------===//
+// DXILMetadataAnalysis and DXILMetadataAnalysisPrinterPass
+
+// Provide an explicit template instantiation for the static ID.
+AnalysisKey DXILMetadataAnalysis::Key;
+
+llvm::dxil::ModuleMetadataInfo
+DXILMetadataAnalysis::run(Module &M, ModuleAnalysisManager &AM) {
+  ModuleMetadataInfo Data;
+  return Data;
----------------
bharadwajy wrote:

> This just creates an empty `ModuleMetadataInfo` without actually populating it

Fixed.

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


More information about the llvm-commits mailing list