13 static void tab (
int n, ostream& fout)
16 while (n--) fout <<
'\t';
26 static void printlines (
int n, list<string>& lines, ostream& fout)
28 list<string>::iterator s;
29 for (s = lines.begin(); s != lines.end(); s++) {
30 tab(n, fout); fout << *s;
42 : fIsRecursive(true), fRecSymbolSet(
singleton(recsymbol)), fEnclosingLoop(encl), fSize(size), fOrder(-1), fIndex(-1), fUseCount(0), fPrinted(0)
52 : fIsRecursive(false), fRecSymbolSet(
nil), fEnclosingLoop(encl), fSize(size), fOrder(-1), fIndex(-1), fUseCount(0), fPrinted(0)
137 (*s)->println(n, fout);
146 tab(n,fout); fout <<
"// LOOP " << this ;
148 tab(n,fout); fout <<
"// pre processing";
152 tab(n,fout); fout <<
"// exec code";
153 tab(n,fout); fout <<
"for (int i=0; i<" <<
fSize <<
"; i++) {";
155 tab(n,fout); fout <<
"}";
158 tab(n,fout); fout <<
"// post processing";
175 tab(n,fout); fout <<
"#pragma omp single";
176 tab(n,fout); fout <<
"{";
177 (*s)->println(n+1, fout);
178 tab(n,fout); fout <<
"}";
183 tab(n,fout); fout <<
"// LOOP " << this ;
185 tab(n,fout); fout <<
"#pragma omp single";
186 tab(n,fout); fout <<
"{";
187 tab(n+1,fout); fout <<
"// pre processing";
189 tab(n,fout); fout <<
"}";
192 tab(n,fout); fout <<
"// exec code";
193 tab(n,fout); fout <<
"#pragma omp for";
194 tab(n,fout); fout <<
"for (int i=0; i<" <<
fSize <<
"; i++) {";
196 tab(n,fout); fout <<
"}";
199 tab(n,fout); fout <<
"#pragma omp single";
200 tab(n,fout); fout <<
"{";
201 tab(n+1,fout); fout <<
"// post processing";
203 tab(n,fout); fout <<
"}";
222 tab(n,fout); fout <<
"for (int i=0; i<" <<
fSize <<
"; i++) {";
224 tab(n+1,fout); fout <<
"// pre processing";
229 tab(n+1,fout); fout <<
"// post processing";
232 tab(n,fout); fout <<
"}";
void println(int n, ostream &fout)
print the loop
void printParLoopln(int n, ostream &fout)
print the loop with a #pragma omp loop
static void tab(int n, ostream &fout)
Print n tabs (for indentation purpose)
Loop *const fEnclosingLoop
Loop from which this one originated.
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
list< string > fPostCode
code to execute at the end of the loop
int fUseCount
how many loops depend on this one
Tree setIntersection(Tree A, Tree B)
void addExecCode(const string &str)
add a line of C++ code
bool isEmpty()
true when the loop doesn't contain any line of code
void addPreCode(const string &str)
add a line of C++ code pre code
void printoneln(int n, ostream &fout)
print the loop in scalar mode
Tree fRecSymbolSet
recursive loops define a set of recursive symbol
Loop(Tree recsymbol, Loop *encl, const string &size)
create a recursive loop
list< string > fExecCode
code to execute in the loop
Tree setUnion(Tree A, Tree B)
list< Loop * > fExtraLoops
extra loops that where in sequences
void absorb(Loop *l)
absorb a loop inside this one
bool hasRecDependencyIn(Tree S)
returns true is this loop or its ancestors define a symbol in S
void addPostCode(const string &str)
add a line of C++ post code
static void printlines(int n, list< string > &lines, ostream &fout)
Print a list of lines.
const string fSize
number of iterations of the loop
list< string > fPreCode
code to execute at the begin of the loop
set< Loop * > fBackwardLoopDependencies
Loops that must be computed before this one.