FAUST compiler  0.9.9.6b8
Public Member Functions | Protected Attributes | Static Protected Attributes
Klass Class Reference

#include <klass.hh>

Inheritance diagram for Klass:
Inheritance graph
[legend]
Collaboration diagram for Klass:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Klass (const string &name, const string &super, int numInputs, int numOutputs, bool __vec=false)
virtual ~Klass ()
void openLoop (const string &size)
 Open a non-recursive loop on top of the stack of open loops.
void openLoop (Tree recsymbol, const string &size)
 Open a recursive loop on top of the stack of open loops.
void closeLoop (Tree sig)
 Close the top loop and either keep it or absorb it within its enclosing loop.
void setLoopProperty (Tree sig, Loop *l)
 Store the loop used to compute a signal.
bool getLoopProperty (Tree sig, Loop *&l)
 Returns the loop used to compute a signal.
const string & getClassName () const
 Returns the name of the class.
LooptopLoop ()
void buildTasksList ()
void addIncludeFile (const string &str)
void addLibrary (const string &str)
void rememberNeedPowerDef ()
void collectIncludeFile (set< string > &S)
void collectLibrary (set< string > &S)
void addSubKlass (Klass *son)
void addDeclCode (const string &str)
void addInitCode (const string &str)
void addStaticInitCode (const string &str)
void addStaticFields (const string &str)
void addUICode (const string &str)
void addUIMacro (const string &str)
void incUIActiveCount ()
void incUIPassiveCount ()
void addSharedDecl (const string &str)
void addFirstPrivateDecl (const string &str)
void addZone1 (const string &str)
void addZone2 (const string &str)
void addZone2b (const string &str)
void addZone2c (const string &str)
void addZone3 (const string &str)
void addPreCode (const string &str)
void addExecCode (const string &str)
void addPostCode (const string &str)
virtual void println (int n, ostream &fout)
 Print a full C++ class corresponding to a Faust dsp.
virtual void printComputeMethod (int n, ostream &fout)
 Print Compute() method according to the various switch.
virtual void printComputeMethodScalar (int n, ostream &fout)
virtual void printComputeMethodVectorFaster (int n, ostream &fout)
 Uses loops of constant gVecSize boundary in order to provide the C compiler with more optimisation opportunities.
virtual void printComputeMethodVectorSimple (int n, ostream &fout)
 Simple loop layout, generally less efficient than printComputeMethodVectorFaster.
virtual void printComputeMethodOpenMP (int n, ostream &fout)
virtual void printComputeMethodScheduler (int n, ostream &fout)
virtual void printLoopGraphScalar (int n, ostream &fout)
 Print the loop graph (scalar mode)
virtual void printLoopGraphVector (int n, ostream &fout)
 Print the loop graph (used for vector code)
virtual void printLoopGraphOpenMP (int n, ostream &fout)
 Print the loop graph as a serie of parallel loops.
virtual void printLoopGraphScheduler (int n, ostream &fout)
 Print the loop graph as a serie of parallel loops.
virtual void printLoopGraphInternal (int n, ostream &fout)
 Print the loop graph (used for internals classes)
virtual void printGraphDotFormat (ostream &fout)
 Print the loop graph in dot format.
virtual void printLoopDeepFirst (int n, ostream &fout, Loop *l, set< Loop * > &visited)
 Print a loop graph deep first.
virtual void printLastLoopLevelScheduler (int n, int lnum, const lset &L, ostream &fout)
 Print the 'level' of the loop graph as a set of parallel loops.
virtual void printLoopLevelScheduler (int n, int lnum, const lset &L, ostream &fout)
 Print the 'level' of the loop graph as a set of parallel loops.
virtual void printOneLoopScheduler (lset::const_iterator p, int n, ostream &fout)
virtual void printLoopLevelOpenMP (int n, int lnum, const lset &L, ostream &fout)
 Print the 'level' of the loop graph as a set of parallel loops.
virtual void printMetadata (int n, const map< Tree, set< Tree > > &S, ostream &fout)
 Print metadata declaration.
virtual void printIncludeFile (ostream &fout)
 Print the required include files.
virtual void printLibrary (ostream &fout)
 Print the required C++ libraries as comments in source code.
virtual void printAdditionalCode (ostream &fout)
 Print additional functions required by the generated code.
int inputs ()
int outputs ()

Protected Attributes

string fKlassName
string fSuperKlassName
int fNumInputs
int fNumOutputs
int fNumActives
 number of active controls in the UI (sliders, buttons, etc.)
int fNumPassives
 number of passive widgets in the UI (bargraphs, etc.)
set< string > fIncludeFileSet
set< string > fLibrarySet
list< Klass * > fSubClassList
list< string > fDeclCode
list< string > fStaticInitCode
 static init code for class constant tables
list< string > fStaticFields
 static fields after class
list< string > fInitCode
list< string > fUICode
list< string > fUIMacro
list< string > fSharedDecl
 shared declarations
list< string > fFirstPrivateDecl
 first private declarations
list< string > fZone1Code
 shared vectors
list< string > fZone2Code
 first private
list< string > fZone2bCode
 single once per block
list< string > fZone2cCode
 single once per block
list< string > fZone3Code
 private every sub block
LoopfTopLoop
 active loops currently open
property< Loop * > fLoopProperty
 loops used to compute some signals
bool fVec

Static Protected Attributes

static bool fNeedPowerDef = false
 true when faustpower definition is needed

Detailed Description

Definition at line 55 of file klass.hh.


Constructor & Destructor Documentation

Klass::Klass ( const string &  name,
const string &  super,
int  numInputs,
int  numOutputs,
bool  __vec = false 
) [inline]

Definition at line 108 of file klass.hh.

      :     fKlassName(name), fSuperKlassName(super), fNumInputs(numInputs), fNumOutputs(numOutputs),
            fNumActives(0), fNumPassives(0),
            fTopLoop(new Loop(0, "count")), fVec(__vec)
    {}
virtual Klass::~Klass ( ) [inline, virtual]

Definition at line 114 of file klass.hh.

{}

Member Function Documentation

void Klass::addDeclCode ( const string &  str) [inline]

Definition at line 140 of file klass.hh.

Referenced by buildTasksList(), SchedulerCompiler::dlineLoop(), VectorCompiler::dlineLoop(), and SchedulerCompiler::vectorLoop().

{ fDeclCode.push_back(str); }

Here is the caller graph for this function:

void Klass::addExecCode ( const string &  str) [inline]
void Klass::addFirstPrivateDecl ( const string &  str) [inline]

Definition at line 157 of file klass.hh.

