[llvm-commits] [llvm] r150092 - in /llvm/trunk: include/llvm/CodeGen/Passes.h include/llvm/Pass.h lib/CodeGen/Passes.cpp lib/VMCore/Pass.cpp
Andrew Trick
atrick at apple.com
Wed Feb 8 13:22:35 PST 2012
Author: atrick
Date: Wed Feb 8 15:22:34 2012
New Revision: 150092
URL: http://llvm.org/viewvc/llvm-project?rev=150092&view=rev
Log:
Added Pass::createPass(ID) to handle pass configuration by ID
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
llvm/trunk/include/llvm/Pass.h
llvm/trunk/lib/CodeGen/Passes.cpp
llvm/trunk/lib/VMCore/Pass.cpp
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=150092&r1=150091&r2=150092&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Wed Feb 8 15:22:34 2012
@@ -135,7 +135,7 @@
///
/// 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.
Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=150092&r1=150091&r2=150092&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Wed Feb 8 15:22:34 2012
@@ -175,6 +175,10 @@
// 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
Modified: llvm/trunk/lib/CodeGen/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Passes.cpp?rev=150092&r1=150091&r2=150092&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Passes.cpp (original)
+++ llvm/trunk/lib/CodeGen/Passes.cpp Wed Feb 8 15:22:34 2012
@@ -103,8 +103,12 @@
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 {
Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=150092&r1=150091&r2=150092&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Wed Feb 8 15:22:34 2012
@@ -189,6 +189,13 @@
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!");
More information about the llvm-commits
mailing list