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#include <optional>
25
26namespace llvm {
27namespace dxil {
28
30private:
32
33public:
34 using iterator =
36
40 : FuncToRsMap(Map) {};
41
42 iterator find(const Function *F) { return FuncToRsMap.find(F); }
43
44 iterator end() { return FuncToRsMap.end(); }
45
47 const auto FuncRs = find(F);
48 if (FuncRs == end())
49 return nullptr;
50 return &FuncRs->second;
51 }
52};
53
54class RootSignatureAnalysis : public AnalysisInfoMixin<RootSignatureAnalysis> {
56 static AnalysisKey Key;
57
58public:
60
62
64};
65
66/// Wrapper pass for the legacy pass manager.
67///
68/// This is required because the passes that will depend on this are codegen
69/// passes which run through the legacy pass manager.
71private:
72 std::unique_ptr<RootSignatureBindingInfo> FuncToRsMap;
73
74public:
75 static char ID;
77
78 RootSignatureBindingInfo &getRSInfo() { return *FuncToRsMap; }
79
80 bool runOnModule(Module &M) override;
81
82 void getAnalysisUsage(AnalysisUsage &AU) const override;
83};
84
85/// Printer pass for RootSignatureAnalysis results.
87 : public PassInfoMixin<RootSignatureAnalysisPrinter> {
88 raw_ostream &OS;
89
90public:
93};
94
95} // namespace dxil
96} // namespace llvm
97#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:55
This file contains the declarations for metadata subclasses.
raw_pwrite_stream & OS
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
Represent the analysis usage information of a pass.
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:177
iterator end()
Definition: DenseMap.h:87
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:255
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
Printer pass for RootSignatureAnalysis results.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Wrapper pass for the legacy pass manager.
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.
Result run(Module &M, ModuleAnalysisManager &AM)
iterator find(const Function *F)
RootSignatureBindingInfo(SmallDenseMap< const Function *, mcdxbc::RootSignatureDesc > Map)
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.
Definition: AddressRanges.h:18
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:93
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:70