Referenced by SchedulerCompiler::dlineLoop(), and VectorCompiler::dlineLoop().

{ fFirstPrivateDecl.push_back(str); }

Here is the caller graph for this function:

void Klass::addIncludeFile ( const string &  str) [inline]

Definition at line 128 of file klass.hh.

Referenced by Compiler::addIncludeFile().

{ fIncludeFileSet.insert(str); }

Here is the caller graph for this function:

void Klass::addInitCode ( const string &  str) [inline]

Definition at line 142 of file klass.hh.

Referenced by buildTasksList(), SchedulerCompiler::dlineLoop(), and VectorCompiler::dlineLoop().

{ fInitCode.push_back(str); }

Here is the caller graph for this function:

void Klass::addLibrary ( const string &  str) [inline]

Definition at line 130 of file klass.hh.

Referenced by Compiler::addLibrary().

{ fLibrarySet.insert(str); }

Here is the caller graph for this function:

void Klass::addPostCode ( const string &  str) [inline]

Definition at line 167 of file klass.hh.

Referenced by SchedulerCompiler::dlineLoop(), and VectorCompiler::dlineLoop().

{ fTopLoop->addPostCode(str); }

Here is the caller graph for this function:

void Klass::addPreCode ( const string &  str) [inline]

Definition at line 165 of file klass.hh.

Referenced by SchedulerCompiler::dlineLoop(), and VectorCompiler::dlineLoop().

{ fTopLoop->addPreCode(str); }

Here is the caller graph for this function:

void Klass::addSharedDecl ( const string &  str) [inline]
void Klass::addStaticFields ( const string &  str) [inline]

Definition at line 146 of file klass.hh.

{ fStaticFields.push_back(str); }
void Klass::addStaticInitCode ( const string &  str) [inline]

Definition at line 144 of file klass.hh.

{ fStaticInitCode.push_back(str); }
void Klass::addSubKlass ( Klass son) [inline]

Definition at line 138 of file klass.hh.

{ fSubClassList.push_back(son); }
void Klass::addUICode ( const string &  str) [inline]

Definition at line 148 of file klass.hh.

Referenced by Compiler::generateUserInterfaceTree(), and Compiler::generateWidgetCode().

{ fUICode.push_back(str); }

Here is the caller graph for this function:

void Klass::addUIMacro ( const string &  str) [inline]

Definition at line 150 of file klass.hh.

Referenced by Compiler::generateWidgetMacro().

{ fUIMacro.push_back(str); }

Here is the caller graph for this function:

void Klass::addZone1 ( const string &  str) [inline]

Definition at line 159 of file klass.hh.

Referenced by VectorCompiler::dlineLoop(), and VectorCompiler::vectorLoop().

{ fZone1Code.push_back(str); }

Here is the caller graph for this function:

void Klass::addZone2 ( const string &  str) [inline]

Definition at line 160 of file klass.hh.

Referenced by SchedulerCompiler::dlineLoop(), and VectorCompiler::dlineLoop().

{ fZone2Code.push_back(str); }

Here is the caller graph for this function:

void Klass::addZone2b ( const string &  str) [inline]

Definition at line 161 of file klass.hh.

{ fZone2bCode.push_back(str); }
void Klass::addZone2c ( const string &  str) [inline]

Definition at line 162 of file klass.hh.

Referenced by buildTasksList().

{ fZone2cCode.push_back(str); }

Here is the caller graph for this function:

void Klass::addZone3 ( const string &  str) [inline]

Definition at line 163 of file klass.hh.

Referenced by buildTasksList(), SchedulerCompiler::compileMultiSignal(), and VectorCompiler::compileMultiSignal().

{ fZone3Code.push_back(str); }

Here is the caller graph for this function:

Definition at line 323 of file klass.cpp.

References addDeclCode(), addInitCode(), addZone2c(), addZone3(), computeUseCount(), Loop::fIndex, fTopLoop, gGroupTaskSwitch, groupSeqLoops(), gTaskCount, LAST_TASK_INDEX, sortGraph(), START_TASK_INDEX, START_TASK_MAX, subst(), and T().

Referenced by SchedulerCompiler::compileMultiSignal().

{
    lgraph G;

    if (gGroupTaskSwitch) {
        computeUseCount(fTopLoop);
        groupSeqLoops(fTopLoop);
    }

    sortGraph(fTopLoop, G);
    int index_task = START_TASK_INDEX;

    addDeclCode("TaskGraph fGraph;");
    addDeclCode("FAUSTFLOAT** input;");
    addDeclCode("FAUSTFLOAT** output;");
    addDeclCode("volatile bool fIsFinished;");
    addDeclCode("int fFullCount;");
    addDeclCode("int fIndex;");
    addDeclCode("DSPThreadPool* fThreadPool;");
    addDeclCode("int fStaticNumThreads;");
    addDeclCode("int fDynamicNumThreads;");

    // Compute forward dependencies
    for (int l=G.size()-1; l>=0; l--) {
        for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) {
            for (lset::const_iterator p1 = (*p)->fBackwardLoopDependencies.begin(); p1!=(*p)->fBackwardLoopDependencies.end(); p1++) {
                (*p1)->fForwardLoopDependencies.insert((*p));
            }
            (*p)->fIndex = index_task;
            index_task++;
        }
    }

    // Compute ready tasks list
    vector<int> task_num;
    for (int l=G.size()-1; l>=0; l--) {
        lset::const_iterator next;
        for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) {
            if ((*p)->fBackwardLoopDependencies.size() == 0) {
                task_num.push_back((*p)->fIndex);
            }
        }
    }

    if (task_num.size() < START_TASK_MAX) {

        // Push ready tasks thread 0, execute one task directly

        addZone3("if (cur_thread == 0) {");

        Loop* keep = NULL;
        for (int l=G.size()-1; l>=0; l--) {
            lset::const_iterator next;
            for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) {
                if ((*p)->fBackwardLoopDependencies.size() == 0) {
                    if (keep == NULL) {
                        keep = *p;
                    } else {
                        addZone3(subst("    taskqueue.PushHead($0);", T((*p)->fIndex)));
                    }
                }
            }
        }

        if (keep != NULL) {
            addZone3(subst("    tasknum = $0;", T(keep->fIndex)));
        }

        addZone3("} else {");
        addZone3("    tasknum = TaskQueue::GetNextTask(cur_thread, fDynamicNumThreads);");
        addZone3("}");

    } else {

        // Cut ready tasks list and have each thread (dynamically) use a subpart
        addZone3(subst("int task_list_size = $0;", T((int)task_num.size())));
        stringstream buf;
        buf << "int task_list[" << task_num.size() << "] = {";
        for(size_t i = 0; i < task_num.size(); i++) {
            buf << task_num[i];
            if (i != (task_num.size() - 1))
                buf << ",";
        }
        buf << "};";

        addZone3(buf.str());
        addZone3("taskqueue.InitTaskList(task_list_size, task_list, fDynamicNumThreads, cur_thread, tasknum);");
    }

    // Last stage connected to end task
    if (G[0].size() > 1) {
        addZone2c("// Initialize end task, if more than one input");
        addZone2c(subst("fGraph.InitTask($0,$1);", T(LAST_TASK_INDEX), T((int)G[0].size())));
    } else {
        addZone2c("// End task has only one input, so will be directly activated");
    }

    // Compute init section
    addZone2c("// Only initialize taks with more than one input");
    for (int l=G.size()-1; l>=0; l--) {
        for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) {
            if ((*p)->fBackwardLoopDependencies.size() > 1)  { // Only initialize taks with more than 1 input, since taks with one input are "directly" activated.
                addZone2c(subst("fGraph.InitTask($0,$1);", T(START_TASK_INDEX + gTaskCount++), T((int)(*p)->fBackwardLoopDependencies.size())));
            } else {
                gTaskCount++;
            }
        }
    }

    addInitCode("fStaticNumThreads = get_max_cpu();");
    addInitCode("fDynamicNumThreads = getenv(\"OMP_NUM_THREADS\") ? atoi(getenv(\"OMP_NUM_THREADS\")) : fStaticNumThreads;");
    addInitCode("fThreadPool = DSPThreadPool::Init();");
    addInitCode("fThreadPool->StartAll(fStaticNumThreads - 1, false);");

    gTaskCount = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::closeLoop ( Tree  sig)

