[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2007-05-02 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.90 - 1.91
---
Log message:

Re-install patch to enable use of PassID.
I am preparing another patch to address the failure that prompted
Chris to revert this patch earlier.


---
Diffs of the changes:  (+14 -15)

 Pass.cpp |   29 ++---
 1 files changed, 14 insertions(+), 15 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.90 llvm/lib/VMCore/Pass.cpp:1.91
--- llvm/lib/VMCore/Pass.cpp:1.90   Tue May  1 23:25:31 2007
+++ llvm/lib/VMCore/Pass.cppWed May  2 15:38:25 2007
@@ -133,7 +133,7 @@
 class PassRegistrar {
   /// PassInfoMap - Keep track of the passinfo object for each registered llvm
   /// pass.
-  std::mapTypeInfo, PassInfo* PassInfoMap;
+  std::mapintptr_t, PassInfo* PassInfoMap;
   
   /// AnalysisGroupInfo - Keep track of information for each analysis group.
   struct AnalysisGroupInfo {
@@ -147,19 +147,19 @@
 
 public:
   
-  const PassInfo *GetPassInfo(const std::type_info TI) const {
-std::mapTypeInfo, PassInfo*::const_iterator I = PassInfoMap.find(TI);
+  const PassInfo *GetPassInfo(intptr_t TI) const {
+std::mapintptr_t, PassInfo*::const_iterator I = PassInfoMap.find(TI);
 return I != PassInfoMap.end() ? I-second : 0;
   }
   
   void RegisterPass(PassInfo PI) {
 bool Inserted =
-  
PassInfoMap.insert(std::make_pair(TypeInfo(PI.getTypeInfo()),PI)).second;
+  PassInfoMap.insert(std::make_pair(PI.getTypeInfo(),PI)).second;
 assert(Inserted  Pass registered multiple times!);
   }
   
   void UnregisterPass(PassInfo PI) {
-std::mapTypeInfo, PassInfo*::iterator I =
+std::mapintptr_t, PassInfo*::iterator I =
   PassInfoMap.find(PI.getTypeInfo());
 assert(I != PassInfoMap.end()  Pass registered but not in map!);
 
@@ -168,7 +168,7 @@
   }
   
   void EnumerateWith(PassRegistrationListener *L) {
-for (std::mapTypeInfo, PassInfo*::const_iterator I = PassInfoMap.begin(),
+for (std::mapintptr_t, PassInfo*::const_iterator I = PassInfoMap.begin(),
  E = PassInfoMap.end(); I != E; ++I)
   L-passEnumerate(I-second);
   }
@@ -210,11 +210,10 @@
 // getPassInfo - Return the PassInfo data structure that corresponds to this
 // pass...
 const PassInfo *Pass::getPassInfo() const {
-  if (PassInfoCache) return PassInfoCache;
-  return lookupPassInfo(typeid(*this));
+  return lookupPassInfo(PassID);
 }
 
-const PassInfo *Pass::lookupPassInfo(const std::type_info TI) {
+const PassInfo *Pass::lookupPassInfo(intptr_t TI) {
   return getPassRegistrar()-GetPassInfo(TI);
 }
 
@@ -238,12 +237,12 @@
 
 // RegisterAGBase implementation
 //
-RegisterAGBase::RegisterAGBase(const std::type_info Interface,
-   const std::type_info *Pass, bool isDefault)
-  : RegisterPassBase(Interface),
+RegisterAGBase::RegisterAGBase(intptr_t InterfaceID,
+   intptr_t PassID, bool isDefault)
+  : RegisterPassBase(InterfaceID),
 ImplementationInfo(0), isDefaultImplementation(isDefault) {
 
-  InterfaceInfo = const_castPassInfo*(Pass::lookupPassInfo(Interface));
+  InterfaceInfo = const_castPassInfo*(Pass::lookupPassInfo(InterfaceID));
   if (InterfaceInfo == 0) {
 // First reference to Interface, register it now.
 registerPass();
@@ -252,8 +251,8 @@
   assert(PIObj.isAnalysisGroup() 
  Trying to join an analysis group that is a normal pass!);
 
-  if (Pass) {
-ImplementationInfo = Pass::lookupPassInfo(*Pass);
+  if (PassID) {
+ImplementationInfo = Pass::lookupPassInfo(PassID);
 assert(ImplementationInfo 
Must register pass before adding to AnalysisGroup!);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2007-05-01 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.88 - 1.89
---
Log message:

disable this assertion as a hack to get the build more unbroken :(



---
Diffs of the changes:  (+1 -1)

 Pass.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.88 llvm/lib/VMCore/Pass.cpp:1.89
--- llvm/lib/VMCore/Pass.cpp:1.88   Tue May  1 16:15:47 2007
+++ llvm/lib/VMCore/Pass.cppTue May  1 23:01:44 2007
@@ -155,7 +155,7 @@
   void RegisterPass(PassInfo PI) {
 bool Inserted =
   PassInfoMap.insert(std::make_pair(PI.getTypeInfo(),PI)).second;
-assert(Inserted  Pass registered multiple times!);
+//assert(Inserted  Pass registered multiple times!);
   }
   
   void UnregisterPass(PassInfo PI) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2007-05-01 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.89 - 1.90
---
Log message:

revert enough of devang's recent patches to get the tree basically working again


---
Diffs of the changes:  (+16 -15)

 Pass.cpp |   31 ---
 1 files changed, 16 insertions(+), 15 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.89 llvm/lib/VMCore/Pass.cpp:1.90
--- llvm/lib/VMCore/Pass.cpp:1.89   Tue May  1 23:01:44 2007
+++ llvm/lib/VMCore/Pass.cppTue May  1 23:25:31 2007
@@ -133,7 +133,7 @@
 class PassRegistrar {
   /// PassInfoMap - Keep track of the passinfo object for each registered llvm
   /// pass.
-  std::mapintptr_t, PassInfo* PassInfoMap;
+  std::mapTypeInfo, PassInfo* PassInfoMap;
   
   /// AnalysisGroupInfo - Keep track of information for each analysis group.
   struct AnalysisGroupInfo {
@@ -147,19 +147,19 @@
 
 public:
   
-  const PassInfo *GetPassInfo(intptr_t TI) const {
-std::mapintptr_t, PassInfo*::const_iterator I = PassInfoMap.find(TI);
+  const PassInfo *GetPassInfo(const std::type_info TI) const {
+std::mapTypeInfo, PassInfo*::const_iterator I = PassInfoMap.find(TI);
 return I != PassInfoMap.end() ? I-second : 0;
   }
   
   void RegisterPass(PassInfo PI) {
 bool Inserted =
-  PassInfoMap.insert(std::make_pair(PI.getTypeInfo(),PI)).second;
-//assert(Inserted  Pass registered multiple times!);
+  
PassInfoMap.insert(std::make_pair(TypeInfo(PI.getTypeInfo()),PI)).second;
+assert(Inserted  Pass registered multiple times!);
   }
   
   void UnregisterPass(PassInfo PI) {
-std::mapintptr_t, PassInfo*::iterator I =
+std::mapTypeInfo, PassInfo*::iterator I =
   PassInfoMap.find(PI.getTypeInfo());
 assert(I != PassInfoMap.end()  Pass registered but not in map!);
 
@@ -168,7 +168,7 @@
   }
   
   void EnumerateWith(PassRegistrationListener *L) {
-for (std::mapintptr_t, PassInfo*::const_iterator I = PassInfoMap.begin(),
+for (std::mapTypeInfo, PassInfo*::const_iterator I = PassInfoMap.begin(),
  E = PassInfoMap.end(); I != E; ++I)
   L-passEnumerate(I-second);
   }
@@ -210,10 +210,11 @@
 // getPassInfo - Return the PassInfo data structure that corresponds to this
 // pass...
 const PassInfo *Pass::getPassInfo() const {
-  return lookupPassInfo(PassID);
+  if (PassInfoCache) return PassInfoCache;
+  return lookupPassInfo(typeid(*this));
 }
 
-const PassInfo *Pass::lookupPassInfo(intptr_t TI) {
+const PassInfo *Pass::lookupPassInfo(const std::type_info TI) {
   return getPassRegistrar()-GetPassInfo(TI);
 }
 
@@ -237,12 +238,12 @@
 
 // RegisterAGBase implementation
 //
-RegisterAGBase::RegisterAGBase(intptr_t InterfaceID,
-   intptr_t PassID, bool isDefault)
-  : RegisterPassBase(InterfaceID),
+RegisterAGBase::RegisterAGBase(const std::type_info Interface,
+   const std::type_info *Pass, bool isDefault)
+  : RegisterPassBase(Interface),
 ImplementationInfo(0), isDefaultImplementation(isDefault) {
 
-  InterfaceInfo = const_castPassInfo*(Pass::lookupPassInfo(InterfaceID));
+  InterfaceInfo = const_castPassInfo*(Pass::lookupPassInfo(Interface));
   if (InterfaceInfo == 0) {
 // First reference to Interface, register it now.
 registerPass();
@@ -251,8 +252,8 @@
   assert(PIObj.isAnalysisGroup() 
  Trying to join an analysis group that is a normal pass!);
 
-  if (PassID) {
-ImplementationInfo = Pass::lookupPassInfo(PassID);
+  if (Pass) {
+ImplementationInfo = Pass::lookupPassInfo(*Pass);
 assert(ImplementationInfo 
Must register pass before adding to AnalysisGroup!);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2007-04-26 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.86 - 1.87
---
Log message:

Move ~Pass() from Pass.h into Pass.cpp


---
Diffs of the changes:  (+5 -0)

 Pass.cpp |5 +
 1 files changed, 5 insertions(+)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.86 llvm/lib/VMCore/Pass.cpp:1.87
--- llvm/lib/VMCore/Pass.cpp:1.86   Fri Apr 20 19:12:18 2007
+++ llvm/lib/VMCore/Pass.cppThu Apr 26 16:33:42 2007
@@ -28,6 +28,11 @@
 //
 
 // Force out-of-line virtual method.
+Pass::~Pass() { 
+  delete Resolver; 
+}
+
+// Force out-of-line virtual method.
 ModulePass::~ModulePass() { }
 
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2007-04-20 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.85 - 1.86
---
Log message:

Fix a bug that prevented the JIT from working correctly after llvm_shutdown.
Pass info objects are initialized by static ctors, so deleting them at
llvm_shutdown time prevents resurrection from working.


---
Diffs of the changes:  (+16 -6)

 Pass.cpp |   22 --
 1 files changed, 16 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.85 llvm/lib/VMCore/Pass.cpp:1.86
--- llvm/lib/VMCore/Pass.cpp:1.85   Sun Mar  4 18:00:42 2007
+++ llvm/lib/VMCore/Pass.cppFri Apr 20 19:12:18 2007
@@ -189,9 +189,19 @@
 };
 }
 
-static ManagedStaticPassRegistrar PassRegistrarObj;
 static std::vectorPassRegistrationListener* *Listeners = 0;
 
+// FIXME: This should use ManagedStatic to manage the pass registrar.
+// Unfortunately, we can't do this, because passes are registered with static
+// ctors, and having llvm_shutdown clear this map prevents successful
+// ressurection after llvm_shutdown is run.
+static PassRegistrar *getPassRegistrar() {
+  static PassRegistrar *PassRegistrarObj = 0;
+  if (!PassRegistrarObj)
+PassRegistrarObj = new PassRegistrar();
+  return PassRegistrarObj;
+}
+
 // getPassInfo - Return the PassInfo data structure that corresponds to this
 // pass...
 const PassInfo *Pass::getPassInfo() const {
@@ -200,11 +210,11 @@
 }
 
 const PassInfo *Pass::lookupPassInfo(const std::type_info TI) {
-  return PassRegistrarObj-GetPassInfo(TI);
+  return getPassRegistrar()-GetPassInfo(TI);
 }
 
 void RegisterPassBase::registerPass() {
-  PassRegistrarObj-RegisterPass(PIObj);
+  getPassRegistrar()-RegisterPass(PIObj);
 
   // Notify any listeners.
   if (Listeners)
@@ -214,7 +224,7 @@
 }
 
 void RegisterPassBase::unregisterPass() {
-  PassRegistrarObj-UnregisterPass(PIObj);
+  getPassRegistrar()-UnregisterPass(PIObj);
 }
 
 
//===--===//
@@ -247,7 +257,7 @@
 PassInfo *IIPI = const_castPassInfo*(ImplementationInfo);
 IIPI-addInterfaceImplemented(InterfaceInfo);
 
-PassRegistrarObj-RegisterAnalysisGroup(InterfaceInfo, IIPI, isDefault);
+getPassRegistrar()-RegisterAnalysisGroup(InterfaceInfo, IIPI, isDefault);
   }
 }
 
@@ -286,7 +296,7 @@
 // passEnumerate callback on each PassInfo object.
 //
 void PassRegistrationListener::enumeratePasses() {
-  PassRegistrarObj-EnumerateWith(this);
+  getPassRegistrar()-EnumerateWith(this);
 }
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp Value.cpp

2007-03-04 Thread Jeff Cohen


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.84 - 1.85
PassManager.cpp updated: 1.138 - 1.139
Value.cpp updated: 1.70 - 1.71
---
Log message:

Unbreak VC++ build.

---
Diffs of the changes:  (+3 -1)

 Pass.cpp|1 +
 PassManager.cpp |1 +
 Value.cpp   |2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.84 llvm/lib/VMCore/Pass.cpp:1.85
--- llvm/lib/VMCore/Pass.cpp:1.84   Tue Jan 30 14:08:38 2007
+++ llvm/lib/VMCore/Pass.cppSun Mar  4 18:00:42 2007
@@ -19,6 +19,7 @@
 #include llvm/ADT/STLExtras.h
 #include llvm/Support/ManagedStatic.h
 #include llvm/Support/TypeInfo.h
+#include algorithm
 #include set
 using namespace llvm;
 


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.138 
llvm/lib/VMCore/PassManager.cpp:1.139
--- llvm/lib/VMCore/PassManager.cpp:1.138   Tue Feb 27 09:00:39 2007
+++ llvm/lib/VMCore/PassManager.cpp Sun Mar  4 18:00:42 2007
@@ -19,6 +19,7 @@
 #include llvm/ModuleProvider.h
 #include llvm/Support/Streams.h
 #include llvm/Support/ManagedStatic.h
+#include algorithm
 #include vector
 #include map
 


Index: llvm/lib/VMCore/Value.cpp
diff -u llvm/lib/VMCore/Value.cpp:1.70 llvm/lib/VMCore/Value.cpp:1.71
--- llvm/lib/VMCore/Value.cpp:1.70  Thu Feb 15 14:01:43 2007
+++ llvm/lib/VMCore/Value.cpp   Sun Mar  4 18:00:42 2007
@@ -128,7 +128,7 @@
 
 void Value::setName(const char *NameStr, unsigned NameLen) {
   if (NameLen == 0  !hasName()) return;
-  if (getType() != Type::VoidTy  Cannot assign a name to void values!);
+  assert(getType() != Type::VoidTy  Cannot assign a name to void values!);
   
   // Get the symbol table to update for this object.
   ValueSymbolTable *ST;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp PassManagerT.h

2007-01-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.81 - 1.82
PassManager.cpp updated: 1.110 - 1.111
PassManagerT.h updated: 1.74 - 1.75
---
Log message:

Remove old pass manager.


---
Diffs of the changes:  (+1 -1099)

 Pass.cpp|  175 --
 PassManager.cpp |3 
 PassManagerT.h  |  922 
 3 files changed, 1 insertion(+), 1099 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.81 llvm/lib/VMCore/Pass.cpp:1.82
--- llvm/lib/VMCore/Pass.cpp:1.81   Fri Dec 22 16:49:00 2006
+++ llvm/lib/VMCore/Pass.cppFri Jan  5 14:16:23 2007
@@ -14,9 +14,6 @@
 
//===--===//
 
 #include llvm/PassManager.h
-#ifdef USE_OLD_PASSMANAGER
-#include PassManagerT.h // PassManagerT implementation
-#endif
 #include llvm/Module.h
 #include llvm/ModuleProvider.h
 #include llvm/ADT/STLExtras.h
@@ -31,157 +28,16 @@
 
 AnalysisResolver::~AnalysisResolver() {
 }
-void AnalysisResolver::setAnalysisResolver(Pass *P, AnalysisResolver *AR) {
-  assert(P-Resolver == 0  Pass already in a PassManager!);
-  P-Resolver = AR;
-}
-
-#ifdef USE_OLD_PASSMANAGER
-//===--===//
-// PassManager implementation - The PassManager class is a simple Pimpl class
-// that wraps the PassManagerT template.
-//
-PassManager::PassManager() : PM(new ModulePassManager()) {}
-PassManager::~PassManager() { delete PM; }
-void PassManager::add(Pass *P) {
-  ModulePass *MP = dynamic_castModulePass*(P);
-  assert(MP  Not a modulepass?);
-  PM-add(MP);
-}
-bool PassManager::run(Module M) { return PM-runOnModule(M); }
-
-//===--===//
-// FunctionPassManager implementation - The FunctionPassManager class
-// is a simple Pimpl class that wraps the PassManagerT template. It
-// is like PassManager, but only deals in FunctionPasses.
-//
-FunctionPassManager::FunctionPassManager(ModuleProvider *P) :
-  PM(new FunctionPassManagerT()), MP(P) {}
-FunctionPassManager::~FunctionPassManager() { delete PM; }
-void FunctionPassManager::add(FunctionPass *P) { PM-add(P); }
-void FunctionPassManager::add(ImmutablePass *IP) { PM-add(IP); }
-
-/// doInitialization - Run all of the initializers for the function passes.
-///
-bool FunctionPassManager::doInitialization() {
-  return PM-doInitialization(*MP-getModule());
-}
-
-bool FunctionPassManager::run(Function F) {
-  std::string errstr;
-  if (MP-materializeFunction(F, errstr)) {
-cerr  Error reading bytecode file:   errstr  \n;
-abort();
-  }
-  return PM-runOnFunction(F);
-}
-
-/// doFinalization - Run all of the initializers for the function passes.
-///
-bool FunctionPassManager::doFinalization() {
-  return PM-doFinalization(*MP-getModule());
-}
-
-
-//===--===//
-// TimingInfo Class - This class is used to calculate information about the
-// amount of time each pass takes to execute.  This only happens with
-// -time-passes is enabled on the command line.
-//
-bool llvm::TimePassesIsEnabled = false;
-static cl::optbool,true
-EnableTiming(time-passes, cl::location(TimePassesIsEnabled),
-cl::desc(Time each pass, printing elapsed time for each on 
exit));
-
-// createTheTimeInfo - This method either initializes the TheTimeInfo pointer 
to
-// a non null value (if the -time-passes option is enabled) or it leaves it
-// null.  It may be called multiple times.
-void TimingInfo::createTheTimeInfo() {
-  if (!TimePassesIsEnabled || TheTimeInfo) return;
-
-  // Constructed the first time this is called, iff -time-passes is enabled.
-  // This guarantees that the object will be constructed before static globals,
-  // thus it will be destroyed before them.
-  static ManagedStaticTimingInfo TTI;
-  TheTimeInfo = *TTI;
-}
-
-void PMDebug::PrintArgumentInformation(const Pass *P) {
-  // Print out passes in pass manager...
-  if (const AnalysisResolver *PM = dynamic_castconst AnalysisResolver*(P)) {
-for (unsigned i = 0, e = PM-getNumContainedPasses(); i != e; ++i)
-  PrintArgumentInformation(PM-getContainedPass(i));
-
-  } else {  // Normal pass.  Print argument information...
-// Print out arguments for registered passes that are _optimizations_
-if (const PassInfo *PI = P-getPassInfo())
-  if (!PI-isAnalysisGroup())
-cerr   -  PI-getPassArgument();
-  }
-}
-
-void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
-   Pass *P, Module *M) {
-  if (PassDebugging = Executions) {
-cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
-  P-getPassName();
-if (M) cerr  ' on Module '  M-getModuleIdentifier()  '\n;
-cerr  '...\n;
-  }
-}
-
-void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
-   Pass 

[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp

2007-01-05 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.82 - 1.83
PassManager.cpp updated: 1.111 - 1.112
---
Log message:

1) Remove old AnalysisResolver.
2) Rename AnalysisResolver_New as AnalysisResolver


---
Diffs of the changes:  (+9 -16)

 Pass.cpp|9 +
 PassManager.cpp |   16 
 2 files changed, 9 insertions(+), 16 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.82 llvm/lib/VMCore/Pass.cpp:1.83
--- llvm/lib/VMCore/Pass.cpp:1.82   Fri Jan  5 14:16:23 2007
+++ llvm/lib/VMCore/Pass.cppFri Jan  5 16:47:07 2007
@@ -23,13 +23,6 @@
 using namespace llvm;
 
 
//===--===//
-//   AnalysisResolver Class Implementation
-//
-
-AnalysisResolver::~AnalysisResolver() {
-}
-
-//===--===//
 // Pass Implementation
 //
 
@@ -37,7 +30,7 @@
 ModulePass::~ModulePass() { }
 
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
-  return Resolver_New-getAnalysisToUpdate(AnalysisID, true) != 0;
+  return Resolver-getAnalysisToUpdate(AnalysisID, true) != 0;
 }
 
 // dumpPassStructure - Implement the -debug-passes=Structure option


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.111 
llvm/lib/VMCore/PassManager.cpp:1.112
--- llvm/lib/VMCore/PassManager.cpp:1.111   Fri Jan  5 14:16:23 2007
+++ llvm/lib/VMCore/PassManager.cpp Fri Jan  5 16:47:07 2007
@@ -463,7 +463,7 @@
   
   // P is a immutable pass and it will be managed by this
   // top level manager. Set up analysis resolver to connect them.
-  AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
+  AnalysisResolver *AR = new AnalysisResolver(*this);
   P-setResolver(AR);
   initializeAnalysisImpl(P);
   addImmutablePass(IP);
@@ -571,7 +571,7 @@
   
   // P is a immutable pass and it will be managed by this
   // top level manager. Set up analysis resolver to connect them.
-  AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
+  AnalysisResolver *AR = new AnalysisResolver(*this);
   P-setResolver(AR);
   initializeAnalysisImpl(P);
   addImmutablePass(IP);
@@ -873,7 +873,7 @@
 
   // This manager is going to manage pass P. Set up analysis resolver
   // to connect them.
-  AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
+  AnalysisResolver *AR = new AnalysisResolver(*this);
   P-setResolver(AR);
 
   if (ProcessAnalysis) {
@@ -956,7 +956,7 @@
 Pass *Impl = findAnalysisPass(*I, true);
 if (Impl == 0)
   assert(0  Analysis used but not available!);
-AnalysisResolver_New *AR = P-getResolver();
+AnalysisResolver *AR = P-getResolver();
 AR-addAnalysisImplsPair(*I, Impl);
   }
 }
@@ -1031,7 +1031,7 @@
 
//===--===//
 // NOTE: Is this the right place to define this method ?
 // getAnalysisToUpdate - Return an analysis result or null if it doesn't exist
-Pass *AnalysisResolver_New::getAnalysisToUpdate(AnalysisID ID, bool dir) const 
{
+Pass *AnalysisResolver::getAnalysisToUpdate(AnalysisID ID, bool dir) const {
   return PM.findAnalysisPass(ID, dir);
 }
 
@@ -1154,7 +1154,7 @@
   FPM-setTopLevelManager(FPM);
 
   PMDataManager *PMD = dynamic_castPMDataManager *(FPM);
-  AnalysisResolver_New *AR = new AnalysisResolver_New(*PMD);
+  AnalysisResolver *AR = new AnalysisResolver(*PMD);
   FPM-setResolver(AR);
   
   MP = P;
@@ -1213,7 +1213,7 @@
 
 // This top level manager is going to manage activeManager. 
 // Set up analysis resolver to connect them.
-AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
+AnalysisResolver *AR = new AnalysisResolver(*this);
 activeManager-setResolver(AR);
 
 addPassManager(activeManager);
@@ -1520,7 +1520,7 @@
 
 // This top level manager is going to manage activeManager. 
 // Set up analysis resolver to connect them.
-AnalysisResolver_New *AR = new AnalysisResolver_New(*this);
+AnalysisResolver *AR = new AnalysisResolver(*this);
 activeManager-setResolver(AR);
 
 addPassManager(activeManager);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2006-12-22 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.80 - 1.81
---
Log message:

ModulePass and ImmutablePass. Force out of line virtual method.


---
Diffs of the changes:  (+6 -0)

 Pass.cpp |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.80 llvm/lib/VMCore/Pass.cpp:1.81
--- llvm/lib/VMCore/Pass.cpp:1.80   Wed Dec 13 15:13:31 2006
+++ llvm/lib/VMCore/Pass.cppFri Dec 22 16:49:00 2006
@@ -171,6 +171,9 @@
 void ModulePass::addToPassManager(ModulePassManager *PM, AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
+#else
+// Force out-of-line virtual method.
+ModulePass::~ModulePass() { }
 #endif
 
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
@@ -215,6 +218,9 @@
  AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
+#else
+// Force out-of-line virtual method.
+ImmutablePass::~ImmutablePass() { }
 #endif
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp PassManagerT.h

2006-12-13 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.78 - 1.79
PassManager.cpp updated: 1.93 - 1.94
PassManagerT.h updated: 1.72 - 1.73
---
Log message:

Move enum PassDebugLevel from PassManagerT.h to Pass.h.
Use PDL as the prefix for these enums.
Define and use PassDebugging_New in new PassManager.


---
Diffs of the changes:  (+42 -21)

 Pass.cpp|8 
 PassManager.cpp |   26 ++
 PassManagerT.h  |   29 -
 3 files changed, 42 insertions(+), 21 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.78 llvm/lib/VMCore/Pass.cpp:1.79
--- llvm/lib/VMCore/Pass.cpp:1.78   Tue Dec 12 20:36:01 2006
+++ llvm/lib/VMCore/Pass.cppWed Dec 13 14:03:48 2006
@@ -122,7 +122,7 @@
 
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Module *M) {
-  if (PassDebugging = Executions) {
+  if (PassDebugging = PDLExecutions) {
 cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
   P-getPassName();
 if (M) cerr  ' on Module '  M-getModuleIdentifier()  '\n;
@@ -132,7 +132,7 @@
 
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Function *F) {
-  if (PassDebugging = Executions) {
+  if (PassDebugging = PDLExecutions) {
 cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
   P-getPassName();
 if (F) cerr  ' on Function '  F-getName();
@@ -142,7 +142,7 @@
 
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, BasicBlock *BB) {
-  if (PassDebugging = Executions) {
+  if (PassDebugging = PDLExecutions) {
 cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
   P-getPassName();
 if (BB) cerr  ' on BasicBlock '  BB-getName();
@@ -152,7 +152,7 @@
 
 void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
Pass *P, const std::vectorAnalysisID 
Set){
-  if (PassDebugging = Details  !Set.empty()) {
+  if (PassDebugging = PDLDetails  !Set.empty()) {
 cerr  (void*)P  std::string(Depth*2+3, ' ')  Msg   Analyses:;
 for (unsigned i = 0; i != Set.size(); ++i) {
   if (i) cerr  ,;


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.93 
llvm/lib/VMCore/PassManager.cpp:1.94
--- llvm/lib/VMCore/PassManager.cpp:1.93Tue Dec 12 20:36:01 2006
+++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 14:03:48 2006
@@ -13,6 +13,7 @@
 
 
 #include llvm/PassManager.h
+#include llvm/Support/CommandLine.h
 #include llvm/Module.h
 #include llvm/ModuleProvider.h
 #include llvm/Support/Streams.h
@@ -84,6 +85,27 @@
 // ModulePassManagers.
 
//===--===//
 
+namespace llvm {
+
+//===--===//
+// Pass debugging information.  Often it is useful to find out what pass is
+// running when a crash occurs in a utility.  When this library is compiled 
with
+// debugging on, a command line option (--debug-pass) is enabled that causes 
the
+// pass name to be printed before it executes.
+//
+
+static cl::optenum PassDebugLevel
+PassDebugging_New(debug-pass, cl::Hidden,
+  cl::desc(Print PassManager debugging information),
+  cl::values(
+  clEnumVal(PDLNone  , disable debug output),
+  clEnumVal(PDLArguments , print pass arguments to pass to 'opt'),
+  clEnumVal(PDLStructure , print pass structure before run()),
+  clEnumVal(PDLExecutions, print pass name before it is executed),
+  clEnumVal(PDLDetails   , print pass details when it is executed),
+ clEnumValEnd));
+} // End of llvm namespace
+
 #ifndef USE_OLD_PASSMANAGER
 namespace llvm {
 
@@ -1241,6 +1263,10 @@
 bool PassManagerImpl_New::run(Module M) {
 
   bool Changed = false;
+
+  if (PassDebugging_New = PDLStructure)
+dumpPasses();
+
   for (std::vectorPass *::iterator I = passManagersBegin(),
  E = passManagersEnd(); I != E; ++I) {
 ModulePassManager *MP = dynamic_castModulePassManager *(*I);


Index: llvm/lib/VMCore/PassManagerT.h
diff -u llvm/lib/VMCore/PassManagerT.h:1.72 llvm/lib/VMCore/PassManagerT.h:1.73
--- llvm/lib/VMCore/PassManagerT.h:1.72 Sun Dec 10 01:40:46 2006
+++ llvm/lib/VMCore/PassManagerT.h  Wed Dec 13 14:03:48 2006
@@ -37,21 +37,16 @@
 // pass name to be printed before it executes.
 //
 
-// Different debug levels that can be enabled...
-enum PassDebugLevel {
-  None, Arguments, Structure, Executions, Details
-};
-
 static cl::optenum PassDebugLevel
 PassDebugging(debug-pass, cl::Hidden,
-  cl::desc(Print PassManager debugging information),
-  cl::values(
-  clEnumVal(None  , disable debug output),
-  clEnumVal(Arguments , print pass arguments to pass to 'opt'),
-  clEnumVal(Structure , print pass 

[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp PassManagerT.h

2006-12-13 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.79 - 1.80
PassManager.cpp updated: 1.94 - 1.95
PassManagerT.h updated: 1.73 - 1.74
---
Log message:

Using PDL as a prefix for PassDebugLevel enums is not a good idea.
Fix it.


---
Diffs of the changes:  (+29 -19)

 Pass.cpp|8 
 PassManager.cpp |   17 +++--
 PassManagerT.h  |   23 ++-
 3 files changed, 29 insertions(+), 19 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.79 llvm/lib/VMCore/Pass.cpp:1.80
--- llvm/lib/VMCore/Pass.cpp:1.79   Wed Dec 13 14:03:48 2006
+++ llvm/lib/VMCore/Pass.cppWed Dec 13 15:13:31 2006
@@ -122,7 +122,7 @@
 
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Module *M) {
-  if (PassDebugging = PDLExecutions) {
+  if (PassDebugging = Executions) {
 cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
   P-getPassName();
 if (M) cerr  ' on Module '  M-getModuleIdentifier()  '\n;
@@ -132,7 +132,7 @@
 
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, Function *F) {
-  if (PassDebugging = PDLExecutions) {
+  if (PassDebugging = Executions) {
 cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
   P-getPassName();
 if (F) cerr  ' on Function '  F-getName();
@@ -142,7 +142,7 @@
 
 void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Pass *P, BasicBlock *BB) {
-  if (PassDebugging = PDLExecutions) {
+  if (PassDebugging = Executions) {
 cerr  (void*)P  std::string(Depth*2+1, ' ')  Action   '
   P-getPassName();
 if (BB) cerr  ' on BasicBlock '  BB-getName();
@@ -152,7 +152,7 @@
 
 void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
Pass *P, const std::vectorAnalysisID 
Set){
-  if (PassDebugging = PDLDetails  !Set.empty()) {
+  if (PassDebugging = Details  !Set.empty()) {
 cerr  (void*)P  std::string(Depth*2+3, ' ')  Msg   Analyses:;
 for (unsigned i = 0; i != Set.size(); ++i) {
   if (i) cerr  ,;


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.94 
llvm/lib/VMCore/PassManager.cpp:1.95
--- llvm/lib/VMCore/PassManager.cpp:1.94Wed Dec 13 14:03:48 2006
+++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 15:13:31 2006
@@ -94,15 +94,20 @@
 // pass name to be printed before it executes.
 //
 
+// Different debug levels that can be enabled...
+enum PassDebugLevel {
+  None, Arguments, Structure, Executions, Details
+};
+
 static cl::optenum PassDebugLevel
 PassDebugging_New(debug-pass, cl::Hidden,
   cl::desc(Print PassManager debugging information),
   cl::values(
-  clEnumVal(PDLNone  , disable debug output),
-  clEnumVal(PDLArguments , print pass arguments to pass to 'opt'),
-  clEnumVal(PDLStructure , print pass structure before run()),
-  clEnumVal(PDLExecutions, print pass name before it is executed),
-  clEnumVal(PDLDetails   , print pass details when it is executed),
+  clEnumVal(None  , disable debug output),
+  clEnumVal(Arguments , print pass arguments to pass to 'opt'),
+  clEnumVal(Structure , print pass structure before run()),
+  clEnumVal(Executions, print pass name before it is executed),
+  clEnumVal(Details   , print pass details when it is executed),
  clEnumValEnd));
 } // End of llvm namespace
 
@@ -1264,7 +1269,7 @@
 
   bool Changed = false;
 
-  if (PassDebugging_New = PDLStructure)
+  if (PassDebugging_New = Structure)
 dumpPasses();
 
   for (std::vectorPass *::iterator I = passManagersBegin(),


Index: llvm/lib/VMCore/PassManagerT.h
diff -u llvm/lib/VMCore/PassManagerT.h:1.73 llvm/lib/VMCore/PassManagerT.h:1.74
--- llvm/lib/VMCore/PassManagerT.h:1.73 Wed Dec 13 14:03:48 2006
+++ llvm/lib/VMCore/PassManagerT.h  Wed Dec 13 15:13:31 2006
@@ -37,15 +37,20 @@
 // pass name to be printed before it executes.
 //
 
+// Different debug levels that can be enabled...
+enum PassDebugLevel {
+  None, Arguments, Structure, Executions, Details
+};
+
 static cl::optenum PassDebugLevel
 PassDebugging(debug-pass, cl::Hidden,
  cl::desc(Print PassManager debugging information),
  cl::values(
-  clEnumVal(PDLNone  , disable debug output),
-  clEnumVal(PDLArguments , print pass arguments to pass to 'opt'),
-  clEnumVal(PDLStructure , print pass structure before run()),
-  clEnumVal(PDLExecutions, print pass name before it is executed),
-  clEnumVal(PDLDetails   , print pass details when it is executed),
+  clEnumVal(None  , disable debug output),
+  clEnumVal(Arguments , print pass arguments to pass to 'opt'),
+  clEnumVal(Structure , print pass structure before run()),
+  clEnumVal(Executions, print pass name before it is executed),
+  clEnumVal(Details   , print pass details when it 

[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp

2006-12-12 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.77 - 1.78
PassManager.cpp updated: 1.92 - 1.93
---
Log message:

Add #ifdef switch toggle between old and new pass manager.  However, 
continue to use old pass manager at the moment. To use new manager
remove #define USE_OLD_PASSMANAGER 1 from Pass.h


---
Diffs of the changes:  (+65 -37)

 Pass.cpp|   18 ++--
 PassManager.cpp |   84 
 2 files changed, 65 insertions(+), 37 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.77 llvm/lib/VMCore/Pass.cpp:1.78
--- llvm/lib/VMCore/Pass.cpp:1.77   Sun Dec 10 01:40:46 2006
+++ llvm/lib/VMCore/Pass.cppTue Dec 12 20:36:01 2006
@@ -14,7 +14,9 @@
 
//===--===//
 
 #include llvm/PassManager.h
+#ifdef USE_OLD_PASSMANAGER
 #include PassManagerT.h // PassManagerT implementation
+#endif
 #include llvm/Module.h
 #include llvm/ModuleProvider.h
 #include llvm/ADT/STLExtras.h
@@ -34,6 +36,7 @@
   P-Resolver = AR;
 }
 
+#ifdef USE_OLD_PASSMANAGER
 
//===--===//
 // PassManager implementation - The PassManager class is a simple Pimpl class
 // that wraps the PassManagerT template.
@@ -158,17 +161,24 @@
 cerr  \n;
   }
 }
+#endif
 
 
//===--===//
 // Pass Implementation
 //
 
+#ifdef USE_OLD_PASSMANAGER
 void ModulePass::addToPassManager(ModulePassManager *PM, AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
+#endif
 
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
+#ifdef USE_OLD_PASSMANAGER
   return Resolver-getAnalysisToUpdate(AnalysisID) != 0;
+#else
+  return Resolver_New-getAnalysisToUpdate(AnalysisID, true) != 0;
+#endif
 }
 
 // dumpPassStructure - Implement the -debug-passes=Structure option
@@ -200,11 +210,12 @@
 
//===--===//
 // ImmutablePass Implementation
 //
+#ifdef USE_OLD_PASSMANAGER
 void ImmutablePass::addToPassManager(ModulePassManager *PM, 
  AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
-
+#endif
 
 
//===--===//
 // FunctionPass Implementation
@@ -233,6 +244,7 @@
   return Changed | doFinalization(*F.getParent());
 }
 
+#ifdef USE_OLD_PASSMANAGER
 void FunctionPass::addToPassManager(ModulePassManager *PM,
 AnalysisUsage AU) {
   PM-addPass(this, AU);
@@ -242,6 +254,7 @@
 AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
+#endif
 
 
//===--===//
 // BasicBlockPass Implementation
@@ -271,6 +284,7 @@
   return Changed;
 }
 
+#ifdef USE_OLD_PASSMANAGER
 void BasicBlockPass::addToPassManager(FunctionPassManagerT *PM,
   AnalysisUsage AU) {
   PM-addPass(this, AU);
@@ -280,7 +294,7 @@
   AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
-
+#endif
 
 
//===--===//
 // Pass Registration mechanism


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.92 
llvm/lib/VMCore/PassManager.cpp:1.93
--- llvm/lib/VMCore/PassManager.cpp:1.92Tue Dec 12 18:34:32 2006
+++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 20:36:01 2006
@@ -84,6 +84,7 @@
 // ModulePassManagers.
 
//===--===//
 
+#ifndef USE_OLD_PASSMANAGER
 namespace llvm {
 
 class PMDataManager;
@@ -125,6 +126,10 @@
   /// then return NULL.
   Pass *findAnalysisPass(AnalysisID AID);
 
+  inline void clearManagers() { 
+PassManagers.clear();
+  }
+
   virtual ~PMTopLevelManager() {
 
 for (std::vectorPass *::iterator I = PassManagers.begin(),
@@ -291,16 +296,16 @@
 };
 
 
//===--===//
-// BasicBlockPassManager_New
+// BasicBlockPassManager
 //
-/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the
+/// BasicBlockPassManager manages BasicBlockPass. It batches all the
 /// pass together and sequence them to process one basic block before
 /// processing next basic block.
-class BasicBlockPassManager_New : public PMDataManager, 
+class BasicBlockPassManager : public PMDataManager, 
   public FunctionPass {
 
 public:
-  BasicBlockPassManager_New(int D) : PMDataManager(D) { }
+  BasicBlockPassManager(int D) : PMDataManager(D) { }
 
   /// Add a pass into a passmanager queue. 
   bool addPass(Pass *p);
@@ -407,20 +412,20 @@
 
 private:
   // Active Pass Managers
-  BasicBlockPassManager_New *activeBBPassManager;
+  BasicBlockPassManager 

[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2006-09-03 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.71 - 1.72
---
Log message:

Add explicit doInitialization/doFinalization methods instead of making
the FunctionPassManager redo this for each function.


---
Diffs of the changes:  (+14 -1)

 Pass.cpp |   15 ++-
 1 files changed, 14 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.71 llvm/lib/VMCore/Pass.cpp:1.72
--- llvm/lib/VMCore/Pass.cpp:1.71   Sun Aug 27 17:21:55 2006
+++ llvm/lib/VMCore/Pass.cppSun Sep  3 23:07:39 2006
@@ -94,13 +94,26 @@
 FunctionPassManager::~FunctionPassManager() { delete PM; }
 void FunctionPassManager::add(FunctionPass *P) { PM-add(P); }
 void FunctionPassManager::add(ImmutablePass *IP) { PM-add(IP); }
+
+/// doInitialization - Run all of the initializers for the function passes.
+///
+bool FunctionPassManager::doInitialization() {
+  return PM-doInitialization(*MP-getModule());
+}
+
 bool FunctionPassManager::run(Function F) {
   std::string errstr;
   if (MP-materializeFunction(F, errstr)) {
 std::cerr  Error reading bytecode file:   errstr  \n;
 abort();
   }
-  return PM-run(F);
+  return PM-runOnFunction(F);
+}
+
+/// doFinalization - Run all of the initializers for the function passes.
+///
+bool FunctionPassManager::doFinalization() {
+  return PM-doFinalization(*MP-getModule());
 }
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

2006-07-06 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.69 - 1.70
---
Log message:

Change the ModuleProvider interface to not throw exceptions.


---
Diffs of the changes:  (+2 -6)

 Pass.cpp |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.69 llvm/lib/VMCore/Pass.cpp:1.70
--- llvm/lib/VMCore/Pass.cpp:1.69   Wed Jun  7 15:00:19 2006
+++ llvm/lib/VMCore/Pass.cppThu Jul  6 16:35:01 2006
@@ -95,14 +95,10 @@
 void FunctionPassManager::add(FunctionPass *P) { PM-add(P); }
 void FunctionPassManager::add(ImmutablePass *IP) { PM-add(IP); }
 bool FunctionPassManager::run(Function F) {
-  try {
-MP-materializeFunction(F);
-  } catch (std::string errstr) {
+  std::string errstr;
+  if (MP-materializeFunction(F, errstr)) {
 std::cerr  Error reading bytecode file:   errstr  \n;
 abort();
-  } catch (...) {
-std::cerr  Error reading bytecode file!\n;
-abort();
   }
   return PM-run(F);
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManagerT.h

2006-01-03 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.66 - 1.67
PassManagerT.h updated: 1.62 - 1.63
---
Log message:

Patch #6's in Saem's refactor-the-passmanager patch series.  From him:

This sanitises the world, blows away the specialisations and adds
traits per passmanager type -- seemed most natural.



---
Diffs of the changes:  (+157 -230)

 Pass.cpp   |   16 +-
 PassManagerT.h |  371 ++---
 2 files changed, 157 insertions(+), 230 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.66 llvm/lib/VMCore/Pass.cpp:1.67
--- llvm/lib/VMCore/Pass.cpp:1.66   Sun Apr 24 20:01:35 2005
+++ llvm/lib/VMCore/Pass.cppWed Jan  4 01:47:13 2006
@@ -78,7 +78,7 @@
 // PassManager implementation - The PassManager class is a simple Pimpl class
 // that wraps the PassManagerT template.
 //
-PassManager::PassManager() : PM(new PassManagerTModule()) {}
+PassManager::PassManager() : PM(new ModulePassManager()) {}
 PassManager::~PassManager() { delete PM; }
 void PassManager::add(Pass *P) {
   ModulePass *MP = dynamic_castModulePass*(P);
@@ -93,7 +93,7 @@
 // is like PassManager, but only deals in FunctionPasses.
 //
 FunctionPassManager::FunctionPassManager(ModuleProvider *P) :
-  PM(new PassManagerTFunction()), MP(P) {}
+  PM(new FunctionPassManagerT()), MP(P) {}
 FunctionPassManager::~FunctionPassManager() { delete PM; }
 void FunctionPassManager::add(FunctionPass *P) { PM-add(P); }
 void FunctionPassManager::add(ImmutablePass *IP) { PM-add(IP); }
@@ -194,7 +194,7 @@
 // Pass Implementation
 //
 
-void ModulePass::addToPassManager(PassManagerTModule *PM, AnalysisUsage AU) 
{
+void ModulePass::addToPassManager(ModulePassManager *PM, AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
 
@@ -231,7 +231,7 @@
 
//===--===//
 // ImmutablePass Implementation
 //
-void ImmutablePass::addToPassManager(PassManagerTModule *PM,
+void ImmutablePass::addToPassManager(ModulePassManager *PM, 
  AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
@@ -264,12 +264,12 @@
   return Changed | doFinalization(*F.getParent());
 }
 
-void FunctionPass::addToPassManager(PassManagerTModule *PM,
+void FunctionPass::addToPassManager(ModulePassManager *PM,
 AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
 
-void FunctionPass::addToPassManager(PassManagerTFunction *PM,
+void FunctionPass::addToPassManager(FunctionPassManagerT *PM,
 AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
@@ -302,12 +302,12 @@
   return Changed;
 }
 
-void BasicBlockPass::addToPassManager(PassManagerTFunction *PM,
+void BasicBlockPass::addToPassManager(FunctionPassManagerT *PM,
   AnalysisUsage AU) {
   PM-addPass(this, AU);
 }
 
-void BasicBlockPass::addToPassManager(PassManagerTBasicBlock *PM,
+void BasicBlockPass::addToPassManager(BasicBlockPassManager *PM,
   AnalysisUsage AU) {
   PM-addPass(this, AU);
 }


Index: llvm/lib/VMCore/PassManagerT.h
diff -u llvm/lib/VMCore/PassManagerT.h:1.62 llvm/lib/VMCore/PassManagerT.h:1.63
--- llvm/lib/VMCore/PassManagerT.h:1.62 Tue Jan  3 23:02:04 2006
+++ llvm/lib/VMCore/PassManagerT.h  Wed Jan  4 01:47:13 2006
@@ -123,10 +123,70 @@
 
 static TimingInfo *TheTimeInfo;
 
-//===--===//
-// Declare the PassManagerTraits which will be specialized...
-//
-templateclass UnitType class PassManagerTraits;   // Do not define.
+// FIXME:I'm not sure if this is the best way, but this was the only way I 
+// could get around the recursive template issues. -- Saem
+struct BBTraits {
+  typedef BasicBlock UnitType;
+  
+  // PassClass - The type of passes tracked by this PassManager
+  typedef BasicBlockPass PassClass;
+
+  // SubPassClass - The types of classes that should be collated together
+  // This is impossible to match, so BasicBlock instantiations of PassManagerT
+  // do not collate.
+  //
+  typedef BasicBlockPassManager SubPassClass;
+
+  // BatcherClass - The type to use for collation of subtypes... This class is
+  // never instantiated for the PassManagerBasicBlock, but it must be an
+  // instance of PassClass to typecheck.
+  //
+  typedef PassClass BatcherClass;
+
+  // ParentClass - The type of the parent PassManager...
+  typedef FunctionPassManagerT ParentClass;
+
+  // PMType - The type of this passmanager
+  typedef BasicBlockPassManager PMType;
+};
+
+struct FTraits {
+  typedef Function UnitType;
+  
+  // PassClass - The type of passes tracked by this PassManager
+  typedef FunctionPass PassClass;
+
+  // SubPassClass - The types of classes that should be collated together
+  typedef BasicBlockPass SubPassClass;
+
+  // BatcherClass - The type to use for collation of subtypes...
+  typedef BasicBlockPassManager