FAUST compiler  0.9.9.6b8
Functions | Variables
sigtyperules.hh File Reference

API to the typing system of signals. More...

#include "signals.hh"
#include "sigtype.hh"
Include dependency graph for sigtyperules.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void typeAnnotation (Tree term)
 Annotates a signal term and its subterms with type information.
Type getCertifiedSigType (Tree term)
 Return the type of a previously annotated signal term.
void annotationStatistics ()
 print annotation statistics

Variables

bool gVectorSwitch

Detailed Description

API to the typing system of signals.

Two functions are provided :

TypeAnnotation must be called first to annotate a signal or a list of signals, before being able to call getCertifiedType on any subterms. GetCertifiedType will produce an error if a term was not previously annotated.

Definition in file sigtyperules.hh.


Function Documentation

print annotation statistics

Definition at line 141 of file sigtyperules.cpp.

References AudioType::gAllocationCount, and TABBER.

{
    cerr << TABBER << "COUNT INFERENCE  " << countInferences << " AT TIME " << clock()/CLOCKS_PER_SEC << 's' << endl;
    cerr << TABBER << "COUNT ALLOCATION " << AudioType::gAllocationCount << endl;
    cerr << TABBER << "COUNT MAXIMAL " << countMaximal << endl;
}

Return the type of a previously annotated signal term.

Return the type of a previously annotated signal term.

Produces an error if the signal has no type associated

Parameters:
sigthe signal we want to know the type
Returns:
the type of the signal

Definition at line 154 of file sigtyperules.cpp.

References getSigType().

Referenced by VectorCompiler::CS(), DocCompiler::generateBinOp(), VectorCompiler::generateCacheCode(), ScalarCompiler::generateCacheCode(), DocCompiler::generateCacheCode(), ScalarCompiler::generateDelayVec(), DocCompiler::generateDelayVec(), DocCompiler::generateDocConstantTbl(), DocCompiler::generateDocWriteTbl(), ScalarCompiler::generateFConst(), DocCompiler::generateFConst(), DocCompiler::generateFVar(), ScalarCompiler::generateHBargraph(), DocCompiler::generateHBargraph(), ScalarCompiler::generateNumber(), DocCompiler::generateNumber(), ScalarCompiler::generatePrefix(), ScalarCompiler::generateRec(), DocCompiler::generateRec(), ScalarCompiler::generateStaticTable(), ScalarCompiler::generateTable(), VectorCompiler::generateVariableStore(), ScalarCompiler::generateVariableStore(), DocCompiler::generateVariableStore(), ScalarCompiler::generateVBargraph(), DocCompiler::generateVBargraph(), ScalarCompiler::generateXtended(), DocCompiler::generateXtended(), OccMarkup::incOcc(), VectorCompiler::needSeparateLoop(), recdraw(), ScalarCompiler::sharingAnnotation(), DocCompiler::sharingAnnotation(), signal2klass(), and sigToGraph().

{
    Type ty = getSigType(sig);
    assert(ty);
    return ty;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void typeAnnotation ( Tree  sig)

Annotates a signal term and its subterms with type information.

Annotates a signal term and its subterms with type information.

Parameters:
sigthe signal term tree to annotate

Definition at line 87 of file sigtyperules.cpp.

References getSigType(), hd(), initialRecType(), isList(), isRec(), len(), setSigType(), CTree::startNewVisit(), symlist(), T(), and tl().

Referenced by DocCompiler::annotate(), ScalarCompiler::prepare(), and ScalarCompiler::prepare2().

{
    Tree            sl = symlist(sig);
    int             n = len(sl);

    vector<Tree>    vrec, vdef;
    vector<Type>    vtype;

    //cerr << "Symlist " << *sl << endl;
    for (Tree l=sl; isList(l); l=tl(l)) {
        Tree    id, body;
        assert(isRec(hd(l), id, body));

        vrec.push_back(hd(l));
        vdef.push_back(body);
    }

    // init recursive types
    for (int i=0; i<n; i++) {
        vtype.push_back(initialRecType(vdef[i]));
    }

    assert (int(vrec.size())==n);
    assert (int(vdef.size())==n);
    assert (int(vtype.size())==n);

    // find least fixpoint
    for (bool finished = false; !finished; ) {

        // init recursive types
        CTree::startNewVisit();
        for (int i=0; i<n; i++) {
            setSigType(vrec[i], vtype[i]);
            vrec[i]->setVisited();
        }

        // compute recursive types
        for (int i=0; i<n; i++) {
            vtype[i] = T(vdef[i], NULLTYPEENV);
        }

        // check finished
        finished = true;
        for (int i=0; i<n; i++) {
            //cerr << i << "-" << *vrec[i] << ":" << *getSigType(vrec[i]) << " => " << *vtype[i] << endl;
            finished =  finished & (getSigType(vrec[i]) == vtype[i]);
        }
    }

    // type full term
    T(sig, NULLTYPEENV);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 137 of file main.cpp.