[llvm-commits] [llvm] r106444 - in /llvm/trunk: include/llvm/Pass.h include/llvm/PassAnalysisSupport.h include/llvm/PassManagers.h include/llvm/PassSupport.h lib/VMCore/Pass.cpp lib/VMCore/PassManager.cpp
Dan Gohman
gohman at apple.com
Mon Jun 21 11:46:46 PDT 2010
Author: djg
Date: Mon Jun 21 13:46:45 2010
New Revision: 106444
URL: http://llvm.org/viewvc/llvm-project?rev=106444&view=rev
Log:
Move several non-performance-critical member functinos out of line.
Modified:
llvm/trunk/include/llvm/Pass.h
llvm/trunk/include/llvm/PassAnalysisSupport.h
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/include/llvm/PassSupport.h
llvm/trunk/lib/VMCore/Pass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=106444&r1=106443&r2=106444&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Mon Jun 21 13:46:45 2010
@@ -31,7 +31,6 @@
#include "llvm/System/DataTypes.h"
-#include <cassert>
#include <string>
#include <utility>
#include <vector>
@@ -89,13 +88,8 @@
Pass(const Pass &); // DO NOT IMPLEMENT
public:
- explicit Pass(PassKind K, intptr_t pid) : Resolver(0), PassID(pid), Kind(K) {
- assert(pid && "pid cannot be 0");
- }
- explicit Pass(PassKind K, const void *pid)
- : Resolver(0), PassID((intptr_t)pid), Kind(K) {
- assert(pid && "pid cannot be 0");
- }
+ explicit Pass(PassKind K, intptr_t pid);
+ explicit Pass(PassKind K, const void *pid);
virtual ~Pass();
@@ -138,13 +132,8 @@
virtual PassManagerType getPotentialPassManagerType() const;
// Access AnalysisResolver
- inline void setResolver(AnalysisResolver *AR) {
- assert(!Resolver && "Resolver is already set");
- Resolver = AR;
- }
- inline AnalysisResolver *getResolver() {
- return Resolver;
- }
+ void setResolver(AnalysisResolver *AR);
+ AnalysisResolver *getResolver() const { return Resolver; }
/// getAnalysisUsage - This function should be overriden by passes that need
/// analysis information to do their job. If a pass specifies that it uses a
@@ -170,11 +159,9 @@
/// an analysis interface through multiple inheritance. If needed, it should
/// override this to adjust the this pointer as needed for the specified pass
/// info.
- virtual void *getAdjustedAnalysisPointer(const PassInfo *) {
- return this;
- }
- virtual ImmutablePass *getAsImmutablePass() { return 0; }
- virtual PMDataManager *getAsPMDataManager() { return 0; }
+ virtual void *getAdjustedAnalysisPointer(const PassInfo *);
+ virtual ImmutablePass *getAsImmutablePass();
+ virtual PMDataManager *getAsPMDataManager();
/// verifyAnalysis() - This member can be implemented by a analysis pass to
/// check state of analysis information.
Modified: llvm/trunk/include/llvm/PassAnalysisSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassAnalysisSupport.h?rev=106444&r1=106443&r2=106444&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassAnalysisSupport.h (original)
+++ llvm/trunk/include/llvm/PassAnalysisSupport.h Mon Jun 21 13:46:45 2010
@@ -49,22 +49,13 @@
// addRequired - Add the specified ID to the required set of the usage info
// for a pass.
//
- AnalysisUsage &addRequiredID(AnalysisID ID) {
- assert(ID && "Pass class not registered!");
- Required.push_back(ID);
- return *this;
- }
+ AnalysisUsage &addRequiredID(AnalysisID ID);
template<class PassClass>
AnalysisUsage &addRequired() {
return addRequiredID(Pass::getClassPassInfo<PassClass>());
}
- AnalysisUsage &addRequiredTransitiveID(AnalysisID ID) {
- assert(ID && "Pass class not registered!");
- Required.push_back(ID);
- RequiredTransitive.push_back(ID);
- return *this;
- }
+ AnalysisUsage &addRequiredTransitiveID(AnalysisID ID);
template<class PassClass>
AnalysisUsage &addRequiredTransitive() {
AnalysisID ID = Pass::getClassPassInfo<PassClass>();
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=106444&r1=106443&r2=106444&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Mon Jun 21 13:46:45 2010
@@ -302,10 +302,7 @@
/// through getAnalysis interface.
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass);
- virtual Pass * getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F) {
- assert (0 && "Unable to find on the fly pass");
- return NULL;
- }
+ virtual Pass *getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F);
/// Initialize available analysis information.
void initializeAnalysisInfo() {
Modified: llvm/trunk/include/llvm/PassSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=106444&r1=106443&r2=106444&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassSupport.h (original)
+++ llvm/trunk/include/llvm/PassSupport.h Mon Jun 21 13:46:45 2010
@@ -109,13 +109,7 @@
}
/// createPass() - Use this method to create an instance of this pass.
- Pass *createPass() const {
- assert((!isAnalysisGroup() || NormalCtor) &&
- "No default implementation found for analysis group!");
- assert(NormalCtor &&
- "Cannot call createPass on PassInfo without default ctor!");
- return NormalCtor();
- }
+ Pass *createPass() const;
/// addInterfaceImplemented - This method is called when this pass is
/// registered as a member of an analysis group with the RegisterAnalysisGroup
Modified: llvm/trunk/lib/VMCore/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Pass.cpp?rev=106444&r1=106443&r2=106444&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Pass.cpp (original)
+++ llvm/trunk/lib/VMCore/Pass.cpp Mon Jun 21 13:46:45 2010
@@ -35,6 +35,15 @@
// Pass Implementation
//
+Pass::Pass(PassKind K, intptr_t pid) : Resolver(0), PassID(pid), Kind(K) {
+ assert(pid && "pid cannot be 0");
+}
+
+Pass::Pass(PassKind K, const void *pid)
+ : Resolver(0), PassID((intptr_t)pid), Kind(K) {
+ assert(pid && "pid cannot be 0");
+}
+
// Force out-of-line virtual method.
Pass::~Pass() {
delete Resolver;
@@ -92,6 +101,23 @@
// By default, don't do anything.
}
+void *Pass::getAdjustedAnalysisPointer(const PassInfo *) {
+ return this;
+}
+
+ImmutablePass *Pass::getAsImmutablePass() {
+ return 0;
+}
+
+PMDataManager *Pass::getAsPMDataManager() {
+ return 0;
+}
+
+void Pass::setResolver(AnalysisResolver *AR) {
+ assert(!Resolver && "Resolver is already set");
+ Resolver = AR;
+}
+
// print - Print out the internal state of the pass. This is called by Analyze
// to print out the contents of an analysis. Otherwise it is not necessary to
// implement this method.
@@ -364,6 +390,14 @@
getPassRegistrar()->UnregisterPass(*this);
}
+Pass *PassInfo::createPass() const {
+ assert((!isAnalysisGroup() || NormalCtor) &&
+ "No default implementation found for analysis group!");
+ assert(NormalCtor &&
+ "Cannot call createPass on PassInfo without default ctor!");
+ return NormalCtor();
+}
+
//===----------------------------------------------------------------------===//
// Analysis Group Implementation Code
//===----------------------------------------------------------------------===//
@@ -467,4 +501,15 @@
GetCFGOnlyPasses(Preserved).enumeratePasses();
}
+AnalysisUsage &AnalysisUsage::addRequiredID(AnalysisID ID) {
+ assert(ID && "Pass class not registered!");
+ Required.push_back(ID);
+ return *this;
+}
+AnalysisUsage &AnalysisUsage::addRequiredTransitiveID(AnalysisID ID) {
+ assert(ID && "Pass class not registered!");
+ Required.push_back(ID);
+ RequiredTransitive.push_back(ID);
+ return *this;
+}
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=106444&r1=106443&r2=106444&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Jun 21 13:46:45 2010
@@ -1147,6 +1147,11 @@
llvm_unreachable("Unable to schedule pass");
}
+Pass *PMDataManager::getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F) {
+ assert(0 && "Unable to find on the fly pass");
+ return NULL;
+}
+
// Destructor
PMDataManager::~PMDataManager() {
for (SmallVector<Pass *, 8>::iterator I = PassVector.begin(),
More information about the llvm-commits
mailing list