summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-07-27 19:26:31 +0000
committerTom Stellard <[email protected]>2012-07-30 20:31:57 +0000
commitc3111eb639f3ff1f4e320325c325cc21efe58ca3 (patch)
tree238e76b68cad41471fdc391a0c7e38676b496464 /src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
parentac669c32c6e80841e3ee63d65b58c0031b22e7b8 (diff)
radeon/llvm: Remove AMDILAlgorithms.tpp
Diffstat (limited to 'src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp')
-rw-r--r--src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp b/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
index 2f51d6f2989..11dae6f963f 100644
--- a/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
+++ b/src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp
@@ -7,7 +7,6 @@
//
//==-----------------------------------------------------------------------===//
-#include "AMDILAlgorithms.tpp"
#include "AMDILDevices.h"
#include "AMDGPUInstrInfo.h"
#include "llvm/ADT/Statistic.h"
@@ -131,6 +130,25 @@ private:
SmallVector<CallInst *, 16> isConstVec;
}; // class AMDILPeepholeOpt
char AMDILPeepholeOpt::ID = 0;
+
+// A template function that has two levels of looping before calling the
+// function with a pointer to the current iterator.
+template<class InputIterator, class SecondIterator, class Function>
+Function safeNestedForEach(InputIterator First, InputIterator Last,
+ SecondIterator S, Function F)
+{
+ for ( ; First != Last; ++First) {
+ SecondIterator sf, sl;
+ for (sf = First->begin(), sl = First->end();
+ sf != sl; ) {
+ if (!F(&sf)) {
+ ++sf;
+ }
+ }
+ }
+ return F;
+}
+
} // anonymous namespace
namespace llvm {