FAUST compiler  0.9.9.6b8
Macros | Functions | Variables
klass.cpp File Reference
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <map>
#include "floats.hh"
#include "smartpointer.hh"
#include "klass.hh"
#include "uitree.hh"
#include "Text.hh"
#include "signals.hh"
#include "ppsig.hh"
#include "recursivness.hh"
Include dependency graph for klass.cpp:

Go to the source code of this file.

Macros

#define WORK_STEALING_INDEX   0
 
#define LAST_TASK_INDEX   1
 
#define START_TASK_INDEX   LAST_TASK_INDEX + 1
 
#define START_TASK_MAX   2
 

Functions

void tab (int n, ostream &fout)
 
void printlines (int n, list< string > &lines, ostream &fout)
 Print a list of lines. More...
 
void printdecllist (int n, const string &decl, list< string > &content, ostream &fout)
 Print a list of elements (e1, e2,...) More...
 
bool isElement (const set< Loop * > &S, Loop *l)
 
static void computeUseCount (Loop *l)
 Compute how many time each loop is used in a DAG. More...
 
static void groupSeqLoops (Loop *l)
 Group together sequences of loops. More...
 
static bool nonRecursiveLevel (const lset &L)
 returns true if all the loops are non recursive More...
 
static void merge (set< string > &dst, set< string > &src)
 

Variables

int gFloatSize
 
bool gVectorSwitch
 
bool gDeepFirstSwitch
 
bool gOpenMPSwitch
 
bool gOpenMPLoop
 
bool gSchedulerSwitch
 
int gVecSize
 
bool gUIMacroSwitch
 
int gVectorLoopVariant
 
bool gGroupTaskSwitch
 
map< Tree, set< Tree > > gMetaDataSet
 
static int gTaskCount = 0
 

Macro Definition Documentation

#define LAST_TASK_INDEX   1

Definition at line 323 of file klass.cpp.

Referenced by Klass::buildTasksList().

#define START_TASK_INDEX   LAST_TASK_INDEX + 1

Definition at line 324 of file klass.cpp.

Referenced by Klass::buildTasksList(), and Klass::printComputeMethodScheduler().

#define START_TASK_MAX   2

Definition at line 326 of file klass.cpp.

Referenced by Klass::buildTasksList().

#define WORK_STEALING_INDEX   0

Definition at line 322 of file klass.cpp.

Function Documentation

static void computeUseCount ( Loop l)
static

Compute how many time each loop is used in a DAG.

Definition at line 288 of file klass.cpp.

References Loop::fBackwardLoopDependencies, and Loop::fUseCount.

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

289 {
290  l->fUseCount++;
291  if (l->fUseCount == 1) {
292  for (lset::iterator p =l->fBackwardLoopDependencies.begin(); p!=l->fBackwardLoopDependencies.end(); p++) {
293  computeUseCount(*p);
294  }
295  }
296 }
int fUseCount
how many loops depend on this one
Definition: loop.hh:68
static void computeUseCount(Loop *l)
Compute how many time each loop is used in a DAG.
Definition: klass.cpp:288
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 groupSeqLoops ( Loop l)
static

Group together sequences of loops.

Definition at line 301 of file klass.cpp.

References Loop::concat(), Loop::fBackwardLoopDependencies, and Loop::fUseCount.

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

302 {
303  int n = (int)l->fBackwardLoopDependencies.size();
304  if (n==0) {
305  return;
306  } else if (n==1) {
307  Loop* f = *(l->fBackwardLoopDependencies.begin());
308  if (f->fUseCount == 1) {
309  l->concat(f);
310  groupSeqLoops(l);
311  } else {
312  groupSeqLoops(f);
313  }
314  return;
315  } else if (n > 1) {
316  for (lset::iterator p =l->fBackwardLoopDependencies.begin(); p!=l->fBackwardLoopDependencies.end(); p++) {
317  groupSeqLoops(*p);
318  }
319  }
320 }
int fUseCount
how many loops depend on this one
Definition: loop.hh:68
void concat(Loop *l)
Definition: loop.cpp:237
static void groupSeqLoops(Loop *l)
Group together sequences of loops.
Definition: klass.cpp:301
Definition: loop.hh:52
set< Loop * > fBackwardLoopDependencies
Loops that must be computed before this one.
Definition: loop.hh:59