Close the top loop and either keep it or absorb it within its enclosing loop.

Definition at line 116 of file klass.cpp.

References Loop::absorb(), Loop::fBackwardLoopDependencies, Loop::fEnclosingLoop, Loop::fRecSymbolSet, fTopLoop, Loop::hasRecDependencyIn(), hd(), Loop::isEmpty(), isNil(), setLoopProperty(), symlist(), and tl().

Referenced by SchedulerCompiler::compileMultiSignal(), VectorCompiler::compileMultiSignal(), VectorCompiler::generateCodeRecursions(), and VectorCompiler::generateLoopCode().

{
    assert(fTopLoop);
    Loop* l = fTopLoop;
    fTopLoop = l->fEnclosingLoop;
    assert(fTopLoop);

    //l->println(4, cerr);
    //cerr << endl;

    Tree S = symlist(sig);
    //cerr << "CLOSE LOOP :" << l << " with symbols " << *S  << endl;
    if (l->isEmpty() || fTopLoop->hasRecDependencyIn(S)) {
        //cout << " will absorb" << endl;
        // empty or dependent loop -> absorbed by enclosing one
        //cerr << "absorbed by : " << fTopLoop << endl;
        fTopLoop->absorb(l);
        //delete l; HACK !!!
    } else {
        // cout << " will NOT absorb" << endl;
        // we have an independent loop
        setLoopProperty(sig,l);     // associate the signal
        fTopLoop->fBackwardLoopDependencies.insert(l);
        // we need to indicate that all recursive symbols defined
        // in this loop are defined in this loop
        for (Tree lsym=l->fRecSymbolSet; !isNil(lsym); lsym=tl(lsym)) {
            this->setLoopProperty(hd(lsym), l);
            //cerr << "loop " << l << " defines " << *hd(lsym) << endl;
        }
    }
    //cerr << "\n" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::collectIncludeFile ( set< string > &  S)

Definition at line 1201 of file klass.cpp.

References fIncludeFileSet, fSubClassList, and merge().

Referenced by printIncludeFile().

{
    list<Klass* >::iterator     k;

    for (k = fSubClassList.begin(); k != fSubClassList.end(); k++)  (*k)->collectIncludeFile(S);
    merge(S, fIncludeFileSet);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::collectLibrary ( set< string > &  S)

Definition at line 1209 of file klass.cpp.

References fLibrarySet, fSubClassList, and merge().

Referenced by printLibrary().

{
    list<Klass* >::iterator     k;

    for (k = fSubClassList.begin(); k != fSubClassList.end(); k++)  (*k)->collectLibrary(S);
    merge(S, fLibrarySet);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const string& Klass::getClassName ( ) const [inline]

Returns the name of the class.

Definition at line 122 of file klass.hh.

bool Klass::getLoopProperty ( Tree  sig,
Loop *&  l 
)

Returns the loop used to compute a signal.

Definition at line 86 of file klass.cpp.

References fLoopProperty, and property< P >::get().

Referenced by VectorCompiler::CS().

{
    return  fLoopProperty.get(sig, l);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::incUIActiveCount ( ) [inline]

Definition at line 152 of file klass.hh.

Referenced by Compiler::generateWidgetCode().

{ fNumActives++; }

Here is the caller graph for this function:

void Klass::incUIPassiveCount ( ) [inline]

Definition at line 153 of file klass.hh.

Referenced by Compiler::generateWidgetCode().

{ fNumPassives++; }

Here is the caller graph for this function:

int Klass::inputs ( ) [inline]

Definition at line 200 of file klass.hh.

Referenced by SchedulerCompiler::compileMultiSignal(), VectorCompiler::compileMultiSignal(), and main().

{ return fNumInputs; }

Here is the caller graph for this function:

void Klass::openLoop ( const string &  size)

Open a non-recursive loop on top of the stack of open loops.

Parameters:
sizethe number of iterations of the loop

Definition at line 95 of file klass.cpp.

References fTopLoop.

Referenced by SchedulerCompiler::compileMultiSignal(), VectorCompiler::compileMultiSignal(), VectorCompiler::generateCodeRecursions(), and VectorCompiler::generateLoopCode().

{
    fTopLoop = new Loop(fTopLoop, size);
    //cerr << "\nOPEN SHARED LOOP(" << size << ") ----> " << fTopLoop << endl;
}

Here is the caller graph for this function:

void Klass::openLoop ( Tree  recsymbol,
const string &  size 
)

Open a recursive loop on top of the stack of open loops.

Parameters:
recsymbolthe recursive symbol defined in this loop
sizethe number of iterations of the loop

Definition at line 106 of file klass.cpp.

References fTopLoop.

{
    fTopLoop = new Loop(recsymbol, fTopLoop, size);
    //cerr << "\nOPEN REC LOOP(" << *recsymbol << ", " << size << ") ----> " << fTopLoop << endl;
}
int Klass::outputs ( ) [inline]

Definition at line 201 of file klass.hh.

Referenced by SchedulerCompiler::compileMultiSignal(), VectorCompiler::compileMultiSignal(), and main().

{ return fNumOutputs; }

Here is the caller graph for this function:

void Klass::printAdditionalCode ( ostream &  fout) [virtual]

Print additional functions required by the generated code.

Definition at line 216 of file klass.cpp.

References fNeedPowerDef.

Referenced by main().

{
    if (fNeedPowerDef) {
        // Add faustpower definition to C++ code
        fout << "#include <cmath>" << endl;
        fout << "template <int N> inline float faustpower(float x)      { return powf(x,N); } " << endl;
        fout << "template <int N> inline double faustpower(double x)    { return pow(x,N); }"  << endl;
        fout << "template <int N> inline int faustpower(int x)          { return faustpower<N/2>(x) * faustpower<N-N/2>(x); } " << endl;
        fout << "template <>     inline int faustpower<0>(int x)        { return 1; }" << endl;
        fout << "template <>     inline int faustpower<1>(int x)        { return x; }" << endl;
    }

}

Here is the caller graph for this function:

void Klass::printComputeMethod ( int  n,
ostream &  fout 
) [virtual]

Print Compute() method according to the various switch.

Definition at line 813 of file klass.cpp.

References gOpenMPSwitch, gSchedulerSwitch, gVectorLoopVariant, gVectorSwitch, printComputeMethodOpenMP(), printComputeMethodScalar(), printComputeMethodScheduler(), printComputeMethodVectorFaster(), and printComputeMethodVectorSimple().

Referenced by println().

{
    if (gSchedulerSwitch) {
        printComputeMethodScheduler (n, fout);
    } else if (gOpenMPSwitch) {
        printComputeMethodOpenMP (n, fout);
    } else if (gVectorSwitch) {
        switch (gVectorLoopVariant) {
            case 0 : printComputeMethodVectorFaster(n, fout); break;
            case 1 : printComputeMethodVectorSimple(n, fout); break;
            default : cerr << "unknown loop variant " << gVectorLoopVariant << endl; exit(1);
        }
   } else {
        printComputeMethodScalar(n, fout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printComputeMethodOpenMP ( int  n,
ostream &  fout 
) [virtual]

Definition at line 946 of file klass.cpp.

References fFirstPrivateDecl, fZone1Code, fZone2bCode, fZone2Code, fZone3Code, gVecSize, printdecllist(), printlines(), printLoopGraphOpenMP(), subst(), tab(), and xfloat().

Referenced by printComputeMethod().

{
    // in openMP mode we need to split loops in smaller pieces not larger
    // than gVecSize and add OpenMP pragmas
    tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat());
        printlines(n+2, fZone1Code, fout);
        printlines(n+2, fZone2Code, fout);
        tab(n+2,fout); fout << "#pragma omp parallel";
        printdecllist(n+3, "firstprivate", fFirstPrivateDecl, fout);

        tab(n+2,fout); fout << "{";
            if (!fZone2bCode.empty()) {
                tab(n+3,fout); fout << "#pragma omp single";
                tab(n+3,fout); fout << "{";
                    printlines(n+4, fZone2bCode, fout);
                tab(n+3,fout); fout << "}";
            }

            tab(n+3,fout); fout << "for (int index = 0; index < fullcount; index += " << gVecSize << ") {";
            tab(n+4,fout); fout << "int count = min ("<< gVecSize << ", fullcount-index);";

            printlines (n+4, fZone3Code, fout);
            printLoopGraphOpenMP (n+4,fout);

            tab(n+3,fout); fout << "}";

        tab(n+2,fout); fout << "}";
    tab(n+1,fout); fout << "}";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printComputeMethodScalar ( int  n,
ostream &  fout 
) [virtual]

Definition at line 830 of file klass.cpp.

References fZone1Code, fZone2bCode, fZone2Code, fZone3Code, printlines(), printLoopGraphScalar(), subst(), tab(), and xfloat().

Referenced by printComputeMethod().

{
    tab(n+1,fout); fout << subst("virtual void compute (int count, $0** input, $0** output) {", xfloat());
        printlines (n+2, fZone1Code, fout);
        printlines (n+2, fZone2Code, fout);
        printlines (n+2, fZone2bCode, fout);
        printlines (n+2, fZone3Code, fout);
        printLoopGraphScalar (n+2,fout);
    tab(n+1,fout); fout << "}";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printComputeMethodScheduler ( int  n,
ostream &  fout 
) [virtual]

Definition at line 1045 of file klass.cpp.

References fZone1Code, fZone2cCode, fZone2Code, fZone3Code, gTaskCount, gVecSize, printlines(), printLoopGraphScheduler(), START_TASK_INDEX, subst(), tab(), and xfloat().

Referenced by printComputeMethod().

{
    tab(n+1,fout); fout << "void display() {";
        tab(n+2,fout); fout << "fGraph.Display();";
    tab(n+1,fout); fout << "}";

    tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat());

        tab(n+2,fout); fout << "GetRealTime();";

        tab(n+2,fout); fout << "this->input = input;";
        tab(n+2,fout); fout << "this->output = output;";

        tab(n+2,fout); fout << "StartMeasure();";

        tab(n+2,fout); fout << "for (fIndex = 0; fIndex < fullcount; fIndex += " << gVecSize << ") {";

        tab(n+3,fout); fout << "fFullCount = min ("<< gVecSize << ", fullcount-fIndex);";
        tab(n+3,fout); fout << "TaskQueue::Init();";
        printlines (n+3, fZone2cCode, fout);

        tab(n+3,fout); fout << "fIsFinished = false;";
        tab(n+3,fout); fout << "fThreadPool->SignalAll(fDynamicNumThreads - 1, this);";
        tab(n+3,fout); fout << "computeThread(0);";
        tab(n+3,fout); fout << "while (!fThreadPool->IsFinished()) {}";

        tab(n+2,fout); fout << "}";

        tab(n+2,fout); fout << "StopMeasure(fStaticNumThreads, fDynamicNumThreads);";

    tab(n+1,fout); fout << "}";

    tab(n+1,fout); fout << "void computeThread(int cur_thread) {";
        printlines (n+2, fZone1Code, fout);
        printlines (n+2, fZone2Code, fout);

        tab(n+2,fout); fout << "// Init graph state";

        tab(n+2,fout); fout << "{";
            tab(n+3,fout); fout << "TaskQueue taskqueue(cur_thread);";
            tab(n+3,fout); fout << "int tasknum = -1;";
            tab(n+3,fout); fout << "int count = fFullCount;";

            // Init input and output
            tab(n+3,fout); fout << "// Init input and output";
            printlines (n+3, fZone3Code, fout);

            tab(n+3,fout); fout << "while (!fIsFinished) {";
                 tab(n+4,fout); fout << "switch (tasknum) {";

                    // Work stealing task
                    tab(n+5, fout); fout << "case WORK_STEALING_INDEX: { ";
                        tab(n+6, fout); fout << "tasknum = TaskQueue::GetNextTask(cur_thread, fDynamicNumThreads);";
                        tab(n+6, fout); fout << "break;";
                    tab(n+5, fout); fout << "} ";

                    // End task
                    tab(n+5, fout); fout << "case LAST_TASK_INDEX: { ";
                        tab(n+6, fout); fout << "fIsFinished = true;";
                        tab(n+6, fout); fout << "break;";
                    tab(n+5, fout); fout << "} ";

                    gTaskCount = START_TASK_INDEX;

                    // DSP tasks
                    printLoopGraphScheduler (n+5,fout);

                 tab(n+4,fout); fout << "}";
            tab(n+3,fout); fout << "}";
        tab(n+2,fout); fout << "}";
    tab(n+1,fout); fout << "}";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printComputeMethodVectorFaster ( int  n,
ostream &  fout 
) [virtual]

Uses loops of constant gVecSize boundary in order to provide the C compiler with more optimisation opportunities.

Improves performances in general, but not always

Definition at line 846 of file klass.cpp.

References fZone1Code, fZone2bCode, fZone2Code, fZone3Code, gVecSize, printlines(), printLoopGraphVector(), subst(), tab(), and xfloat().

Referenced by printComputeMethod().

{
    // in vector mode we need to split loops in smaller pieces not larger
    // than gVecSize
    tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat());
        printlines(n+2, fZone1Code, fout);
        printlines(n+2, fZone2Code, fout);
        printlines(n+2, fZone2bCode, fout);

        tab(n+2,fout); fout << "int index;";
        tab(n+2,fout); fout << "for (index = 0; index <= fullcount - " << gVecSize << "; index += " << gVecSize << ") {";
            tab(n+3,fout); fout << "// compute by blocks of " << gVecSize << " samples";
            tab(n+3,fout); fout << "const int count = " << gVecSize << ";";
            printlines (n+3, fZone3Code, fout);
            printLoopGraphVector(n+3,fout);
        tab(n+2,fout); fout << "}";

        tab(n+2,fout); fout << "if (index < fullcount) {";
            tab(n+3,fout); fout << "// compute the remaining samples if any";
            tab(n+3,fout); fout << "int count = fullcount-index;";
            printlines (n+3, fZone3Code, fout);
             printLoopGraphVector(n+3,fout);
        tab(n+2,fout); fout << "}";
    tab(n+1,fout); fout << "}";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printComputeMethodVectorSimple ( int  n,
ostream &  fout 
) [virtual]

Simple loop layout, generally less efficient than printComputeMethodVectorFaster.

Definition at line 875 of file klass.cpp.

References fZone1Code, fZone2bCode, fZone2Code, fZone3Code, gVecSize, printlines(), printLoopGraphVector(), subst(), tab(), and xfloat().

Referenced by printComputeMethod().

{
    // in vector mode we need to split loops in smaller pieces not larger
    // than gVecSize
    tab(n+1,fout); fout << subst("virtual void compute (int fullcount, $0** input, $0** output) {", xfloat());
        printlines(n+2, fZone1Code, fout);
        printlines(n+2, fZone2Code, fout);
        printlines(n+2, fZone2bCode, fout);
        tab(n+2,fout); fout << "for (int index = 0; index < fullcount; index += " << gVecSize << ") {";
            tab(n+3,fout); fout << "int count = min("<< gVecSize << ", fullcount-index);";
            printlines (n+3, fZone3Code, fout);
            printLoopGraphVector(n+3,fout);
        tab(n+2,fout); fout << "}";
    tab(n+1,fout); fout << "}";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printGraphDotFormat ( ostream &  fout) [virtual]

Print the loop graph in dot format.

Definition at line 517 of file klass.cpp.

References fTopLoop, and sortGraph().

Referenced by main().

{
    lgraph G;
    sortGraph(fTopLoop, G);

    fout << "strict digraph loopgraph {" << endl;
    fout << '\t' << "rankdir=LR;" << endl;
    fout << '\t' << "node[color=blue, fillcolor=lightblue, style=filled, fontsize=9];" << endl;

    int lnum = 0;       // used for loop numbers
    // for each level of the graph
    for (int l=G.size()-1; l>=0; l--) {
        // for each task in the level
        for (lset::const_iterator t =G[l].begin(); t!=G[l].end(); t++) {
            // print task label "Lxxx : 0xffffff"
            fout << '\t' << 'L'<<(*t)<<"[label=<<font face=\"verdana,bold\">L"<<lnum++<<"</font> : "<<(*t)<<">];"<<endl;
            // for each source of the task
            for (lset::const_iterator src = (*t)->fBackwardLoopDependencies.begin(); src!=(*t)->fBackwardLoopDependencies.end(); src++) {
                // print the connection Lxxx -> Lyyy;
                fout << '\t' << 'L'<<(*src)<<"->"<<'L'<<(*t)<<';'<<endl;
            }
        }
    }
    fout << "}" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printIncludeFile ( ostream &  fout) [virtual]

Print the required include files.

Definition at line 198 of file klass.cpp.

References collectIncludeFile(), and gOpenMPSwitch.

Referenced by main().

{
    set<string> S;
    set<string>::iterator f;

    if (gOpenMPSwitch) {
        fout << "#include <omp.h>" << "\n";
    }

    collectIncludeFile(S);
    for (f = S.begin(); f != S.end(); f++)  {
        fout << "#include " << *f << "\n";
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLastLoopLevelScheduler ( int  n,
int  lnum,
const lset L,
ostream &  fout 
) [virtual]

Print the 'level' of the loop graph as a set of parallel loops.

Definition at line 623 of file klass.cpp.

References gTaskCount, nonRecursiveLevel(), and tab().

Referenced by printLoopGraphScheduler().

{
    if (nonRecursiveLevel(L) && L.size() == 1 && !(*L.begin())->isEmpty()) {

        lset::const_iterator p =L.begin();
        tab(n, fout); fout << "case " << gTaskCount++ << ": { ";
        (*p)->println(n+1, fout);
        tab(n+1, fout); fout << "tasknum = LAST_TASK_INDEX;";
        tab(n+1, fout); fout << "break;";
        tab(n, fout); fout << "} ";

    } else if (L.size() > 1) {

        for (lset::const_iterator p =L.begin(); p!=L.end(); p++) {
            tab(n, fout); fout << "case " << gTaskCount++ << ": { ";
            (*p)->println(n+1, fout);
            tab(n+1, fout); fout << "fGraph.ActivateOneOutputTask(taskqueue, LAST_TASK_INDEX, tasknum);";
            tab(n+1, fout); fout << "break;";
            tab(n, fout); fout << "} ";
        }

    } else if (L.size() == 1 && !(*L.begin())->isEmpty()) {

        lset::const_iterator p =L.begin();
        tab(n, fout); fout << "case " << gTaskCount++ << ": { ";
        (*p)->println(n+1, fout);
        tab(n+1, fout); fout << "tasknum = LAST_TASK_INDEX;";
        tab(n+1, fout); fout << "break;";
        tab(n, fout); fout << "} ";

    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLibrary ( ostream &  fout) [virtual]

Print the required C++ libraries as comments in source code.

Definition at line 181 of file klass.cpp.

References collectLibrary().

Referenced by main().

{
    set<string> S;
    set<string>::iterator f;

    string sep;
    collectLibrary(S);
    fout << "/* link with ";
    for (f = S.begin(), sep =": "; f != S.end(); f++, sep = ", ")   {
        fout << sep << *f;
    }
    fout << " */\n";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::println ( int  n,
ostream &  fout 
) [virtual]

Print a full C++ class corresponding to a Faust dsp.

Reimplemented in SigFloatGenKlass, and SigIntGenKlass.

Definition at line 732 of file klass.cpp.

References fDeclCode, fInitCode, fKlassName, fNumActives, fNumInputs, fNumOutputs, fNumPassives, fStaticFields, fStaticInitCode, fSubClassList, fSuperKlassName, fUICode, fUIMacro, gMetaDataSet, gSchedulerSwitch, gUIMacroSwitch, printComputeMethod(), printlines(), printMetadata(), and tab().

Referenced by main().

{
    list<Klass* >::iterator k;

    tab(n,fout); fout << "#define FAUSTCLASS "<< fKlassName << endl;

    if (gSchedulerSwitch) {
        tab(n,fout); fout << "class " << fKlassName << " : public " << fSuperKlassName << ", public Runnable {";
    } else {
        tab(n,fout); fout << "class " << fKlassName << " : public " << fSuperKlassName << " {";
    }

    if (gUIMacroSwitch) {
        tab(n,fout); fout << "  public:";
    } else {
        tab(n,fout); fout << "  private:";
    }

    for (k = fSubClassList.begin(); k != fSubClassList.end(); k++)  (*k)->println(n+1, fout);

    printlines(n+1, fDeclCode, fout);

    tab(n,fout); fout << "  public:";

    printMetadata(n+1, gMetaDataSet, fout);

    if (gSchedulerSwitch) {
        tab(n+1,fout); fout << "virtual ~" << fKlassName << "() \t{ "
                            << "DSPThreadPool::Destroy()"
                            << "; }";
    }

    tab(n+1,fout); fout     << "virtual int getNumInputs() \t{ "
                    << "return " << fNumInputs
                    << "; }";
    tab(n+1,fout); fout     << "virtual int getNumOutputs() \t{ "
                    << "return " << fNumOutputs
                    << "; }";

    tab(n+1,fout); fout << "static void classInit(int samplingFreq) {";
        printlines (n+2, fStaticInitCode, fout);
    tab(n+1,fout); fout << "}";

    tab(n+1,fout); fout << "virtual void instanceInit(int samplingFreq) {";
        tab(n+2,fout); fout << "fSamplingFreq = samplingFreq;";
        printlines (n+2, fInitCode, fout);
    tab(n+1,fout); fout << "}";

    tab(n+1,fout); fout << "virtual void init(int samplingFreq) {";
        tab(n+2,fout); fout << "classInit(samplingFreq);";
         tab(n+2,fout); fout << "instanceInit(samplingFreq);";
    tab(n+1,fout); fout << "}";


    tab(n+1,fout); fout << "virtual void buildUserInterface(UI* interface) {";
        printlines (n+2, fUICode, fout);
    tab(n+1,fout); fout << "}";

    printComputeMethod(n, fout);

    tab(n,fout); fout << "};\n" << endl;

    printlines(n, fStaticFields, fout);

    // generate user interface macros if needed
    if (gUIMacroSwitch) {
        tab(n, fout); fout << "#ifdef FAUST_UIMACROS";
            tab(n+1,fout); fout << "#define FAUST_INPUTS " << fNumInputs;
            tab(n+1,fout); fout << "#define FAUST_OUTPUTS " << fNumOutputs;
            tab(n+1,fout); fout << "#define FAUST_ACTIVES " << fNumActives;
            tab(n+1,fout); fout << "#define FAUST_PASSIVES " << fNumPassives;
            printlines(n+1, fUIMacro, fout);
        tab(n, fout); fout << "#endif";
    }

    fout << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopDeepFirst ( int  n,
ostream &  fout,
Loop l,
set< Loop * > &  visited 
) [virtual]

Print a loop graph deep first.

Definition at line 262 of file klass.cpp.

References Loop::fBackwardLoopDependencies, Loop::fOrder, isElement(), Loop::println(), and tab().

Referenced by printLoopGraphVector().

{
    // avoid printing already printed loops
    if (isElement(visited, l)) return;

    // remember we have printed this loop
    visited.insert(l);

    // print the dependencies loops (that need to be computed before this one)
    for (lset::const_iterator p =l->fBackwardLoopDependencies.begin(); p!=l->fBackwardLoopDependencies.end(); p++) {
        printLoopDeepFirst(n, fout, *p, visited);
    }
    // the print the loop itself
    tab(n, fout);
    tab(n, fout); fout << "// LOOP " << l << ", ORDER " << l->fOrder << endl;
    l->println(n+1, fout);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopGraphInternal ( int  n,
ostream &  fout 
) [virtual]

Print the loop graph (used for internals classes)

Definition at line 546 of file klass.cpp.

References fTopLoop, gVectorSwitch, sortGraph(), and tab().

Referenced by SigIntGenKlass::println(), and SigFloatGenKlass::println().

{
    lgraph G;
    sortGraph(fTopLoop, G);

    // normal mode
    for (int l=G.size()-1; l>=0; l--) {
        if (gVectorSwitch) { tab(n, fout); fout << "// SECTION : " << G.size() - l; }
        for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) {
            (*p)->printoneln(n, fout);
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopGraphOpenMP ( int  n,
ostream &  fout 
) [virtual]

Print the loop graph as a serie of parallel loops.

Definition at line 474 of file klass.cpp.

References computeUseCount(), fTopLoop, gGroupTaskSwitch, groupSeqLoops(), printLoopLevelOpenMP(), sortGraph(), and tab().

Referenced by printComputeMethodOpenMP().

{
    if (gGroupTaskSwitch) {
        computeUseCount(fTopLoop);
        groupSeqLoops(fTopLoop);
    }

    lgraph G;
    sortGraph(fTopLoop, G);

    // OpenMP mode : add OpenMP directives
    for (int l=G.size()-1; l>=0; l--) {
        tab(n, fout); fout << "// SECTION : " << G.size() - l;
        printLoopLevelOpenMP(n, G.size() - l, G[l], fout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopGraphScalar ( int  n,
ostream &  fout 
) [virtual]

Print the loop graph (scalar mode)

Definition at line 563 of file klass.cpp.

References fTopLoop, and Loop::printoneln().

Referenced by printComputeMethodScalar().

{
    fTopLoop->printoneln(n, fout);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopGraphScheduler ( int  n,
ostream &  fout 
) [virtual]

Print the loop graph as a serie of parallel loops.

Definition at line 494 of file klass.cpp.

References computeUseCount(), fTopLoop, gGroupTaskSwitch, groupSeqLoops(), printLastLoopLevelScheduler(), printLoopLevelScheduler(), sortGraph(), and tab().

Referenced by printComputeMethodScheduler().

{
    if (gGroupTaskSwitch) {
        computeUseCount(fTopLoop);
        groupSeqLoops(fTopLoop);
    }

    lgraph G;
    sortGraph(fTopLoop, G);

    // OpenMP mode : add OpenMP directives
    for (int l=G.size()-1; l>0; l--) {
        tab(n, fout); fout << "// SECTION : " << G.size() - l;
        printLoopLevelScheduler(n, G.size() - l, G[l], fout);
    }

    printLastLoopLevelScheduler(n, G.size(), G[0], fout);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopGraphVector ( int  n,
ostream &  fout 
) [virtual]

Print the loop graph (used for vector code)

Definition at line 443 of file klass.cpp.

References computeUseCount(), fTopLoop, gDeepFirstSwitch, gGroupTaskSwitch, groupSeqLoops(), gVectorSwitch, printLoopDeepFirst(), sortGraph(), and tab().

Referenced by printComputeMethodVectorFaster(), and printComputeMethodVectorSimple().

{
    if (gGroupTaskSwitch) {
        computeUseCount(fTopLoop);
        groupSeqLoops(fTopLoop);
    }

    lgraph G;
    sortGraph(fTopLoop, G);

#if 1
    // EXPERIMENTAL
    if (gVectorSwitch && gDeepFirstSwitch) {
        set<Loop*> visited;
        printLoopDeepFirst(n, fout, fTopLoop, visited);
        return;
    }
#endif

    // normal mode
    for (int l=G.size()-1; l>=0; l--) {
        if (gVectorSwitch) { tab(n, fout); fout << "// SECTION : " << G.size() - l; }
        for (lset::const_iterator p =G[l].begin(); p!=G[l].end(); p++) {
            (*p)->println(n, fout);
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopLevelOpenMP ( int  n,
int  lnum,
const lset L,
ostream &  fout 
) [virtual]

Print the 'level' of the loop graph as a set of parallel loops.

Definition at line 583 of file klass.cpp.

References gOpenMPLoop, nonRecursiveLevel(), and tab().

Referenced by printLoopGraphOpenMP().

{
    if (nonRecursiveLevel(L) && L.size()==1) {
        for (lset::const_iterator p =L.begin(); p!=L.end(); p++) {
            if ((*p)->isEmpty() == false) {
                if (gOpenMPLoop) {
                    (*p)->printParLoopln(n, fout);
                } else {
                    tab(n, fout); fout << "#pragma omp single ";
                    tab(n, fout); fout << "{ ";
                    (*p)->println(n+1, fout);
                    tab(n, fout); fout << "} ";
                }
            }
        }

    } else if (L.size() > 1) {
        tab(n, fout); fout << "#pragma omp sections ";
        tab(n, fout); fout << "{ ";
        for (lset::const_iterator p =L.begin(); p!=L.end(); p++) {
            tab(n+1, fout); fout << "#pragma omp section ";
            tab(n+1, fout); fout << "{";
            (*p)->println(n+2, fout);
            tab(n+1, fout); fout << "} ";
        }
        tab(n, fout); fout << "} ";
    } else if (L.size() == 1 && !(*L.begin())->isEmpty()) {
        tab(n, fout); fout << "#pragma omp single ";
        tab(n, fout); fout << "{ ";
            for (lset::const_iterator p =L.begin(); p!=L.end(); p++) {
                (*p)->println(n+1, fout);
            }
        tab(n, fout); fout << "} ";
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printLoopLevelScheduler ( int  n,
int  lnum,
const lset L,
ostream &  fout 
) [virtual]

Print the 'level' of the loop graph as a set of parallel loops.

Definition at line 716 of file klass.cpp.

References nonRecursiveLevel(), and printOneLoopScheduler().

Referenced by printLoopGraphScheduler().

{
    if (nonRecursiveLevel(L) && L.size() == 1 && !(*L.begin())->isEmpty()) {
        printOneLoopScheduler(L.begin(), n, fout);
    } else if (L.size() > 1) {
        for (lset::const_iterator p = L.begin(); p != L.end(); p++) {
            printOneLoopScheduler(p, n, fout);
        }
    } else if (L.size() == 1 && !(*L.begin())->isEmpty()) {
        printOneLoopScheduler(L.begin(), n, fout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printMetadata ( int  n,
const map< Tree, set< Tree > > &  S,
ostream &  fout 
) [virtual]

Print metadata declaration.

Definition at line 233 of file klass.cpp.

References gMetaDataSet, tab(), and tree().

Referenced by println().

{
    tab(n,fout); fout   << "static void metadata(Meta* m) \t{ ";

    for (map<Tree, set<Tree> >::iterator i = gMetaDataSet.begin(); i != gMetaDataSet.end(); i++) {
        if (i->first != tree("author")) {
            tab(n+1,fout); fout << "m->declare(\"" << *(i->first) << "\", " << **(i->second.begin()) << ");";
        } else {
            for (set<Tree>::iterator j = i->second.begin(); j != i->second.end(); j++) {
                if (j == i->second.begin()) {
                     tab(n+1,fout); fout << "m->declare(\"" << *(i->first) << "\", " << **j << ");" ;
                } else {
                     tab(n+1,fout); fout << "m->declare(\"" << "contributor" << "\", " << **j << ");";
                }
            }
        }
    }

    tab(n,fout); fout << "}" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::printOneLoopScheduler ( lset::const_iterator  p,
int  n,
ostream &  fout 
) [virtual]

Definition at line 656 of file klass.cpp.

References Loop::fIndex, gTaskCount, subst(), T(), and tab().

Referenced by printLoopLevelScheduler().

{
    tab(n, fout); fout << "case " << gTaskCount++ << ": { ";
    (*p)->println(n+1, fout);

    // One output only
    if ((*p)->fForwardLoopDependencies.size() == 1) {

        lset::const_iterator p1 = (*p)->fForwardLoopDependencies.begin();
        if ((*p1)->fBackwardLoopDependencies.size () == 1) {
            tab(n+1, fout); fout << subst("tasknum = $0;", T((*p1)->fIndex));
        } else {
            tab(n+1, fout); fout << subst("fGraph.ActivateOneOutputTask(taskqueue, $0, tasknum);", T((*p1)->fIndex));
        }

    } else {

        Loop* keep = NULL;
        // Find one output with only one backward dependencies
        for (lset::const_iterator p1 = (*p)->fForwardLoopDependencies.begin(); p1!=(*p)->fForwardLoopDependencies.end(); p1++) {
            if ((*p1)->fBackwardLoopDependencies.size () == 1) {
                keep = *p1;
                break;
            }
        }

        if (keep == NULL) {
            tab(n+1, fout); fout << "tasknum = WORK_STEALING_INDEX;";
        }

        for (lset::const_iterator p1 = (*p)->fForwardLoopDependencies.begin(); p1!=(*p)->fForwardLoopDependencies.end(); p1++) {
            if ((*p1)->fBackwardLoopDependencies.size () == 1) {  // Task is the only input
                if (*p1 != keep) {
                    tab(n+1, fout); fout << subst("taskqueue.PushHead($0);", T((*p1)->fIndex));
                }
            } else {
                if (keep == NULL) {
                    tab(n+1, fout); fout << subst("fGraph.ActivateOutputTask(taskqueue, $0, tasknum);", T((*p1)->fIndex));
                } else {
                    tab(n+1, fout); fout << subst("fGraph.ActivateOutputTask(taskqueue, $0);", T((*p1)->fIndex));
                }
            }
        }

        if (keep != NULL) {
            tab(n+1, fout); fout << subst("tasknum = $0;", T(keep->fIndex)); // Last one
        } else {
            tab(n+1, fout); fout << "fGraph.GetReadyTask(taskqueue, tasknum);"; // Last one
        }
    }

    tab(n+1, fout); fout << "break;";
    tab(n, fout); fout << "} ";
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Klass::rememberNeedPowerDef ( ) [inline]

Definition at line 132 of file klass.hh.

Referenced by PowPrim::generateCode().

{ fNeedPowerDef = true; }

Here is the caller graph for this function:

void Klass::setLoopProperty ( Tree  sig,
Loop l 
)

Store the loop used to compute a signal.

Definition at line 78 of file klass.cpp.

References fLoopProperty, and property< P >::set().

Referenced by closeLoop().

{
    fLoopProperty.set(sig,l);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Loop* Klass::topLoop ( ) [inline]

Definition at line 124 of file klass.hh.

Referenced by VectorCompiler::CS(), and VectorCompiler::generateLoopCode().

{ return fTopLoop; }

Here is the caller graph for this function:


Member Data Documentation

list<string> Klass::fDeclCode [protected]

Definition at line 78 of file klass.hh.

Referenced by println(), SigIntGenKlass::println(), and SigFloatGenKlass::println().

list<string> Klass::fFirstPrivateDecl [protected]

first private declarations

Definition at line 93 of file klass.hh.

Referenced by printComputeMethodOpenMP().

set<string> Klass::fIncludeFileSet [protected]

Definition at line 73 of file klass.hh.

Referenced by collectIncludeFile().

list<string> Klass::fInitCode [protected]

Definition at line 81 of file klass.hh.

Referenced by println(), and SigFloatGenKlass::println().

string Klass::fKlassName [protected]

Definition at line 66 of file klass.hh.

Referenced by println(), SigIntGenKlass::println(), and SigFloatGenKlass::println().

set<string> Klass::fLibrarySet [protected]

Definition at line 74 of file klass.hh.

Referenced by collectLibrary().

loops used to compute some signals

Definition at line 102 of file klass.hh.

Referenced by getLoopProperty(), and setLoopProperty().

bool Klass::fNeedPowerDef = false [static, protected]

true when faustpower definition is needed

Definition at line 61 of file klass.hh.

Referenced by printAdditionalCode().

int Klass::fNumActives [protected]

number of active controls in the UI (sliders, buttons, etc.)

Definition at line 70 of file klass.hh.

Referenced by println().

int Klass::fNumInputs [protected]

Definition at line 68 of file klass.hh.

Referenced by println(), SigIntGenKlass::println(), and SigFloatGenKlass::println().

int Klass::fNumOutputs [protected]

Definition at line 69 of file klass.hh.

Referenced by println(), SigIntGenKlass::println(), and SigFloatGenKlass::println().

int Klass::fNumPassives [protected]

number of passive widgets in the UI (bargraphs, etc.)

Definition at line 71 of file klass.hh.

Referenced by println().

list<string> Klass::fSharedDecl [protected]

shared declarations

Definition at line 92 of file klass.hh.

list<string> Klass::fStaticFields [protected]

static fields after class

Definition at line 80 of file klass.hh.

Referenced by println().

list<string> Klass::fStaticInitCode [protected]

static init code for class constant tables

Definition at line 79 of file klass.hh.

Referenced by println().

list<Klass* > Klass::fSubClassList [protected]
string Klass::fSuperKlassName [protected]

Definition at line 67 of file klass.hh.

Referenced by println().

Loop* Klass::fTopLoop [protected]
list<string> Klass::fUICode [protected]

Definition at line 82 of file klass.hh.

Referenced by println().

list<string> Klass::fUIMacro [protected]

Definition at line 83 of file klass.hh.

Referenced by println().

bool Klass::fVec [protected]

Definition at line 104 of file klass.hh.

list<string> Klass::fZone1Code [protected]
list<string> Klass::fZone2bCode [protected]
list<string> Klass::fZone2cCode [protected]

single once per block

Definition at line 98 of file klass.hh.

Referenced by printComputeMethodScheduler().

list<string> Klass::fZone2Code [protected]
list<string> Klass::fZone3Code [protected]

The documentation for this class was generated from the following files: