[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp EdgeProfiling.cpp RSProfiling.cpp RSProfiling.h

Devang Patel dpatel at apple.com
Tue May 1 14:17:46 PDT 2007



Changes in directory llvm/lib/Transforms/Instrumentation:

BlockProfiling.cpp updated: 1.22 -> 1.23
EdgeProfiling.cpp updated: 1.12 -> 1.13
RSProfiling.cpp updated: 1.23 -> 1.24
RSProfiling.h updated: 1.4 -> 1.5
---
Log message:

Do not use typeinfo to identify pass in pass manager.


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

 BlockProfiling.cpp |    7 +++++++
 EdgeProfiling.cpp  |    4 ++++
 RSProfiling.cpp    |    7 +++++++
 RSProfiling.h      |    1 +
 4 files changed, 19 insertions(+)


Index: llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.22 llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.23
--- llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp:1.22	Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp	Tue May  1 16:15:47 2007
@@ -32,9 +32,13 @@
 
 namespace {
   class VISIBILITY_HIDDEN FunctionProfiler : public RSProfilers_std {
+  public:
+    static const int ID;
     bool runOnModule(Module &M);
   };
 
+  const int FunctionProfiler::ID = 0;
+
   RegisterPass<FunctionProfiler> X("insert-function-profiling",
                                "Insert instrumentation for function profiling");
   RegisterAnalysisGroup<RSProfilers> XG(X);
@@ -79,8 +83,11 @@
 namespace {
   class BlockProfiler : public RSProfilers_std {
     bool runOnModule(Module &M);
+  public:
+    static const int ID;
   };
 
+  const int BlockProfiler::ID = 0;
   RegisterPass<BlockProfiler> Y("insert-block-profiling",
                                 "Insert instrumentation for block profiling");
   RegisterAnalysisGroup<RSProfilers> YG(Y);


Index: llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.12 llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.13
--- llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp:1.12	Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/Instrumentation/EdgeProfiling.cpp	Tue May  1 16:15:47 2007
@@ -32,8 +32,12 @@
 namespace {
   class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass {
     bool runOnModule(Module &M);
+  public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    EdgeProfiler() : ModulePass((intptr_t)&ID) {}
   };
 
+  const int EdgeProfiler::ID = 0;
   RegisterPass<EdgeProfiler> X("insert-edge-profiling",
                                "Insert instrumentation for edge profiling");
 }


Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.23 llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.24
--- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.23	Tue Apr 17 12:54:12 2007
+++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp	Tue May  1 16:15:47 2007
@@ -69,6 +69,7 @@
   /// measuring framework overhead
   class VISIBILITY_HIDDEN NullProfilerRS : public RSProfilers {
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
     bool isProfiling(Value* v) {
       return false;
     }
@@ -80,7 +81,9 @@
     }
   };
 
+  const int RSProfilers::ID = 0;
   static RegisterAnalysisGroup<RSProfilers> A("Profiling passes");
+  const int NullProfilerRS::ID = 0;
   static RegisterPass<NullProfilerRS> NP("insert-null-profiling-rs",
                                          "Measure profiling framework overhead");
   static RegisterAnalysisGroup<RSProfilers, true> NPT(NP);
@@ -138,6 +141,9 @@
 
   /// ProfilerRS - Insert the random sampling framework
   struct VISIBILITY_HIDDEN ProfilerRS : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    ProfilerRS() : FunctionPass((intptr_t)&ID) {}
+
     std::map<Value*, Value*> TransCache;
     std::set<BasicBlock*> ChoicePoints;
     Chooser* c;
@@ -154,6 +160,7 @@
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
   };
 
+  const int ProfilerRS::ID = 0;
   RegisterPass<ProfilerRS> X("insert-rs-profiling-framework",
                              "Insert random sampling instrumentation framework");
 }


Index: llvm/lib/Transforms/Instrumentation/RSProfiling.h
diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.h:1.4 llvm/lib/Transforms/Instrumentation/RSProfiling.h:1.5
--- llvm/lib/Transforms/Instrumentation/RSProfiling.h:1.4	Sat Feb  3 18:40:41 2007
+++ llvm/lib/Transforms/Instrumentation/RSProfiling.h	Tue May  1 16:15:47 2007
@@ -17,6 +17,7 @@
   /// RSProfilers_std - a simple support class for profilers that handles most
   /// of the work of chaining and tracking inserted code.
   struct RSProfilers_std : public RSProfilers {
+    static const int ID;
     std::set<Value*> profcode;
     // Lookup up values in profcode
     virtual bool isProfiling(Value* v);






More information about the llvm-commits mailing list