From 7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 27 Jun 2001 23:41:11 +0000 Subject: Miscellaneous cleanups: * Convert post to pre-increment for for loops * Use generic programming more * Use new Value::cast* instructions * Use new Module, Method, & BasicBlock forwarding methods * Use new facilities in STLExtras.h * Use new Instruction::isPHINode() method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/IntervalPartition.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'lib/Analysis/IntervalPartition.cpp') diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp index f820d7ad16..32936fd43d 100644 --- a/lib/Analysis/IntervalPartition.cpp +++ b/lib/Analysis/IntervalPartition.cpp @@ -6,6 +6,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/IntervalIterator.h" +#include "llvm/Tools/STLExtras.h" using namespace cfg; @@ -49,22 +50,24 @@ void IntervalPartition::updatePredecessors(cfg::Interval *Int) { // specified method... // IntervalPartition::IntervalPartition(Method *M) { - assert(M->getBasicBlocks().front() && "Cannot operate on prototypes!"); + assert(M->front() && "Cannot operate on prototypes!"); // Pass false to intervals_begin because we take ownership of it's memory method_interval_iterator I = intervals_begin(M, false); - method_interval_iterator End = intervals_end(M); - assert(I != End && "No intervals in method!?!?!"); + assert(I != intervals_end(M) && "No intervals in method!?!?!"); addIntervalToPartition(RootInterval = *I); - for (++I; I != End; ++I) - addIntervalToPartition(*I); + ++I; // After the first one... + + // Add the rest of the intervals to the partition... + for_each(I, intervals_end(M), + bind_obj(this, &IntervalPartition::addIntervalToPartition)); // Now that we know all of the successor information, propogate this to the // predecessors for each block... - for(iterator It = begin(), E = end(); It != E; ++It) - updatePredecessors(*It); + for_each(begin(), end(), + bind_obj(this, &IntervalPartition::updatePredecessors)); } @@ -78,16 +81,18 @@ IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) { // Pass false to intervals_begin because we take ownership of it's memory interval_part_interval_iterator I = intervals_begin(IP, false); - interval_part_interval_iterator End = intervals_end(IP); - assert(I != End && "No intervals in interval partition!?!?!"); + assert(I != intervals_end(IP) && "No intervals in interval partition!?!?!"); addIntervalToPartition(RootInterval = *I); - for (++I; I != End; ++I) - addIntervalToPartition(*I); + ++I; // After the first one... + + // Add the rest of the intervals to the partition... + for_each(I, intervals_end(IP), + bind_obj(this, &IntervalPartition::addIntervalToPartition)); // Now that we know all of the successor information, propogate this to the // predecessors for each block... - for(iterator I = begin(), E = end(); I != E; ++I) - updatePredecessors(*I); + for_each(begin(), end(), + bind_obj(this, &IntervalPartition::updatePredecessors)); } -- cgit v1.2.3-18-g5258