2001-06-24 12:05:21 +08:00
|
|
|
//===- Interval.cpp - Interval class code ------------------------*- C++ -*--=//
|
2001-06-21 04:09:55 +08:00
|
|
|
//
|
2002-04-29 00:21:30 +08:00
|
|
|
// This file contains the definition of the Interval class, which represents a
|
|
|
|
// partition of a control flow graph of some kind.
|
2001-06-21 04:09:55 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2001-06-24 12:05:21 +08:00
|
|
|
#include "llvm/Analysis/Interval.h"
|
2001-06-21 04:09:55 +08:00
|
|
|
#include "llvm/BasicBlock.h"
|
2002-02-13 06:39:50 +08:00
|
|
|
#include "llvm/Support/CFG.h"
|
2001-06-21 04:09:55 +08:00
|
|
|
|
2001-06-21 13:26:15 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Interval Implementation
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// isLoop - Find out if there is a back edge in this interval...
|
|
|
|
//
|
2002-04-29 00:21:30 +08:00
|
|
|
bool Interval::isLoop() const {
|
2001-06-21 13:26:15 +08:00
|
|
|
// There is a loop in this interval iff one of the predecessors of the header
|
|
|
|
// node lives in the interval.
|
2002-02-13 06:39:50 +08:00
|
|
|
for (::pred_iterator I = ::pred_begin(HeaderNode), E = ::pred_end(HeaderNode);
|
|
|
|
I != E; ++I) {
|
2001-06-21 13:26:15 +08:00
|
|
|
if (contains(*I)) return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|