<!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/html; charset=utf-8" /> <title>Gimple statements — gcc-python-plugin 0.9 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '0.9', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="gcc-python-plugin 0.9 documentation" href="index.html" /> <link rel="next" title="Optimization passes" href="passes.html" /> <link rel="prev" title="gcc.Tree and its subclasses" href="tree.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="passes.html" title="Optimization passes" accesskey="N">next</a> |</li> <li class="right" > <a href="tree.html" title="gcc.Tree and its subclasses" accesskey="P">previous</a> |</li> <li><a href="index.html">gcc-python-plugin 0.9 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="gimple-statements"> <h1>Gimple statements<a class="headerlink" href="#gimple-statements" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="gcc.Gimple"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">Gimple</tt><a class="headerlink" href="#gcc.Gimple" title="Permalink to this definition">¶</a></dt> <dd><p>A statement, in GCC’s Gimple representation.</p> <p>The __str__ method is implemented using GCC’s own pretty-printer for gimple, so e.g.:</p> <div class="highlight-python"><div class="highlight"><pre><span class="nb">str</span><span class="p">(</span><span class="n">stmt</span><span class="p">)</span> </pre></div> </div> <p>might return:</p> <div class="highlight-python"><div class="highlight"><pre><span class="s">'D.3259 = (long unsigned int) i;'</span> </pre></div> </div> <dl class="attribute"> <dt id="gcc.Gimple.loc"> <tt class="descname">loc</tt><a class="headerlink" href="#gcc.Gimple.loc" title="Permalink to this definition">¶</a></dt> <dd><p>Source code location of this statement, as a <a class="reference internal" href="basics.html#gcc.Location" title="gcc.Location"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Location</span></tt></a> (or None)</p> </dd></dl> <dl class="attribute"> <dt id="gcc.Gimple.block"> <tt class="descname">block</tt><a class="headerlink" href="#gcc.Gimple.block" title="Permalink to this definition">¶</a></dt> <dd><p>The lexical block holding this statement, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.Gimple.exprtype"> <tt class="descname">exprtype</tt><a class="headerlink" href="#gcc.Gimple.exprtype" title="Permalink to this definition">¶</a></dt> <dd><p>The type of the main expression computed by this statement, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a> (which might be <tt class="xref py py-class docutils literal"><span class="pre">gcc.VoidType</span></tt>)</p> </dd></dl> <dl class="attribute"> <dt id="gcc.Gimple.str_no_uid"> <tt class="descname">str_no_uid</tt><a class="headerlink" href="#gcc.Gimple.str_no_uid" title="Permalink to this definition">¶</a></dt> <dd><p>A string representation of this statement, like str(), but without including any internal UIDs.</p> <p>This is intended for use in selftests that compare output against some expected value, to avoid embedding values that change into the expected output.</p> <p>For example, given an assignment to a temporary, the <cite>str(stmt)</cite> for the gcc.GimpleAssign might be:</p> <div class="highlight-python"><div class="highlight"><pre><span class="s">'D.3259 = (long unsigned int) i;'</span> </pre></div> </div> <p>where the UID “3259” is liable to change from compile to compile, whereas the <cite>stmt.str_no_uid</cite> has value:</p> <div class="highlight-python"><div class="highlight"><pre><span class="s">'D.xxxx = (long unsigned int) i;'</span> </pre></div> </div> <p>which won’t arbitrarily change each time.</p> </dd></dl> <dl class="method"> <dt id="gcc.Gimple.walk_tree"> <tt class="descname">walk_tree</tt><big>(</big><em>callback</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#gcc.Gimple.walk_tree" title="Permalink to this definition">¶</a></dt> <dd><p>Visit all <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a> nodes associated with this statement, potentially more than once each. This will visit both the left-hand-side and right-hand-side operands of the statement (if any), and recursively visit any of their child nodes.</p> <p>For each node, the callback is invoked, supplying the node, and any extra positional and keyword arguments passed to <cite>walk_tree</cite>:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">callback</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> </pre></div> </div> <p>If the callback returns a true value, the traversal stops, and that <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a> is the result of the call to <cite>walk_tree</cite>. Otherwise, the traversal continues, and <cite>walk_tree</cite> eventually returns <cite>None</cite>.</p> </dd></dl> </dd></dl> <p><a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a> has various subclasses, each corresponding to the one of the kinds of statement within GCC’s internal representation.</p> <p>The following subclasses have been wrapped for use from Python scripts:</p> <table border="1" class="docutils"> <colgroup> <col width="38%" /> <col width="62%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Subclass</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><a class="reference internal" href="#gcc.GimpleAssign" title="gcc.GimpleAssign"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleAssign</span></tt></a></td> <td><p class="first">An assignment of an expression to an l-value:</p> <div class="last highlight-python"><pre>LHS = RHS1 EXPRCODE RHS2;</pre> </div> </td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#gcc.GimpleCall" title="gcc.GimpleCall"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleCall</span></tt></a></td> <td><p class="first">A function call:</p> <div class="last highlight-python"><pre>[ LHS = ] FN(ARG1, ..., ARGN);</pre> </div> </td> </tr> <tr class="row-even"><td><a class="reference internal" href="#gcc.GimpleCond" title="gcc.GimpleCond"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleCond</span></tt></a></td> <td><p class="first">A conditional jump, of the form:</p> <div class="last highlight-python"><pre>if (LHS EXPRCODE RHS) goto TRUE_LABEL else goto FALSE_LABEL;</pre> </div> </td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#gcc.GimpleLabel" title="gcc.GimpleLabel"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleLabel</span></tt></a></td> <td><p class="first">A label statement (jump target):</p> <div class="last highlight-python"><pre>LABEL:</pre> </div> </td> </tr> <tr class="row-even"><td><a class="reference internal" href="#gcc.GimplePhi" title="gcc.GimplePhi"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimplePhi</span></tt></a></td> <td><p class="first">Used in the SSA passes:</p> <div class="last highlight-python"><pre>LHS = PHI <ARG1, ..., ARGN>;</pre> </div> </td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#gcc.GimpleReturn" title="gcc.GimpleReturn"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleReturn</span></tt></a></td> <td><p class="first">A “return” statement:</p> <div class="last highlight-python"><div class="highlight"><pre><span class="n">RETURN</span> <span class="p">[</span><span class="n">RETVAL</span><span class="p">];</span> </pre></div> </div> </td> </tr> <tr class="row-even"><td><a class="reference internal" href="#gcc.GimpleSwitch" title="gcc.GimpleSwitch"><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleSwitch</span></tt></a></td> <td><p class="first">A switch statement:</p> <div class="last highlight-python"><pre>switch (INDEXVAR) { case LAB1: ...; break; ... case LABN: ...; break; default: ... }</pre> </div> </td> </tr> </tbody> </table> <p>There are some additional subclasses that have not yet been fully wrapped by the Python plugin (email the <a class="reference external" href="https://fedorahosted.org/mailman/listinfo/gcc-python-plugin/">gcc-python-plugin’s mailing list</a> if you’re interested in working with these):</p> <table border="1" class="docutils"> <colgroup> <col width="43%" /> <col width="57%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Subclass</th> <th class="head">Meaning</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleAsm</span></tt></td> <td>One or more inline assembly statements</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleBind</span></tt></td> <td>A lexical scope</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleCatch</span></tt></td> <td>An exception handler</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleDebug</span></tt></td> <td>A debug statement</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleEhDispatch</span></tt></td> <td>Used in exception-handling</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleEhFilter</span></tt></td> <td>Used in exception-handling</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleEhMustNotThrow</span></tt></td> <td>Used in exception-handling</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleErrorMark</span></tt></td> <td>A dummy statement used for handling internal errors</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleGoto</span></tt></td> <td>An unconditional jump</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleNop</span></tt></td> <td>The “do nothing” statement</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpAtomicLoad</span></tt></td> <td>Used for implementing OpenMP</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpAtomicStore</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpContinue</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpCritical</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpFor</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpMaster</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpOrdered</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpParallel</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpReturn</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpSection</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpSections</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpSectionsSwitch</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpSingle</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleOmpTask</span></tt></td> <td>(ditto)</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimplePredict</span></tt></td> <td>A hint for branch prediction</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleResx</span></tt></td> <td>Resumes execution after an exception</td> </tr> <tr class="row-even"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleTry</span></tt></td> <td>A try/catch or try/finally statement</td> </tr> <tr class="row-odd"><td><tt class="xref py py-class docutils literal"><span class="pre">gcc.GimpleWithCleanupExpr</span></tt></td> <td>Internally used when generating GIMPLE</td> </tr> </tbody> </table> <dl class="class"> <dt id="gcc.GimpleAssign"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimpleAssign</tt><a class="headerlink" href="#gcc.GimpleAssign" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a>: an assignment of an expression to an l-value:</p> <div class="highlight-python"><pre>LHS = RHS1 EXPRCODE RHS2;</pre> </div> <dl class="attribute"> <dt id="gcc.GimpleAssign.lhs"> <tt class="descname">lhs</tt><a class="headerlink" href="#gcc.GimpleAssign.lhs" title="Permalink to this definition">¶</a></dt> <dd><p>Left-hand-side of the assignment, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleAssign.rhs"> <tt class="descname">rhs</tt><a class="headerlink" href="#gcc.GimpleAssign.rhs" title="Permalink to this definition">¶</a></dt> <dd><p>The operands on the right-hand-side of the expression, as a list of <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a> instances (either of length 1 or length 2, depending on the expression).</p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleAssign.exprcode"> <tt class="descname">exprcode</tt><a class="headerlink" href="#gcc.GimpleAssign.exprcode" title="Permalink to this definition">¶</a></dt> <dd><p>The kind of the expression, as an <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a> subclass (the type itself, not an instance)</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="gcc.GimpleCall"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimpleCall</tt><a class="headerlink" href="#gcc.GimpleCall" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a>: an invocation of a function, potentially assigning the result to an l-value:</p> <div class="highlight-python"><pre>[ LHS = ] FN(ARG1, ..., ARGN);</pre> </div> <dl class="attribute"> <dt id="gcc.GimpleCall.lhs"> <tt class="descname">lhs</tt><a class="headerlink" href="#gcc.GimpleCall.lhs" title="Permalink to this definition">¶</a></dt> <dd><p>Left-hand-side of the assignment, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a>, or <cite>None</cite></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCall.rhs"> <tt class="descname">rhs</tt><a class="headerlink" href="#gcc.GimpleCall.rhs" title="Permalink to this definition">¶</a></dt> <dd><p>The operands on the right-hand-side of the expression, as a list of <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a> instances</p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCall.fn"> <tt class="descname">fn</tt><a class="headerlink" href="#gcc.GimpleCall.fn" title="Permalink to this definition">¶</a></dt> <dd><p>The function being called, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCall.fndecl"> <tt class="descname">fndecl</tt><a class="headerlink" href="#gcc.GimpleCall.fndecl" title="Permalink to this definition">¶</a></dt> <dd><p>The declaration of the function being called (if any), as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCall.args"> <tt class="descname">args</tt><a class="headerlink" href="#gcc.GimpleCall.args" title="Permalink to this definition">¶</a></dt> <dd><p>The arguments for the call, as a list of <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCall.noreturn"> <tt class="descname">noreturn</tt><a class="headerlink" href="#gcc.GimpleCall.noreturn" title="Permalink to this definition">¶</a></dt> <dd><p>(boolean) Has this call been marked as not returning? (e.g. a call to <cite>exit</cite>)</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="gcc.GimpleReturn"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimpleReturn</tt><a class="headerlink" href="#gcc.GimpleReturn" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a>: a “return” statement, signifying the end of a <a class="reference internal" href="cfg.html#gcc.BasicBlock" title="gcc.BasicBlock"><tt class="xref py py-class docutils literal"><span class="pre">gcc.BasicBlock</span></tt></a>:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">RETURN</span> <span class="p">[</span><span class="n">RETVAL</span><span class="p">];</span> </pre></div> </div> <dl class="attribute"> <dt id="gcc.GimpleReturn.retval"> <tt class="descname">retval</tt><a class="headerlink" href="#gcc.GimpleReturn.retval" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <p>The return value, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a>, or <cite>None</cite>.</p> </dd></dl> <dl class="class"> <dt id="gcc.GimpleCond"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimpleCond</tt><a class="headerlink" href="#gcc.GimpleCond" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a>: a conditional jump, of the form:</p> <div class="highlight-python"><pre>if (LHS EXPRCODE RHS) goto TRUE_LABEL else goto FALSE_LABEL</pre> </div> <dl class="attribute"> <dt id="gcc.GimpleCond.lhs"> <tt class="descname">lhs</tt><a class="headerlink" href="#gcc.GimpleCond.lhs" title="Permalink to this definition">¶</a></dt> <dd><p>Left-hand-side of the comparison, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCond.exprcode"> <tt class="descname">exprcode</tt><a class="headerlink" href="#gcc.GimpleCond.exprcode" title="Permalink to this definition">¶</a></dt> <dd><p>The comparison predicate, as a <a class="reference internal" href="tree.html#gcc.Comparison" title="gcc.Comparison"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Comparison</span></tt></a> subclass (the type itself, not an instance). For example, the gcc.GimpleCond statement for this fragment of C code:</p> <div class="highlight-python"><pre>if (a == b)</pre> </div> <p>would have stmt.exprcode == gcc.EqExpr</p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCond.rhs"> <tt class="descname">rhs</tt><a class="headerlink" href="#gcc.GimpleCond.rhs" title="Permalink to this definition">¶</a></dt> <dd><p>The right-hand-side of the comparison, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCond.true_label"> <tt class="descname">true_label</tt><a class="headerlink" href="#gcc.GimpleCond.true_label" title="Permalink to this definition">¶</a></dt> <dd><p>The <tt class="xref py py-class docutils literal"><span class="pre">gcc.LabelDecl</span></tt> node used as the jump target for when the comparison is true</p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleCond.false_label"> <tt class="descname">false_label</tt><a class="headerlink" href="#gcc.GimpleCond.false_label" title="Permalink to this definition">¶</a></dt> <dd><p>The <tt class="xref py py-class docutils literal"><span class="pre">gcc.LabelDecl</span></tt> node used as the jump target for when the comparison is false</p> </dd></dl> <p>Note that a C conditional of the form:</p> <div class="highlight-python"><pre>if (some_int) {suiteA} else {suiteB}</pre> </div> <p>is implicitly expanded to:</p> <div class="highlight-python"><pre>if (some_int != 0) {suiteA} else {suiteB}</pre> </div> <p>and this becomes a gcc.GimpleCond with <cite>lhs</cite> as the integer, <cite>exprcode</cite> as <cite><type ‘gcc.NeExpr’></cite>, and <cite>rhs</cite> as <cite>gcc.IntegerCst(0)</cite>.</p> </dd></dl> <dl class="class"> <dt id="gcc.GimplePhi"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimplePhi</tt><a class="headerlink" href="#gcc.GimplePhi" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a> used in the SSA passes: a “PHI” or “phoney” function, for merging the various possible values a variable can have based on the edge that we entered this <a class="reference internal" href="cfg.html#gcc.BasicBlock" title="gcc.BasicBlock"><tt class="xref py py-class docutils literal"><span class="pre">gcc.BasicBlock</span></tt></a> on:</p> <div class="highlight-python"><pre>LHS = PHI <ARG1, ..., ARGN>;</pre> </div> <dl class="attribute"> <dt id="gcc.GimplePhi.lhs"> <tt class="descname">lhs</tt><a class="headerlink" href="#gcc.GimplePhi.lhs" title="Permalink to this definition">¶</a></dt> <dd><p>Left-hand-side of the assignment, as a <tt class="xref py py-class docutils literal"><span class="pre">gcc.SsaName</span></tt></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimplePhi.args"> <tt class="descname">args</tt><a class="headerlink" href="#gcc.GimplePhi.args" title="Permalink to this definition">¶</a></dt> <dd><p>A list of (<a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a>, <a class="reference internal" href="cfg.html#gcc.Edge" title="gcc.Edge"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Edge</span></tt></a>) pairs representing the possible (expr, edge) inputs. Each <cite>expr</cite> is either a <tt class="xref py py-class docutils literal"><span class="pre">gcc.SsaName</span></tt> or a <a class="reference internal" href="tree.html#gcc.Constant" title="gcc.Constant"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Constant</span></tt></a></p> </dd></dl> </dd></dl> <dl class="class"> <dt id="gcc.GimpleSwitch"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimpleSwitch</tt><a class="headerlink" href="#gcc.GimpleSwitch" title="Permalink to this definition">¶</a></dt> <dd><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a>: a switch statement, signifying the end of a <a class="reference internal" href="cfg.html#gcc.BasicBlock" title="gcc.BasicBlock"><tt class="xref py py-class docutils literal"><span class="pre">gcc.BasicBlock</span></tt></a>:</p> <div class="highlight-python"><pre>switch (INDEXVAR) { case LAB1: ...; break; ... case LABN: ...; break; default: ... }</pre> </div> <dl class="attribute"> <dt id="gcc.GimpleSwitch.indexvar"> <tt class="descname">indexvar</tt><a class="headerlink" href="#gcc.GimpleSwitch.indexvar" title="Permalink to this definition">¶</a></dt> <dd><p>The index variable used by the switch statement, as a <a class="reference internal" href="tree.html#gcc.Tree" title="gcc.Tree"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Tree</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="gcc.GimpleSwitch.labels"> <tt class="descname">labels</tt><a class="headerlink" href="#gcc.GimpleSwitch.labels" title="Permalink to this definition">¶</a></dt> <dd><p>The labels of the switch statement, as a list of <a class="reference internal" href="tree.html#gcc.CaseLabelExpr" title="gcc.CaseLabelExpr"><tt class="xref py py-class docutils literal"><span class="pre">gcc.CaseLabelExpr</span></tt></a>.</p> <p>The initial label in the list is always the default.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="gcc.GimpleLabel"> <em class="property">class </em><tt class="descclassname">gcc.</tt><tt class="descname">GimpleLabel</tt><a class="headerlink" href="#gcc.GimpleLabel" title="Permalink to this definition">¶</a></dt> <dd><blockquote> <div><p>Subclass of <a class="reference internal" href="#gcc.Gimple" title="gcc.Gimple"><tt class="xref py py-class docutils literal"><span class="pre">gcc.Gimple</span></tt></a>, representing a “label” statement:</p> <div class="highlight-python"><pre>LABEL:</pre> </div> </div></blockquote> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="tree.html" title="previous chapter">gcc.Tree and its subclasses</a></p> <h4>Next topic</h4> <p class="topless"><a href="passes.html" title="next chapter">Optimization passes</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/gimple.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="passes.html" title="Optimization passes" >next</a> |</li> <li class="right" > <a href="tree.html" title="gcc.Tree and its subclasses" >previous</a> |</li> <li><a href="index.html">gcc-python-plugin 0.9 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2011, David Malcolm. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>