|
FAUST compiler
0.9.9.6b8
|
#include <stdio.h>#include <assert.h>#include <iostream>#include <fstream>#include <time.h>#include "sigtype.hh"#include "sigprint.hh"#include "ppsig.hh"#include "prim2.hh"#include "tlib.hh"#include "sigtyperules.hh"#include "xtended.hh"#include "recursivness.hh"
Go to the source code of this file.
Macros | |
| #define | TRACE(x) ; |
Functions | |
| static void | setSigType (Tree sig, Type t) |
| Set the type annotation of sig. More... | |
| static Type | getSigType (Tree sig) |
| Retrieve the type annotation of sig. More... | |
| static Type | initialRecType (Tree t) |
| Compute an initial type solution for a recursive block E1,E2,...En -> TREC,TREC,...TREC. More... | |
| static Type | T (Tree term, Tree ignoreenv) |
| Shortcut to getOrInferType, retrieve or infere the type of a term according to its surrounding type environment. More... | |
| static Type | infereSigType (Tree sig, Tree env) |
| Infere the type of a term according to its surrounding type environment. More... | |
| static Type | infereFFType (Tree ff, Tree ls, Tree env) |
| Infere the type of a foreign function call. More... | |
| static Type | infereFConstType (Tree type) |
| Infere the type of a foreign constant. More... | |
| static Type | infereFVarType (Tree type) |
| Infere the type of a foreign variable. More... | |
| static Type | infereRecType (Tree sig, Tree body, Tree env) |
| Infere the type of e recursive block by trying solutions of increasing generality. More... | |
| static Type | infereReadTableType (Type tbl, Type ri) |
| Infere the type of the result of reading a table. More... | |
| static Type | infereWriteTableType (Type tbl, Type wi, Type wd) |
| Infere the type of the result of writing into a table. More... | |
| static Type | infereProjType (Type t, int i, int vec) |
| Infere the type of a projection (selection) of a tuplet element. More... | |
| static Type | infereXType (Tree sig, Tree env) |
| Infere the type of an extended (primitive) block. More... | |
| static Type | infereDocConstantTblType (Type size, Type init) |
| static Type | infereDocWriteTblType (Type size, Type init, Type widx, Type wsig) |
| static Type | infereDocAccessTblType (Type tbl, Type ridx) |
| static Type | infereWaveformType (Tree wfsig, Tree env) |
| Infere the type of a waveform: More... | |
| static interval | arithmetic (int opcode, const interval &x, const interval &y) |
| Compute the resulting interval of an arithmetic operation. More... | |
| void | typeAnnotation (Tree sig) |
| Fully annotate every subtree of term with type information. More... | |
| void | annotationStatistics () |
| print annotation statistics More... | |
| Type | getCertifiedSigType (Tree sig) |
| Retrieve the type of sig and check it exists. More... | |
Variables | |
| static Tree | NULLTYPEENV = tree(symbol("NullTypeEnv")) |
| The empty type environment (also property key for closed term type) More... | |
| static int | countInferences |
| static int | countMaximal |
| #define TRACE | ( | x | ) | ; |
Definition at line 71 of file sigtyperules.cpp.
Referenced by getSigType(), setSigType(), and T().
| void annotationStatistics | ( | ) |
print annotation statistics
Definition at line 146 of file sigtyperules.cpp.
References AudioType::gAllocationCount, and TABBER.
Compute the resulting interval of an arithmetic operation.
| op | code of the operation |
| s1 | interval of the left operand |
| s2 | interval of the right operand |
Definition at line 655 of file sigtyperules.cpp.
References kAdd, kAND, kDiv, kEQ, kGE, kGT, kLE, kLsh, kLT, kMul, kNE, kOR, kRem, kRsh, kSub, and kXOR.
Referenced by infereSigType().

Retrieve the type of sig and check it exists.
Return the type of a previously annotated signal term.
Produces an error if the signal has no type associated
| sig | the signal we want to know the type |
Definition at line 159 of file sigtyperules.cpp.
References getSigType().
Referenced by VectorCompiler::CS(), ScalarCompiler::declareWaveform(), ScalarCompiler::forceCacheCode(), ScalarCompiler::generateBinOp(), 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().


Retrieve the type annotation of sig.
| sig | the signal we want to know the type |
Definition at line 190 of file sigtyperules.cpp.
References CTree::getType(), TABBER, and TRACE.
Referenced by getCertifiedSigType(), T(), and typeAnnotation().


Definition at line 499 of file sigtyperules.cpp.
Referenced by infereSigType().

Definition at line 478 of file sigtyperules.cpp.
References checkInit(), checkInt(), and checkKonst().
Referenced by infereSigType().


Definition at line 485 of file sigtyperules.cpp.
References checkInit(), checkInt(), checkKonst(), kSamp, and kScal.
Referenced by infereSigType().


Infere the type of a foreign constant.
Definition at line 568 of file sigtyperules.cpp.
References kInit, kKonst, kNum, kVect, makeSimpleType(), and tree2int().
Referenced by infereSigType().


