Sophie

Sophie

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

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: shlysis.cpp File Reference</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>
</div>
<div class="contents">
<h1>shlysis.cpp File Reference</h1>
<p>The sharing analysis of tree t is the annotation of all its subtrees t' with their number of occurences in t.  
<a href="#_details">More...</a></p>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="shlysis_8hh_source.html">shlysis.hh</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="compatibility_8hh_source.html">compatibility.hh</a>&quot;</code><br/>
<div class="dynheader">
Include dependency graph for shlysis.cpp:</div>
<div class="dynsection">
</div>

<p><a href="shlysis_8cpp_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="shlysis_8cpp.html#a827cae6cc8102ab89e60ae2996fbdbf4">shprkey</a> (<a class="el" href="classCTree.html">Tree</a> t)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a specific property key for the sharing count of subtrees of t.  <a href="#a827cae6cc8102ab89e60ae2996fbdbf4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="shlysis_8cpp.html#a501f0b3e93e8aebc9264835ee051859d">shcount</a> (<a class="el" href="classCTree.html">Tree</a> key, <a class="el" href="classCTree.html">Tree</a> t)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the value of sharing count or 0.  <a href="#a501f0b3e93e8aebc9264835ee051859d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="shlysis_8cpp.html#a69b22f836f822d8296ca9f3061029e2a">annotate</a> (<a class="el" href="classCTree.html">Tree</a> k, <a class="el" href="classCTree.html">Tree</a> t, <a class="el" href="shlysis_8hh.html#ab9939aac687344648c82a67abb6e57dc">barrier</a> foo)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Recursively increment the occurences count of t and its subtrees.  <a href="#a69b22f836f822d8296ca9f3061029e2a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="shlysis_8cpp.html#a3ed5bd7932722816a2420ec5614f0e1d">nobarrier</a> (const <a class="el" href="classCTree.html">Tree</a> &amp;t)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="shlysis_8cpp.html#a8146485be597a95467cfba6f56ff78c6">shlysis</a> (<a class="el" href="classCTree.html">Tree</a> t, <a class="el" href="shlysis_8hh.html#ab9939aac687344648c82a67abb6e57dc">barrier</a> foo)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Do a sharing analysis : annotates all the subtrees of t with there occurences.  <a href="#a8146485be597a95467cfba6f56ff78c6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="shlysis_8cpp.html#a315ed9d9d7d552741763dc18ec6dcb04">shlysis</a> (<a class="el" href="classCTree.html">Tree</a> t)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Do a sharing analysis : annotates all the subtrees of t with there occurences.  <a href="#a315ed9d9d7d552741763dc18ec6dcb04"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>The sharing analysis of tree t is the annotation of all its subtrees t' with their number of occurences in t. </p>
<p>As this annotation of t' depends of a context (the tree t for which t' is a subtree) a specific property key unique to each sharing analysis must be generated. </p>

<p>Definition in file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a69b22f836f822d8296ca9f3061029e2a"></a><!-- doxytag: member="shlysis.cpp::annotate" ref="a69b22f836f822d8296ca9f3061029e2a" args="(Tree k, Tree t, barrier foo)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void annotate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>t</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="shlysis_8hh.html#ab9939aac687344648c82a67abb6e57dc">barrier</a>&nbsp;</td>
          <td class="paramname"> <em>foo</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Recursively increment the occurences count of t and its subtrees. </p>

<p>Definition at line <a class="el" href="shlysis_8cpp_source.html#l00129">129</a> of file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>

<p>References <a class="el" href="tree_8hh_source.html#l00142">CTree::arity()</a>, <a class="el" href="tree_8hh_source.html#l00143">CTree::branch()</a>, <a class="el" href="recursive-tree_8cpp_source.html#l00059">isRec()</a>, <a class="el" href="list_8cpp_source.html#l00418">setProperty()</a>, <a class="el" href="shlysis_8cpp_source.html#l00081">shcount()</a>, and <a class="el" href="tree_8hh_source.html#l00173">tree()</a>.</p>

