Implement LoopDepth calculation in terms of dominators instead of intervals
authorChris Lattner <sabre@nondot.org>
Thu, 31 Jan 2002 00:41:01 +0000 (00:41 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 31 Jan 2002 00:41:01 +0000 (00:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1600 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopDepth.h

index 89068d6bb791521d137a96a8d2b53d91aee54a50..861a384b94c3720dc0f1592779b05f49539bb17d 100644 (file)
@@ -8,22 +8,34 @@
 #ifndef LLVM_ANALYSIS_LOOP_DEPTH_H
 #define LLVM_ANALYSIS_LOOP_DEPTH_H
 
-#include <map>
-class BasicBlock;
-class Method;
-namespace cfg {class Interval; }
+#include "llvm/Pass.h"
+namespace cfg {
+  class LoopInfo;
 
-class LoopDepthCalculator {
+class LoopDepthCalculator : public MethodPass {
   std::map<const BasicBlock*, unsigned> LoopDepth;
-  inline void AddBB(const BasicBlock *BB);    // Increment count for this block
-  inline void ProcessInterval(cfg::Interval *I);
+  void calculate(Method *M, LoopInfo &Loops);
 public:
+  static AnalysisID ID;            // cfg::LoopDepth Analysis ID 
+
+  LoopDepthCalculator(AnalysisID id) { assert(id == ID); }
   LoopDepthCalculator(Method *M);
 
+  // This is a pass...
+  bool runOnMethod(Method *M);
+
   inline unsigned getLoopDepth(const BasicBlock *BB) const { 
     std::map<const BasicBlock*,unsigned>::const_iterator I = LoopDepth.find(BB);
     return I != LoopDepth.end() ? I->second : 0;
   }
+
+  // getAnalysisUsageInfo - Provide loop depth, require loop info
+  //
+  virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
+                                    Pass::AnalysisSet &Destroyed,
+                                    Pass::AnalysisSet &Provided);
 };
 
+}  // end namespace cfg
+
 #endif