mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 00:11:00 +00:00
4dd88f6fbf
is recoded to use IntervalIterators. IntervalIterators can now maintain their own memory or let an external entity do it. Loop depth is a new user of IntervalPartition for calculating the loop nesting depth of a basic block TODO: add IntervalPartition capability to split intervals between the looping portion and the "tail" portion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69 91177308-0d34-0410-b5e6-96231b3b80d8
30 lines
856 B
C++
30 lines
856 B
C++
//===- llvm/Analysis/LoopDepth.h - Loop Depth Calculation --------*- C++ -*--=//
|
|
//
|
|
// This file provides a simple class to calculate the loop depth of a
|
|
// BasicBlock.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_ANALYSIS_LOOP_DEPTH_H
|
|
#define LLVM_ANALYSIS_LOOP_DEPTH_H
|
|
|
|
#include <map>
|
|
class BasicBlock;
|
|
class Method;
|
|
namespace cfg {class Interval; }
|
|
|
|
class LoopDepthCalculator {
|
|
map<const BasicBlock*, unsigned> LoopDepth;
|
|
inline void AddBB(const BasicBlock *BB); // Increment count for this block
|
|
inline void ProcessInterval(cfg::Interval *I);
|
|
public:
|
|
LoopDepthCalculator(Method *M);
|
|
|
|
inline unsigned getLoopDepth(const BasicBlock *BB) const {
|
|
map<const BasicBlock*, unsigned>::const_iterator I = LoopDepth.find(BB);
|
|
return I != LoopDepth.end() ? I->second : 0;
|
|
}
|
|
};
|
|
|
|
#endif
|