<p>Referenced by <a class="el" href="shlysis_8cpp_source.html#l00105">shlysis()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00130"></a>00130 {
<a name="l00131"></a>00131     cerr &lt;&lt; <span class="stringliteral">&quot;Annotate &quot;</span> &lt;&lt; *t &lt;&lt; endl;
<a name="l00132"></a>00132     <span class="keywordtype">int</span> c = <a class="code" href="shlysis_8cpp.html#a501f0b3e93e8aebc9264835ee051859d" title="Return the value of sharing count or 0.">shcount</a>(k,t);
<a name="l00133"></a>00133     <span class="keywordflow">if</span> (c==0) {
<a name="l00134"></a>00134         <span class="comment">// First visit</span>
<a name="l00135"></a>00135         <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> var, body;
<a name="l00136"></a>00136         <span class="keywordflow">if</span> (<a class="code" href="recursive-tree_8cpp.html#a4cb44c6e41e21da830e748dc35f16ba5" title="is t a de Bruijn recursive tree">isRec</a>(t, var, body)) {
<a name="l00137"></a>00137             <span class="comment">// special case for recursive trees</span>
<a name="l00138"></a>00138             <a class="code" href="list_8cpp.html#a5ead5a3e91af18d8f94e0974990a3c5a">setProperty</a>(t, k, <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(1));
<a name="l00139"></a>00139             <a class="code" href="shlysis_8cpp.html#a69b22f836f822d8296ca9f3061029e2a" title="Recursively increment the occurences count of t and its subtrees.">annotate</a>(k, body, foo);
<a name="l00140"></a>00140             <span class="keywordflow">return</span>;
<a name="l00141"></a>00141         } <span class="keywordflow">else</span> {
<a name="l00142"></a>00142             <span class="keywordtype">int</span> n = t-&gt;<a class="code" href="classCTree.html#a68f2be5e845407bc956a2893fe6f0d03" title="return the number of branches (subtrees) of a tree">arity</a>();
<a name="l00143"></a>00143             <span class="keywordflow">if</span> (n&gt;0 &amp;&amp; ! foo(t)) {
<a name="l00144"></a>00144                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;n; i++) <a class="code" href="shlysis_8cpp.html#a69b22f836f822d8296ca9f3061029e2a" title="Recursively increment the occurences count of t and its subtrees.">annotate</a>(k, t-&gt;<a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(i), foo);
<a name="l00145"></a>00145             }
<a name="l00146"></a>00146         }
<a name="l00147"></a>00147     } <span class="keywordflow">else</span> {
<a name="l00148"></a>00148         <span class="comment">//printf(&quot; annotate %p with %d\n&quot;, (CTree*)t, c+1);</span>
<a name="l00149"></a>00149     }
<a name="l00150"></a>00150     <a class="code" href="list_8cpp.html#a5ead5a3e91af18d8f94e0974990a3c5a">setProperty</a>(t, k, <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(c+1));
<a name="l00151"></a>00151 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a3ed5bd7932722816a2420ec5614f0e1d"></a><!-- doxytag: member="shlysis.cpp::nobarrier" ref="a3ed5bd7932722816a2420ec5614f0e1d" args="(const Tree &amp;t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static bool nobarrier </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classCTree.html">Tree</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>t</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="shlysis_8cpp_source.html#l00099">99</a> of file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>

<p>Referenced by <a class="el" href="shlysis_8cpp_source.html#l00117">shlysis()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00099"></a>00099 { <span class="keywordflow">return</span> <span class="keyword">false</span>; }
</pre></div></p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a501f0b3e93e8aebc9264835ee051859d"></a><!-- doxytag: member="shlysis.cpp::shcount" ref="a501f0b3e93e8aebc9264835ee051859d" args="(Tree key, Tree t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int shcount </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>t</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the value of sharing count or 0. </p>

<p>Definition at line <a class="el" href="shlysis_8cpp_source.html#l00081">81</a> of file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>

<p>References <a class="el" href="node_8hh_source.html#l00098">Node::getInt()</a>, <a class="el" href="list_8cpp_source.html#l00423">getProperty()</a>, and <a class="el" href="tree_8hh_source.html#l00141">CTree::node()</a>.</p>

<p>Referenced by <a class="el" href="shlysis_8cpp_source.html#l00129">annotate()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00082"></a>00082 {
<a name="l00083"></a>00083     <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> c;
<a name="l00084"></a>00084     <span class="keywordflow">if</span> (<a class="code" href="list_8cpp.html#a665745948013d012bb123e9577c094bd">getProperty</a>(t, key, c)) {
<a name="l00085"></a>00085         <span class="keywordflow">return</span> c-&gt;<a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>().<a class="code" href="classNode.html#a0ac89402d0e51d19bed062529a375efe">getInt</a>();
<a name="l00086"></a>00086     } <span class="keywordflow">else</span> {
<a name="l00087"></a>00087         <span class="keywordflow">return</span> 0;
<a name="l00088"></a>00088     }
<a name="l00089"></a>00089 }   
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a315ed9d9d7d552741763dc18ec6dcb04"></a><!-- doxytag: member="shlysis.cpp::shlysis" ref="a315ed9d9d7d552741763dc18ec6dcb04" args="(Tree t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCTree.html">Tree</a> shlysis </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>t</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Do a sharing analysis : annotates all the subtrees of t with there occurences. </p>

<p>Definition at line <a class="el" href="shlysis_8cpp_source.html#l00117">117</a> of file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>

<p>References <a class="el" href="shlysis_8cpp_source.html#l00129">annotate()</a>, <a class="el" href="shlysis_8cpp_source.html#l00099">nobarrier()</a>, and <a class="el" href="shlysis_8cpp_source.html#l00069">shprkey()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00118"></a>00118 {
<a name="l00119"></a>00119     <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> k = <a class="code" href="shlysis_8cpp.html#a827cae6cc8102ab89e60ae2996fbdbf4" title="Create a specific property key for the sharing count of subtrees of t.">shprkey</a>(t);
<a name="l00120"></a>00120     <a class="code" href="shlysis_8cpp.html#a69b22f836f822d8296ca9f3061029e2a" title="Recursively increment the occurences count of t and its subtrees.">annotate</a>(k, t, <a class="code" href="shlysis_8cpp.html#a3ed5bd7932722816a2420ec5614f0e1d">nobarrier</a>);
<a name="l00121"></a>00121     <span class="keywordflow">return</span> k;
<a name="l00122"></a>00122 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a8146485be597a95467cfba6f56ff78c6"></a><!-- doxytag: member="shlysis.cpp::shlysis" ref="a8146485be597a95467cfba6f56ff78c6" args="(Tree t, barrier foo)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCTree.html">Tree</a> shlysis </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>t</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="shlysis_8hh.html#ab9939aac687344648c82a67abb6e57dc">barrier</a>&nbsp;</td>
          <td class="paramname"> <em>foo</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Do a sharing analysis : annotates all the subtrees of t with there occurences. </p>

<p>Definition at line <a class="el" href="shlysis_8cpp_source.html#l00105">105</a> of file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>

<p>References <a class="el" href="shlysis_8cpp_source.html#l00129">annotate()</a>, and <a class="el" href="shlysis_8cpp_source.html#l00069">shprkey()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00106"></a>00106 {
<a name="l00107"></a>00107     <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> k = <a class="code" href="shlysis_8cpp.html#a827cae6cc8102ab89e60ae2996fbdbf4" title="Create a specific property key for the sharing count of subtrees of t.">shprkey</a>(t);
<a name="l00108"></a>00108     <a class="code" href="shlysis_8cpp.html#a69b22f836f822d8296ca9f3061029e2a" title="Recursively increment the occurences count of t and its subtrees.">annotate</a>(k, t, foo);
<a name="l00109"></a>00109     <span class="keywordflow">return</span> k;
<a name="l00110"></a>00110 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a827cae6cc8102ab89e60ae2996fbdbf4"></a><!-- doxytag: member="shlysis.cpp::shprkey" ref="a827cae6cc8102ab89e60ae2996fbdbf4" args="(Tree t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCTree.html">Tree</a> shprkey </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>t</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create a specific property key for the sharing count of subtrees of t. </p>

<p>Definition at line <a class="el" href="shlysis_8cpp_source.html#l00069">69</a> of file <a class="el" href="shlysis_8cpp_source.html">shlysis.cpp</a>.</p>

<p>References <a class="el" href="symbol_8hh_source.html#l00098">name()</a>, <a class="el" href="tree_8hh_source.html#l00173">tree()</a>, and <a class="el" href="symbol_8hh_source.html#l00097">unique()</a>.</p>

<p>Referenced by <a class="el" href="sharing_8cpp_source.html#l00088">ScalarCompiler::sharingAnalysis()</a>, <a class="el" href="doc__sharing_8cpp_source.html#l00096">DocCompiler::sharingAnalysis()</a>, and <a class="el" href="shlysis_8cpp_source.html#l00105">shlysis()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00070"></a>00070 {
<a name="l00071"></a>00071     <span class="keywordtype">char</span>    <a class="code" href="symbol_8hh.html#a8243134fbbd9d924ebbb3f833922e310" title="Returns the name of a symbol.">name</a>[256];
<a name="l00072"></a>00072     snprintf(name, 256, <span class="stringliteral">&quot;SHARED IN %p : &quot;</span>, (<a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">CTree</a>*)t);
<a name="l00073"></a>00073     <span class="keywordflow">return</span> <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(<a class="code" href="symbol_8hh.html#a377309446e0e86ae663cd6709e02889d" title="Returns a new unique symbol of name strxxx.">unique</a>(name));
<a name="l00074"></a>00074 }   
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:11 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>