mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
[PM] Add a utility to the new pass manager for generating a pass which
is a no-op other than requiring some analysis results be available. This can be used in real pass pipelines to force the usually lazy analysis running to eagerly compute something at a specific point, and it can be used to test the pass manager infrastructure (my primary use at the moment). I've also added bit of pipeline parsing magic to support generating these directly from the opt command so that you can directly use these when debugging your analysis. The syntax is: require<analysis-name> This can be used at any level of the pass manager. For example: cgscc(function(require<my-analysis>,no-op-function)) This would produce a no-op function pass requiring my-analysis, followed by a fully no-op function pass, both of these in a function pass manager which is nested inside of a bottom-up CGSCC pass manager which is in the top-level (implicit) module pass manager. I have zero attachment to the particular syntax I'm using here. Consider it a straw man for use while I'm testing and fleshing things out. Suggestions for better syntax welcome, and I'll update everything based on any consensus that develops. I've used this new functionality to more directly test the analysis printing rather than relying on the cgscc pass manager running an analysis for me. This is still minimally tested because I need to have analyses to run first! ;] That patch is next, but wanted to keep this one separate for easier review and discussion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225236 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
5165dfdf9a
commit
a3376d2d36
3 files changed
+66
-4
No files matched your search
@@ -54,6 +54,12 @@ static bool isModulePassName(StringRef Name) {
|
||||
#define MODULE_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
|
||||
#include "PassRegistry.def"
|
||||
|
||||
// We also support building a require pass around any analysis.
|
||||
#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (Name == "require<" NAME ">") \
|
||||
return true;
|
||||
#include "PassRegistry.def"
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,6 +69,12 @@ static bool isCGSCCPassName(StringRef Name) {
|
||||
#define CGSCC_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
|
||||
#include "PassRegistry.def"
|
||||
|
||||
// We also support building a require pass around any analysis.
|
||||
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (Name == "require<" NAME ">") \
|
||||
return true;
|
||||
#include "PassRegistry.def"
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,6 +84,12 @@ static bool isFunctionPassName(StringRef Name) {
|
||||
#define FUNCTION_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
|
||||
#include "PassRegistry.def"
|
||||
|
||||
// We also support building a require pass around any analysis.
|
||||
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (Name == "require<" NAME ">") \
|
||||
return true;
|
||||
#include "PassRegistry.def"
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -88,6 +106,14 @@ static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) {
|
||||
}
|
||||
#include "PassRegistry.def"
|
||||
|
||||
// We also support building a require pass around any analysis.
|
||||
#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (Name == "require<" NAME ">") { \
|
||||
MPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>()); \
|
||||
return true; \
|
||||
}
|
||||
#include "PassRegistry.def"
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -104,6 +130,14 @@ static bool parseCGSCCPassName(CGSCCPassManager &CGPM, StringRef Name) {
|
||||
}
|
||||
#include "PassRegistry.def"
|
||||
|
||||
// We also support building a require pass around any analysis.
|
||||
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (Name == "require<" NAME ">") { \
|
||||
CGPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>()); \
|
||||
return true; \
|
||||
}
|
||||
#include "PassRegistry.def"
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,6 +154,14 @@ static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) {
|
||||
}
|
||||
#include "PassRegistry.def"
|
||||
|
||||
// We also support building a require pass around any analysis.
|
||||
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (Name == "require<" NAME ">") { \
|
||||
FPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>()); \
|
||||
return true; \
|
||||
}
|
||||
#include "PassRegistry.def"
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user