X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/1059e1cc0c2ecfa237406949aa26155b6a5b9154..66f23d4fabf89ad09adbd4dfc15ac6b5b2b7da83:/interpretor/preprocessor/faust-0.9.47mr3/compiler/parallelize/graphSorting.cpp diff --git a/interpretor/preprocessor/faust-0.9.47mr3/compiler/parallelize/graphSorting.cpp b/interpretor/preprocessor/faust-0.9.47mr3/compiler/parallelize/graphSorting.cpp deleted file mode 100644 index ad779eb..0000000 --- a/interpretor/preprocessor/faust-0.9.47mr3/compiler/parallelize/graphSorting.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include "graphSorting.hh" - -/** - * Set the order of a loop and place it to appropriate set - */ -static void setOrder(Loop* l, int order, lgraph& V) -{ - assert(l); - V.resize(order+1); - if (l->fOrder >= 0) { V[l->fOrder].erase(l); } - l->fOrder = order; V[order].insert(l); -} - -/** - * Set the order of T1's loops and collect there sons into T2 - */ -static void setLevel(int order, const lset& T1, lset& T2, lgraph& V) -{ - for (lset::const_iterator p = T1.begin(); p!=T1.end(); p++) { - setOrder(*p, order, V); - T2.insert((*p)->fBackwardLoopDependencies.begin(), (*p)->fBackwardLoopDependencies.end()); - } -} - - -static void resetOrder(Loop* l) -{ - l->fOrder = -1; - for (lset::const_iterator p = l->fBackwardLoopDependencies.begin(); p!=l->fBackwardLoopDependencies.end(); p++) { - resetOrder(*p); - } -} -/** - * Topological sort of an acyclic graph of loops. The loops - * are collect in an lgraph : a vector of sets of loops - */ -void sortGraph(Loop* root, lgraph& V) -{ - lset T1, T2; - int level; - - assert(root); - resetOrder(root); - T1.insert(root); level=0; V.clear(); - do { - setLevel(level, T1, T2, V); - T1=T2; T2.clear(); level++; - } while (T1.size()>0); - - // Erase empty levels - lgraph::iterator p = V.begin(); - while (p != V.end()) { - if ((*p).size() == 1 && (*(*p).begin())->isEmpty()) { - p = V.erase(p); - } else { - p++; - } - } -}