mise à jour tp4b
This commit is contained in:
parent
09f487f142
commit
bfcce272c9
BIN
TP04/tp4b.pdf
Normal file
BIN
TP04/tp4b.pdf
Normal file
Binary file not shown.
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
403
docs/html/_modules/Lib/CFG.html
Normal file
403
docs/html/_modules/Lib/CFG.html
Normal file
@ -0,0 +1,403 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Lib.CFG — MiniC documentation</title>
|
||||||
|
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||||
|
<script src="../../_static/doctools.js"></script>
|
||||||
|
<script src="../../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../../search.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../../index.html" class="icon icon-home">
|
||||||
|
MiniC
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Errors.html">Base library - Errors</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Statement.html">Base library - Statement</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.RiscV.html">Base library - RISC-V instructions</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Operands.html">Base library - Operands</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../../index.html">MiniC</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
|
||||||
|
<li class="breadcrumb-item active">Lib.CFG</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<h1>Source code for Lib.CFG</h1><div class="highlight"><pre>
|
||||||
|
<span></span><span class="sd">"""</span>
|
||||||
|
<span class="sd">Classes for a RiscV CFG: :py:class:`CFG` for the CFG itself,</span>
|
||||||
|
<span class="sd">and :py:class:`Block` for its basic blocks.</span>
|
||||||
|
<span class="sd">"""</span>
|
||||||
|
|
||||||
|
<span class="kn">from</span> <span class="nn">graphviz</span> <span class="kn">import</span> <span class="n">Digraph</span> <span class="c1"># for dot output</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">cast</span><span class="p">,</span> <span class="n">Any</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Set</span><span class="p">,</span> <span class="n">Iterator</span>
|
||||||
|
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Errors</span> <span class="kn">import</span> <span class="n">MiniCInternalError</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Operands</span> <span class="kn">import</span> <span class="p">(</span><span class="n">Operand</span><span class="p">,</span> <span class="n">Immediate</span><span class="p">,</span> <span class="n">Function</span><span class="p">,</span> <span class="n">A0</span><span class="p">)</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Statement</span> <span class="kn">import</span> <span class="p">(</span>
|
||||||
|
<span class="n">Statement</span><span class="p">,</span> <span class="n">Instru3A</span><span class="p">,</span> <span class="n">Label</span><span class="p">,</span>
|
||||||
|
<span class="n">AbsoluteJump</span><span class="p">,</span> <span class="n">ConditionalJump</span><span class="p">,</span> <span class="n">Comment</span>
|
||||||
|
<span class="p">)</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Terminator</span> <span class="kn">import</span> <span class="p">(</span>
|
||||||
|
<span class="n">Terminator</span><span class="p">,</span> <span class="n">BranchingTerminator</span><span class="p">,</span> <span class="n">Return</span><span class="p">)</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.FunctionData</span> <span class="kn">import</span> <span class="p">(</span><span class="n">FunctionData</span><span class="p">,</span> <span class="n">_iter_statements</span><span class="p">,</span> <span class="n">_print_code</span><span class="p">)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="n">BlockInstr</span> <span class="o">=</span> <span class="n">Instru3A</span> <span class="o">|</span> <span class="n">Comment</span>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block">[docs]</a><span class="k">class</span> <span class="nc">Block</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> A basic block of a :py:class:`CFG` is made of three main parts:</span>
|
||||||
|
|
||||||
|
<span class="sd"> - a start :py:class:`label <Lib.Statement.Label>` that uniquely identifies the block in the CFG</span>
|
||||||
|
<span class="sd"> - the main body of the block, a list of instructions</span>
|
||||||
|
<span class="sd"> (excluding labels, jumps and branching instructions)</span>
|
||||||
|
<span class="sd"> - a :py:class:`terminator <Lib.Terminator.Terminator>`</span>
|
||||||
|
<span class="sd"> that represents the final jump or branching instruction of the block,</span>
|
||||||
|
<span class="sd"> and points to the successors of the block.</span>
|
||||||
|
<span class="sd"> See the documentation for :py:class:`Lib.Terminator.Terminator` for further explanations.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
|
||||||
|
<span class="n">_terminator</span><span class="p">:</span> <span class="n">Terminator</span>
|
||||||
|
<span class="n">_label</span><span class="p">:</span> <span class="n">Label</span>
|
||||||
|
<span class="n">_phis</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">]</span>
|
||||||
|
<span class="n">_instructions</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">BlockInstr</span><span class="p">]</span>
|
||||||
|
<span class="n">_in</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="s1">'Block'</span><span class="p">]</span>
|
||||||
|
<span class="n">_gen</span><span class="p">:</span> <span class="n">Set</span>
|
||||||
|
<span class="n">_kill</span><span class="p">:</span> <span class="n">Set</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">label</span><span class="p">:</span> <span class="n">Label</span><span class="p">,</span> <span class="n">insts</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">BlockInstr</span><span class="p">],</span> <span class="n">terminator</span><span class="p">:</span> <span class="n">Terminator</span><span class="p">):</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_label</span> <span class="o">=</span> <span class="n">label</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span> <span class="o">=</span> <span class="n">insts</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_in</span> <span class="o">=</span> <span class="p">[]</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_phis</span> <span class="o">=</span> <span class="p">[]</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_terminator</span> <span class="o">=</span> <span class="n">terminator</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_gen</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_kill</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||||
|
<span class="n">instr</span> <span class="o">=</span> <span class="p">[</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">Comment</span><span class="p">)]</span>
|
||||||
|
<span class="n">instr_str</span> <span class="o">=</span> <span class="s1">'</span><span class="se">\n</span><span class="s1">'</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">instr</span><span class="p">))</span>
|
||||||
|
<span class="n">s</span> <span class="o">=</span> <span class="s1">'</span><span class="si">{}</span><span class="s1">:</span><span class="se">\n\n</span><span class="si">{}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_label</span><span class="p">,</span> <span class="n">instr_str</span><span class="p">)</span>
|
||||||
|
<span class="k">return</span> <span class="n">s</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.to_dot"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.to_dot">[docs]</a> <span class="k">def</span> <span class="nf">to_dot</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> <span class="c1"># pragma: no cover</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Outputs all statements of the block as a string."""</span>
|
||||||
|
<span class="c1"># dot is weird: lines ending with \l instead of \n are left-aligned.</span>
|
||||||
|
<span class="n">NEWLINE</span> <span class="o">=</span> <span class="s1">'</span><span class="se">\\</span><span class="s1">l '</span>
|
||||||
|
<span class="n">instr</span> <span class="o">=</span> <span class="p">[]</span>
|
||||||
|
<span class="n">instr</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_phis</span>
|
||||||
|
<span class="n">instr</span> <span class="o">+=</span> <span class="p">[</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">Comment</span><span class="p">)]</span>
|
||||||
|
<span class="n">instr</span> <span class="o">+=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">()]</span>
|
||||||
|
<span class="n">instr_str</span> <span class="o">=</span> <span class="n">NEWLINE</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">instr</span><span class="p">))</span>
|
||||||
|
<span class="n">s</span> <span class="o">=</span> <span class="s1">'</span><span class="si">{}</span><span class="s1">:</span><span class="si">{}{}</span><span class="se">\\</span><span class="s1">l'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_label</span><span class="p">,</span> <span class="n">NEWLINE</span><span class="p">,</span> <span class="n">instr_str</span><span class="p">)</span>
|
||||||
|
<span class="k">return</span> <span class="n">s</span></div>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||||
|
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_label</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_body"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_body">[docs]</a> <span class="k">def</span> <span class="nf">get_body</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">BlockInstr</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the statements in the body of the block (no phi-node nor the terminator)."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_all_statements"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_all_statements">[docs]</a> <span class="k">def</span> <span class="nf">get_all_statements</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> Return all statements of the block</span>
|
||||||
|
<span class="sd"> (including phi-nodes and the terminator, but not the label of the block).</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_phis</span> <span class="o">+</span>
|
||||||
|
<span class="n">cast</span><span class="p">(</span><span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span><span class="p">)</span> <span class="o">+</span>
|
||||||
|
<span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">()])</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_body_and_terminator"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_body_and_terminator">[docs]</a> <span class="k">def</span> <span class="nf">get_body_and_terminator</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> Return all statements of the block, except phi-nodes</span>
|
||||||
|
<span class="sd"> (and the label of the block).</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="k">return</span> <span class="p">(</span><span class="n">cast</span><span class="p">(</span><span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span><span class="p">)</span> <span class="o">+</span>
|
||||||
|
<span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">()])</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_label"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_label">[docs]</a> <span class="k">def</span> <span class="nf">get_label</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Label</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the label of the block."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_label</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_in"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_in">[docs]</a> <span class="k">def</span> <span class="nf">get_in</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="s1">'Block'</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the list of blocks with an edge to the considered block."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_in</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_terminator"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_terminator">[docs]</a> <span class="k">def</span> <span class="nf">get_terminator</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Terminator</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the terminator of the block."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_terminator</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.set_terminator"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.set_terminator">[docs]</a> <span class="k">def</span> <span class="nf">set_terminator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">term</span><span class="p">:</span> <span class="n">Terminator</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Set the terminator of the block."""</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_terminator</span> <span class="o">=</span> <span class="n">term</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.get_phis"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.get_phis">[docs]</a> <span class="k">def</span> <span class="nf">get_phis</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the list of all φ instructions of the block."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_phis</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.add_phi"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.add_phi">[docs]</a> <span class="k">def</span> <span class="nf">add_phi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">phi</span><span class="p">:</span> <span class="n">Statement</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Add a φ instruction to the block."""</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_phis</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">phi</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.set_phis"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.set_phis">[docs]</a> <span class="k">def</span> <span class="nf">set_phis</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">phis</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Statement</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Replace the φ instructions in the block by the given list `phis`."""</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_phis</span> <span class="o">=</span> <span class="n">phis</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.remove_all_phis"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.remove_all_phis">[docs]</a> <span class="k">def</span> <span class="nf">remove_all_phis</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Remove all φ instructions in the block."""</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_phis</span> <span class="o">=</span> <span class="p">[]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.iter_statements"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.iter_statements">[docs]</a> <span class="k">def</span> <span class="nf">iter_statements</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Iterate over instructions.</span>
|
||||||
|
<span class="sd"> For each real instruction i (not label or comment), replace it</span>
|
||||||
|
<span class="sd"> with the list of instructions given by f(i).</span>
|
||||||
|
|
||||||
|
<span class="sd"> Assume there is no phi-node.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="k">assert</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_phis</span> <span class="o">==</span> <span class="p">[])</span>
|
||||||
|
<span class="n">new_statements</span> <span class="o">=</span> <span class="n">_iter_statements</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
|
||||||
|
<span class="n">end_statements</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">())</span>
|
||||||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">end_statements</span><span class="p">)</span> <span class="o">>=</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end_statements</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">Terminator</span><span class="p">):</span>
|
||||||
|
<span class="n">new_terminator</span> <span class="o">=</span> <span class="n">end_statements</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span> <span class="o">=</span> <span class="n">new_statements</span> <span class="o">+</span> <span class="n">end_statements</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">set_terminator</span><span class="p">(</span><span class="n">new_terminator</span><span class="p">)</span>
|
||||||
|
<span class="k">else</span><span class="p">:</span>
|
||||||
|
<span class="k">raise</span> <span class="n">MiniCInternalError</span><span class="p">(</span>
|
||||||
|
<span class="s2">"Block.iter_statements: Invalid replacement for terminator </span><span class="si">{}</span><span class="s2">:</span><span class="se">\n</span><span class="s2"> </span><span class="si">{}</span><span class="s2">"</span>
|
||||||
|
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">(),</span> <span class="n">end_statements</span><span class="p">))</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Block.add_instruction"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.Block.add_instruction">[docs]</a> <span class="k">def</span> <span class="nf">add_instruction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">instr</span><span class="p">:</span> <span class="n">BlockInstr</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Add an instruction to the body of the block."""</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_instructions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">instr</span><span class="p">)</span></div></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG">[docs]</a><span class="k">class</span> <span class="nc">CFG</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> A complete control-flow graph representing a function.</span>
|
||||||
|
<span class="sd"> This class is mainly made of a list of basic :py:class:`Block`,</span>
|
||||||
|
<span class="sd"> a label indicating the :py:meth:`entry point of the function <get_start>`,</span>
|
||||||
|
<span class="sd"> and an :py:meth:`exit label <get_end>`.</span>
|
||||||
|
|
||||||
|
<span class="sd"> As with linear code, metadata about the function can be found</span>
|
||||||
|
<span class="sd"> in the :py:attr:`fdata` member variable.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
|
||||||
|
<span class="n">_start</span><span class="p">:</span> <span class="n">Label</span>
|
||||||
|
<span class="n">_end</span><span class="p">:</span> <span class="n">Label</span>
|
||||||
|
<span class="n">_blocks</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Label</span><span class="p">,</span> <span class="n">Block</span><span class="p">]</span>
|
||||||
|
|
||||||
|
<span class="c1">#: Metadata about the function represented by this CFG</span>
|
||||||
|
<span class="n">fdata</span><span class="p">:</span> <span class="n">FunctionData</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fdata</span><span class="p">:</span> <span class="n">FunctionData</span><span class="p">):</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span> <span class="o">=</span> <span class="p">{}</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">fdata</span> <span class="o">=</span> <span class="n">fdata</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_init_blks</span><span class="p">()</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fdata</span><span class="o">.</span><span class="n">fresh_label</span><span class="p">(</span><span class="s2">"end"</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="nf">_init_blks</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Add a block for division by 0."""</span>
|
||||||
|
<span class="c1"># Label for the address of the error message</span>
|
||||||
|
<span class="c1"># This address is added by print_code</span>
|
||||||
|
<span class="n">label_div_by_zero_msg</span> <span class="o">=</span> <span class="n">Label</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fdata</span><span class="o">.</span><span class="n">_label_div_by_zero</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s2">"_msg"</span><span class="p">)</span>
|
||||||
|
<span class="n">blk</span> <span class="o">=</span> <span class="n">Block</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fdata</span><span class="o">.</span><span class="n">_label_div_by_zero</span><span class="p">,</span> <span class="p">[</span>
|
||||||
|
<span class="n">Instru3A</span><span class="p">(</span><span class="s2">"la"</span><span class="p">,</span> <span class="n">A0</span><span class="p">,</span> <span class="n">label_div_by_zero_msg</span><span class="p">),</span>
|
||||||
|
<span class="n">Instru3A</span><span class="p">(</span><span class="s2">"call"</span><span class="p">,</span> <span class="n">Function</span><span class="p">(</span><span class="s2">"println_string"</span><span class="p">)),</span>
|
||||||
|
<span class="n">Instru3A</span><span class="p">(</span><span class="s2">"li"</span><span class="p">,</span> <span class="n">A0</span><span class="p">,</span> <span class="n">Immediate</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span>
|
||||||
|
<span class="n">Instru3A</span><span class="p">(</span><span class="s2">"call"</span><span class="p">,</span> <span class="n">Function</span><span class="p">(</span><span class="s2">"exit"</span><span class="p">)),</span>
|
||||||
|
<span class="p">],</span> <span class="n">terminator</span><span class="o">=</span><span class="n">Return</span><span class="p">())</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">add_block</span><span class="p">(</span><span class="n">blk</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.get_start"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.get_start">[docs]</a> <span class="k">def</span> <span class="nf">get_start</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Label</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the entry label of the CFG."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_start</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.set_start"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.set_start">[docs]</a> <span class="k">def</span> <span class="nf">set_start</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="n">Label</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Set the entry label of the CFG."""</span>
|
||||||
|
<span class="k">assert</span> <span class="p">(</span><span class="n">start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="p">)</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="o">=</span> <span class="n">start</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.get_end"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.get_end">[docs]</a> <span class="k">def</span> <span class="nf">get_end</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Label</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the exit label of the CFG."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.add_block"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.add_block">[docs]</a> <span class="k">def</span> <span class="nf">add_block</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">blk</span><span class="p">:</span> <span class="n">Block</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Add a new block to the CFG."""</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="p">[</span><span class="n">blk</span><span class="o">.</span><span class="n">_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">blk</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.get_block"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.get_block">[docs]</a> <span class="k">def</span> <span class="nf">get_block</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="n">Label</span><span class="p">)</span> <span class="o">-></span> <span class="n">Block</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the block with label `name`."""</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="p">[</span><span class="n">name</span><span class="p">]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.get_blocks"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.get_blocks">[docs]</a> <span class="k">def</span> <span class="nf">get_blocks</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Block</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return all the blocks."""</span>
|
||||||
|
<span class="k">return</span> <span class="p">[</span><span class="n">b</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="o">.</span><span class="n">values</span><span class="p">()]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.get_entries"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.get_entries">[docs]</a> <span class="k">def</span> <span class="nf">get_entries</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Block</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return all the blocks with no predecessors."""</span>
|
||||||
|
<span class="k">return</span> <span class="p">[</span><span class="n">b</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">b</span><span class="o">.</span><span class="n">get_in</span><span class="p">()]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.add_edge"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.add_edge">[docs]</a> <span class="k">def</span> <span class="nf">add_edge</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">src</span><span class="p">:</span> <span class="n">Block</span><span class="p">,</span> <span class="n">dest</span><span class="p">:</span> <span class="n">Block</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Add the edge src -> dest in the control flow graph."""</span>
|
||||||
|
<span class="n">dest</span><span class="o">.</span><span class="n">get_in</span><span class="p">()</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">src</span><span class="p">)</span></div>
|
||||||
|
<span class="c1"># assert (dest.get_label() in src.get_terminator().targets())</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.remove_edge"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.remove_edge">[docs]</a> <span class="k">def</span> <span class="nf">remove_edge</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">src</span><span class="p">:</span> <span class="n">Block</span><span class="p">,</span> <span class="n">dest</span><span class="p">:</span> <span class="n">Block</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Remove the edge src -> dest in the control flow graph."""</span>
|
||||||
|
<span class="n">dest</span><span class="o">.</span><span class="n">get_in</span><span class="p">()</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">src</span><span class="p">)</span></div>
|
||||||
|
<span class="c1"># assert (dest.get_label() not in src.get_terminator().targets())</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.out_blocks"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.out_blocks">[docs]</a> <span class="k">def</span> <span class="nf">out_blocks</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">block</span><span class="p">:</span> <span class="n">Block</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Block</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> Return the list of blocks in the CFG targeted by</span>
|
||||||
|
<span class="sd"> the Terminator of Block block.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">get_block</span><span class="p">(</span><span class="n">dest</span><span class="p">)</span> <span class="k">for</span> <span class="n">dest</span> <span class="ow">in</span> <span class="n">block</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">()</span><span class="o">.</span><span class="n">targets</span><span class="p">()]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.gather_defs"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.gather_defs">[docs]</a> <span class="k">def</span> <span class="nf">gather_defs</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Dict</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">Set</span><span class="p">[</span><span class="n">Block</span><span class="p">]]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> Return a dictionary associating variables to all the blocks</span>
|
||||||
|
<span class="sd"> containing one of their definitions.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="n">defs</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Operand</span><span class="p">,</span> <span class="n">Set</span><span class="p">[</span><span class="n">Block</span><span class="p">]]</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
|
||||||
|
<span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_blocks</span><span class="p">():</span>
|
||||||
|
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">b</span><span class="o">.</span><span class="n">get_all_statements</span><span class="p">():</span>
|
||||||
|
<span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">i</span><span class="o">.</span><span class="n">defined</span><span class="p">():</span>
|
||||||
|
<span class="k">if</span> <span class="n">v</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">defs</span><span class="p">:</span>
|
||||||
|
<span class="n">defs</span><span class="p">[</span><span class="n">v</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">b</span><span class="p">}</span>
|
||||||
|
<span class="k">else</span><span class="p">:</span>
|
||||||
|
<span class="n">defs</span><span class="p">[</span><span class="n">v</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">b</span><span class="p">)</span>
|
||||||
|
<span class="k">return</span> <span class="n">defs</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.iter_statements"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.iter_statements">[docs]</a> <span class="k">def</span> <span class="nf">iter_statements</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Apply f to all instructions in all the blocks."""</span>
|
||||||
|
<span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_blocks</span><span class="p">():</span>
|
||||||
|
<span class="n">b</span><span class="o">.</span><span class="n">iter_statements</span><span class="p">(</span><span class="n">f</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.linearize_naive"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.linearize_naive">[docs]</a> <span class="k">def</span> <span class="nf">linearize_naive</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Iterator</span><span class="p">[</span><span class="n">Statement</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> Linearize the given control flow graph as a list of instructions.</span>
|
||||||
|
<span class="sd"> Naive procedure that adds jumps everywhere.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="k">for</span> <span class="n">label</span><span class="p">,</span> <span class="n">block</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||||
|
<span class="k">yield</span> <span class="n">label</span>
|
||||||
|
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">block</span><span class="o">.</span><span class="n">_instructions</span><span class="p">:</span>
|
||||||
|
<span class="k">yield</span> <span class="n">i</span>
|
||||||
|
<span class="k">match</span> <span class="n">block</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">():</span>
|
||||||
|
<span class="k">case</span> <span class="n">BranchingTerminator</span><span class="p">()</span> <span class="k">as</span> <span class="n">j</span><span class="p">:</span>
|
||||||
|
<span class="c1"># In case of conditional jump, add the missing edge</span>
|
||||||
|
<span class="k">yield</span> <span class="n">ConditionalJump</span><span class="p">(</span><span class="n">j</span><span class="o">.</span><span class="n">cond</span><span class="p">,</span> <span class="n">j</span><span class="o">.</span><span class="n">op1</span><span class="p">,</span> <span class="n">j</span><span class="o">.</span><span class="n">op2</span><span class="p">,</span> <span class="n">j</span><span class="o">.</span><span class="n">label_then</span><span class="p">)</span>
|
||||||
|
<span class="k">yield</span> <span class="n">AbsoluteJump</span><span class="p">(</span><span class="n">j</span><span class="o">.</span><span class="n">label_else</span><span class="p">)</span>
|
||||||
|
<span class="k">case</span> <span class="n">AbsoluteJump</span><span class="p">()</span> <span class="k">as</span> <span class="n">j</span><span class="p">:</span>
|
||||||
|
<span class="k">yield</span> <span class="n">AbsoluteJump</span><span class="p">(</span><span class="n">j</span><span class="o">.</span><span class="n">label</span><span class="p">)</span>
|
||||||
|
<span class="k">case</span> <span class="n">Return</span><span class="p">():</span>
|
||||||
|
<span class="k">yield</span> <span class="n">AbsoluteJump</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_end</span><span class="p">())</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.print_code"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.print_code">[docs]</a> <span class="k">def</span> <span class="nf">print_code</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output</span><span class="p">,</span> <span class="n">linearize</span><span class="o">=</span><span class="p">(</span><span class="k">lambda</span> <span class="n">cfg</span><span class="p">:</span> <span class="nb">list</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">linearize_naive</span><span class="p">())),</span>
|
||||||
|
<span class="n">comment</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Print the linearization of the CFG."""</span>
|
||||||
|
<span class="n">statements</span> <span class="o">=</span> <span class="n">linearize</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
|
||||||
|
<span class="n">_print_code</span><span class="p">(</span><span class="n">statements</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">fdata</span><span class="p">,</span> <span class="n">output</span><span class="p">,</span> <span class="n">init_label</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="p">,</span>
|
||||||
|
<span class="n">fin_label</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">,</span> <span class="n">fin_div0</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="n">comment</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="CFG.print_dot"><a class="viewcode-back" href="../../api/Lib.CFG.html#Lib.CFG.CFG.print_dot">[docs]</a> <span class="k">def</span> <span class="nf">print_dot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">DF</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">view</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> <span class="c1"># pragma: no cover</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Print the CFG as a graph."""</span>
|
||||||
|
<span class="n">graph</span> <span class="o">=</span> <span class="n">Digraph</span><span class="p">()</span>
|
||||||
|
<span class="c1"># nodes</span>
|
||||||
|
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">blk</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||||
|
<span class="k">if</span> <span class="n">DF</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||||
|
<span class="n">df_str</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">blk</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">DF</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">len</span><span class="p">(</span><span class="n">DF</span><span class="p">[</span><span class="n">blk</span><span class="p">])</span> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">DF</span><span class="p">[</span><span class="n">blk</span><span class="p">])</span>
|
||||||
|
<span class="n">df_lab</span> <span class="o">=</span> <span class="n">blk</span><span class="o">.</span><span class="n">to_dot</span><span class="p">()</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n\n</span><span class="s2">Dominance frontier:</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="n">df_str</span>
|
||||||
|
<span class="k">else</span><span class="p">:</span>
|
||||||
|
<span class="n">df_lab</span> <span class="o">=</span> <span class="n">blk</span><span class="o">.</span><span class="n">to_dot</span><span class="p">()</span>
|
||||||
|
<span class="n">graph</span><span class="o">.</span><span class="n">node</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">blk</span><span class="o">.</span><span class="n">_label</span><span class="p">),</span> <span class="n">label</span><span class="o">=</span><span class="n">df_lab</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="s1">'rectangle'</span><span class="p">)</span>
|
||||||
|
<span class="c1"># edges</span>
|
||||||
|
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">blk</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_blocks</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||||
|
<span class="k">for</span> <span class="n">child</span> <span class="ow">in</span> <span class="n">blk</span><span class="o">.</span><span class="n">get_terminator</span><span class="p">()</span><span class="o">.</span><span class="n">targets</span><span class="p">():</span>
|
||||||
|
<span class="n">graph</span><span class="o">.</span><span class="n">edge</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">blk</span><span class="o">.</span><span class="n">_label</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">child</span><span class="p">))</span>
|
||||||
|
<span class="n">graph</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">view</span><span class="o">=</span><span class="n">view</span><span class="p">)</span></div></div>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2023, compil-lyon.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
261
docs/html/_modules/Lib/Terminator.html
Normal file
261
docs/html/_modules/Lib/Terminator.html
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Lib.Terminator — MiniC documentation</title>
|
||||||
|
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
|
||||||
|
<script src="../../_static/doctools.js"></script>
|
||||||
|
<script src="../../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../../search.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../../index.html" class="icon icon-home">
|
||||||
|
MiniC
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Errors.html">Base library - Errors</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Statement.html">Base library - Statement</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.RiscV.html">Base library - RISC-V instructions</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Operands.html">Base library - Operands</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../../index.html">MiniC</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
|
||||||
|
<li class="breadcrumb-item active">Lib.Terminator</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<h1>Source code for Lib.Terminator</h1><div class="highlight"><pre>
|
||||||
|
<span></span><span class="sd">"""</span>
|
||||||
|
<span class="sd">MIF08, CAP, CFG library - Terminators.</span>
|
||||||
|
|
||||||
|
<span class="sd">Each :py:class:`block <Lib.CFG.Block>` of a :py:class:`CFG <Lib.CFG.CFG>`</span>
|
||||||
|
<span class="sd">ends with a branching instruction called a terminator.</span>
|
||||||
|
<span class="sd">There are three kinds of terminators:</span>
|
||||||
|
|
||||||
|
<span class="sd">- :py:class:`Lib.Statement.AbsoluteJump` is a non-conditional jump</span>
|
||||||
|
<span class="sd"> to another block of the CFG</span>
|
||||||
|
<span class="sd">- :py:class:`BranchingTerminator` is a conditional branching</span>
|
||||||
|
<span class="sd"> instruction with two successor blocks.</span>
|
||||||
|
<span class="sd"> Unlike the class :py:class:`ConditionalJump <Lib.Statement.ConditionalJump>`</span>
|
||||||
|
<span class="sd"> that was used in :py:class:`LinearCode <Lib.LinearCode.LinearCode>`,</span>
|
||||||
|
<span class="sd"> both successor labels have to be specified.</span>
|
||||||
|
<span class="sd">- :py:class:`Return` marks the end of the function</span>
|
||||||
|
|
||||||
|
<span class="sd">During the construction of the CFG, :py:func:`jump2terminator` builds</span>
|
||||||
|
<span class="sd">a terminator for each extracted chunk of instructions.</span>
|
||||||
|
<span class="sd">"""</span>
|
||||||
|
|
||||||
|
<span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Errors</span> <span class="kn">import</span> <span class="n">MiniCInternalError</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Operands</span> <span class="kn">import</span> <span class="n">Operand</span><span class="p">,</span> <span class="n">Renamer</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">,</span> <span class="n">Condition</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">Lib.Statement</span> <span class="kn">import</span> <span class="n">AbsoluteJump</span><span class="p">,</span> <span class="n">ConditionalJump</span><span class="p">,</span> <span class="n">Instruction</span><span class="p">,</span> <span class="n">Label</span><span class="p">,</span> <span class="n">Statement</span>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return">[docs]</a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">unsafe_hash</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||||
|
<span class="k">class</span> <span class="nc">Return</span><span class="p">(</span><span class="n">Statement</span><span class="p">):</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""A terminator that marks the end of the function."""</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||||
|
<span class="k">return</span> <span class="p">(</span><span class="s2">"return"</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.printIns"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.printIns">[docs]</a> <span class="k">def</span> <span class="nf">printIns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">stream</span><span class="p">):</span>
|
||||||
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"return"</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="n">stream</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.targets"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.targets">[docs]</a> <span class="k">def</span> <span class="nf">targets</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Label</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the labels targetted by the Return terminator."""</span>
|
||||||
|
<span class="k">return</span> <span class="p">[]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.args"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.args">[docs]</a> <span class="k">def</span> <span class="nf">args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Operand</span><span class="p">]:</span>
|
||||||
|
<span class="k">return</span> <span class="p">[]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.rename"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.rename">[docs]</a> <span class="k">def</span> <span class="nf">rename</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">renamer</span><span class="p">:</span> <span class="n">Renamer</span><span class="p">):</span>
|
||||||
|
<span class="k">pass</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.substitute"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.substitute">[docs]</a> <span class="k">def</span> <span class="nf">substitute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subst</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Operand</span><span class="p">,</span> <span class="n">Operand</span><span class="p">]):</span>
|
||||||
|
<span class="k">if</span> <span class="n">subst</span> <span class="o">!=</span> <span class="p">{}:</span>
|
||||||
|
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span>
|
||||||
|
<span class="s2">"substitute: No possible substitution on instruction </span><span class="si">{}</span><span class="s2">"</span>
|
||||||
|
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.with_args"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.with_args">[docs]</a> <span class="k">def</span> <span class="nf">with_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_args</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Operand</span><span class="p">]):</span>
|
||||||
|
<span class="k">if</span> <span class="n">new_args</span> <span class="o">!=</span> <span class="p">[]:</span>
|
||||||
|
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span>
|
||||||
|
<span class="s2">"substitute: No possible substitution on instruction </span><span class="si">{}</span><span class="s2">"</span>
|
||||||
|
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="Return.is_read_only"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.Return.is_read_only">[docs]</a> <span class="k">def</span> <span class="nf">is_read_only</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span>
|
||||||
|
<span class="k">return</span> <span class="kc">True</span></div></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="BranchingTerminator"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator">[docs]</a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">init</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||||
|
<span class="k">class</span> <span class="nc">BranchingTerminator</span><span class="p">(</span><span class="n">Instruction</span><span class="p">):</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""A terminating statement with a condition."""</span>
|
||||||
|
|
||||||
|
<span class="c1">#: The condition of the branch</span>
|
||||||
|
<span class="n">cond</span><span class="p">:</span> <span class="n">Condition</span>
|
||||||
|
<span class="c1">#: The destination label if the condition is true</span>
|
||||||
|
<span class="n">label_then</span><span class="p">:</span> <span class="n">Label</span>
|
||||||
|
<span class="c1">#: The destination label if the condition is false</span>
|
||||||
|
<span class="n">label_else</span><span class="p">:</span> <span class="n">Label</span>
|
||||||
|
<span class="c1">#: The first operand of the condition</span>
|
||||||
|
<span class="n">op1</span><span class="p">:</span> <span class="n">Operand</span>
|
||||||
|
<span class="c1">#: The second operand of the condition</span>
|
||||||
|
<span class="n">op2</span><span class="p">:</span> <span class="n">Operand</span>
|
||||||
|
<span class="n">_read_only</span> <span class="o">=</span> <span class="kc">True</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cond</span><span class="p">:</span> <span class="n">Condition</span><span class="p">,</span> <span class="n">op1</span><span class="p">:</span> <span class="n">Operand</span><span class="p">,</span> <span class="n">op2</span><span class="p">:</span> <span class="n">Operand</span><span class="p">,</span>
|
||||||
|
<span class="n">label_then</span><span class="p">:</span> <span class="n">Label</span><span class="p">,</span> <span class="n">label_else</span><span class="p">:</span> <span class="n">Label</span><span class="p">):</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">cond</span> <span class="o">=</span> <span class="n">cond</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">label_then</span> <span class="o">=</span> <span class="n">label_then</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">label_else</span> <span class="o">=</span> <span class="n">label_else</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">op1</span> <span class="o">=</span> <span class="n">op1</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">op2</span> <span class="o">=</span> <span class="n">op2</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">ins</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cond</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="BranchingTerminator.args"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.args">[docs]</a> <span class="k">def</span> <span class="nf">args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Operand</span><span class="p">]:</span>
|
||||||
|
<span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">op1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">op2</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_then</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_else</span><span class="p">]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="BranchingTerminator.targets"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.targets">[docs]</a> <span class="k">def</span> <span class="nf">targets</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Label</span><span class="p">]:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""Return the labels targetted by the Branching terminator."""</span>
|
||||||
|
<span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">label_then</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_else</span><span class="p">]</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="BranchingTerminator.rename"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.rename">[docs]</a> <span class="k">def</span> <span class="nf">rename</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">renamer</span><span class="p">:</span> <span class="n">Renamer</span><span class="p">):</span>
|
||||||
|
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op1</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">):</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">op1</span> <span class="o">=</span> <span class="n">renamer</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op1</span><span class="p">)</span>
|
||||||
|
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op2</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">):</span>
|
||||||
|
<span class="bp">self</span><span class="o">.</span><span class="n">op2</span> <span class="o">=</span> <span class="n">renamer</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op2</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="BranchingTerminator.substitute"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.substitute">[docs]</a> <span class="k">def</span> <span class="nf">substitute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subst</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Operand</span><span class="p">,</span> <span class="n">Operand</span><span class="p">]):</span>
|
||||||
|
<span class="k">for</span> <span class="n">op</span> <span class="ow">in</span> <span class="n">subst</span><span class="p">:</span>
|
||||||
|
<span class="k">if</span> <span class="n">op</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">():</span>
|
||||||
|
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span>
|
||||||
|
<span class="s2">"substitute: Operand </span><span class="si">{}</span><span class="s2"> is not present in instruction </span><span class="si">{}</span><span class="s2">"</span>
|
||||||
|
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">op</span><span class="p">,</span> <span class="bp">self</span><span class="p">))</span>
|
||||||
|
<span class="n">op1</span> <span class="o">=</span> <span class="n">subst</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">op1</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op1</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">)</span> \
|
||||||
|
<span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">op1</span>
|
||||||
|
<span class="n">op2</span> <span class="o">=</span> <span class="n">subst</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op2</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">op2</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">op2</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">)</span> \
|
||||||
|
<span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">op2</span>
|
||||||
|
<span class="k">return</span> <span class="n">BranchingTerminator</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cond</span><span class="p">,</span> <span class="n">op1</span><span class="p">,</span> <span class="n">op2</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_then</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_else</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="BranchingTerminator.with_args"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.with_args">[docs]</a> <span class="k">def</span> <span class="nf">with_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_args</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Operand</span><span class="p">]):</span>
|
||||||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_args</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">4</span><span class="p">:</span>
|
||||||
|
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span>
|
||||||
|
<span class="s2">"substitute: Invalid number of arguments for instruction </span><span class="si">{}</span><span class="s2">, expected 4 got </span><span class="si">{}</span><span class="s2">"</span>
|
||||||
|
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">new_args</span><span class="p">))</span>
|
||||||
|
<span class="n">op1</span> <span class="o">=</span> <span class="n">new_args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||||
|
<span class="n">op2</span> <span class="o">=</span> <span class="n">new_args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
|
||||||
|
<span class="k">return</span> <span class="n">BranchingTerminator</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cond</span><span class="p">,</span> <span class="n">op1</span><span class="p">,</span> <span class="n">op2</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_then</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">label_else</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||||
|
<span class="k">return</span> <span class="nb">hash</span><span class="p">(</span><span class="nb">super</span><span class="p">)</span></div>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="n">Terminator</span> <span class="o">=</span> <span class="n">Return</span> <span class="o">|</span> <span class="n">AbsoluteJump</span> <span class="o">|</span> <span class="n">BranchingTerminator</span>
|
||||||
|
<span class="sd">"""Type alias for terminators"""</span>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="viewcode-block" id="jump2terminator"><a class="viewcode-back" href="../../api/Lib.Terminator.html#Lib.Terminator.jump2terminator">[docs]</a><span class="k">def</span> <span class="nf">jump2terminator</span><span class="p">(</span><span class="n">j</span><span class="p">:</span> <span class="n">ConditionalJump</span> <span class="o">|</span> <span class="n">AbsoluteJump</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span>
|
||||||
|
<span class="n">next_label</span><span class="p">:</span> <span class="n">Label</span> <span class="o">|</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">Terminator</span><span class="p">:</span>
|
||||||
|
<span class="w"> </span><span class="sd">"""</span>
|
||||||
|
<span class="sd"> Construct the Terminator associated to the potential jump j</span>
|
||||||
|
<span class="sd"> to the potential label next_label.</span>
|
||||||
|
<span class="sd"> """</span>
|
||||||
|
<span class="k">match</span> <span class="n">j</span><span class="p">:</span>
|
||||||
|
<span class="k">case</span> <span class="n">ConditionalJump</span><span class="p">():</span>
|
||||||
|
<span class="k">if</span> <span class="p">(</span><span class="n">next_label</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">):</span>
|
||||||
|
<span class="k">raise</span> <span class="n">MiniCInternalError</span><span class="p">(</span>
|
||||||
|
<span class="s2">"jump2terminator: Missing secondary label for instruction </span><span class="si">{}</span><span class="s2">"</span>
|
||||||
|
<span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">j</span><span class="p">))</span>
|
||||||
|
<span class="n">label_else</span> <span class="o">=</span> <span class="n">next_label</span>
|
||||||
|
<span class="k">return</span> <span class="n">BranchingTerminator</span><span class="p">(</span><span class="n">j</span><span class="o">.</span><span class="n">cond</span><span class="p">,</span> <span class="n">j</span><span class="o">.</span><span class="n">op1</span><span class="p">,</span> <span class="n">j</span><span class="o">.</span><span class="n">op2</span><span class="p">,</span> <span class="n">j</span><span class="o">.</span><span class="n">label</span><span class="p">,</span> <span class="n">label_else</span><span class="p">)</span>
|
||||||
|
<span class="k">case</span> <span class="n">AbsoluteJump</span><span class="p">():</span>
|
||||||
|
<span class="k">return</span> <span class="n">AbsoluteJump</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="n">j</span><span class="o">.</span><span class="n">label</span><span class="p">)</span>
|
||||||
|
<span class="k">case</span><span class="w"> </span><span class="k">_</span><span class="p">:</span>
|
||||||
|
<span class="k">if</span> <span class="n">next_label</span><span class="p">:</span>
|
||||||
|
<span class="k">return</span> <span class="n">AbsoluteJump</span><span class="p">(</span><span class="n">next_label</span><span class="p">)</span>
|
||||||
|
<span class="k">else</span><span class="p">:</span>
|
||||||
|
<span class="k">return</span> <span class="n">Return</span><span class="p">()</span></div>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2023, compil-lyon.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -74,12 +76,14 @@
|
|||||||
|
|
||||||
<h1>All modules for which code is available</h1>
|
<h1>All modules for which code is available</h1>
|
||||||
<ul><li><a href="Lib/Allocator.html">Lib.Allocator</a></li>
|
<ul><li><a href="Lib/Allocator.html">Lib.Allocator</a></li>
|
||||||
|
<li><a href="Lib/CFG.html">Lib.CFG</a></li>
|
||||||
<li><a href="Lib/Errors.html">Lib.Errors</a></li>
|
<li><a href="Lib/Errors.html">Lib.Errors</a></li>
|
||||||
<li><a href="Lib/FunctionData.html">Lib.FunctionData</a></li>
|
<li><a href="Lib/FunctionData.html">Lib.FunctionData</a></li>
|
||||||
<li><a href="Lib/LinearCode.html">Lib.LinearCode</a></li>
|
<li><a href="Lib/LinearCode.html">Lib.LinearCode</a></li>
|
||||||
<li><a href="Lib/Operands.html">Lib.Operands</a></li>
|
<li><a href="Lib/Operands.html">Lib.Operands</a></li>
|
||||||
<li><a href="Lib/RiscV.html">Lib.RiscV</a></li>
|
<li><a href="Lib/RiscV.html">Lib.RiscV</a></li>
|
||||||
<li><a href="Lib/Statement.html">Lib.Statement</a></li>
|
<li><a href="Lib/Statement.html">Lib.Statement</a></li>
|
||||||
|
<li><a href="Lib/Terminator.html">Lib.Terminator</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
7
docs/html/_sources/api/Lib.CFG.rst.txt
Normal file
7
docs/html/_sources/api/Lib.CFG.rst.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Lib.CFG module
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. automodule:: Lib.CFG
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
7
docs/html/_sources/api/Lib.Terminator.rst.txt
Normal file
7
docs/html/_sources/api/Lib.Terminator.rst.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Lib.Terminator module
|
||||||
|
=====================
|
||||||
|
|
||||||
|
.. automodule:: Lib.Terminator
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
@ -8,12 +8,14 @@ Submodules
|
|||||||
:maxdepth: 4
|
:maxdepth: 4
|
||||||
|
|
||||||
Lib.Allocator
|
Lib.Allocator
|
||||||
|
Lib.CFG
|
||||||
Lib.Errors
|
Lib.Errors
|
||||||
Lib.FunctionData
|
Lib.FunctionData
|
||||||
Lib.LinearCode
|
Lib.LinearCode
|
||||||
Lib.Operands
|
Lib.Operands
|
||||||
Lib.RiscV
|
Lib.RiscV
|
||||||
Lib.Statement
|
Lib.Statement
|
||||||
|
Lib.Terminator
|
||||||
|
|
||||||
Module contents
|
Module contents
|
||||||
---------------
|
---------------
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<script src="../_static/js/theme.js"></script>
|
<script src="../_static/js/theme.js"></script>
|
||||||
<link rel="index" title="Index" href="../genindex.html" />
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
<link rel="search" title="Search" href="../search.html" />
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Lib.CFG module" href="Lib.CFG.html" />
|
||||||
<link rel="prev" title="Lib.LinearCode module" href="Lib.LinearCode.html" />
|
<link rel="prev" title="Lib.LinearCode module" href="Lib.LinearCode.html" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -62,6 +63,8 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -159,6 +162,7 @@ Fail if there are too many temporaries.</p>
|
|||||||
</div>
|
</div>
|
||||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
<a href="Lib.LinearCode.html" class="btn btn-neutral float-left" title="Lib.LinearCode module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
<a href="Lib.LinearCode.html" class="btn btn-neutral float-left" title="Lib.LinearCode module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="Lib.CFG.html" class="btn btn-neutral float-right" title="Lib.CFG module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
372
docs/html/api/Lib.CFG.html
Normal file
372
docs/html/api/Lib.CFG.html
Normal file
@ -0,0 +1,372 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Lib.CFG module — MiniC documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="next" title="Lib.Terminator module" href="Lib.Terminator.html" />
|
||||||
|
<link rel="prev" title="Lib.Allocator module" href="Lib.Allocator.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../index.html" class="icon icon-home">
|
||||||
|
MiniC
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Errors.html">Base library - Errors</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Statement.html">Base library - Statement</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.RiscV.html">Base library - RISC-V instructions</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Operands.html">Base library - Operands</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Control Flow Graph - CFG and Basic blocks</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#Lib.CFG.Block"><code class="docutils literal notranslate"><span class="pre">Block</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.to_dot"><code class="docutils literal notranslate"><span class="pre">Block.to_dot()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_body"><code class="docutils literal notranslate"><span class="pre">Block.get_body()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_all_statements"><code class="docutils literal notranslate"><span class="pre">Block.get_all_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_body_and_terminator"><code class="docutils literal notranslate"><span class="pre">Block.get_body_and_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_label"><code class="docutils literal notranslate"><span class="pre">Block.get_label()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_in"><code class="docutils literal notranslate"><span class="pre">Block.get_in()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_terminator"><code class="docutils literal notranslate"><span class="pre">Block.get_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.set_terminator"><code class="docutils literal notranslate"><span class="pre">Block.set_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.get_phis"><code class="docutils literal notranslate"><span class="pre">Block.get_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.add_phi"><code class="docutils literal notranslate"><span class="pre">Block.add_phi()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.set_phis"><code class="docutils literal notranslate"><span class="pre">Block.set_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.remove_all_phis"><code class="docutils literal notranslate"><span class="pre">Block.remove_all_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.iter_statements"><code class="docutils literal notranslate"><span class="pre">Block.iter_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.Block.add_instruction"><code class="docutils literal notranslate"><span class="pre">Block.add_instruction()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#Lib.CFG.CFG"><code class="docutils literal notranslate"><span class="pre">CFG</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.fdata"><code class="docutils literal notranslate"><span class="pre">CFG.fdata</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.get_start"><code class="docutils literal notranslate"><span class="pre">CFG.get_start()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.set_start"><code class="docutils literal notranslate"><span class="pre">CFG.set_start()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.get_end"><code class="docutils literal notranslate"><span class="pre">CFG.get_end()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.add_block"><code class="docutils literal notranslate"><span class="pre">CFG.add_block()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.get_block"><code class="docutils literal notranslate"><span class="pre">CFG.get_block()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.get_blocks"><code class="docutils literal notranslate"><span class="pre">CFG.get_blocks()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.get_entries"><code class="docutils literal notranslate"><span class="pre">CFG.get_entries()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.add_edge"><code class="docutils literal notranslate"><span class="pre">CFG.add_edge()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.remove_edge"><code class="docutils literal notranslate"><span class="pre">CFG.remove_edge()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.out_blocks"><code class="docutils literal notranslate"><span class="pre">CFG.out_blocks()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.gather_defs"><code class="docutils literal notranslate"><span class="pre">CFG.gather_defs()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.iter_statements"><code class="docutils literal notranslate"><span class="pre">CFG.iter_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.linearize_naive"><code class="docutils literal notranslate"><span class="pre">CFG.linearize_naive()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.print_code"><code class="docutils literal notranslate"><span class="pre">CFG.print_code()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.CFG.CFG.print_dot"><code class="docutils literal notranslate"><span class="pre">CFG.print_dot()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">MiniC</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
|
||||||
|
<li class="breadcrumb-item active">Lib.CFG module</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="../_sources/api/Lib.CFG.rst.txt" rel="nofollow"> View page source</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="module-Lib.CFG">
|
||||||
|
<span id="lib-cfg-module"></span><h1>Lib.CFG module<a class="headerlink" href="#module-Lib.CFG" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>Classes for a RiscV CFG: <a class="reference internal" href="#Lib.CFG.CFG" title="Lib.CFG.CFG"><code class="xref py py-class docutils literal notranslate"><span class="pre">CFG</span></code></a> for the CFG itself,
|
||||||
|
and <a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><code class="xref py py-class docutils literal notranslate"><span class="pre">Block</span></code></a> for its basic blocks.</p>
|
||||||
|
<dl class="py class">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block">
|
||||||
|
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.CFG.</span></span><span class="sig-name descname"><span class="pre">Block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">label</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">insts</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Instru3A" title="Lib.Statement.Instru3A"><span class="pre">Instru3A</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Comment" title="Lib.Statement.Comment"><span class="pre">Comment</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">terminator</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return" title="Lib.Terminator.Return"><span class="pre">Return</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.AbsoluteJump" title="Lib.Statement.AbsoluteJump"><span class="pre">AbsoluteJump</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator" title="Lib.Terminator.BranchingTerminator"><span class="pre">BranchingTerminator</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/CFG.html#Block"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||||||
|
<p>A basic block of a <a class="reference internal" href="#Lib.CFG.CFG" title="Lib.CFG.CFG"><code class="xref py py-class docutils literal notranslate"><span class="pre">CFG</span></code></a> is made of three main parts:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><p>a start <a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><code class="xref py py-class docutils literal notranslate"><span class="pre">label</span></code></a> that uniquely identifies the block in the CFG</p></li>
|
||||||
|
<li><p>the main body of the block, a list of instructions
|
||||||
|
(excluding labels, jumps and branching instructions)</p></li>
|
||||||
|
<li><p>a <a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Terminator" title="Lib.Terminator.Terminator"><code class="xref py py-class docutils literal notranslate"><span class="pre">terminator</span></code></a>
|
||||||
|
that represents the final jump or branching instruction of the block,
|
||||||
|
and points to the successors of the block.
|
||||||
|
See the documentation for <a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Terminator" title="Lib.Terminator.Terminator"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lib.Terminator.Terminator</span></code></a> for further explanations.</p></li>
|
||||||
|
</ul>
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.to_dot">
|
||||||
|
<span class="sig-name descname"><span class="pre">to_dot</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.to_dot"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.to_dot" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Outputs all statements of the block as a string.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_body">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_body</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Instru3A" title="Lib.Statement.Instru3A"><span class="pre">Instru3A</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Comment" title="Lib.Statement.Comment"><span class="pre">Comment</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_body"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_body" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the statements in the body of the block (no phi-node nor the terminator).</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_all_statements">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_all_statements</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><span class="pre">Statement</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_all_statements"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_all_statements" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return all statements of the block
|
||||||
|
(including phi-nodes and the terminator, but not the label of the block).</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_body_and_terminator">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_body_and_terminator</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><span class="pre">Statement</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_body_and_terminator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_body_and_terminator" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return all statements of the block, except phi-nodes
|
||||||
|
(and the label of the block).</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_label">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_label</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_label"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_label" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the label of the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_in">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_in</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_in"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_in" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the list of blocks with an edge to the considered block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_terminator">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_terminator</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return" title="Lib.Terminator.Return"><span class="pre">Return</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.AbsoluteJump" title="Lib.Statement.AbsoluteJump"><span class="pre">AbsoluteJump</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator" title="Lib.Terminator.BranchingTerminator"><span class="pre">BranchingTerminator</span></a></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_terminator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_terminator" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the terminator of the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.set_terminator">
|
||||||
|
<span class="sig-name descname"><span class="pre">set_terminator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">term</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return" title="Lib.Terminator.Return"><span class="pre">Return</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.AbsoluteJump" title="Lib.Statement.AbsoluteJump"><span class="pre">AbsoluteJump</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator" title="Lib.Terminator.BranchingTerminator"><span class="pre">BranchingTerminator</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.set_terminator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.set_terminator" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Set the terminator of the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.get_phis">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_phis</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><span class="pre">Statement</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.get_phis"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.get_phis" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the list of all φ instructions of the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.add_phi">
|
||||||
|
<span class="sig-name descname"><span class="pre">add_phi</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">phi</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><span class="pre">Statement</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.add_phi"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.add_phi" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Add a φ instruction to the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.set_phis">
|
||||||
|
<span class="sig-name descname"><span class="pre">set_phis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">phis</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><span class="pre">Statement</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.set_phis"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.set_phis" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Replace the φ instructions in the block by the given list <cite>phis</cite>.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.remove_all_phis">
|
||||||
|
<span class="sig-name descname"><span class="pre">remove_all_phis</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.remove_all_phis"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.remove_all_phis" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Remove all φ instructions in the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.iter_statements">
|
||||||
|
<span class="sig-name descname"><span class="pre">iter_statements</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.iter_statements"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.iter_statements" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Iterate over instructions.
|
||||||
|
For each real instruction i (not label or comment), replace it
|
||||||
|
with the list of instructions given by f(i).</p>
|
||||||
|
<p>Assume there is no phi-node.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.Block.add_instruction">
|
||||||
|
<span class="sig-name descname"><span class="pre">add_instruction</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">instr</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Instru3A" title="Lib.Statement.Instru3A"><span class="pre">Instru3A</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Comment" title="Lib.Statement.Comment"><span class="pre">Comment</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#Block.add_instruction"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.Block.add_instruction" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Add an instruction to the body of the block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py class">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG">
|
||||||
|
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.CFG.</span></span><span class="sig-name descname"><span class="pre">CFG</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fdata</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.FunctionData.html#Lib.FunctionData.FunctionData" title="Lib.FunctionData.FunctionData"><span class="pre">FunctionData</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
|
||||||
|
<p>A complete control-flow graph representing a function.
|
||||||
|
This class is mainly made of a list of basic <a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><code class="xref py py-class docutils literal notranslate"><span class="pre">Block</span></code></a>,
|
||||||
|
a label indicating the <a class="reference internal" href="#Lib.CFG.CFG.get_start" title="Lib.CFG.CFG.get_start"><code class="xref py py-meth docutils literal notranslate"><span class="pre">entry</span> <span class="pre">point</span> <span class="pre">of</span> <span class="pre">the</span> <span class="pre">function</span></code></a>,
|
||||||
|
and an <a class="reference internal" href="#Lib.CFG.CFG.get_end" title="Lib.CFG.CFG.get_end"><code class="xref py py-meth docutils literal notranslate"><span class="pre">exit</span> <span class="pre">label</span></code></a>.</p>
|
||||||
|
<p>As with linear code, metadata about the function can be found
|
||||||
|
in the <a class="reference internal" href="#Lib.CFG.CFG.fdata" title="Lib.CFG.CFG.fdata"><code class="xref py py-attr docutils literal notranslate"><span class="pre">fdata</span></code></a> member variable.</p>
|
||||||
|
<dl class="py attribute">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.fdata">
|
||||||
|
<span class="sig-name descname"><span class="pre">fdata</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="Lib.FunctionData.html#Lib.FunctionData.FunctionData" title="Lib.FunctionData.FunctionData"><span class="pre">FunctionData</span></a></em><a class="headerlink" href="#Lib.CFG.CFG.fdata" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Metadata about the function represented by this CFG</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.get_start">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_start</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.get_start"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.get_start" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the entry label of the CFG.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.set_start">
|
||||||
|
<span class="sig-name descname"><span class="pre">set_start</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">start</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.set_start"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.set_start" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Set the entry label of the CFG.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.get_end">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_end</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.get_end"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.get_end" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the exit label of the CFG.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.add_block">
|
||||||
|
<span class="sig-name descname"><span class="pre">add_block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">blk</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.add_block"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.add_block" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Add a new block to the CFG.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.get_block">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.get_block"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.get_block" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the block with label <cite>name</cite>.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.get_blocks">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_blocks</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.get_blocks"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.get_blocks" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return all the blocks.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.get_entries">
|
||||||
|
<span class="sig-name descname"><span class="pre">get_entries</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.get_entries"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.get_entries" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return all the blocks with no predecessors.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.add_edge">
|
||||||
|
<span class="sig-name descname"><span class="pre">add_edge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.add_edge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.add_edge" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Add the edge src -> dest in the control flow graph.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.remove_edge">
|
||||||
|
<span class="sig-name descname"><span class="pre">remove_edge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">src</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">dest</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.remove_edge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.remove_edge" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Remove the edge src -> dest in the control flow graph.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.out_blocks">
|
||||||
|
<span class="sig-name descname"><span class="pre">out_blocks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">block</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.out_blocks"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.out_blocks" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the list of blocks in the CFG targeted by
|
||||||
|
the Terminator of Block block.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.gather_defs">
|
||||||
|
<span class="sig-name descname"><span class="pre">gather_defs</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Set</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.gather_defs"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.gather_defs" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return a dictionary associating variables to all the blocks
|
||||||
|
containing one of their definitions.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.iter_statements">
|
||||||
|
<span class="sig-name descname"><span class="pre">iter_statements</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.iter_statements"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.iter_statements" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Apply f to all instructions in all the blocks.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.linearize_naive">
|
||||||
|
<span class="sig-name descname"><span class="pre">linearize_naive</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">Iterator</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><span class="pre">Statement</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.linearize_naive"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.linearize_naive" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Linearize the given control flow graph as a list of instructions.
|
||||||
|
Naive procedure that adds jumps everywhere.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.print_code">
|
||||||
|
<span class="sig-name descname"><span class="pre">print_code</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">linearize=<function</span> <span class="pre">CFG.<lambda>></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">comment=None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.print_code"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.print_code" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Print the linearization of the CFG.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.CFG.CFG.print_dot">
|
||||||
|
<span class="sig-name descname"><span class="pre">print_dot</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">DF</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">view</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference internal" href="../_modules/Lib/CFG.html#CFG.print_dot"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.CFG.CFG.print_dot" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Print the CFG as a graph.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="Lib.Allocator.html" class="btn btn-neutral float-left" title="Lib.Allocator module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
<a href="Lib.Terminator.html" class="btn btn-neutral float-right" title="Lib.Terminator module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2023, compil-lyon.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -57,6 +57,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,6 +61,8 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,6 +64,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -96,6 +96,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,6 +67,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -109,6 +109,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
287
docs/html/api/Lib.Terminator.html
Normal file
287
docs/html/api/Lib.Terminator.html
Normal file
@ -0,0 +1,287 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="writer-html5" lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Lib.Terminator module — MiniC documentation</title>
|
||||||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="../_static/js/html5shiv.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||||
|
<script src="../_static/doctools.js"></script>
|
||||||
|
<script src="../_static/sphinx_highlight.js"></script>
|
||||||
|
<script src="../_static/js/theme.js"></script>
|
||||||
|
<link rel="index" title="Index" href="../genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="../search.html" />
|
||||||
|
<link rel="prev" title="Lib.CFG module" href="Lib.CFG.html" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav">
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-scroll">
|
||||||
|
<div class="wy-side-nav-search" >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="../index.html" class="icon icon-home">
|
||||||
|
MiniC
|
||||||
|
</a>
|
||||||
|
<div role="search">
|
||||||
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
||||||
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Errors.html">Base library - Errors</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Statement.html">Base library - Statement</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.RiscV.html">Base library - RISC-V instructions</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Operands.html">Base library - Operands</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Control Flow Graph - Terminators</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#Lib.Terminator.Return"><code class="docutils literal notranslate"><span class="pre">Return</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.printIns"><code class="docutils literal notranslate"><span class="pre">Return.printIns()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.targets"><code class="docutils literal notranslate"><span class="pre">Return.targets()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.args"><code class="docutils literal notranslate"><span class="pre">Return.args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.rename"><code class="docutils literal notranslate"><span class="pre">Return.rename()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.substitute"><code class="docutils literal notranslate"><span class="pre">Return.substitute()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.with_args"><code class="docutils literal notranslate"><span class="pre">Return.with_args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.Return.is_read_only"><code class="docutils literal notranslate"><span class="pre">Return.is_read_only()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.cond"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.cond</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.label_then"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.label_then</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.label_else"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.label_else</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.op1"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.op1</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.op2"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.op2</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.args"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.targets"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.targets()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.rename"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.rename()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.substitute"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.substitute()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#Lib.Terminator.BranchingTerminator.with_args"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.with_args()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#Lib.Terminator.Terminator"><code class="docutils literal notranslate"><span class="pre">Terminator</span></code></a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#Lib.Terminator.jump2terminator"><code class="docutils literal notranslate"><span class="pre">jump2terminator()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="../index.html">MiniC</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="Page navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
|
||||||
|
<li class="breadcrumb-item active">Lib.Terminator module</li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
<a href="../_sources/api/Lib.Terminator.rst.txt" rel="nofollow"> View page source</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||||
|
<div itemprop="articleBody">
|
||||||
|
|
||||||
|
<section id="module-Lib.Terminator">
|
||||||
|
<span id="lib-terminator-module"></span><h1>Lib.Terminator module<a class="headerlink" href="#module-Lib.Terminator" title="Permalink to this heading"></a></h1>
|
||||||
|
<p>MIF08, CAP, CFG library - Terminators.</p>
|
||||||
|
<p>Each <a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><code class="xref py py-class docutils literal notranslate"><span class="pre">block</span></code></a> of a <a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG" title="Lib.CFG.CFG"><code class="xref py py-class docutils literal notranslate"><span class="pre">CFG</span></code></a>
|
||||||
|
ends with a branching instruction called a terminator.
|
||||||
|
There are three kinds of terminators:</p>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><p><a class="reference internal" href="Lib.Statement.html#Lib.Statement.AbsoluteJump" title="Lib.Statement.AbsoluteJump"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lib.Statement.AbsoluteJump</span></code></a> is a non-conditional jump
|
||||||
|
to another block of the CFG</p></li>
|
||||||
|
<li><p><a class="reference internal" href="#Lib.Terminator.BranchingTerminator" title="Lib.Terminator.BranchingTerminator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BranchingTerminator</span></code></a> is a conditional branching
|
||||||
|
instruction with two successor blocks.
|
||||||
|
Unlike the class <a class="reference internal" href="Lib.Statement.html#Lib.Statement.ConditionalJump" title="Lib.Statement.ConditionalJump"><code class="xref py py-class docutils literal notranslate"><span class="pre">ConditionalJump</span></code></a>
|
||||||
|
that was used in <a class="reference internal" href="Lib.LinearCode.html#Lib.LinearCode.LinearCode" title="Lib.LinearCode.LinearCode"><code class="xref py py-class docutils literal notranslate"><span class="pre">LinearCode</span></code></a>,
|
||||||
|
both successor labels have to be specified.</p></li>
|
||||||
|
<li><p><a class="reference internal" href="#Lib.Terminator.Return" title="Lib.Terminator.Return"><code class="xref py py-class docutils literal notranslate"><span class="pre">Return</span></code></a> marks the end of the function</p></li>
|
||||||
|
</ul>
|
||||||
|
<p>During the construction of the CFG, <a class="reference internal" href="#Lib.Terminator.jump2terminator" title="Lib.Terminator.jump2terminator"><code class="xref py py-func docutils literal notranslate"><span class="pre">jump2terminator()</span></code></a> builds
|
||||||
|
a terminator for each extracted chunk of instructions.</p>
|
||||||
|
<dl class="py class">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return">
|
||||||
|
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.Terminator.</span></span><span class="sig-name descname"><span class="pre">Return</span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Bases: <a class="reference internal" href="Lib.Statement.html#Lib.Statement.Statement" title="Lib.Statement.Statement"><code class="xref py py-class docutils literal notranslate"><span class="pre">Statement</span></code></a></p>
|
||||||
|
<p>A terminator that marks the end of the function.</p>
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.printIns">
|
||||||
|
<span class="sig-name descname"><span class="pre">printIns</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.printIns"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.printIns" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Print the statement on the given output.
|
||||||
|
Should never be called on the base class.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.targets">
|
||||||
|
<span class="sig-name descname"><span class="pre">targets</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.targets"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.targets" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the labels targetted by the Return terminator.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.args">
|
||||||
|
<span class="sig-name descname"><span class="pre">args</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.args"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.args" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd></dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.rename">
|
||||||
|
<span class="sig-name descname"><span class="pre">rename</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">renamer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Renamer" title="Lib.Operands.Renamer"><span class="pre">Renamer</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.rename"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.rename" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd></dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.substitute">
|
||||||
|
<span class="sig-name descname"><span class="pre">substitute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">subst</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.substitute"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.substitute" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return a new instruction, cloned from this one, replacing operands
|
||||||
|
that appear as key in subst by their value.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.with_args">
|
||||||
|
<span class="sig-name descname"><span class="pre">with_args</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">new_args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.with_args"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.with_args" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return a new instruction, cloned from this one, where operands have
|
||||||
|
been replaced by new_args.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Return.is_read_only">
|
||||||
|
<span class="sig-name descname"><span class="pre">is_read_only</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#Return.is_read_only"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.Return.is_read_only" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd></dd></dl>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py class">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator">
|
||||||
|
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.Terminator.</span></span><span class="sig-name descname"><span class="pre">BranchingTerminator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cond</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Condition" title="Lib.Operands.Condition"><span class="pre">Condition</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">op1</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">op2</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">label_then</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">label_else</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#BranchingTerminator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.BranchingTerminator" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Bases: <a class="reference internal" href="Lib.Statement.html#Lib.Statement.Instruction" title="Lib.Statement.Instruction"><code class="xref py py-class docutils literal notranslate"><span class="pre">Instruction</span></code></a></p>
|
||||||
|
<p>A terminating statement with a condition.</p>
|
||||||
|
<dl class="py attribute">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.cond">
|
||||||
|
<span class="sig-name descname"><span class="pre">cond</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Condition" title="Lib.Operands.Condition"><span class="pre">Condition</span></a></em><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.cond" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>The condition of the branch</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py attribute">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.label_then">
|
||||||
|
<span class="sig-name descname"><span class="pre">label_then</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></em><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.label_then" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>The destination label if the condition is true</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py attribute">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.label_else">
|
||||||
|
<span class="sig-name descname"><span class="pre">label_else</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a></em><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.label_else" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>The destination label if the condition is false</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py attribute">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.op1">
|
||||||
|
<span class="sig-name descname"><span class="pre">op1</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a></em><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.op1" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>The first operand of the condition</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py attribute">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.op2">
|
||||||
|
<span class="sig-name descname"><span class="pre">op2</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a></em><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.op2" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>The second operand of the condition</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.args">
|
||||||
|
<span class="sig-name descname"><span class="pre">args</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#BranchingTerminator.args"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.args" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>List of operands the instruction takes</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.targets">
|
||||||
|
<span class="sig-name descname"><span class="pre">targets</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#BranchingTerminator.targets"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.targets" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return the labels targetted by the Branching terminator.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.rename">
|
||||||
|
<span class="sig-name descname"><span class="pre">rename</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">renamer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Renamer" title="Lib.Operands.Renamer"><span class="pre">Renamer</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#BranchingTerminator.rename"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.rename" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd></dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.substitute">
|
||||||
|
<span class="sig-name descname"><span class="pre">substitute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">subst</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#BranchingTerminator.substitute"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.substitute" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return a new instruction, cloned from this one, replacing operands
|
||||||
|
that appear as key in subst by their value.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py method">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.BranchingTerminator.with_args">
|
||||||
|
<span class="sig-name descname"><span class="pre">with_args</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">new_args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Operand" title="Lib.Operands.Operand"><span class="pre">Operand</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Terminator.html#BranchingTerminator.with_args"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.BranchingTerminator.with_args" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Return a new instruction, cloned from this one, where operands have
|
||||||
|
been replaced by new_args.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py data">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.Terminator">
|
||||||
|
<span class="sig-prename descclassname"><span class="pre">Lib.Terminator.</span></span><span class="sig-name descname"><span class="pre">Terminator</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">Lib.Terminator.Return</span> <span class="pre">|</span> <span class="pre">Lib.Statement.AbsoluteJump</span> <span class="pre">|</span> <span class="pre">Lib.Terminator.BranchingTerminator</span></em><a class="headerlink" href="#Lib.Terminator.Terminator" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Type alias for terminators</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="py function">
|
||||||
|
<dt class="sig sig-object py" id="Lib.Terminator.jump2terminator">
|
||||||
|
<span class="sig-prename descclassname"><span class="pre">Lib.Terminator.</span></span><span class="sig-name descname"><span class="pre">jump2terminator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">j</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.ConditionalJump" title="Lib.Statement.ConditionalJump"><span class="pre">ConditionalJump</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.AbsoluteJump" title="Lib.Statement.AbsoluteJump"><span class="pre">AbsoluteJump</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">next_label</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="#Lib.Terminator.Return" title="Lib.Terminator.Return"><span class="pre">Return</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="Lib.Statement.html#Lib.Statement.AbsoluteJump" title="Lib.Statement.AbsoluteJump"><span class="pre">AbsoluteJump</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="#Lib.Terminator.BranchingTerminator" title="Lib.Terminator.BranchingTerminator"><span class="pre">BranchingTerminator</span></a></span></span><a class="reference internal" href="../_modules/Lib/Terminator.html#jump2terminator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Terminator.jump2terminator" title="Permalink to this definition"></a></dt>
|
||||||
|
<dd><p>Construct the Terminator associated to the potential jump j
|
||||||
|
to the potential label next_label.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||||
|
<a href="Lib.CFG.html" class="btn btn-neutral float-left" title="Lib.CFG module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>© Copyright 2023, compil-lyon.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||||
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||||
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.Navigation.enable(true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -48,6 +48,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -94,6 +96,45 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Lib.CFG module</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block"><code class="docutils literal notranslate"><span class="pre">Block</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.to_dot"><code class="docutils literal notranslate"><span class="pre">Block.to_dot()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_body"><code class="docutils literal notranslate"><span class="pre">Block.get_body()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_all_statements"><code class="docutils literal notranslate"><span class="pre">Block.get_all_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_body_and_terminator"><code class="docutils literal notranslate"><span class="pre">Block.get_body_and_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_label"><code class="docutils literal notranslate"><span class="pre">Block.get_label()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_in"><code class="docutils literal notranslate"><span class="pre">Block.get_in()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_terminator"><code class="docutils literal notranslate"><span class="pre">Block.get_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.set_terminator"><code class="docutils literal notranslate"><span class="pre">Block.set_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.get_phis"><code class="docutils literal notranslate"><span class="pre">Block.get_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.add_phi"><code class="docutils literal notranslate"><span class="pre">Block.add_phi()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.set_phis"><code class="docutils literal notranslate"><span class="pre">Block.set_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.remove_all_phis"><code class="docutils literal notranslate"><span class="pre">Block.remove_all_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.iter_statements"><code class="docutils literal notranslate"><span class="pre">Block.iter_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block.add_instruction"><code class="docutils literal notranslate"><span class="pre">Block.add_instruction()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG"><code class="docutils literal notranslate"><span class="pre">CFG</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.fdata"><code class="docutils literal notranslate"><span class="pre">CFG.fdata</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.get_start"><code class="docutils literal notranslate"><span class="pre">CFG.get_start()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.set_start"><code class="docutils literal notranslate"><span class="pre">CFG.set_start()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.get_end"><code class="docutils literal notranslate"><span class="pre">CFG.get_end()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.add_block"><code class="docutils literal notranslate"><span class="pre">CFG.add_block()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.get_block"><code class="docutils literal notranslate"><span class="pre">CFG.get_block()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.get_blocks"><code class="docutils literal notranslate"><span class="pre">CFG.get_blocks()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.get_entries"><code class="docutils literal notranslate"><span class="pre">CFG.get_entries()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.add_edge"><code class="docutils literal notranslate"><span class="pre">CFG.add_edge()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.remove_edge"><code class="docutils literal notranslate"><span class="pre">CFG.remove_edge()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.out_blocks"><code class="docutils literal notranslate"><span class="pre">CFG.out_blocks()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.gather_defs"><code class="docutils literal notranslate"><span class="pre">CFG.gather_defs()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.iter_statements"><code class="docutils literal notranslate"><span class="pre">CFG.iter_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.linearize_naive"><code class="docutils literal notranslate"><span class="pre">CFG.linearize_naive()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.print_code"><code class="docutils literal notranslate"><span class="pre">CFG.print_code()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG.print_dot"><code class="docutils literal notranslate"><span class="pre">CFG.print_dot()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Errors.html">Lib.Errors module</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Errors.html">Lib.Errors module</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCRuntimeError"><code class="docutils literal notranslate"><span class="pre">MiniCRuntimeError</span></code></a></li>
|
<li class="toctree-l2"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCRuntimeError"><code class="docutils literal notranslate"><span class="pre">MiniCRuntimeError</span></code></a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCInternalError"><code class="docutils literal notranslate"><span class="pre">MiniCInternalError</span></code></a></li>
|
<li class="toctree-l2"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCInternalError"><code class="docutils literal notranslate"><span class="pre">MiniCInternalError</span></code></a></li>
|
||||||
@ -254,6 +295,34 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Lib.Terminator module</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return"><code class="docutils literal notranslate"><span class="pre">Return</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.printIns"><code class="docutils literal notranslate"><span class="pre">Return.printIns()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.targets"><code class="docutils literal notranslate"><span class="pre">Return.targets()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.args"><code class="docutils literal notranslate"><span class="pre">Return.args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.rename"><code class="docutils literal notranslate"><span class="pre">Return.rename()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.substitute"><code class="docutils literal notranslate"><span class="pre">Return.substitute()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.with_args"><code class="docutils literal notranslate"><span class="pre">Return.with_args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return.is_read_only"><code class="docutils literal notranslate"><span class="pre">Return.is_read_only()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.cond"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.cond</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.label_then"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.label_then</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.label_else"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.label_else</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.op1"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.op1</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.op2"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.op2</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.args"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.targets"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.targets()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.rename"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.rename()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.substitute"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.substitute()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator.with_args"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.with_args()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Terminator"><code class="docutils literal notranslate"><span class="pre">Terminator</span></code></a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.jump2terminator"><code class="docutils literal notranslate"><span class="pre">jump2terminator()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -85,6 +87,11 @@
|
|||||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Allocator.html#Lib.Allocator.NaiveAllocator"><code class="docutils literal notranslate"><span class="pre">NaiveAllocator</span></code></a></li>
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Allocator.html#Lib.Allocator.NaiveAllocator"><code class="docutils literal notranslate"><span class="pre">NaiveAllocator</span></code></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.CFG.html">Lib.CFG module</a><ul>
|
||||||
|
<li class="toctree-l4"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block"><code class="docutils literal notranslate"><span class="pre">Block</span></code></a></li>
|
||||||
|
<li class="toctree-l4"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG"><code class="docutils literal notranslate"><span class="pre">CFG</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Errors.html">Lib.Errors module</a><ul>
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Errors.html">Lib.Errors module</a><ul>
|
||||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCRuntimeError"><code class="docutils literal notranslate"><span class="pre">MiniCRuntimeError</span></code></a></li>
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCRuntimeError"><code class="docutils literal notranslate"><span class="pre">MiniCRuntimeError</span></code></a></li>
|
||||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCInternalError"><code class="docutils literal notranslate"><span class="pre">MiniCInternalError</span></code></a></li>
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Errors.html#Lib.Errors.MiniCInternalError"><code class="docutils literal notranslate"><span class="pre">MiniCInternalError</span></code></a></li>
|
||||||
@ -155,6 +162,13 @@
|
|||||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.ConditionalJump"><code class="docutils literal notranslate"><span class="pre">ConditionalJump</span></code></a></li>
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Statement.html#Lib.Statement.ConditionalJump"><code class="docutils literal notranslate"><span class="pre">ConditionalJump</span></code></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="Lib.Terminator.html">Lib.Terminator module</a><ul>
|
||||||
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Return"><code class="docutils literal notranslate"><span class="pre">Return</span></code></a></li>
|
||||||
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.BranchingTerminator"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator</span></code></a></li>
|
||||||
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.Terminator"><code class="docutils literal notranslate"><span class="pre">Terminator</span></code></a></li>
|
||||||
|
<li class="toctree-l4"><a class="reference internal" href="Lib.Terminator.html#Lib.Terminator.jump2terminator"><code class="docutils literal notranslate"><span class="pre">jump2terminator()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="Lib.html#module-Lib">Module contents</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="Lib.html#module-Lib">Module contents</a></li>
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -77,6 +79,7 @@
|
|||||||
|
|
||||||
<div class="genindex-jumpbox">
|
<div class="genindex-jumpbox">
|
||||||
<a href="#A"><strong>A</strong></a>
|
<a href="#A"><strong>A</strong></a>
|
||||||
|
| <a href="#B"><strong>B</strong></a>
|
||||||
| <a href="#C"><strong>C</strong></a>
|
| <a href="#C"><strong>C</strong></a>
|
||||||
| <a href="#D"><strong>D</strong></a>
|
| <a href="#D"><strong>D</strong></a>
|
||||||
| <a href="#F"><strong>F</strong></a>
|
| <a href="#F"><strong>F</strong></a>
|
||||||
@ -109,16 +112,26 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump">AbsoluteJump (class in Lib.Statement)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump">AbsoluteJump (class in Lib.Statement)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.add">add() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.add">add() (in module Lib.RiscV)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.add_block">add_block() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_comment">add_comment() (Lib.LinearCode.LinearCode method)</a>
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_comment">add_comment() (Lib.LinearCode.LinearCode method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_instruction">add_instruction() (Lib.LinearCode.LinearCode method)</a>
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.add_edge">add_edge() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.add_instruction">add_instruction() (Lib.CFG.Block method)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_instruction">(Lib.LinearCode.LinearCode method)</a>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_instruction_PRINTLN_INT">add_instruction_PRINTLN_INT() (Lib.LinearCode.LinearCode method)</a>
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_instruction_PRINTLN_INT">add_instruction_PRINTLN_INT() (Lib.LinearCode.LinearCode method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_label">add_label() (Lib.LinearCode.LinearCode method)</a>
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_label">add_label() (Lib.LinearCode.LinearCode method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.add_phi">add_phi() (Lib.CFG.Block method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.add_tmp">add_tmp() (Lib.Operands.TemporaryPool method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.add_tmp">add_tmp() (Lib.Operands.TemporaryPool method)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -134,22 +147,44 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.args">(Lib.Statement.Instru3A method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.args">(Lib.Statement.Instru3A method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.args">(Lib.Statement.Instruction method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.args">(Lib.Statement.Instruction method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.args">(Lib.Terminator.BranchingTerminator method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.args">(Lib.Terminator.Return method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
|
||||||
|
<h2 id="B">B</h2>
|
||||||
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block">Block (class in Lib.CFG)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator">BranchingTerminator (class in Lib.Terminator)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
</tr></table>
|
||||||
|
|
||||||
<h2 id="C">C</h2>
|
<h2 id="C">C</h2>
|
||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.call">call() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.call">call() (in module Lib.RiscV)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG">CFG (class in Lib.CFG)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment">Comment (class in Lib.Statement)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment">Comment (class in Lib.Statement)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment.comment">comment (Lib.Statement.Comment attribute)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment.comment">comment (Lib.Statement.Comment attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.cond">cond (Lib.Statement.ConditionalJump attribute)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.cond">cond (Lib.Statement.ConditionalJump attribute)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.cond">(Lib.Terminator.BranchingTerminator attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Condition">Condition (class in Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Condition">Condition (class in Lib.Operands)</a>
|
||||||
@ -186,8 +221,12 @@
|
|||||||
<h2 id="F">F</h2>
|
<h2 id="F">F</h2>
|
||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.fdata">fdata (Lib.LinearCode.LinearCode attribute)</a>
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.fdata">fdata (Lib.CFG.CFG attribute)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.fdata">(Lib.LinearCode.LinearCode attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.FP">FP (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.FP">FP (in module Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer.fresh">fresh() (Lib.Operands.Renamer method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer.fresh">fresh() (Lib.Operands.Renamer method)</a>
|
||||||
@ -214,6 +253,10 @@
|
|||||||
<h2 id="G">G</h2>
|
<h2 id="G">G</h2>
|
||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.gather_defs">gather_defs() (Lib.CFG.CFG method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_all_statements">get_all_statements() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.get_all_temps">get_all_temps() (Lib.Operands.TemporaryPool method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.get_all_temps">get_all_temps() (Lib.Operands.TemporaryPool method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Temporary.get_alloced_loc">get_alloced_loc() (Lib.Operands.Temporary method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Temporary.get_alloced_loc">get_alloced_loc() (Lib.Operands.Temporary method)</a>
|
||||||
@ -222,12 +265,28 @@
|
|||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.get_alloced_loc">(Lib.Operands.TemporaryPool method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.get_alloced_loc">(Lib.Operands.TemporaryPool method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.get_instructions">get_instructions() (Lib.LinearCode.LinearCode method)</a>
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_block">get_block() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.FunctionData.html#Lib.FunctionData.FunctionData.get_label_div_by_zero">get_label_div_by_zero() (Lib.FunctionData.FunctionData method)</a>
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_blocks">get_blocks() (Lib.CFG.CFG method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_body">get_body() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_body_and_terminator">get_body_and_terminator() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_end">get_end() (Lib.CFG.CFG method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_entries">get_entries() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_in">get_in() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.get_instructions">get_instructions() (Lib.LinearCode.LinearCode method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_label">get_label() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.FunctionData.html#Lib.FunctionData.FunctionData.get_label_div_by_zero">get_label_div_by_zero() (Lib.FunctionData.FunctionData method)</a>
|
||||||
|
</li>
|
||||||
<li><a href="api/Lib.FunctionData.html#Lib.FunctionData.FunctionData.get_name">get_name() (Lib.FunctionData.FunctionData method)</a>
|
<li><a href="api/Lib.FunctionData.html#Lib.FunctionData.FunctionData.get_name">get_name() (Lib.FunctionData.FunctionData method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.FunctionData.html#Lib.FunctionData.FunctionData.get_offset">get_offset() (Lib.FunctionData.FunctionData method)</a>
|
<li><a href="api/Lib.FunctionData.html#Lib.FunctionData.FunctionData.get_offset">get_offset() (Lib.FunctionData.FunctionData method)</a>
|
||||||
@ -236,6 +295,12 @@
|
|||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Offset.get_offset">(Lib.Operands.Offset method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Offset.get_offset">(Lib.Operands.Offset method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_phis">get_phis() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_start">get_start() (Lib.CFG.CFG method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_terminator">get_terminator() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.GP">GP (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.GP">GP (in module Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.GP_REGS">GP_REGS (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.GP_REGS">GP_REGS (in module Lib.Operands)</a>
|
||||||
@ -254,16 +319,26 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.ins">(Lib.Statement.Instruction attribute)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.ins">(Lib.Statement.Instruction attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A">Instru3A (class in Lib.Statement)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A">Instru3A (class in Lib.Statement)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction">Instruction (class in Lib.Statement)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction">Instruction (class in Lib.Statement)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.is_read_only">is_read_only() (Lib.Statement.Instruction method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.is_read_only">is_read_only() (Lib.Statement.Instruction method)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.is_read_only">(Lib.Terminator.Return method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.iter_statements">iter_statements() (Lib.LinearCode.LinearCode method)</a>
|
</ul></li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.iter_statements">iter_statements() (Lib.CFG.Block method)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.iter_statements">(Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.iter_statements">(Lib.LinearCode.LinearCode method)</a>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
|
||||||
@ -271,6 +346,10 @@
|
|||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.jump">jump() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.jump">jump() (in module Lib.RiscV)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.jump2terminator">jump2terminator() (in module Lib.Terminator)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
@ -286,6 +365,10 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.label">(Lib.Statement.ConditionalJump attribute)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.label">(Lib.Statement.ConditionalJump attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.label_else">label_else (Lib.Terminator.BranchingTerminator attribute)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.label_then">label_then (Lib.Terminator.BranchingTerminator attribute)</a>
|
||||||
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.land">land() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.land">land() (in module Lib.RiscV)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.ld">ld() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.ld">ld() (in module Lib.RiscV)</a>
|
||||||
@ -304,6 +387,13 @@
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="api/Lib.Allocator.html#module-Lib.Allocator">module</a>
|
<li><a href="api/Lib.Allocator.html#module-Lib.Allocator">module</a>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
|
<li>
|
||||||
|
Lib.CFG
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.CFG.html#module-Lib.CFG">module</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li>
|
<li>
|
||||||
@ -348,9 +438,18 @@
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="api/Lib.Statement.html#module-Lib.Statement">module</a>
|
<li><a href="api/Lib.Statement.html#module-Lib.Statement">module</a>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
|
<li>
|
||||||
|
Lib.Terminator
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#module-Lib.Terminator">module</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode">LinearCode (class in Lib.LinearCode)</a>
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode">LinearCode (class in Lib.LinearCode)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.linearize_naive">linearize_naive() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.lor">lor() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.lor">lor() (in module Lib.RiscV)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -375,6 +474,8 @@
|
|||||||
<li><a href="api/Lib.html#module-Lib">Lib</a>
|
<li><a href="api/Lib.html#module-Lib">Lib</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Allocator.html#module-Lib.Allocator">Lib.Allocator</a>
|
<li><a href="api/Lib.Allocator.html#module-Lib.Allocator">Lib.Allocator</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#module-Lib.CFG">Lib.CFG</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Errors.html#module-Lib.Errors">Lib.Errors</a>
|
<li><a href="api/Lib.Errors.html#module-Lib.Errors">Lib.Errors</a>
|
||||||
</li>
|
</li>
|
||||||
@ -387,6 +488,8 @@
|
|||||||
<li><a href="api/Lib.RiscV.html#module-Lib.RiscV">Lib.RiscV</a>
|
<li><a href="api/Lib.RiscV.html#module-Lib.RiscV">Lib.RiscV</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#module-Lib.Statement">Lib.Statement</a>
|
<li><a href="api/Lib.Statement.html#module-Lib.Statement">Lib.Statement</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#module-Lib.Terminator">Lib.Terminator</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
@ -418,12 +521,22 @@
|
|||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Offset">Offset (class in Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Offset">Offset (class in Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.op1">op1 (Lib.Statement.ConditionalJump attribute)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.op1">op1 (Lib.Statement.ConditionalJump attribute)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.op1">(Lib.Terminator.BranchingTerminator attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.op2">op2 (Lib.Statement.ConditionalJump attribute)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.op2">op2 (Lib.Statement.ConditionalJump attribute)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.op2">(Lib.Terminator.BranchingTerminator attribute)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Operand">Operand (class in Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Operand">Operand (class in Lib.Operands)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.out_blocks">out_blocks() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
@ -437,10 +550,18 @@
|
|||||||
<li><a href="api/Lib.Allocator.html#Lib.Allocator.NaiveAllocator.prepare">(Lib.Allocator.NaiveAllocator method)</a>
|
<li><a href="api/Lib.Allocator.html#Lib.Allocator.NaiveAllocator.prepare">(Lib.Allocator.NaiveAllocator method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.print_code">print_code() (Lib.LinearCode.LinearCode method)</a>
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.print_code">print_code() (Lib.CFG.CFG method)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.print_code">(Lib.LinearCode.LinearCode method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.print_dot">print_dot() (Lib.LinearCode.LinearCode method)</a>
|
</ul></li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.print_dot">print_dot() (Lib.CFG.CFG method)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.print_dot">(Lib.LinearCode.LinearCode method)</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment.printIns">printIns() (Lib.Statement.Comment method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment.printIns">printIns() (Lib.Statement.Comment method)</a>
|
||||||
@ -451,6 +572,8 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Label.printIns">(Lib.Statement.Label method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Label.printIns">(Lib.Statement.Label method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.printIns">(Lib.Statement.Statement method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.printIns">(Lib.Statement.Statement method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.printIns">(Lib.Terminator.Return method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
@ -466,6 +589,10 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.regset_to_string">regset_to_string() (in module Lib.Statement)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.regset_to_string">regset_to_string() (in module Lib.Statement)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.rem">rem() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.rem">rem() (in module Lib.RiscV)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.remove_all_phis">remove_all_phis() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.remove_edge">remove_edge() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.rename">rename() (Lib.Statement.AbsoluteJump method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.rename">rename() (Lib.Statement.AbsoluteJump method)</a>
|
||||||
|
|
||||||
@ -475,6 +602,10 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.rename">(Lib.Statement.Instru3A method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.rename">(Lib.Statement.Instru3A method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.rename">(Lib.Statement.Instruction method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.rename">(Lib.Statement.Instruction method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.rename">(Lib.Terminator.BranchingTerminator method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.rename">(Lib.Terminator.Return method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
@ -489,6 +620,8 @@
|
|||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer.replace">(Lib.Operands.Renamer method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer.replace">(Lib.Operands.Renamer method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return">Return (class in Lib.Terminator)</a>
|
||||||
|
</li>
|
||||||
<li><a href="api/Lib.Allocator.html#Lib.Allocator.Allocator.rewriteCode">rewriteCode() (Lib.Allocator.Allocator method)</a>
|
<li><a href="api/Lib.Allocator.html#Lib.Allocator.Allocator.rewriteCode">rewriteCode() (Lib.Allocator.Allocator method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
@ -500,15 +633,21 @@
|
|||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.S">S (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.S">S (in module Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.sd">sd() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.sd">sd() (in module Lib.RiscV)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.set_phis">set_phis() (Lib.CFG.Block method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.set_start">set_start() (Lib.CFG.CFG method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.set_temp_allocation">set_temp_allocation() (Lib.Operands.TemporaryPool method)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.set_temp_allocation">set_temp_allocation() (Lib.Operands.TemporaryPool method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.set_terminator">set_terminator() (Lib.CFG.Block method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.SP">SP (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.SP">SP (in module Lib.Operands)</a>
|
||||||
</li>
|
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement">Statement (class in Lib.Statement)</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement">Statement (class in Lib.Statement)</a>
|
||||||
|
</li>
|
||||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.sub">sub() (in module Lib.RiscV)</a>
|
<li><a href="api/Lib.RiscV.html#Lib.RiscV.sub">sub() (in module Lib.RiscV)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.substitute">substitute() (Lib.Statement.AbsoluteJump method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.substitute">substitute() (Lib.Statement.AbsoluteJump method)</a>
|
||||||
@ -519,6 +658,10 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.substitute">(Lib.Statement.Instru3A method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.substitute">(Lib.Statement.Instru3A method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.substitute">(Lib.Statement.Statement method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.substitute">(Lib.Statement.Statement method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.substitute">(Lib.Terminator.BranchingTerminator method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.substitute">(Lib.Terminator.Return method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
@ -530,12 +673,22 @@
|
|||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.T">T (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.T">T (in module Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.targets">targets() (Lib.Statement.AbsoluteJump method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.targets">targets() (Lib.Statement.AbsoluteJump method)</a>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.targets">(Lib.Terminator.BranchingTerminator method)</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.targets">(Lib.Terminator.Return method)</a>
|
||||||
|
</li>
|
||||||
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Temporary">Temporary (class in Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.Temporary">Temporary (class in Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool">TemporaryPool (class in Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool">TemporaryPool (class in Lib.Operands)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Terminator">Terminator (in module Lib.Terminator)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.to_dot">to_dot() (Lib.CFG.Block method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Operands.html#Lib.Operands.TP">TP (in module Lib.Operands)</a>
|
<li><a href="api/Lib.Operands.html#Lib.Operands.TP">TP (in module Lib.Operands)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -565,6 +718,10 @@
|
|||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.with_args">(Lib.Statement.Instru3A method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.with_args">(Lib.Statement.Instru3A method)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.with_args">(Lib.Statement.Statement method)</a>
|
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.with_args">(Lib.Statement.Statement method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.with_args">(Lib.Terminator.BranchingTerminator method)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="api/Lib.Terminator.html#Lib.Terminator.Return.with_args">(Lib.Terminator.Return method)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -254,6 +256,73 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block"><code class="docutils literal notranslate"><span class="pre">Block</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.to_dot"><code class="docutils literal notranslate"><span class="pre">Block.to_dot()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_body"><code class="docutils literal notranslate"><span class="pre">Block.get_body()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_all_statements"><code class="docutils literal notranslate"><span class="pre">Block.get_all_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_body_and_terminator"><code class="docutils literal notranslate"><span class="pre">Block.get_body_and_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_label"><code class="docutils literal notranslate"><span class="pre">Block.get_label()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_in"><code class="docutils literal notranslate"><span class="pre">Block.get_in()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_terminator"><code class="docutils literal notranslate"><span class="pre">Block.get_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.set_terminator"><code class="docutils literal notranslate"><span class="pre">Block.set_terminator()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.get_phis"><code class="docutils literal notranslate"><span class="pre">Block.get_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.add_phi"><code class="docutils literal notranslate"><span class="pre">Block.add_phi()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.set_phis"><code class="docutils literal notranslate"><span class="pre">Block.set_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.remove_all_phis"><code class="docutils literal notranslate"><span class="pre">Block.remove_all_phis()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.iter_statements"><code class="docutils literal notranslate"><span class="pre">Block.iter_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.Block.add_instruction"><code class="docutils literal notranslate"><span class="pre">Block.add_instruction()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG"><code class="docutils literal notranslate"><span class="pre">CFG</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.fdata"><code class="docutils literal notranslate"><span class="pre">CFG.fdata</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.get_start"><code class="docutils literal notranslate"><span class="pre">CFG.get_start()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.set_start"><code class="docutils literal notranslate"><span class="pre">CFG.set_start()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.get_end"><code class="docutils literal notranslate"><span class="pre">CFG.get_end()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.add_block"><code class="docutils literal notranslate"><span class="pre">CFG.add_block()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.get_block"><code class="docutils literal notranslate"><span class="pre">CFG.get_block()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.get_blocks"><code class="docutils literal notranslate"><span class="pre">CFG.get_blocks()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.get_entries"><code class="docutils literal notranslate"><span class="pre">CFG.get_entries()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.add_edge"><code class="docutils literal notranslate"><span class="pre">CFG.add_edge()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.remove_edge"><code class="docutils literal notranslate"><span class="pre">CFG.remove_edge()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.out_blocks"><code class="docutils literal notranslate"><span class="pre">CFG.out_blocks()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.gather_defs"><code class="docutils literal notranslate"><span class="pre">CFG.gather_defs()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.iter_statements"><code class="docutils literal notranslate"><span class="pre">CFG.iter_statements()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.linearize_naive"><code class="docutils literal notranslate"><span class="pre">CFG.linearize_naive()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.print_code"><code class="docutils literal notranslate"><span class="pre">CFG.print_code()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.CFG.html#Lib.CFG.CFG.print_dot"><code class="docutils literal notranslate"><span class="pre">CFG.print_dot()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Terminator.html">Control Flow Graph - Terminators</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return"><code class="docutils literal notranslate"><span class="pre">Return</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.printIns"><code class="docutils literal notranslate"><span class="pre">Return.printIns()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.targets"><code class="docutils literal notranslate"><span class="pre">Return.targets()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.args"><code class="docutils literal notranslate"><span class="pre">Return.args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.rename"><code class="docutils literal notranslate"><span class="pre">Return.rename()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.substitute"><code class="docutils literal notranslate"><span class="pre">Return.substitute()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.with_args"><code class="docutils literal notranslate"><span class="pre">Return.with_args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Return.is_read_only"><code class="docutils literal notranslate"><span class="pre">Return.is_read_only()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator</span></code></a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.cond"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.cond</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.label_then"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.label_then</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.label_else"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.label_else</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.op1"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.op1</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.op2"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.op2</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.args"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.args()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.targets"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.targets()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.rename"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.rename()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.substitute"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.substitute()</span></code></a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.with_args"><code class="docutils literal notranslate"><span class="pre">BranchingTerminator.with_args()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.Terminator"><code class="docutils literal notranslate"><span class="pre">Terminator</span></code></a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Terminator.html#Lib.Terminator.jump2terminator"><code class="docutils literal notranslate"><span class="pre">jump2terminator()</span></code></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<p>These pages document the various Python sources in the Lib/
|
<p>These pages document the various Python sources in the Lib/
|
||||||
@ -282,8 +351,8 @@ you should understand the naive allocator in the <a class="reference internal" h
|
|||||||
</section>
|
</section>
|
||||||
<section id="control-flow-graph-intermediate-representation">
|
<section id="control-flow-graph-intermediate-representation">
|
||||||
<h2>Control Flow Graph Intermediate representation<a class="headerlink" href="#control-flow-graph-intermediate-representation" title="Permalink to this heading"></a></h2>
|
<h2>Control Flow Graph Intermediate representation<a class="headerlink" href="#control-flow-graph-intermediate-representation" title="Permalink to this heading"></a></h2>
|
||||||
<p>The classes for the CFG and its basic blocks are in the <span class="xref std std-doc">api/Lib.CFG</span>.
|
<p>The classes for the CFG and its basic blocks are in the <a class="reference internal" href="api/Lib.CFG.html"><span class="doc">Lib.CFG module</span></a>.
|
||||||
Each block ends with a terminator, as documented in the <span class="xref std std-doc">api/Lib.Terminator</span>.</p>
|
Each block ends with a terminator, as documented in the <a class="reference internal" href="api/Lib.Terminator.html"><span class="doc">Lib.Terminator module</span></a>.</p>
|
||||||
</section>
|
</section>
|
||||||
<section id="ssa-form">
|
<section id="ssa-form">
|
||||||
<h2>SSA form<a class="headerlink" href="#ssa-form" title="Permalink to this heading"></a></h2>
|
<h2>SSA form<a class="headerlink" href="#ssa-form" title="Permalink to this heading"></a></h2>
|
||||||
|
Binary file not shown.
@ -50,6 +50,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -97,6 +99,11 @@
|
|||||||
<td>   
|
<td>   
|
||||||
<a href="api/Lib.Allocator.html#module-Lib.Allocator"><code class="xref">Lib.Allocator</code></a></td><td>
|
<a href="api/Lib.Allocator.html#module-Lib.Allocator"><code class="xref">Lib.Allocator</code></a></td><td>
|
||||||
<em></em></td></tr>
|
<em></em></td></tr>
|
||||||
|
<tr class="cg-1">
|
||||||
|
<td></td>
|
||||||
|
<td>   
|
||||||
|
<a href="api/Lib.CFG.html#module-Lib.CFG"><code class="xref">Lib.CFG</code></a></td><td>
|
||||||
|
<em></em></td></tr>
|
||||||
<tr class="cg-1">
|
<tr class="cg-1">
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>   
|
<td>   
|
||||||
@ -127,6 +134,11 @@
|
|||||||
<td>   
|
<td>   
|
||||||
<a href="api/Lib.Statement.html#module-Lib.Statement"><code class="xref">Lib.Statement</code></a></td><td>
|
<a href="api/Lib.Statement.html#module-Lib.Statement"><code class="xref">Lib.Statement</code></a></td><td>
|
||||||
<em></em></td></tr>
|
<em></em></td></tr>
|
||||||
|
<tr class="cg-1">
|
||||||
|
<td></td>
|
||||||
|
<td>   
|
||||||
|
<a href="api/Lib.Terminator.html#module-Lib.Terminator"><code class="xref">Lib.Terminator</code></a></td><td>
|
||||||
|
<em></em></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.FunctionData.html">Base library - Function data</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Allocator.html">Temporary allocation</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.CFG.html">Control Flow Graph - CFG and Basic blocks</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user