Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
[oota-llvm.git] / lib / Analysis / Interval.cpp
1 //===- Interval.cpp - Interval class code ------------------------*- C++ -*--=//
2 //
3 // This file contains the definition of the Interval class, which represents a
4 // partition of a control flow graph of some kind.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #include "llvm/Analysis/Interval.h"
9 #include "llvm/BasicBlock.h"
10 #include "llvm/Support/CFG.h"
11
12 //===----------------------------------------------------------------------===//
13 // Interval Implementation
14 //===----------------------------------------------------------------------===//
15
16 // isLoop - Find out if there is a back edge in this interval...
17 //
18 bool Interval::isLoop() const {
19   // There is a loop in this interval iff one of the predecessors of the header
20   // node lives in the interval.
21   for (::pred_iterator I = ::pred_begin(HeaderNode), E = ::pred_end(HeaderNode);
22        I != E; ++I) {
23     if (contains(*I)) return true;
24   }
25   return false;
26 }
27
28