mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
Added Pass::createPass(ID) to handle pass configuration by ID
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150092 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d2a7bedbc9
commit
ebe18ef5c2
@ -135,7 +135,7 @@ protected:
|
||||
///
|
||||
|
||||
/// Add a target-independent CodeGen pass at this point in the pipeline.
|
||||
void addCommonPass(char &ID);
|
||||
void addPass(char &ID);
|
||||
|
||||
/// printNoVerify - Add a pass to dump the machine function, if debugging is
|
||||
/// enabled.
|
||||
|
@ -175,6 +175,10 @@ public:
|
||||
// argument string, or null if it is not known.
|
||||
static const PassInfo *lookupPassInfo(StringRef Arg);
|
||||
|
||||
// createPass - Create a object for the specified pass class,
|
||||
// or null if it is not known.
|
||||
static Pass *createPass(char &TI);
|
||||
|
||||
/// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
|
||||
/// get analysis information that might be around, for example to update it.
|
||||
/// This is different than getAnalysis in that it can fail (if the analysis
|
||||
|
@ -103,8 +103,12 @@ TargetPassConfig::TargetPassConfig()
|
||||
llvm_unreachable("TargetPassConfig should not be constructed on-the-fly");
|
||||
}
|
||||
|
||||
void TargetPassConfig::addCommonPass(char &ID) {
|
||||
// FIXME: about to be implemented.
|
||||
void TargetPassConfig::addPass(char &ID) {
|
||||
// FIXME: check user overrides
|
||||
Pass *P = Pass::createPass(ID);
|
||||
if (!P)
|
||||
llvm_unreachable("Pass ID not registered");
|
||||
PM.add(P);
|
||||
}
|
||||
|
||||
void TargetPassConfig::printNoVerify(const char *Banner) const {
|
||||
|
@ -189,6 +189,13 @@ const PassInfo *Pass::lookupPassInfo(StringRef Arg) {
|
||||
return PassRegistry::getPassRegistry()->getPassInfo(Arg);
|
||||
}
|
||||
|
||||
Pass *Pass::createPass(char &TI) {
|
||||
const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(&TI);
|
||||
if (!PI)
|
||||
return NULL;
|
||||
return PI->createPass();
|
||||
}
|
||||
|
||||
Pass *PassInfo::createPass() const {
|
||||
assert((!isAnalysisGroup() || NormalCtor) &&
|
||||
"No default implementation found for analysis group!");
|
||||
|
Loading…
Reference in New Issue
Block a user