LLVM 22.0.0git
DXILRootSignature.h
Go to the documentation of this file.
1//===- DXILRootSignature.h - DXIL Root Signature helper objects -----------===//
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 helper objects and APIs for working with DXIL
10/// Root Signatures.
11///
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_LIB_TARGET_DIRECTX_DXILROOTSIGNATURE_H
14#define LLVM_LIB_TARGET_DIRECTX_DXILROOTSIGNATURE_H
15
16#include "llvm/ADT/DenseMap.h"
19#include "llvm/IR/Metadata.h"
20#include "llvm/IR/Module.h"
21#include "llvm/IR/PassManager.h"
23#include "llvm/Pass.h"
24
25namespace llvm {
26namespace dxil {
27
29private:
31
32public:
33 using iterator =
35
40
41 iterator find(const Function *F) { return FuncToRsMap.find(F); }
42
43 iterator end() { return FuncToRsMap.end(); }
44
46 const auto FuncRs = find(F);
47 if (FuncRs == end())
48 return nullptr;
49 return &FuncRs->second;
50 }
51};
52
53class RootSignatureAnalysis : public AnalysisInfoMixin<RootSignatureAnalysis> {
55 static AnalysisKey Key;
56
57public:
59
61
63};
64
65/// Wrapper pass for the legacy pass manager.
66///
67/// This is required because the passes that will depend on this are codegen
68/// passes which run through the legacy pass manager.
70private:
71 std::unique_ptr<RootSignatureBindingInfo> FuncToRsMap;
72
73public:
74 static char ID;
76
77 RootSignatureBindingInfo &getRSInfo() { return *FuncToRsMap; }
78
79 bool runOnModule(Module &M) override;
80
81 void getAnalysisUsage(AnalysisUsage &AU) const override;
82};
83
84/// Printer pass for RootSignatureAnalysis results.
86 : public PassInfoMixin<RootSignatureAnalysisPrinter> {
87 raw_ostream &OS;
88
89public:
90 explicit RootSignatureAnalysisPrinter(raw_ostream &OS) : OS(OS) {}
92};
93
94} // namespace dxil
95} // namespace llvm
96#endif
This file defines the DenseMap class.
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:54
This file contains the declarations for metadata subclasses.
Represent the analysis usage information of a pass.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Definition DenseMap.h:74
ModulePass(char &pid)
Definition Pass.h:257
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
RootSignatureBindingInfo & getRSInfo()
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
RootSignatureBindingInfo Result
Result run(Module &M, ModuleAnalysisManager &AM)
iterator find(const Function *F)
RootSignatureBindingInfo(SmallDenseMap< const Function *, mcdxbc::RootSignatureDesc > Map)
SmallDenseMap< const Function *, mcdxbc::RootSignatureDesc >::iterator iterator
mcdxbc::RootSignatureDesc * getDescForFunction(const Function *F)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition PassManager.h:92
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition PassManager.h:69