Infere the type of a foreign function call.
Definition at line 538 of file sigtyperules.cpp.
References ffarity(), ffrestype(), hd(), isList(), kInit, kInt, kKonst, kNum, kSamp, kVect, makeSimpleType(), T(), and tl().
Referenced by infereSigType().


Infere the type of a foreign variable.
Definition at line 580 of file sigtyperules.cpp.
References kBlock, kExec, kNum, kVect, makeSimpleType(), and tree2int().
Referenced by infereSigType().


Infere the type of a projection (selection) of a tuplet element.
Definition at line 402 of file sigtyperules.cpp.
References isTupletType(), kVect, and vecCast().
Referenced by infereSigType().


Infere the type of the result of reading a table.
Definition at line 454 of file sigtyperules.cpp.
References AudioType::boolean(), AudioType::computability(), TableType::content(), isSimpleType(), isTableType(), kInt, AudioType::nature(), AudioType::variability(), and AudioType::vectorability().
Referenced by infereSigType().


Infere the type of e recursive block by trying solutions of increasing generality.
Definition at line 528 of file sigtyperules.cpp.
Referenced by infereSigType().

Infere the type of a term according to its surrounding type environment.
| sig | the signal to aanlyze |
| env | the type environment |
Definition at line 249 of file sigtyperules.cpp.
References arithmetic(), boolCast(), AudioType::boolean(), castInterval(), checkInit(), checkInt(), AudioType::computability(), floatCast(), AudioType::getInterval(), getUserData(), hd(), infereDocAccessTblType(), infereDocConstantTblType(), infereDocWriteTblType(), infereFConstType(), infereFFType(), infereFVarType(), infereProjType(), infereReadTableType(), infereRecType(), infereWaveformType(), infereWriteTableType(), infereXType(), intCast(), isList(), isNil(), isProj(), isRec(), isSigAttach(), isSigBinOp(), isSigButton(), isSigCheckbox(), isSigDelay1(), isSigDocAccessTbl(), isSigDocConstantTbl(), isSigDocWriteTbl(), isSigFConst(), isSigFFun(), isSigFixDelay(), isSigFloatCast(), isSigFVar(), isSigGen(), isSigHBargraph(), isSigHSlider(), isSigInput(), isSigInt(), isSigIntCast(), isSigNumEntry(), isSigOutput(), isSigPrefix(), isSigRDTbl(), isSigReal(), isSigSelect2(), isSigSelect3(), isSigTable(), isSigVBargraph(), isSigVSlider(), isSigWaveform(), isSigWRTbl(), isSimpleType(), kComp, kDiv, kGT, kInt, kKonst, kNE, kNum, kReal, kScal, kVect, interval::lo, makeSimpleType(), makeTableType(), max(), min(), name(), AudioType::nature(), print(), reunion(), sampCast(), T(), TGUI, TGUI01, TINPUT, tl(), tree2float(), interval::valid, AudioType::variability(), and AudioType::vectorability().
Referenced by T().

Infere the type of a waveform:
Definition at line 597 of file sigtyperules.cpp.
References CTree::arity(), CTree::branch(), isInt(), kComp, kInt, kNum, kReal, kSamp, kScal, makeSimpleType(), CTree::node(), T(), and tree2float().
Referenced by infereSigType().


Infere the type of the result of writing into a table.
Definition at line 427 of file sigtyperules.cpp.
References TableType::content(), isSimpleType(), isTableType(), kInt, makeTableType(), and AudioType::nature().
Referenced by infereSigType().


Infere the type of an extended (primitive) block.
Definition at line 632 of file sigtyperules.cpp.
References CTree::arity(), CTree::branch(), getUserData(), xtended::infereSigType(), and T().
Referenced by infereSigType().


Compute an initial type solution for a recursive block E1,E2,...En -> TREC,TREC,...TREC.
Definition at line 514 of file sigtyperules.cpp.
References isList(), tl(), and TREC.
Referenced by typeAnnotation().


Set the type annotation of sig.
| sig | the signal we want to type |
| t | the type of the signal |
Definition at line 179 of file sigtyperules.cpp.
References CTree::setType(), TABBER, and TRACE.
Referenced by T(), and typeAnnotation().


Shortcut to getOrInferType, retrieve or infere the type of a term according to its surrounding type environment.
| sig | the signal to analyze |
| env | the type environment |
Definition at line 223 of file sigtyperules.cpp.
References getSigType(), infereSigType(), CTree::isAlreadyVisited(), setSigType(), CTree::setVisited(), TABBER, and TRACE.
Referenced by infereFFType(), infereSigType(), infereWaveformType(), infereXType(), and typeAnnotation().


| void typeAnnotation | ( | Tree | sig | ) |
Fully annotate every subtree of term with type information.
Annotates a signal term and its subterms with type information.
| sig | the signal term tree to annotate |
Definition at line 89 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().


|
static |
Definition at line 79 of file sigtyperules.cpp.
|
static |
Definition at line 80 of file sigtyperules.cpp.
The empty type environment (also property key for closed term type)
Definition at line 77 of file sigtyperules.cpp.
1.8.7