blob: a6567ec1c9d78edc9fc807d665abff95c6ddf8fa [file] [log] [blame]
Chris Lattner107109c2001-06-24 04:05:21 +00001//===- Interval.cpp - Interval class code ------------------------*- C++ -*--=//
Chris Lattner2275c1d2001-06-20 20:09:55 +00002//
Chris Lattner107109c2001-06-24 04:05:21 +00003// This file contains the definition of the cfg::Interval class, which
4// represents a partition of a control flow graph of some kind.
Chris Lattner2275c1d2001-06-20 20:09:55 +00005//
6//===----------------------------------------------------------------------===//
7
Chris Lattner107109c2001-06-24 04:05:21 +00008#include "llvm/Analysis/Interval.h"
Chris Lattner2275c1d2001-06-20 20:09:55 +00009#include "llvm/BasicBlock.h"
10#include "llvm/CFG.h"
11
Chris Lattnered465bc2001-06-20 22:44:32 +000012using namespace cfg;
13
Chris Lattner1c54f1d2001-06-21 05:26:15 +000014//===----------------------------------------------------------------------===//
15// Interval Implementation
16//===----------------------------------------------------------------------===//
17
18// isLoop - Find out if there is a back edge in this interval...
19//
20bool Interval::isLoop() const {
21 // There is a loop in this interval iff one of the predecessors of the header
22 // node lives in the interval.
23 for (BasicBlock::pred_iterator I = pred_begin(HeaderNode),
24 E = pred_end(HeaderNode); I != E; ++I) {
25 if (contains(*I)) return true;
26 }
27 return false;
28}
29
30