Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > aaf33964de706a538481c929c1da6a44 > files > 2997

faust-doc-0.9.10-5mdv2010.1.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FAUST compiler: compile_vect.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>compile_vect.cpp</h1><a href="compile__vect_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> ************************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">    FAUST compiler</span>
<a name="l00004"></a>00004 <span class="comment">    Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale</span>
<a name="l00005"></a>00005 <span class="comment">    ---------------------------------------------------------------------</span>
<a name="l00006"></a>00006 <span class="comment">    This program is free software; you can redistribute it and/or modify</span>
<a name="l00007"></a>00007 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
<a name="l00008"></a>00008 <span class="comment">    the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00009"></a>00009 <span class="comment">    (at your option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">    This program is distributed in the hope that it will be useful,</span>
<a name="l00012"></a>00012 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00013"></a>00013 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00014"></a>00014 <span class="comment">    GNU General Public License for more details.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment">    You should have received a copy of the GNU General Public License</span>
<a name="l00017"></a>00017 <span class="comment">    along with this program; if not, write to the Free Software</span>
<a name="l00018"></a>00018 <span class="comment">    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00019"></a>00019 <span class="comment"> ************************************************************************</span>
<a name="l00020"></a>00020 <span class="comment"> ************************************************************************/</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="compile__vect_8hh.html">compile_vect.hh</a>&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="floats_8hh.html">floats.hh</a>&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="ppsig_8hh.html">ppsig.hh</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="delayline_8hh.html">delayline.hh</a>&quot;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="compile__vect_8cpp.html#a6913f43c820ecbf6076c31d40598b7ee">gVecSize</a>;
<a name="l00030"></a>00030 <span class="keyword">extern</span> <span class="keywordtype">bool</span> <a class="code" href="compile__scal_8cpp.html#aed8da6f8f23ca426bf3ea6564e0bd6f2">gSchedulerSwitch</a>;
<a name="l00031"></a>00031 
<a name="l00032"></a><a class="code" href="classVectorCompiler.html#aed983c23776dfd40264a14ee750f2c4c">00032</a> <span class="keywordtype">void</span> <a class="code" href="classVectorCompiler.html#aed983c23776dfd40264a14ee750f2c4c">VectorCompiler::compileMultiSignal</a> (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> L)
<a name="l00033"></a>00033 {
<a name="l00034"></a>00034     <span class="comment">//contextor recursivness(0);</span>
<a name="l00035"></a>00035     L = <a class="code" href="classScalarCompiler.html#a7144aea17822337a175d660cd6def014">prepare</a>(L);     <span class="comment">// optimize, share and annotate expression</span>
<a name="l00036"></a>00036     
<a name="l00037"></a>00037     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#ae4a8930e2604b74416905dc1830c2bb1">inputs</a>(); i++) {
<a name="l00038"></a>00038         <span class="keywordflow">if</span> (<a class="code" href="compile__scal_8cpp.html#aed8da6f8f23ca426bf3ea6564e0bd6f2">gSchedulerSwitch</a>) {
<a name="l00039"></a>00039             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a368fbe339be25ff39dcddd984e2c6342">addZone3</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$1* input$0 = &amp;input[$0][fIndex];&quot;</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>()));
<a name="l00040"></a>00040         } <span class="keywordflow">else</span> {
<a name="l00041"></a>00041             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a368fbe339be25ff39dcddd984e2c6342">addZone3</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$1* input$0 = &amp;input[$0][index];&quot;</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>()));
<a name="l00042"></a>00042         }
<a name="l00043"></a>00043     }
<a name="l00044"></a>00044     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a7050eb78afb74764622f1b6140297dd4">outputs</a>(); i++) {
<a name="l00045"></a>00045         <span class="keywordflow">if</span> (<a class="code" href="compile__scal_8cpp.html#aed8da6f8f23ca426bf3ea6564e0bd6f2">gSchedulerSwitch</a>) {
<a name="l00046"></a>00046             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a368fbe339be25ff39dcddd984e2c6342">addZone3</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$1* output$0 = &amp;output[$0][fIndex];&quot;</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>()));
<a name="l00047"></a>00047         } <span class="keywordflow">else</span> {
<a name="l00048"></a>00048             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a368fbe339be25ff39dcddd984e2c6342">addZone3</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$1* output$0 = &amp;output[$0][index];&quot;</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>()));
<a name="l00049"></a>00049         }
<a name="l00050"></a>00050     }
<a name="l00051"></a>00051                 
<a name="l00052"></a>00052     <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a9cbf32b697f222569fa953a740c0eb4c">addSharedDecl</a>(<span class="stringliteral">&quot;fullcount&quot;</span>); 
<a name="l00053"></a>00053     <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a9cbf32b697f222569fa953a740c0eb4c">addSharedDecl</a>(<span class="stringliteral">&quot;input&quot;</span>); 
<a name="l00054"></a>00054     <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a9cbf32b697f222569fa953a740c0eb4c">addSharedDecl</a>(<span class="stringliteral">&quot;output&quot;</span>); 
<a name="l00055"></a>00055     
<a name="l00056"></a>00056     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; <a class="code" href="list_8hh.html#a8bdd73641276e0c0f999f504348eacc1">isList</a>(L); L = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(L), i++) {
<a name="l00057"></a>00057         <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig = <a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(L);
<a name="l00058"></a>00058         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a393c343f0a6fe7d0cf16d6e91f243398" title="Open a non-recursive loop on top of the stack of open loops.">openLoop</a>(<span class="stringliteral">&quot;count&quot;</span>);
<a name="l00059"></a>00059         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;output$0[i] = $2$1;&quot;</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="classVectorCompiler.html#a00dc47a1dd180a4c2a36494a5e9d0273" title="Compile a signal.">CS</a>(sig), <a class="code" href="floats_8cpp.html#a73d3935ab38244e8006fbaa2b7caf33c">xcast</a>()));
<a name="l00060"></a>00060         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4d19081c50e9ce7300f9b220df6fce76" title="Close the top loop and either keep it or absorb it within its enclosing loop.">closeLoop</a>();
<a name="l00061"></a>00061     }
<a name="l00062"></a>00062     
<a name="l00063"></a>00063     <span class="keywordflow">if</span> (<a class="code" href="compile__scal_8cpp.html#aed8da6f8f23ca426bf3ea6564e0bd6f2">gSchedulerSwitch</a>) {
<a name="l00064"></a>00064         <span class="comment">// Build tasks list </span>
<a name="l00065"></a>00065         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a0019dbeefbadbcb850c742e257508722">buildTasksList</a>();
<a name="l00066"></a>00066     }
<a name="l00067"></a>00067     
<a name="l00068"></a>00068     <a class="code" href="classCompiler.html#ae994f402a26a38796eab173a1028804e" title="Generate buildUserInterface C++ lines of code corresponding to user interface element...">generateUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>));
<a name="l00069"></a>00069     <a class="code" href="classCompiler.html#a83bb12b7d930bd1b574e35202f5d3da6" title="Generate user interface macros corresponding to user interface element t.">generateMacroInterfaceTree</a>(<span class="stringliteral">&quot;&quot;</span>, <a class="code" href="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>));
<a name="l00070"></a>00070     <span class="keywordflow">if</span> (<a class="code" href="classCompiler.html#a8a23c67dd7d72d5aa6353d29de84b711">fDescription</a>) {
<a name="l00071"></a>00071         <a class="code" href="classCompiler.html#a8a23c67dd7d72d5aa6353d29de84b711">fDescription</a>-&gt;<a class="code" href="classDescription.html#a7b97643d00e0cc786355a696cac2bcba">ui</a>(<a class="code" href="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>));
<a name="l00072"></a>00072     }
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00081"></a><a class="code" href="classVectorCompiler.html#a00dc47a1dd180a4c2a36494a5e9d0273">00081</a> <span class="keywordtype">string</span>  <a class="code" href="classVectorCompiler.html#a00dc47a1dd180a4c2a36494a5e9d0273" title="Compile a signal.">VectorCompiler::CS</a> (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig)
<a name="l00082"></a>00082 {
<a name="l00083"></a>00083     <span class="keywordtype">int</span>         i;
<a name="l00084"></a>00084     <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a>        x;
<a name="l00085"></a>00085     <span class="keywordtype">string</span>      code;
<a name="l00086"></a>00086 
<a name="l00087"></a>00087     <span class="keywordflow">if</span> (!<a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4" title="Test if a signal is already compiled.">getCompiledExpression</a>(sig, code)) {
<a name="l00088"></a>00088         code = <a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59" title="Compile a signal.">generateCode</a>(sig);
<a name="l00089"></a>00089         <span class="comment">//cerr &lt;&lt; &quot;CS : &quot; &lt;&lt; code &lt;&lt; &quot; for &quot; &lt;&lt; ppsig(sig) &lt;&lt; endl;</span>
<a name="l00090"></a>00090         <a class="code" href="classScalarCompiler.html#a47e098af6e5857d4577371e459cd6df4" title="Set the string of a compiled expression is already compiled.">setCompiledExpression</a>(sig, code);
<a name="l00091"></a>00091     } <span class="keywordflow">else</span> {
<a name="l00092"></a>00092         <span class="comment">// check for recursive dependencies</span>
<a name="l00093"></a>00093         <a class="code" href="structLoop.html">Loop</a>*   ls;
<a name="l00094"></a>00094         <a class="code" href="structLoop.html">Loop</a>*   <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a> = <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a7460f9d1e2ad11be5abc9acdbbbf0277">topLoop</a>();
<a name="l00095"></a>00095         <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a9b54e9177bb3726e06700649c3e5c05d">isProj</a>(sig, &amp;i, x) &amp;&amp; tl-&gt;<a class="code" href="structLoop.html#a9e74faad0e7d3bb55619d3d90203219b" title="indicates a dependency with an enclosing loop">findRecDefinition</a>(x)) {
<a name="l00096"></a>00096             tl-&gt;<a class="code" href="structLoop.html#a9412652d16b9aaa7ca21541cc0aa0229" title="Check for a recursive dependecy and add it if needed.">addRecDependency</a>(x);
<a name="l00097"></a>00097         } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a8e1da4c0525a993e38749160f3fc2aa5" title="Returns the loop used to compute a signal.">getLoopProperty</a>(sig,ls)) {
<a name="l00098"></a>00098             <span class="comment">//cerr &lt;&lt; &quot;in CS : fBackwardLoopDependencies.insert : &quot; &lt;&lt; tl &lt;&lt; &quot; --dependson--&gt; &quot; &lt;&lt; ls &lt;&lt; endl;</span>
<a name="l00099"></a>00099             tl-&gt;<a class="code" href="structLoop.html#a73f599daabab6c3669355713ca914e83" title="Loops that must be computed before this one.">fBackwardLoopDependencies</a>.insert(ls);
<a name="l00100"></a>00100         } <span class="keywordflow">else</span> {
<a name="l00101"></a>00101            <span class="comment">//cerr &lt;&lt; &quot;in CS :  no loop property for : &quot; &lt;&lt; ppsig(sig) &lt;&lt; endl;</span>
<a name="l00102"></a>00102 
<a name="l00103"></a>00103         }
<a name="l00104"></a>00104     }
<a name="l00105"></a>00105     <span class="keywordflow">return</span> code;
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00113"></a><a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59">00113</a> <span class="keywordtype">string</span> <a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59" title="Compile a signal.">VectorCompiler::generateCode</a> (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig)
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115     <span class="keywordtype">int</span>     i;
<a name="l00116"></a>00116     <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a>    x;
<a name="l00117"></a>00117     <a class="code" href="structLoop.html">Loop</a>*   l;
<a name="l00118"></a>00118 
<a name="l00119"></a>00119     l = <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a7460f9d1e2ad11be5abc9acdbbbf0277">topLoop</a>();
<a name="l00120"></a>00120     assert(l);
<a name="l00121"></a>00121 
<a name="l00122"></a>00122     <span class="keywordflow">if</span> (<a class="code" href="classVectorCompiler.html#a41f6414f75499ea54aafb110c3b203b4" title="Test if a signal need to be compiled in a separate loop.">needSeparateLoop</a>(sig)) {
<a name="l00123"></a>00123         <span class="comment">// we need a separate loop unless it&#39;s an old recursion</span>
<a name="l00124"></a>00124         <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a9b54e9177bb3726e06700649c3e5c05d">isProj</a>(sig, &amp;i, x)) {
<a name="l00125"></a>00125             <span class="comment">// projection of a recursive group x</span>
<a name="l00126"></a>00126             <span class="keywordflow">if</span> (l-&gt;<a class="code" href="structLoop.html#a9e74faad0e7d3bb55619d3d90203219b" title="indicates a dependency with an enclosing loop">findRecDefinition</a>(x)) {
<a name="l00127"></a>00127                 <span class="comment">// x is already in the loop stack</span>
<a name="l00128"></a>00128                 l-&gt;<a class="code" href="structLoop.html#a9412652d16b9aaa7ca21541cc0aa0229" title="Check for a recursive dependecy and add it if needed.">addRecDependency</a>(x);
<a name="l00129"></a>00129                 <span class="keywordflow">return</span> <a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59" title="Compile a signal.">ScalarCompiler::generateCode</a>(sig);
<a name="l00130"></a>00130             } <span class="keywordflow">else</span> {
<a name="l00131"></a>00131                 <span class="comment">// x must be defined</span>
<a name="l00132"></a>00132                 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a393c343f0a6fe7d0cf16d6e91f243398" title="Open a non-recursive loop on top of the stack of open loops.">openLoop</a>(x, <span class="stringliteral">&quot;count&quot;</span>);
<a name="l00133"></a>00133                 <span class="keywordtype">string</span> c = <a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59" title="Compile a signal.">ScalarCompiler::generateCode</a>(sig);
<a name="l00134"></a>00134                 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4d19081c50e9ce7300f9b220df6fce76" title="Close the top loop and either keep it or absorb it within its enclosing loop.">closeLoop</a>(sig);
<a name="l00135"></a>00135                 <span class="keywordflow">return</span> c;
<a name="l00136"></a>00136             }
<a name="l00137"></a>00137         } <span class="keywordflow">else</span> {
<a name="l00138"></a>00138             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a393c343f0a6fe7d0cf16d6e91f243398" title="Open a non-recursive loop on top of the stack of open loops.">openLoop</a>(<span class="stringliteral">&quot;count&quot;</span>);
<a name="l00139"></a>00139             <span class="keywordtype">string</span> c = <a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59" title="Compile a signal.">ScalarCompiler::generateCode</a>(sig);
<a name="l00140"></a>00140             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4d19081c50e9ce7300f9b220df6fce76" title="Close the top loop and either keep it or absorb it within its enclosing loop.">closeLoop</a>(sig);
<a name="l00141"></a>00141             <span class="keywordflow">return</span> c;
<a name="l00142"></a>00142         }
<a name="l00143"></a>00143     } <span class="keywordflow">else</span> {
<a name="l00144"></a>00144         <span class="keywordflow">return</span> <a class="code" href="classVectorCompiler.html#af8918246b8ae134504d606b1ee65da59" title="Compile a signal.">ScalarCompiler::generateCode</a>(sig);
<a name="l00145"></a>00145     }
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147 
<a name="l00148"></a>00148 
<a name="l00155"></a><a class="code" href="classVectorCompiler.html#a446965617480f2c52ad9cc6e474395bb">00155</a> <span class="keywordtype">string</span> <a class="code" href="classVectorCompiler.html#a446965617480f2c52ad9cc6e474395bb" title="Generate cache code for a signal if needed.">VectorCompiler::generateCacheCode</a>(<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; exp)
<a name="l00156"></a>00156 {
<a name="l00157"></a>00157     <span class="keywordtype">string</span>      vname, ctype;
<a name="l00158"></a>00158     <span class="keywordtype">int</span>         sharing = <a class="code" href="classScalarCompiler.html#a7bf169572df60b9383297d85f36e2506">getSharingCount</a>(sig);
<a name="l00159"></a>00159     <a class="code" href="classP.html">Type</a>        t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig);
<a name="l00160"></a>00160     <a class="code" href="classOccurences.html">Occurences</a>* o = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(sig);
<a name="l00161"></a>00161     <span class="keywordtype">int</span>         d = o-&gt;<a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>();
<a name="l00162"></a>00162 
<a name="l00163"></a>00163     <span class="keywordflow">if</span> (t-&gt;variability() &lt; <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a>) {
<a name="l00164"></a>00164         <span class="keywordflow">if</span> (d==0) {
<a name="l00165"></a>00165             <span class="comment">// non-sample, not delayed : same as scalar cache</span>
<a name="l00166"></a>00166             <span class="keywordflow">return</span> <a class="code" href="classVectorCompiler.html#a446965617480f2c52ad9cc6e474395bb" title="Generate cache code for a signal if needed.">ScalarCompiler::generateCacheCode</a>(sig,exp);
<a name="l00167"></a>00167 
<a name="l00168"></a>00168         } <span class="keywordflow">else</span> {
<a name="l00169"></a>00169             <span class="comment">// it is a non-sample but used delayed</span>
<a name="l00170"></a>00170             <span class="comment">// we need a delay line</span>
<a name="l00171"></a>00171             <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">&quot;Xec&quot;</span>, ctype, vname);
<a name="l00172"></a>00172             <a class="code" href="classVectorCompiler.html#a4a78b541b4c01df34c128aff55489675" title="Generate code for the delay mecchanism without using temporary variables.">generateDelayLine</a>(ctype, vname, d, exp);
<a name="l00173"></a>00173             <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(sig, vname);
<a name="l00174"></a>00174             <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a3dfe37829af796260959bedfc9ca5c08" title="Test if exp is very simple that is it can&amp;#39;t be considered a real component.">verySimple</a>(sig)) {
<a name="l00175"></a>00175                 <span class="keywordflow">return</span> exp;
<a name="l00176"></a>00176             } <span class="keywordflow">else</span> {
<a name="l00177"></a>00177                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vname);
<a name="l00178"></a>00178             }
<a name="l00179"></a>00179         }
<a name="l00180"></a>00180     } <span class="keywordflow">else</span> {
<a name="l00181"></a>00181         <span class="comment">// sample-rate signal</span>
<a name="l00182"></a>00182         <span class="keywordflow">if</span> (d &gt; 0) {
<a name="l00183"></a>00183             <span class="comment">// used delayed : we need a delay line</span>
<a name="l00184"></a>00184             <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">&quot;Yec&quot;</span>, ctype, vname);
<a name="l00185"></a>00185             <a class="code" href="classVectorCompiler.html#a4a78b541b4c01df34c128aff55489675" title="Generate code for the delay mecchanism without using temporary variables.">generateDelayLine</a>(ctype, vname, d, exp);
<a name="l00186"></a>00186             <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(sig, vname);
<a name="l00187"></a>00187 
<a name="l00188"></a>00188             <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a3dfe37829af796260959bedfc9ca5c08" title="Test if exp is very simple that is it can&amp;#39;t be considered a real component.">verySimple</a>(sig)) {
<a name="l00189"></a>00189                 <span class="keywordflow">return</span> exp;
<a name="l00190"></a>00190             } <span class="keywordflow">else</span> {
<a name="l00191"></a>00191                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vname);
<a name="l00192"></a>00192             }
<a name="l00193"></a>00193         } <span class="keywordflow">else</span> {
<a name="l00194"></a>00194             <span class="comment">// not delayed</span>
<a name="l00195"></a>00195             <span class="keywordflow">if</span> ( sharing &gt; 1 &amp;&amp; ! <a class="code" href="signals_8cpp.html#a3dfe37829af796260959bedfc9ca5c08" title="Test if exp is very simple that is it can&amp;#39;t be considered a real component.">verySimple</a>(sig) ) {
<a name="l00196"></a>00196                 <span class="comment">// shared and not simple : we need a vector</span>
<a name="l00197"></a>00197                <span class="comment">// cerr &lt;&lt; &quot;ZEC : &quot; &lt;&lt; ppsig(sig) &lt;&lt; endl;</span>
<a name="l00198"></a>00198                 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">&quot;Zec&quot;</span>, ctype, vname);
<a name="l00199"></a>00199                 <a class="code" href="classVectorCompiler.html#a4a78b541b4c01df34c128aff55489675" title="Generate code for the delay mecchanism without using temporary variables.">generateDelayLine</a>(ctype, vname, d, exp);
<a name="l00200"></a>00200                 <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(sig, vname);
<a name="l00201"></a>00201                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vname);
<a name="l00202"></a>00202            } <span class="keywordflow">else</span> {
<a name="l00203"></a>00203                 <span class="comment">// not shared or simple : no cache needed</span>
<a name="l00204"></a>00204                 <span class="keywordflow">return</span> exp;
<a name="l00205"></a>00205             }
<a name="l00206"></a>00206         }
<a name="l00207"></a>00207     }
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209 
<a name="l00210"></a>00210 
<a name="l00211"></a>00211 
<a name="l00212"></a>00212 
<a name="l00218"></a><a class="code" href="classVectorCompiler.html#a41f6414f75499ea54aafb110c3b203b4">00218</a> <span class="keywordtype">bool</span> <a class="code" href="classVectorCompiler.html#a41f6414f75499ea54aafb110c3b203b4" title="Test if a signal need to be compiled in a separate loop.">VectorCompiler::needSeparateLoop</a>(<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig)
<a name="l00219"></a>00219 {
<a name="l00220"></a>00220     <a class="code" href="classOccurences.html">Occurences</a>* o = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(sig);
<a name="l00221"></a>00221     <a class="code" href="classP.html">Type</a>        t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig);
<a name="l00222"></a>00222     <span class="keywordtype">int</span>         c = <a class="code" href="classScalarCompiler.html#a7bf169572df60b9383297d85f36e2506">getSharingCount</a>(sig);
<a name="l00223"></a>00223     <span class="keywordtype">bool</span>        b;
<a name="l00224"></a>00224 
<a name="l00225"></a>00225     <span class="keywordtype">int</span>         i;
<a name="l00226"></a>00226     <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a>        x,y;
<a name="l00227"></a>00227 
<a name="l00228"></a>00228 
<a name="l00229"></a>00229     <span class="keywordflow">if</span> (o-&gt;<a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()&gt;0) {
<a name="l00230"></a>00230         <span class="comment">//cerr &lt;&lt; &quot;DLY &quot;; // delayed expressions require a separate loop</span>
<a name="l00231"></a>00231         b = <span class="keyword">true</span>;
<a name="l00232"></a>00232     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a3dfe37829af796260959bedfc9ca5c08" title="Test if exp is very simple that is it can&amp;#39;t be considered a real component.">verySimple</a>(sig) || t-&gt;variability()&lt;<a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a>) {
<a name="l00233"></a>00233         b = <span class="keyword">false</span>;      <span class="comment">// non sample computation never require a loop</span>
<a name="l00234"></a>00234     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#af55cdefee258834b3b8f6c070d4970c9">isSigFixDelay</a>(sig, x, y)) {
<a name="l00235"></a>00235         b = <span class="keyword">false</span>;      <span class="comment">// </span>
<a name="l00236"></a>00236     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a9b54e9177bb3726e06700649c3e5c05d">isProj</a>(sig, &amp;i ,x)) {
<a name="l00237"></a>00237         <span class="comment">//cerr &lt;&lt; &quot;REC &quot;; // recursive expressions require a separate loop</span>
<a name="l00238"></a>00238         b = <span class="keyword">true</span>;
<a name="l00239"></a>00239     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &gt; 1) {
<a name="l00240"></a>00240         <span class="comment">//cerr &lt;&lt; &quot;SHA(&quot; &lt;&lt; c &lt;&lt; &quot;) &quot;; // expressions used several times required a separate loop</span>
<a name="l00241"></a>00241         b = <span class="keyword">true</span>;
<a name="l00242"></a>00242     } <span class="keywordflow">else</span> {
<a name="l00243"></a>00243         <span class="comment">// sample expressions that are not recursive, not delayed</span>
<a name="l00244"></a>00244         <span class="comment">// and not shared, doesn&#39;t require a separate loop.</span>
<a name="l00245"></a>00245         b = <span class="keyword">false</span>;
<a name="l00246"></a>00246     }
<a name="l00247"></a>00247 <span class="comment">/*    if (b) {</span>
<a name="l00248"></a>00248 <span class="comment">        cerr &lt;&lt; &quot;Separate Loop for &quot; &lt;&lt; ppsig(sig) &lt;&lt; endl;</span>
<a name="l00249"></a>00249 <span class="comment">    } else {</span>
<a name="l00250"></a>00250 <span class="comment">        cerr &lt;&lt; &quot;Same Loop for &quot; &lt;&lt; ppsig(sig) &lt;&lt; endl;</span>
<a name="l00251"></a>00251 <span class="comment">    }*/</span>
<a name="l00252"></a>00252     <span class="keywordflow">return</span> b;
<a name="l00253"></a>00253 }
<a name="l00254"></a>00254 
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 
<a name="l00257"></a>00257 
<a name="l00258"></a><a class="code" href="classVectorCompiler.html#a4a78b541b4c01df34c128aff55489675">00258</a> <span class="keywordtype">void</span> <a class="code" href="classVectorCompiler.html#a4a78b541b4c01df34c128aff55489675" title="Generate code for the delay mecchanism without using temporary variables.">VectorCompiler::generateDelayLine</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; ctype, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; vname, <span class="keywordtype">int</span> mxd, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; exp)
<a name="l00259"></a>00259 {
<a name="l00260"></a>00260     <span class="keywordflow">if</span> (mxd == 0) {
<a name="l00261"></a>00261         <a class="code" href="delayline_8cpp.html#a4105777e2d8b59892f42b9a157002e9e" title="Generate the code for a (short) delay line.">vectorLoop</a>(<a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>, ctype, vname, exp);
<a name="l00262"></a>00262     } <span class="keywordflow">else</span> {
<a name="l00263"></a>00263         <a class="code" href="delayline_8cpp.html#aeeff01069783bf9c6ec3f18fda583a42" title="Generate the code for a (short) delay line.">dlineLoop</a>(<a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>, ctype, vname, mxd, exp);
<a name="l00264"></a>00264     }
<a name="l00265"></a>00265 }
<a name="l00266"></a>00266 
<a name="l00267"></a>00267 
<a name="l00268"></a><a class="code" href="classVectorCompiler.html#a37bb71786922656262d3452a85e12c9d">00268</a> <span class="keywordtype">string</span> <a class="code" href="classVectorCompiler.html#a37bb71786922656262d3452a85e12c9d">VectorCompiler::generateVariableStore</a>(<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; exp)
<a name="l00269"></a>00269 {
<a name="l00270"></a>00270     <a class="code" href="classP.html">Type</a>        t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig);
<a name="l00271"></a>00271 
<a name="l00272"></a>00272     <span class="keywordflow">if</span> (<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig)-&gt;variability() == <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a>) {
<a name="l00273"></a>00273         <span class="keywordtype">string</span>      vname, ctype;
<a name="l00274"></a>00274         <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(t, <span class="stringliteral">&quot;Vector&quot;</span>, ctype, vname);
<a name="l00275"></a>00275         <a class="code" href="delayline_8cpp.html#a4105777e2d8b59892f42b9a157002e9e" title="Generate the code for a (short) delay line.">vectorLoop</a>(<a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>, ctype, vname, exp);
<a name="l00276"></a>00276         <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vname);
<a name="l00277"></a>00277     } <span class="keywordflow">else</span> {
<a name="l00278"></a>00278         <span class="keywordflow">return</span> <a class="code" href="classVectorCompiler.html#a37bb71786922656262d3452a85e12c9d">ScalarCompiler::generateVariableStore</a>(sig, exp);
<a name="l00279"></a>00279     }
<a name="l00280"></a>00280 }
<a name="l00281"></a>00281 
<a name="l00282"></a>00282 
<a name="l00288"></a><a class="code" href="classVectorCompiler.html#a38318c939418370575a9b49707109655">00288</a> <span class="keywordtype">string</span> <a class="code" href="classVectorCompiler.html#a38318c939418370575a9b49707109655" title="Generate code for accessing a delayed signal.">VectorCompiler::generateFixDelay</a> (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig, <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> exp, <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> delay)
<a name="l00289"></a>00289 {
<a name="l00290"></a>00290     <span class="keywordtype">int</span>     mxd, d; 
<a name="l00291"></a>00291     <span class="keywordtype">string</span>  vecname;
<a name="l00292"></a>00292  
<a name="l00293"></a>00293     <span class="comment">//cerr &lt;&lt; &quot;VectorCompiler::generateFixDelay &quot; &lt;&lt; ppsig(sig) &lt;&lt; endl;</span>
<a name="l00294"></a>00294 
<a name="l00295"></a>00295     <a class="code" href="classVectorCompiler.html#a00dc47a1dd180a4c2a36494a5e9d0273" title="Compile a signal.">CS</a>(exp); <span class="comment">// ensure exp is compiled to have a vector name</span>
<a name="l00296"></a>00296 
<a name="l00297"></a>00297     mxd = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(exp)-&gt;<a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>();
<a name="l00298"></a>00298 
<a name="l00299"></a>00299     <span class="keywordflow">if</span> (! <a class="code" href="classScalarCompiler.html#a12cd9487cf729b06cbece49552bc632e" title="Get the vector name property of a signal, the name of the vector used to store the...">getVectorNameProperty</a>(exp, vecname)) {
<a name="l00300"></a>00300         cerr &lt;&lt; <span class="stringliteral">&quot;no vector name for &quot;</span> &lt;&lt; <a class="code" href="classppsig.html">ppsig</a>(exp) &lt;&lt; endl;
<a name="l00301"></a>00301         exit(1);
<a name="l00302"></a>00302     }
<a name="l00303"></a>00303 
<a name="l00304"></a>00304     <span class="keywordflow">if</span> (mxd == 0) {
<a name="l00305"></a>00305         <span class="comment">// not a real vector name but a scalar name</span>
<a name="l00306"></a>00306         <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vecname);
<a name="l00307"></a>00307 
<a name="l00308"></a>00308     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mxd &lt; <a class="code" href="doc__compile_8cpp.html#a278e0cda879c0108aff047853ab0214c">gMaxCopyDelay</a>){
<a name="l00309"></a>00309         <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(delay, &amp;d)) {
<a name="l00310"></a>00310             <span class="keywordflow">if</span> (d == 0) {
<a name="l00311"></a>00311                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vecname);
<a name="l00312"></a>00312             } <span class="keywordflow">else</span> {
<a name="l00313"></a>00313                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i-$1]&quot;</span>, vecname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(d));
<a name="l00314"></a>00314             }
<a name="l00315"></a>00315         } <span class="keywordflow">else</span> {
<a name="l00316"></a>00316             <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i-$1]&quot;</span>, vecname, <a class="code" href="classVectorCompiler.html#a00dc47a1dd180a4c2a36494a5e9d0273" title="Compile a signal.">CS</a>(delay));
<a name="l00317"></a>00317         }
<a name="l00318"></a>00318 
<a name="l00319"></a>00319     } <span class="keywordflow">else</span> {
<a name="l00320"></a>00320 
<a name="l00321"></a>00321         <span class="comment">// long delay : we use a ring buffer of size 2^x</span>
<a name="l00322"></a>00322         <span class="keywordtype">int</span>     N   = <a class="code" href="classScalarCompiler.html#ad2a7768ff9ad2157f15a11686fe70366" title="Compute the minimal power of 2 greater than x.">pow2limit</a>( mxd+<a class="code" href="compile__vect_8cpp.html#a6913f43c820ecbf6076c31d40598b7ee">gVecSize</a> );
<a name="l00323"></a>00323 
<a name="l00324"></a>00324         <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(delay, &amp;d)) {
<a name="l00325"></a>00325             <span class="keywordflow">if</span> (d == 0) {
<a name="l00326"></a>00326                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[($0_idx+i)&amp;$1]&quot;</span>, vecname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1));
<a name="l00327"></a>00327             } <span class="keywordflow">else</span> {
<a name="l00328"></a>00328                 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[($0_idx+i-$2)&amp;$1]&quot;</span>, vecname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1), <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(d));
<a name="l00329"></a>00329             }
<a name="l00330"></a>00330         } <span class="keywordflow">else</span> {
<a name="l00331"></a>00331             <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[($0_idx+i-$2)&amp;$1]&quot;</span>, vecname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1), <a class="code" href="classVectorCompiler.html#a00dc47a1dd180a4c2a36494a5e9d0273" title="Compile a signal.">CS</a>(delay));
<a name="l00332"></a>00332         }
<a name="l00333"></a>00333     }
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336 
<a name="l00342"></a><a class="code" href="classVectorCompiler.html#a905e49bf887c9689e72ab0bb73afbb80">00342</a> <span class="keywordtype">string</span> <a class="code" href="classVectorCompiler.html#a905e49bf887c9689e72ab0bb73afbb80" title="Generate code for the delay mecchanism.">VectorCompiler::generateDelayVec</a>(<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; exp, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; ctype, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; vname, <span class="keywordtype">int</span> mxd)
<a name="l00343"></a>00343 {
<a name="l00344"></a>00344     <span class="comment">// it is a non-sample but used delayed</span>
<a name="l00345"></a>00345     <span class="comment">// we need a delay line</span>
<a name="l00346"></a>00346     <a class="code" href="classVectorCompiler.html#a4a78b541b4c01df34c128aff55489675" title="Generate code for the delay mecchanism without using temporary variables.">generateDelayLine</a>(ctype, vname, mxd, exp);
<a name="l00347"></a>00347     <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(sig, vname);
<a name="l00348"></a>00348     <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a3dfe37829af796260959bedfc9ca5c08" title="Test if exp is very simple that is it can&amp;#39;t be considered a real component.">verySimple</a>(sig)) {
<a name="l00349"></a>00349         <span class="keywordflow">return</span> exp;
<a name="l00350"></a>00350     } <span class="keywordflow">else</span> {
<a name="l00351"></a>00351         <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0[i]&quot;</span>, vname);
<a name="l00352"></a>00352     }
<a name="l00353"></a>00353 }
<a name="l00354"></a>00354 
<a name="l00355"></a>00355 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Apr 28 23:59:58 2010 for FAUST compiler by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>