Path: blob/main/contrib/llvm-project/llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp
35266 views
//===- DXILResourceAnalysis.cpp - DXIL Resource analysis-------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file This file contains Analysis for information about DXIL resources.9///10//===----------------------------------------------------------------------===//1112#include "DXILResourceAnalysis.h"13#include "DirectX.h"14#include "llvm/IR/PassManager.h"1516using namespace llvm;1718#define DEBUG_TYPE "dxil-resource-analysis"1920dxil::Resources DXILResourceAnalysis::run(Module &M,21ModuleAnalysisManager &AM) {22dxil::Resources R;23R.collect(M);24return R;25}2627AnalysisKey DXILResourceAnalysis::Key;2829PreservedAnalyses DXILResourcePrinterPass::run(Module &M,30ModuleAnalysisManager &AM) {31dxil::Resources Res = AM.getResult<DXILResourceAnalysis>(M);32Res.print(OS);33return PreservedAnalyses::all();34}3536char DXILResourceWrapper::ID = 0;37INITIALIZE_PASS_BEGIN(DXILResourceWrapper, DEBUG_TYPE,38"DXIL resource Information", true, true)39INITIALIZE_PASS_END(DXILResourceWrapper, DEBUG_TYPE,40"DXIL resource Information", true, true)4142bool DXILResourceWrapper::runOnModule(Module &M) {43Resources.collect(M);44return false;45}4647DXILResourceWrapper::DXILResourceWrapper() : ModulePass(ID) {}4849void DXILResourceWrapper::print(raw_ostream &OS, const Module *) const {50Resources.print(OS);51}525354