LLVM 23.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
45 bool empty() const { return FuncToRsMap.empty(); }
46
48 const auto FuncRs = find(F);
49 if (FuncRs == end())
50 return nullptr;
51 return &FuncRs->second;
52 }
53};
54
55class RootSignatureAnalysis : public AnalysisInfoMixin<RootSignatureAnalysis> {
57 static AnalysisKey Key;
58
59public:
61
63
65};
66
67/// Wrapper pass for the legacy pass manager.
68///
69/// This is required because the passes that will depend on this are codegen
70/// passes which run through the legacy pass manager.
72private:
73 std::unique_ptr<RootSignatureBindingInfo> FuncToRsMap;
74
75public:
76 static char ID;
78
79 RootSignatureBindingInfo &getRSInfo() { return *FuncToRsMap; }
80
81 bool runOnModule(Module &M) override;
82
83 void getAnalysisUsage(AnalysisUsage &AU) const override;
84};
85
86/// Printer pass for RootSignatureAnalysis results.
88 : public OptionalPassInfoMixin<RootSignatureAnalysisPrinter> {
89 raw_ostream &OS;
90
91public:
92 explicit RootSignatureAnalysisPrinter(raw_ostream &OS) : OS(OS) {}
94};
95
96} // namespace dxil
97} // namespace llvm
98#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.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition Analysis.h:29
A CRTP mix-in for passes that can be skipped.