summaryrefslogtreecommitdiffstats
path: root/src/gallium
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
parentac669c32c6e80841e3ee63d65b58c0031b22e7b8 (diff)
radeon/llvm: Remove AMDILAlgorithms.tpp
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeon/AMDILAlgorithms.tpp93
-rw-r--r--src/gallium/drivers/radeon/AMDILPeepholeOptimizer.cpp20
2 files changed, 19 insertions, 94 deletions
diff --git a/src/gallium/drivers/radeon/AMDILAlgorithms.tpp b/src/gallium/drivers/radeon/AMDILAlgorithms.tpp
deleted file mode 100644
index 058475f0f98..00000000000
--- a/src/gallium/drivers/radeon/AMDILAlgorithms.tpp
+++ /dev/null
@@ -1,93 +0,0 @@
-//===------ AMDILAlgorithms.tpp - AMDIL Template Algorithms Header --------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides templates algorithms that extend the STL algorithms, but
-// are useful for the AMDIL backend
-//
-//===----------------------------------------------------------------------===//
-
-// A template function that loops through the iterators and passes the second
-// argument along with each iterator to the function. If the function returns
-// true, then the current iterator is invalidated and it moves back, before
-// moving forward to the next iterator, otherwise it moves forward without
-// issue. This is based on the for_each STL function, but allows a reference to
-// the second argument
-template<class InputIterator, class Function, typename Arg>
-Function binaryForEach(InputIterator First, InputIterator Last, Function F,
- Arg &Second)
-{
- for ( ; First!=Last; ++First ) {
- F(*First, Second);
- }
- return F;
-}
-
-template<class InputIterator, class Function, typename Arg>
-Function safeBinaryForEach(InputIterator First, InputIterator Last, Function F,
- Arg &Second)
-{
- for ( ; First!=Last; ++First ) {
- if (F(*First, Second)) {
- --First;
- }
- }
- return F;
-}
-
-// A template function that has two levels of looping before calling the
-// function with the passed in argument. See binaryForEach for further
-// explanation
-template<class InputIterator, class Function, typename Arg>
-Function binaryNestedForEach(InputIterator First, InputIterator Last,
- Function F, Arg &Second)
-{
- for ( ; First != Last; ++First) {
- binaryForEach(First->begin(), First->end(), F, Second);
- }
- return F;
-}
-template<class InputIterator, class Function, typename Arg>
-Function safeBinaryNestedForEach(InputIterator First, InputIterator Last,
- Function F, Arg &Second)
-{
- for ( ; First != Last; ++First) {
- safeBinaryForEach(First->begin(), First->end(), F, Second);
- }
- return F;
-}
-
-// Unlike the STL, a pointer to the iterator itself is passed in with the 'safe'
-// versions of these functions This allows the function to handle situations
-// such as invalidated iterators
-template<class InputIterator, class Function>
-Function safeForEach(InputIterator First, InputIterator Last, Function F)
-{
- for ( ; First!=Last; ++First ) F(&First)
- ; // Do nothing.
- return F;
-}
-
-// A template function that has two levels of looping before calling the
-// function with a pointer to the current iterator. See binaryForEach for
-// further explanation
-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;
-}
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 {