1 //===- llvm/Analysis/LoopDepth.h - Loop Depth Calculation --------*- C++ -*--=//
3 // This file provides a simple class to calculate the loop depth of a
6 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_ANALYSIS_LOOP_DEPTH_H
9 #define LLVM_ANALYSIS_LOOP_DEPTH_H
14 namespace cfg {class Interval; }
16 class LoopDepthCalculator {
17 std::map<const BasicBlock*, unsigned> LoopDepth;
18 inline void AddBB(const BasicBlock *BB); // Increment count for this block
19 inline void ProcessInterval(cfg::Interval *I);
21 LoopDepthCalculator(Method *M);
23 inline unsigned getLoopDepth(const BasicBlock *BB) const {
24 std::map<const BasicBlock*,unsigned>::const_iterator I = LoopDepth.find(BB);
25 return I != LoopDepth.end() ? I->second : 0;