Here is the call graph for this function:

Here is the caller graph for this function:

bool isElement ( const set< Loop * > &  S,
Loop l 
)
inline

Definition at line 259 of file klass.cpp.

Referenced by Klass::printLoopDeepFirst(), and ppsig::printrec().

260 {
261  return S.find(l)!= S.end();
262 }

Here is the caller graph for this function:

static void merge ( set< string > &  dst,
set< string > &  src 
)
static

Definition at line 1203 of file klass.cpp.

Referenced by Klass::collectIncludeFile(), and Klass::collectLibrary().

1204 {
1205  set<string>::iterator i;
1206  for (i = src.begin(); i != src.end(); i++) dst.insert(*i);
1207 }

Here is the caller graph for this function:

static bool nonRecursiveLevel ( const lset L)
static

returns true if all the loops are non recursive

Definition at line 576 of file klass.cpp.

Referenced by Klass::printLastLoopLevelScheduler(), Klass::printLoopLevelOpenMP(), and Klass::printLoopLevelScheduler().

577 {
578  for (lset::const_iterator p =L.begin(); p!=L.end(); p++) {
579  if ((*p)->fIsRecursive) return false;
580  }
581  return true;
582 }

Here is the caller graph for this function:

void printdecllist ( int  n,
const string &  decl,
list< string > &  content,
ostream &  fout 
)

Print a list of elements (e1, e2,...)

Definition at line 164 of file klass.cpp.

References tab().

Referenced by Klass::printComputeMethodOpenMP().

165 {
166  if (!content.empty()) {
167  list<string>::iterator s;
168  fout << "\\";
169  tab(n, fout); fout << decl;
170  string sep = "(";
171  for (s = content.begin(); s != content.end(); s++) {
172  fout << sep << *s;
173  sep = ", ";
174  }
175  fout << ')';
176  }
177 }
void tab(int n, ostream &fout)
Definition: klass.cpp:68

Here is the call graph for this function:

Here is the caller graph for this function:

void printlines ( int  n,
list< string > &  lines,
ostream &  fout 
)

Print a list of lines.

Definition at line 153 of file klass.cpp.

References tab().

Referenced by Klass::printComputeMethodOpenMP(), Klass::printComputeMethodScalar(), Klass::printComputeMethodScheduler(), Klass::printComputeMethodVectorFaster(), Klass::printComputeMethodVectorSimple(), Klass::println(), SigIntGenKlass::println(), and SigFloatGenKlass::println().

154 {
155  list<string>::iterator s;
156  for (s = lines.begin(); s != lines.end(); s++) {
157  tab(n, fout); fout << *s;
158  }
159 }
void tab(int n, ostream &fout)
Definition: klass.cpp:68

Here is the call graph for this function:

Here is the caller graph for this function:

void tab ( int  n,
ostream &  fout 
)

Variable Documentation

bool gDeepFirstSwitch

Definition at line 139 of file main.cpp.

Referenced by Klass::printLoopGraphVector(), and process_cmdline().

int gFloatSize

Definition at line 153 of file main.cpp.

Referenced by Klass::printAdditionalCode().

bool gGroupTaskSwitch
map<Tree, set<Tree> > gMetaDataSet

Definition at line 91 of file main.cpp.

Referenced by Klass::println(), and Klass::printMetadata().

bool gOpenMPLoop

Definition at line 144 of file main.cpp.

Referenced by Klass::printLoopLevelOpenMP().

bool gOpenMPSwitch

Definition at line 143 of file main.cpp.

Referenced by Klass::printComputeMethod(), and Klass::printIncludeFile().

bool gSchedulerSwitch

Definition at line 145 of file main.cpp.

Referenced by main(), Klass::printComputeMethod(), Klass::println(), and process_cmdline().

int gTaskCount = 0
static
bool gUIMacroSwitch

Definition at line 148 of file main.cpp.

Referenced by Klass::println(), and process_cmdline().

int gVecSize
int gVectorLoopVariant

Definition at line 141 of file main.cpp.

Referenced by Klass::printComputeMethod(), and process_cmdline().

bool gVectorSwitch