-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[DirectX] Infrastructure to collect shader flags for each function #112967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
3da01ee
397f70b
ae373d4
c02053a
47ab4c5
fa8ec60
a4f1e51
a6d84b2
31b0770
3427781
56af02a
f8e501f
c6b3390
70e46e0
07734f7
a0d2a31
2cee00a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,8 @@ | |
| #ifndef LLVM_TARGET_DIRECTX_DXILSHADERFLAGS_H | ||
| #define LLVM_TARGET_DIRECTX_DXILSHADERFLAGS_H | ||
|
|
||
| #include "llvm/ADT/DenseMap.h" | ||
| #include "llvm/IR/Function.h" | ||
| #include "llvm/IR/PassManager.h" | ||
| #include "llvm/Pass.h" | ||
| #include "llvm/Support/Compiler.h" | ||
|
|
@@ -60,21 +62,30 @@ struct ComputedShaderFlags { | |
| return FeatureFlags; | ||
| } | ||
|
|
||
| static ComputedShaderFlags computeFlags(Module &M); | ||
| void print(raw_ostream &OS = dbgs()) const; | ||
| LLVM_DUMP_METHOD void dump() const { print(); } | ||
| }; | ||
|
|
||
| using FunctionShaderFlagsMap = | ||
| SmallDenseMap<Function const *, ComputedShaderFlags>; | ||
| struct DXILModuleShaderFlagsInfo { | ||
|
||
| // Shader Flag mask representing module-level properties | ||
| ComputedShaderFlags ModuleFlags; | ||
| // Map representing shader flag mask representing properties of each of the | ||
| // functions in the module | ||
| FunctionShaderFlagsMap FuncShaderFlagsMap; | ||
| }; | ||
|
|
||
| class ShaderFlagsAnalysis : public AnalysisInfoMixin<ShaderFlagsAnalysis> { | ||
| friend AnalysisInfoMixin<ShaderFlagsAnalysis>; | ||
| static AnalysisKey Key; | ||
|
|
||
| public: | ||
| ShaderFlagsAnalysis() = default; | ||
|
|
||
| using Result = ComputedShaderFlags; | ||
| using Result = DXILModuleShaderFlagsInfo; | ||
|
|
||
| ComputedShaderFlags run(Module &M, ModuleAnalysisManager &AM); | ||
| DXILModuleShaderFlagsInfo run(Module &M, ModuleAnalysisManager &AM); | ||
| }; | ||
|
|
||
| /// Printer pass for ShaderFlagsAnalysis results. | ||
|
|
@@ -92,19 +103,16 @@ class ShaderFlagsAnalysisPrinter | |
| /// This is required because the passes that will depend on this are codegen | ||
| /// passes which run through the legacy pass manager. | ||
| class ShaderFlagsAnalysisWrapper : public ModulePass { | ||
| ComputedShaderFlags Flags; | ||
| DXILModuleShaderFlagsInfo MSFI; | ||
|
|
||
| public: | ||
| static char ID; | ||
|
|
||
| ShaderFlagsAnalysisWrapper() : ModulePass(ID) {} | ||
|
|
||
| const ComputedShaderFlags &getShaderFlags() { return Flags; } | ||
| const DXILModuleShaderFlagsInfo &getShaderFlags() { return MSFI; } | ||
|
|
||
| bool runOnModule(Module &M) override { | ||
| Flags = ComputedShaderFlags::computeFlags(M); | ||
| return false; | ||
| } | ||
| bool runOnModule(Module &M) override; | ||
|
|
||
| void getAnalysisUsage(AnalysisUsage &AU) const override { | ||
| AU.setPreservesAll(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an issue tracking this?