[llvm-commits] CVS: llvm/lib/Analysis/ProfileInfo.cpp ProfileInfoLoaderPass.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 8 15:31:06 PST 2004


Changes in directory llvm/lib/Analysis:

ProfileInfo.cpp updated: 1.3 -> 1.4
ProfileInfoLoaderPass.cpp updated: 1.3 -> 1.4

---
Log message:

Refactor implementations


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

Index: llvm/lib/Analysis/ProfileInfo.cpp
diff -u llvm/lib/Analysis/ProfileInfo.cpp:1.3 llvm/lib/Analysis/ProfileInfo.cpp:1.4
--- llvm/lib/Analysis/ProfileInfo.cpp:1.3	Wed Feb 11 00:10:18 2004
+++ llvm/lib/Analysis/ProfileInfo.cpp	Mon Mar  8 15:30:35 2004
@@ -29,9 +29,7 @@
 //
 
 namespace {
-  struct NoProfileInfo : public ImmutablePass, public ProfileInfo {
-    unsigned getExecutionCount(BasicBlock *BB) { return 0; }
-  };
+  struct NoProfileInfo : public ImmutablePass, public ProfileInfo {};
  
   // Register this pass...
   RegisterOpt<NoProfileInfo>


Index: llvm/lib/Analysis/ProfileInfoLoaderPass.cpp
diff -u llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.3 llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.4
--- llvm/lib/Analysis/ProfileInfoLoaderPass.cpp:1.3	Wed Feb 11 13:14:04 2004
+++ llvm/lib/Analysis/ProfileInfoLoaderPass.cpp	Mon Mar  8 15:30:35 2004
@@ -26,7 +26,6 @@
 
   class LoaderPass : public Pass, public ProfileInfo {
     std::string Filename;
-    std::map<BasicBlock*, unsigned> ExecutionCounts;
   public:
     LoaderPass(const std::string &filename = "")
       : Filename(filename) {
@@ -43,11 +42,6 @@
 
     /// run - Load the profile information from the specified file.
     virtual bool run(Module &M);
-
-    virtual unsigned getExecutionCount(BasicBlock *BB) {
-      std::map<BasicBlock*, unsigned>::iterator I = ExecutionCounts.find(BB);
-      return I != ExecutionCounts.end() ? I->second : 0;
-    }
   };
  
   RegisterOpt<LoaderPass>
@@ -65,7 +59,8 @@
 }
 
 bool LoaderPass::run(Module &M) {
-  ProfileInfoLoader PIL("opt", Filename, M);
+  ProfileInfoLoader PIL("profile-loader", Filename, M);
+  ExecutionCounts.clear();
   if (PIL.hasAccurateBlockCounts()) {
     std::vector<std::pair<BasicBlock*, unsigned> > Counts;
     PIL.getBlockCounts(Counts);





More information about the llvm-commits mailing list