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