1//===- DXILResourceAnalysis.cpp - DXIL Resource analysis-------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file This file contains Analysis for information about DXIL resources.
10///
11//===----------------------------------------------------------------------===//
12
13#include "DXILResourceAnalysis.h"
14#include "DirectX.h"
15#include "llvm/IR/PassManager.h"
16
17using namespace llvm;
18
19#define DEBUG_TYPE "dxil-resource-analysis"
20
21dxil::Resources DXILResourceAnalysis::run(Module &M,
22 ModuleAnalysisManager &AM) {
23 dxil::Resources R;
24 R.collect(M);
25 return R;
26}
27
28AnalysisKey DXILResourceAnalysis::Key;
29
30PreservedAnalyses DXILResourcePrinterPass::run(Module &M,
31 ModuleAnalysisManager &AM) {
32 dxil::Resources Res = AM.getResult<DXILResourceAnalysis>(IR&: M);
33 Res.print(O&: OS);
34 return PreservedAnalyses::all();
35}
36
37char DXILResourceWrapper::ID = 0;
38INITIALIZE_PASS_BEGIN(DXILResourceWrapper, DEBUG_TYPE,
39 "DXIL resource Information", true, true)
40INITIALIZE_PASS_END(DXILResourceWrapper, DEBUG_TYPE,
41 "DXIL resource Information", true, true)
42
43bool DXILResourceWrapper::runOnModule(Module &M) {
44 Resources.collect(M);
45 return false;
46}
47
48DXILResourceWrapper::DXILResourceWrapper() : ModulePass(ID) {}
49
50void DXILResourceWrapper::print(raw_ostream &OS, const Module *) const {
51 Resources.print(O&: OS);
52}
53

source code of llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp