FAUST compiler  0.9.9.6b8
Functions
graphSorting.cpp File Reference
#include <set>
#include "graphSorting.hh"
Include dependency graph for graphSorting.cpp:

Go to the source code of this file.

Functions

static void setOrder (Loop *l, int order, lgraph &V)
 Set the order of a loop and place it to appropriate set. More...
 
static void setLevel (int order, const lset &T1, lset &T2, lgraph &V)
 Set the order of T1's loops and collect there sons into T2. More...
 
static void resetOrder (Loop *l)
 
void sortGraph (Loop *root, lgraph &V)
 Topological sort of an acyclic graph of loops. More...
 

Function Documentation

static void resetOrder ( Loop l)
static

Definition at line 27 of file graphSorting.cpp.

References Loop::fBackwardLoopDependencies, and Loop::fOrder.

Referenced by sortGraph().

28 {
29  l->fOrder = -1;
30  for (lset::const_iterator p = l->fBackwardLoopDependencies.begin(); p!=l->fBackwardLoopDependencies.end(); p++) {
31  resetOrder(*p);
32  }
33 }
static void resetOrder(Loop *l)
int fOrder
used during topological sort
Definition: loop.hh:65
set< Loop * > fBackwardLoopDependencies
Loops that must be computed before this one.
Definition: loop.hh:59

Here is the caller graph for this function:

static void setLevel ( int  order,
const lset T1,
lset T2,
lgraph V 
)
static

Set the order of T1's loops and collect there sons into T2.

Definition at line 18 of file graphSorting.cpp.

References setOrder().

Referenced by sortGraph().

19 {
20  for (lset::const_iterator p = T1.begin(); p!=T1.end(); p++) {
21  setOrder(*p, order, V);
22  T2.insert((*p)->fBackwardLoopDependencies.begin(), (*p)->fBackwardLoopDependencies.end());
23  }
24 }
static void setOrder(Loop *l, int order, lgraph &V)
Set the order of a loop and place it to appropriate set.
Definition: graphSorting.cpp:7

Here is the call graph for this function:

Here is the caller graph for this function:

static void setOrder ( Loop l,
int  order,
lgraph V 
)
static

Set the order of a loop and place it to appropriate set.

Definition at line 7 of file graphSorting.cpp.

References Loop::fOrder.

Referenced by setLevel().

8 {
9  assert(l);
10  V.resize(order+1);
11  if (l->fOrder >= 0) { V[l->fOrder].erase(l); }
12  l->fOrder = order; V[order].insert(l);
13 }
int fOrder
used during topological sort
Definition: loop.hh:65

Here is the caller graph for this function:

void sortGraph ( Loop root,
lgraph V 
)

Topological sort of an acyclic graph of loops.

Topological sort of an acyclic graph of loops starting from its root.

The loops are collect in an lgraph : a vector of sets of loops

Definition at line 38 of file graphSorting.cpp.

References resetOrder(), and setLevel().

Referenced by Klass::buildTasksList(), Klass::printGraphDotFormat(), Klass::printLoopGraphInternal(), Klass::printLoopGraphOpenMP(), Klass::printLoopGraphScheduler(), and Klass::printLoopGraphVector().

39 {
40  lset T1, T2;
41  int level;
42 
43  assert(root);
44  resetOrder(root);
45  T1.insert(root); level=0; V.clear();
46  do {
47  setLevel(level, T1, T2, V);
48  T1=T2; T2.clear(); level++;
49  } while (T1.size()>0);
50 
51  // Erase empty levels
52  lgraph::iterator p = V.begin();
53  while (p != V.end()) {
54  if ((*p).size() == 1 && (*(*p).begin())->isEmpty()) {
55  p = V.erase(p);
56  } else {
57  p++;
58  }
59  }
60 }
static void setLevel(int order, const lset &T1, lset &T2, lgraph &V)
Set the order of T1's loops and collect there sons into T2.
set< Loop * > lset
Definition: graphSorting.hh:10
static void resetOrder(Loop *l)

Here is the call graph for this function:

Here is the caller graph for this function: