llvm.org GIT mirror llvm / 1c54f1d
Implement the new Interval::isLoop method Implement destructor to free memory git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 19 years ago
1 changed file(s) with 29 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1010 #include "llvm/CFG.h"
1111
1212 using namespace cfg;
13
14 //===----------------------------------------------------------------------===//
15 // Interval Implementation
16 //===----------------------------------------------------------------------===//
17
18 // isLoop - Find out if there is a back edge in this interval...
19 //
20 bool 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
31 //===----------------------------------------------------------------------===//
32 // IntervalPartition Implementation
33 //===----------------------------------------------------------------------===//
34
35 template static inline void deleter(T *Ptr) { delete Ptr; }
36
37 // Destructor - Free memory
38 IntervalPartition::~IntervalPartition() {
39 for_each(begin(), end(), deleter);
40 }
41
1342
1443 // getNodeHeader - Given a source graph node and the source graph, return the
1544 // BasicBlock that is the header node. This is the opposite of