Merge branch 'main' of https://github.com/Drup/cap-lab24.git
This commit is contained in:
commit
b8af070658
@ -85,6 +85,7 @@ ALL_IN_MEM_FILES.sort()
|
||||
ALL_FILES = list(set(ALL_FILES))
|
||||
ALL_FILES.sort()
|
||||
|
||||
|
||||
class TestCodeGen(TestExpectPragmas, TestCompiler):
|
||||
DISABLE_CODEGEN = DISABLE_CODEGEN
|
||||
SKIP_NOT_IMPLEMENTED = SKIP_NOT_IMPLEMENTED
|
||||
|
10
PLANNING.md
10
PLANNING.md
@ -66,7 +66,7 @@ _Academic first semester 2024-2025_
|
||||
|
||||
# Week 6:
|
||||
|
||||
- :hammer: Lab 4b: Thursday 14/10/2024, 13h30-15h30. Room E001 (Samuel Humeau & Emma Nardino)
|
||||
- :hammer: Lab 4b: Monday 14/10/2024, 13h30-15h30. Room E001 (Samuel Humeau & Emma Nardino)
|
||||
|
||||
* Control Flow Graph [TP04b](TP04/tp4b.pdf).
|
||||
* Code in [MiniC/TP04/](MiniC/TP04/).
|
||||
@ -75,3 +75,11 @@ _Academic first semester 2024-2025_
|
||||
- :book: Course: Thursday 17/10/2024, 10h15-12h15. Amphi L (Gabriel Radanne)
|
||||
|
||||
* Register allocation [slides in english](course/cap_cours07_regalloc.pdf).
|
||||
|
||||
# Week 7:
|
||||
|
||||
- :hammer: Lab 5a: Monday 21/10/2024, 13h30-15h30. Room E001 (Samuel Humeau & Emma Nardino)
|
||||
|
||||
* Control Flow Graph under SSA Form [TP05a](TP05/tp5a.pdf).
|
||||
* Code in [MiniC/TP05/](MiniC/TP05/).
|
||||
* Documentation (updated) [here](docs/html/index.html).
|
||||
|
BIN
TP05/tp5a.pdf
Normal file
BIN
TP05/tp5a.pdf
Normal file
Binary file not shown.
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
239
docs/html/_modules/Lib/Dominators.html
Normal file
239
docs/html/_modules/Lib/Dominators.html
Normal file
@ -0,0 +1,239 @@
|
||||
<!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.Dominators — 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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</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.Dominators</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.Dominators</h1><div class="highlight"><pre>
|
||||
<span></span><span class="sd">"""</span>
|
||||
<span class="sd">Utility functions to work with dominators in a :py:class:`CFG <Lib.CFG.CFG>`.</span>
|
||||
|
||||
<span class="sd">Do not hesitate to look at the source of the functions</span>
|
||||
<span class="sd">to get a better understanding of the algorithms.</span>
|
||||
<span class="sd">"""</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Set</span>
|
||||
<span class="kn">from</span> <span class="nn">graphviz</span> <span class="kn">import</span> <span class="n">Digraph</span>
|
||||
<span class="kn">from</span> <span class="nn">Lib.CFG</span> <span class="kn">import</span> <span class="n">Block</span><span class="p">,</span> <span class="n">CFG</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="computeDom"><a class="viewcode-back" href="../../api/Lib.Dominators.html#Lib.Dominators.computeDom">[docs]</a><span class="k">def</span> <span class="nf">computeDom</span><span class="p">(</span><span class="n">cfg</span><span class="p">:</span> <span class="n">CFG</span><span class="p">)</span> <span class="o">-></span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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"> `computeDom(cfg)` computes the table associating blocks to their</span>
|
||||
<span class="sd"> dominators in `cfg`.</span>
|
||||
<span class="sd"> It works by solving the equation system.</span>
|
||||
|
||||
<span class="sd"> This is an helper function called during SSA entry.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">all_blocks</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">set</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get_blocks</span><span class="p">())</span>
|
||||
<span class="n">dominators</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="n">all_blocks</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">b</span><span class="o">.</span><span class="n">get_in</span><span class="p">():</span> <span class="c1"># If b has some predecessor</span>
|
||||
<span class="n">dominators</span><span class="p">[</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="n">all_blocks</span>
|
||||
<span class="k">else</span><span class="p">:</span> <span class="c1"># If b has no predecessors</span>
|
||||
<span class="n">dominators</span><span class="p">[</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">b</span><span class="p">}</span>
|
||||
<span class="n">new_dominators</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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">while</span> <span class="kc">True</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">all_blocks</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">b</span><span class="o">.</span><span class="n">get_in</span><span class="p">():</span>
|
||||
<span class="n">dom_preds</span> <span class="o">=</span> <span class="p">[</span><span class="n">dominators</span><span class="p">[</span><span class="n">b2</span><span class="p">]</span> <span class="k">for</span> <span class="n">b2</span> <span class="ow">in</span> <span class="n">b</span><span class="o">.</span><span class="n">get_in</span><span class="p">()]</span>
|
||||
<span class="n">new_dominators</span><span class="p">[</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">b</span><span class="p">}</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="nb">set</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="o">*</span><span class="n">dom_preds</span><span class="p">))</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">new_dominators</span><span class="p">[</span><span class="n">b</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">if</span> <span class="n">dominators</span> <span class="o">==</span> <span class="n">new_dominators</span><span class="p">:</span>
|
||||
<span class="k">break</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">dominators</span> <span class="o">=</span> <span class="n">new_dominators</span>
|
||||
<span class="n">new_dominators</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="n">dominators</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="printDT"><a class="viewcode-back" href="../../api/Lib.Dominators.html#Lib.Dominators.printDT">[docs]</a><span class="k">def</span> <span class="nf">printDT</span><span class="p">(</span><span class="n">filename</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">graph</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="kc">None</span><span class="p">:</span> <span class="c1"># pragma: no cover</span>
|
||||
<span class="w"> </span><span class="sd">"""Display a graphical rendering of the given domination tree."""</span>
|
||||
<span class="n">dot</span> <span class="o">=</span> <span class="n">Digraph</span><span class="p">()</span>
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">graph</span><span class="p">:</span>
|
||||
<span class="n">dot</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">k</span><span class="o">.</span><span class="n">get_label</span><span class="p">()))</span>
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">graph</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">graph</span><span class="p">[</span><span class="n">k</span><span class="p">]:</span>
|
||||
<span class="n">dot</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">k</span><span class="o">.</span><span class="n">get_label</span><span class="p">()),</span> <span class="nb">str</span><span class="p">(</span><span class="n">v</span><span class="o">.</span><span class="n">get_label</span><span class="p">()))</span>
|
||||
<span class="n">dot</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="kc">True</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="computeDT"><a class="viewcode-back" href="../../api/Lib.Dominators.html#Lib.Dominators.computeDT">[docs]</a><span class="k">def</span> <span class="nf">computeDT</span><span class="p">(</span><span class="n">cfg</span><span class="p">:</span> <span class="n">CFG</span><span class="p">,</span> <span class="n">dominators</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="n">dom_graphs</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">basename</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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"> `computeDT(cfg, dominators)` computes the domination tree of `cfg`</span>
|
||||
<span class="sd"> using the previously computed `dominators`.</span>
|
||||
<span class="sd"> It returns `DT`, a dictionary which associates a block with its children</span>
|
||||
<span class="sd"> in the dominator tree.</span>
|
||||
|
||||
<span class="sd"> This is an helper function called during SSA entry.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># First, compute the immediate dominators</span>
|
||||
<span class="n">idominators</span><span class="p">:</span> <span class="n">Dict</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="p">{}</span>
|
||||
<span class="k">for</span> <span class="n">b</span><span class="p">,</span> <span class="n">doms</span> <span class="ow">in</span> <span class="n">dominators</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||
<span class="c1"># The immediate dominator of b is the unique vertex n ≠ b</span>
|
||||
<span class="c1"># which dominates b and is dominated by all vertices in Dom(b) − b.</span>
|
||||
<span class="n">strict_doms</span> <span class="o">=</span> <span class="n">doms</span> <span class="o">-</span> <span class="p">{</span><span class="n">b</span><span class="p">}</span>
|
||||
<span class="n">idoms</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span>
|
||||
<span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">strict_doms</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">strict_doms</span><span class="o">.</span><span class="n">issubset</span><span class="p">(</span><span class="n">dominators</span><span class="p">[</span><span class="n">n</span><span class="p">]):</span>
|
||||
<span class="n">idoms</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">idoms</span><span class="p">:</span>
|
||||
<span class="k">assert</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">idoms</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="n">idominators</span><span class="p">[</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="n">idoms</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
|
||||
<span class="c1"># Then, simply inverse the relation to obtain the domination tree</span>
|
||||
<span class="n">DT</span> <span class="o">=</span> <span class="p">{</span><span class="n">b</span><span class="p">:</span> <span class="nb">set</span><span class="p">()</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">cfg</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="p">,</span> <span class="n">idominator</span> <span class="ow">in</span> <span class="n">idominators</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||
<span class="n">DT</span><span class="p">[</span><span class="n">idominator</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
|
||||
<span class="c1"># Print the domination tree if asked</span>
|
||||
<span class="k">if</span> <span class="n">dom_graphs</span><span class="p">:</span>
|
||||
<span class="n">s</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{}</span><span class="s2">.</span><span class="si">{}</span><span class="s2">.ssa.DT.dot"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">basename</span><span class="p">,</span> <span class="n">cfg</span><span class="o">.</span><span class="n">fdata</span><span class="o">.</span><span class="n">get_name</span><span class="p">())</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"SSA - domination tree graph:"</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span>
|
||||
<span class="n">printDT</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">DT</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">DT</span></div>
|
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">_computeDF_at_block</span><span class="p">(</span>
|
||||
<span class="n">cfg</span><span class="p">:</span> <span class="n">CFG</span><span class="p">,</span>
|
||||
<span class="n">dominators</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="n">DT</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="n">b</span><span class="p">:</span> <span class="n">Block</span><span class="p">,</span>
|
||||
<span class="n">DF</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="kc">None</span><span class="p">:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> `_computeDF_at_block(...)` computes the dominance frontier at the given block,</span>
|
||||
<span class="sd"> by updating `DF`.</span>
|
||||
|
||||
<span class="sd"> This is an helper function called during SSA entry.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">S</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="p">{</span><span class="n">succ</span> <span class="k">for</span> <span class="n">succ</span> <span class="ow">in</span> <span class="n">cfg</span><span class="o">.</span><span class="n">out_blocks</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="k">if</span> <span class="n">succ</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">DT</span><span class="p">[</span><span class="n">b</span><span class="p">]}</span>
|
||||
<span class="k">for</span> <span class="n">b_succ</span> <span class="ow">in</span> <span class="n">DT</span><span class="p">[</span><span class="n">b</span><span class="p">]:</span>
|
||||
<span class="n">_computeDF_at_block</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">dominators</span><span class="p">,</span> <span class="n">DT</span><span class="p">,</span> <span class="n">b_succ</span><span class="p">,</span> <span class="n">DF</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">b_frontier</span> <span class="ow">in</span> <span class="n">DF</span><span class="p">[</span><span class="n">b_succ</span><span class="p">]:</span>
|
||||
<span class="k">if</span> <span class="n">b</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">dominators</span><span class="p">[</span><span class="n">b_frontier</span><span class="p">]</span> <span class="o">-</span> <span class="p">{</span><span class="n">b_frontier</span><span class="p">}):</span>
|
||||
<span class="n">S</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">b_frontier</span><span class="p">)</span>
|
||||
<span class="n">DF</span><span class="p">[</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="n">S</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="computeDF"><a class="viewcode-back" href="../../api/Lib.Dominators.html#Lib.Dominators.computeDF">[docs]</a><span class="k">def</span> <span class="nf">computeDF</span><span class="p">(</span><span class="n">cfg</span><span class="p">:</span> <span class="n">CFG</span><span class="p">,</span> <span class="n">dominators</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="n">DT</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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="n">dom_graphs</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">basename</span><span class="p">:</span> <span class="nb">str</span>
|
||||
<span class="p">)</span> <span class="o">-></span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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"> `computeDF(...)` computes the dominance frontier of a CFG.</span>
|
||||
<span class="sd"> It returns `DF` which associates a block to its frontier.</span>
|
||||
|
||||
<span class="sd"> This is an helper function called during SSA entry.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">DF</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Block</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_entry</span> <span class="ow">in</span> <span class="n">cfg</span><span class="o">.</span><span class="n">get_entries</span><span class="p">():</span>
|
||||
<span class="n">_computeDF_at_block</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">dominators</span><span class="p">,</span> <span class="n">DT</span><span class="p">,</span> <span class="n">b_entry</span><span class="p">,</span> <span class="n">DF</span><span class="p">)</span>
|
||||
<span class="c1"># Print the domination frontier on the CFG if asked</span>
|
||||
<span class="k">if</span> <span class="n">dom_graphs</span><span class="p">:</span>
|
||||
<span class="n">s</span> <span class="o">=</span> <span class="s2">"</span><span class="si">{}</span><span class="s2">.</span><span class="si">{}</span><span class="s2">.ssa.DF.dot"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">basename</span><span class="p">,</span> <span class="n">cfg</span><span class="o">.</span><span class="n">fdata</span><span class="o">.</span><span class="n">get_name</span><span class="p">())</span>
|
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"SSA - dominance frontier graph:"</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span>
|
||||
<span class="n">cfg</span><span class="o">.</span><span class="n">print_dot</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">DF</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">DF</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>
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
423
docs/html/_modules/Lib/Graphes.html
Normal file
423
docs/html/_modules/Lib/Graphes.html
Normal file
@ -0,0 +1,423 @@
|
||||
<!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.Graphes — 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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</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.Graphes</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.Graphes</h1><div class="highlight"><pre>
|
||||
<span></span><span class="sd">""" Python Classes for Oriented and Non Oriented Graphs</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">List</span><span class="p">,</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Set</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">,</span> <span class="n">Any</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="GraphError"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GraphError">[docs]</a><span class="k">class</span> <span class="nc">GraphError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
|
||||
<span class="w"> </span><span class="sd">"""Exception raised for self loops.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="n">message</span><span class="p">:</span> <span class="nb">str</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">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">message</span> <span class="o">=</span> <span class="n">message</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph">[docs]</a><span class="k">class</span> <span class="nc">GeneralGraph</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> General class regrouping similarities</span>
|
||||
<span class="sd"> between directed and non oriented graphs.</span>
|
||||
<span class="sd"> The only differences between the two are:</span>
|
||||
|
||||
<span class="sd"> - how to compute the set of edges</span>
|
||||
<span class="sd"> - how to add an edge</span>
|
||||
<span class="sd"> - how to print the graph</span>
|
||||
<span class="sd"> - how to delete a vertex</span>
|
||||
<span class="sd"> - how to delete an edge</span>
|
||||
<span class="sd"> - we only color undirected graphs</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="n">graph_dict</span><span class="p">:</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="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">graph_dict</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Initializes a graph object.</span>
|
||||
<span class="sd"> If no dictionary or None is given,</span>
|
||||
<span class="sd"> an empty dictionary will be used.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">graph_dict</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">graph_dict</span> <span class="o">=</span> <span class="p">{}</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span> <span class="o">=</span> <span class="n">graph_dict</span>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.vertices"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.vertices">[docs]</a> <span class="k">def</span> <span class="nf">vertices</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">Any</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""Return the vertices of a graph."""</span>
|
||||
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span></div>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.add_vertex"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.add_vertex">[docs]</a> <span class="k">def</span> <span class="nf">add_vertex</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">vertex</span><span class="p">:</span> <span class="n">Any</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">"""</span>
|
||||
<span class="sd"> If the vertex "vertex" is not in</span>
|
||||
<span class="sd"> self.graph_dict, a key "vertex" with an empty</span>
|
||||
<span class="sd"> list as a value is added to the dictionary.</span>
|
||||
<span class="sd"> Otherwise nothing has to be done.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">vertex</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.edges"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.edges">[docs]</a> <span class="k">def</span> <span class="nf">edges</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">Set</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""Return the edges of the graph."""</span>
|
||||
<span class="k">return</span> <span class="p">[]</span></div>
|
||||
|
||||
<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">res</span> <span class="o">=</span> <span class="s2">"vertices: "</span>
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="n">res</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="o">+</span> <span class="s2">" "</span>
|
||||
<span class="n">res</span> <span class="o">+=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">edges: "</span>
|
||||
<span class="k">for</span> <span class="n">edge</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">():</span>
|
||||
<span class="n">res</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="n">edge</span><span class="p">)</span> <span class="o">+</span> <span class="s2">" "</span>
|
||||
<span class="k">return</span> <span class="n">res</span>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.dfs_traversal"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.dfs_traversal">[docs]</a> <span class="k">def</span> <span class="nf">dfs_traversal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">root</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute a depth first search of the graph,</span>
|
||||
<span class="sd"> from the vertex root.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">seen</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">todo</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">root</span><span class="p">]</span>
|
||||
<span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">todo</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># while todo ...</span>
|
||||
<span class="n">current</span> <span class="o">=</span> <span class="n">todo</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span>
|
||||
<span class="n">seen</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">current</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">neighbour</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">current</span><span class="p">]:</span>
|
||||
<span class="k">if</span> <span class="n">neighbour</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">seen</span><span class="p">:</span>
|
||||
<span class="n">todo</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">neighbour</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">seen</span></div>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.is_reachable_from"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.is_reachable_from">[docs]</a> <span class="k">def</span> <span class="nf">is_reachable_from</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">v1</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">v2</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span>
|
||||
<span class="w"> </span><span class="sd">"""True if there is a path from v1 to v2."""</span>
|
||||
<span class="k">return</span> <span class="n">v2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs_traversal</span><span class="p">(</span><span class="n">v1</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.connected_components"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.connected_components">[docs]</a> <span class="k">def</span> <span class="nf">connected_components</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">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute the list of all connected components of the graph,</span>
|
||||
<span class="sd"> each component being a list of vetices.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">components</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">done</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">vertices</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">done</span><span class="p">:</span>
|
||||
<span class="n">v_comp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs_traversal</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||||
<span class="n">components</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">v_comp</span><span class="p">)</span>
|
||||
<span class="n">done</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">v_comp</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">components</span></div>
|
||||
|
||||
<div class="viewcode-block" id="GeneralGraph.bfs_traversal"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.bfs_traversal">[docs]</a> <span class="k">def</span> <span class="nf">bfs_traversal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">root</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute a breadth first search of the graph,</span>
|
||||
<span class="sd"> from the vertex root.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">seen</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">todo</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">root</span><span class="p">]</span>
|
||||
<span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">todo</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># while todo ...</span>
|
||||
<span class="n">current</span> <span class="o">=</span> <span class="n">todo</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c1"># list.pop(0): for dequeuing (on the left...) !</span>
|
||||
<span class="n">seen</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">current</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">neighbour</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">current</span><span class="p">]:</span>
|
||||
<span class="k">if</span> <span class="n">neighbour</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">seen</span><span class="p">:</span>
|
||||
<span class="n">todo</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">neighbour</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">seen</span></div></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="Graph"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph">[docs]</a><span class="k">class</span> <span class="nc">Graph</span><span class="p">(</span><span class="n">GeneralGraph</span><span class="p">):</span>
|
||||
<span class="w"> </span><span class="sd">"""Class for non oriented graphs."""</span>
|
||||
|
||||
<div class="viewcode-block" id="Graph.edges"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.edges">[docs]</a> <span class="k">def</span> <span class="nf">edges</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">Set</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> A static method generating the set of edges</span>
|
||||
<span class="sd"> (they appear twice in the dictionnary).</span>
|
||||
<span class="sd"> Return a list of sets.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">edges</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">vertex</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">neighbour</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex</span><span class="p">]:</span>
|
||||
<span class="k">if</span> <span class="p">{</span><span class="n">neighbour</span><span class="p">,</span> <span class="n">vertex</span><span class="p">}</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">edges</span><span class="p">:</span>
|
||||
<span class="n">edges</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="n">vertex</span><span class="p">,</span> <span class="n">neighbour</span><span class="p">})</span>
|
||||
<span class="k">return</span> <span class="n">edges</span></div>
|
||||
|
||||
<div class="viewcode-block" id="Graph.add_edge"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.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">edge</span><span class="p">:</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">Any</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">"""</span>
|
||||
<span class="sd"> Add an edge in the graph.</span>
|
||||
<span class="sd"> edge should be a pair and not (c,c)</span>
|
||||
<span class="sd"> (we call g.add_edge((v1,v2)))</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="p">(</span><span class="n">vertex1</span><span class="p">,</span> <span class="n">vertex2</span><span class="p">)</span> <span class="o">=</span> <span class="n">edge</span>
|
||||
<span class="k">if</span> <span class="n">vertex1</span> <span class="o">==</span> <span class="n">vertex2</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">GraphError</span><span class="p">(</span><span class="s2">"Cannot add a self loop on vertex </span><span class="si">{}</span><span class="s2"> in an unoriented graph."</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
|
||||
<span class="nb">str</span><span class="p">(</span><span class="n">vertex1</span><span class="p">)))</span>
|
||||
<span class="k">if</span> <span class="n">vertex1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex1</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">vertex2</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex1</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">vertex2</span><span class="p">}</span>
|
||||
<span class="k">if</span> <span class="n">vertex2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex2</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">vertex1</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex2</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">vertex1</span><span class="p">}</span></div>
|
||||
|
||||
<div class="viewcode-block" id="Graph.print_dot"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.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">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">colors</span><span class="o">=</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 graph."""</span>
|
||||
<span class="n">color_names</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'red'</span><span class="p">,</span> <span class="s1">'blue'</span><span class="p">,</span> <span class="s1">'green'</span><span class="p">,</span> <span class="s1">'yellow'</span><span class="p">,</span> <span class="s1">'cyan'</span><span class="p">,</span> <span class="s1">'magenta'</span><span class="p">]</span> <span class="o">+</span> \
|
||||
<span class="p">[</span><span class="sa">f</span><span class="s2">"grey</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">10</span><span class="p">)]</span>
|
||||
<span class="n">color_shapes</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'ellipse'</span><span class="p">,</span> <span class="s1">'box'</span><span class="p">,</span> <span class="s1">'diamond'</span><span class="p">,</span> <span class="s1">'trapezium'</span><span class="p">,</span> <span class="s1">'egg'</span><span class="p">,</span>
|
||||
<span class="s1">'parallelogram'</span><span class="p">,</span> <span class="s1">'house'</span><span class="p">,</span> <span class="s1">'triangle'</span><span class="p">,</span> <span class="s1">'pentagon'</span><span class="p">,</span> <span class="s1">'hexagon'</span><span class="p">,</span>
|
||||
<span class="s1">'septagon'</span><span class="p">,</span> <span class="s1">'octagon'</span><span class="p">]</span>
|
||||
<span class="n">dot</span> <span class="o">=</span> <span class="n">Digraph</span><span class="p">(</span><span class="n">comment</span><span class="o">=</span><span class="s1">'Conflict Graph'</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="n">shape</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">colors</span><span class="p">:</span>
|
||||
<span class="n">color</span> <span class="o">=</span> <span class="s2">"red"</span> <span class="c1"># Graph not colored: red for everyone</span>
|
||||
<span class="k">elif</span> <span class="n">k</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">colors</span><span class="p">:</span>
|
||||
<span class="n">color</span> <span class="o">=</span> <span class="s2">"grey"</span> <span class="c1"># Node not colored: grey</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">n</span> <span class="o">=</span> <span class="n">colors</span><span class="p">[</span><span class="n">k</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="n">n</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="n">color_names</span><span class="p">):</span>
|
||||
<span class="n">color</span> <span class="o">=</span> <span class="n">color_names</span><span class="p">[</span><span class="n">colors</span><span class="p">[</span><span class="n">k</span><span class="p">]]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">color</span> <span class="o">=</span> <span class="s2">"black"</span> <span class="c1"># Too many colors anyway, it won't be readable.</span>
|
||||
<span class="n">shape</span> <span class="o">=</span> <span class="n">color_shapes</span><span class="p">[</span><span class="n">n</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">color_shapes</span><span class="p">)]</span>
|
||||
<span class="n">dot</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">k</span><span class="p">),</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="p">(</span><span class="n">v1</span><span class="p">,</span> <span class="n">v2</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">():</span>
|
||||
<span class="n">dot</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">v1</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">v2</span><span class="p">),</span> <span class="nb">dir</span><span class="o">=</span><span class="s2">"none"</span><span class="p">)</span>
|
||||
<span class="c1"># print(dot.source)</span>
|
||||
<span class="n">dot</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">view</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="c1"># print in pdf</span></div>
|
||||
|
||||
<div class="viewcode-block" id="Graph.delete_vertex"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.delete_vertex">[docs]</a> <span class="k">def</span> <span class="nf">delete_vertex</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">vertex</span><span class="p">:</span> <span class="n">Any</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">"""Delete a vertex and all the adjacent edges."""</span>
|
||||
<span class="n">gdict</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span>
|
||||
<span class="k">for</span> <span class="n">neighbour</span> <span class="ow">in</span> <span class="n">gdict</span><span class="p">[</span><span class="n">vertex</span><span class="p">]:</span>
|
||||
<span class="n">gdict</span><span class="p">[</span><span class="n">neighbour</span><span class="p">]</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">vertex</span><span class="p">)</span>
|
||||
<span class="k">del</span> <span class="n">gdict</span><span class="p">[</span><span class="n">vertex</span><span class="p">]</span></div>
|
||||
|
||||
<div class="viewcode-block" id="Graph.delete_edge"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.delete_edge">[docs]</a> <span class="k">def</span> <span class="nf">delete_edge</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">edge</span><span class="p">:</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">Any</span><span class="p">]):</span>
|
||||
<span class="w"> </span><span class="sd">"""Delete an edge."""</span>
|
||||
<span class="p">(</span><span class="n">v1</span><span class="p">,</span> <span class="n">v2</span><span class="p">)</span> <span class="o">=</span> <span class="n">edge</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">v1</span><span class="p">]</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">v2</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">v2</span><span class="p">]</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">v1</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="Graph.color"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.color">[docs]</a> <span class="k">def</span> <span class="nf">color</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="nb">int</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Color the graph with an unlimited number of colors.</span>
|
||||
<span class="sd"> Return a dict vertex -> color, where color is an integer (0, 1, ...).</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">coloring</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">color_with_k_colors</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="n">coloring</span></div>
|
||||
|
||||
<span class="c1"># see algo of the course</span>
|
||||
<div class="viewcode-block" id="Graph.color_with_k_colors"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.Graph.color_with_k_colors">[docs]</a> <span class="k">def</span> <span class="nf">color_with_k_colors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">K</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">avoidingnodes</span><span class="o">=</span><span class="p">())</span> <span class="o">-></span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="nb">int</span><span class="p">],</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">List</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Color with <= K colors (if K is unspecified, use unlimited colors).</span>
|
||||
|
||||
<span class="sd"> Return 3 values:</span>
|
||||
|
||||
<span class="sd"> - a dict vertex -> color</span>
|
||||
<span class="sd"> - a Boolean, True if the coloring succeeded</span>
|
||||
<span class="sd"> - the set of nodes actually colored</span>
|
||||
|
||||
<span class="sd"> Do not color vertices belonging to avoidingnodes.</span>
|
||||
|
||||
<span class="sd"> Continue even if the algo fails.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">K</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">K</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">)</span>
|
||||
<span class="n">todo_vertices</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">is_total</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="n">gcopy</span> <span class="o">=</span> <span class="n">Graph</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span>
|
||||
<span class="c1"># suppress nodes that are not to be considered.</span>
|
||||
<span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">avoidingnodes</span><span class="p">:</span>
|
||||
<span class="n">gcopy</span><span class="o">.</span><span class="n">delete_vertex</span><span class="p">(</span><span class="n">node</span><span class="p">)</span>
|
||||
<span class="c1"># append nodes in the list according to their degree and node number:</span>
|
||||
<span class="k">while</span> <span class="n">gcopy</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="n">todo</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">gcopy</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">)</span>
|
||||
<span class="n">todo</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">v</span><span class="p">:</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">gcopy</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">v</span><span class="p">]),</span> <span class="nb">str</span><span class="p">(</span><span class="n">v</span><span class="p">)))</span>
|
||||
<span class="n">lower</span> <span class="o">=</span> <span class="n">todo</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">todo_vertices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">lower</span><span class="p">)</span>
|
||||
<span class="n">gcopy</span><span class="o">.</span><span class="n">delete_vertex</span><span class="p">(</span><span class="n">lower</span><span class="p">)</span>
|
||||
<span class="c1"># Now reverse the list: first elements are those with higher degree</span>
|
||||
<span class="c1"># print(todo_vertices)</span>
|
||||
<span class="n">todo_vertices</span><span class="o">.</span><span class="n">reverse</span><span class="p">()</span> <span class="c1"># in place reversal</span>
|
||||
<span class="c1"># print(todo_vertices)</span>
|
||||
<span class="n">coloring</span> <span class="o">=</span> <span class="p">{}</span>
|
||||
<span class="n">colored_nodes</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="c1"># gdict will be the coloring map to return</span>
|
||||
<span class="n">gdict</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span>
|
||||
<span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">todo_vertices</span><span class="p">:</span>
|
||||
<span class="n">seen_neighbours</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">gdict</span><span class="p">[</span><span class="n">v</span><span class="p">]</span> <span class="k">if</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">coloring</span><span class="p">]</span>
|
||||
<span class="n">choose_among</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="nb">range</span><span class="p">(</span><span class="n">K</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span>
|
||||
<span class="n">i</span> <span class="ow">in</span> <span class="p">[</span><span class="n">coloring</span><span class="p">[</span><span class="n">v1</span><span class="p">]</span> <span class="k">for</span> <span class="n">v1</span> <span class="ow">in</span> <span class="n">seen_neighbours</span><span class="p">])]</span>
|
||||
<span class="k">if</span> <span class="n">choose_among</span><span class="p">:</span>
|
||||
<span class="c1"># if the node can be colored, I choose the minimal color.</span>
|
||||
<span class="n">color</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">choose_among</span><span class="p">)</span>
|
||||
<span class="n">coloring</span><span class="p">[</span><span class="n">v</span><span class="p">]</span> <span class="o">=</span> <span class="n">color</span>
|
||||
<span class="n">colored_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">v</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># if I cannot color some node, the coloring is not Total</span>
|
||||
<span class="c1"># but I continue</span>
|
||||
<span class="n">is_total</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="k">return</span> <span class="p">(</span><span class="n">coloring</span><span class="p">,</span> <span class="n">is_total</span><span class="p">,</span> <span class="n">colored_nodes</span><span class="p">)</span></div></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="DiGraph"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph">[docs]</a><span class="k">class</span> <span class="nc">DiGraph</span><span class="p">(</span><span class="n">GeneralGraph</span><span class="p">):</span>
|
||||
<span class="w"> </span><span class="sd">"""Class for directed graphs."""</span>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.pred"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.pred">[docs]</a> <span class="k">def</span> <span class="nf">pred</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">v</span><span class="p">:</span> <span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Set</span><span class="p">:</span>
|
||||
<span class="w"> </span><span class="sd">"""Return all predecessors of the vertex `v` in the graph."""</span>
|
||||
<span class="k">return</span> <span class="p">{</span><span class="n">src</span> <span class="k">for</span> <span class="n">src</span><span class="p">,</span> <span class="n">dests</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">dests</span><span class="p">}</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.neighbourhoods"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.neighbourhoods">[docs]</a> <span class="k">def</span> <span class="nf">neighbourhoods</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">Tuple</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="w"> </span><span class="sd">"""Return all neighbourhoods in the graph."""</span>
|
||||
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="o">.</span><span class="n">items</span><span class="p">())</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.edges"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.edges">[docs]</a> <span class="k">def</span> <span class="nf">edges</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">Set</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">""" A static method generating the set of edges"""</span>
|
||||
<span class="n">edges</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">vertex</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">neighbour</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex</span><span class="p">]:</span>
|
||||
<span class="n">edges</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">vertex</span><span class="p">,</span> <span class="n">neighbour</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">edges</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.add_edge"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.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">edge</span><span class="p">:</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">Any</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">"""</span>
|
||||
<span class="sd"> Add an edge in the graph.</span>
|
||||
<span class="sd"> edge should be a pair and not (c,c)</span>
|
||||
<span class="sd"> (we call g.add_edge((v1,v2)))</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="p">(</span><span class="n">vertex1</span><span class="p">,</span> <span class="n">vertex2</span><span class="p">)</span> <span class="o">=</span> <span class="n">edge</span>
|
||||
<span class="k">if</span> <span class="n">vertex1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex1</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">vertex2</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex1</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="n">vertex2</span><span class="p">}</span>
|
||||
<span class="k">if</span> <span class="n">vertex2</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex2</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.print_dot"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.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">name</span><span class="p">:</span> <span class="nb">str</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 graph."""</span>
|
||||
<span class="n">dot</span> <span class="o">=</span> <span class="n">Digraph</span><span class="p">(</span><span class="n">comment</span><span class="o">=</span><span class="s1">'Conflict Graph'</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">:</span>
|
||||
<span class="n">shape</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="n">color</span> <span class="o">=</span> <span class="s2">"grey"</span>
|
||||
<span class="n">dot</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">k</span><span class="p">),</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="n">shape</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="p">(</span><span class="n">v1</span><span class="p">,</span> <span class="n">v2</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">():</span>
|
||||
<span class="n">dot</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">v1</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">v2</span><span class="p">),</span> <span class="nb">dir</span><span class="o">=</span><span class="s2">"none"</span><span class="p">)</span>
|
||||
<span class="c1"># print(dot.source)</span>
|
||||
<span class="n">dot</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">view</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="c1"># print in pdf</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.delete_vertex"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.delete_vertex">[docs]</a> <span class="k">def</span> <span class="nf">delete_vertex</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">vertex</span><span class="p">:</span> <span class="n">Any</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">"""Delete a vertex and all the adjacent edges."""</span>
|
||||
<span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">neighbours</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
|
||||
<span class="k">if</span> <span class="n">vertex</span> <span class="ow">in</span> <span class="n">neighbours</span><span class="p">:</span>
|
||||
<span class="n">neighbours</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">vertex</span><span class="p">)</span>
|
||||
<span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">vertex</span><span class="p">]</span></div>
|
||||
|
||||
<div class="viewcode-block" id="DiGraph.delete_edge"><a class="viewcode-back" href="../../api/Lib.Graphes.html#Lib.Graphes.DiGraph.delete_edge">[docs]</a> <span class="k">def</span> <span class="nf">delete_edge</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">edge</span><span class="p">:</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">Any</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">"""Delete an edge."""</span>
|
||||
<span class="p">(</span><span class="n">v1</span><span class="p">,</span> <span class="n">v2</span><span class="p">)</span> <span class="o">=</span> <span class="n">edge</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">graph_dict</span><span class="p">[</span><span class="n">v1</span><span class="p">]</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">v2</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>
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
173
docs/html/_modules/Lib/PhiNode.html
Normal file
173
docs/html/_modules/Lib/PhiNode.html
Normal file
@ -0,0 +1,173 @@
|
||||
<!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.PhiNode — 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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</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.PhiNode</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.PhiNode</h1><div class="highlight"><pre>
|
||||
<span></span><span class="sd">"""</span>
|
||||
<span class="sd">Classes for φ nodes in a RiscV CFG :py:class:`CFG <Lib.CFG.CFG>` under SSA Form:</span>
|
||||
<span class="sd">:py:class:`PhiNode` for a statement of the form temp_x = φ(temp_0, ..., temp_n).</span>
|
||||
<span class="sd">These particular kinds of statements are expected to be in the field</span>
|
||||
<span class="sd">b._phis for a :py:class:`Block <Lib.CFG.Block>` b.</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.Operands</span> <span class="kn">import</span> <span class="n">Operand</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">,</span> <span class="n">DataLocation</span><span class="p">,</span> <span class="n">Renamer</span>
|
||||
<span class="kn">from</span> <span class="nn">Lib.Statement</span> <span class="kn">import</span> <span class="n">Statement</span><span class="p">,</span> <span class="n">Label</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="PhiNode"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode">[docs]</a><span class="nd">@dataclass</span>
|
||||
<span class="k">class</span> <span class="nc">PhiNode</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"> A φ node is a renaming in the CFG, of the form temp_x = φ(temp_0, ..., temp_n).</span>
|
||||
<span class="sd"> The field var contains the variable temp_x.</span>
|
||||
<span class="sd"> The field srcs relies for each precedent block in the CFG, identified with its label,</span>
|
||||
<span class="sd"> the variable temp_i of the φ node.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">var</span><span class="p">:</span> <span class="n">DataLocation</span>
|
||||
<span class="n">srcs</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">Operand</span><span class="p">]</span>
|
||||
|
||||
<div class="viewcode-block" id="PhiNode.defined"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.defined">[docs]</a> <span class="k">def</span> <span class="nf">defined</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="w"> </span><span class="sd">"""Return the variable defined by the φ node."""</span>
|
||||
<span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">var</span><span class="p">]</span></div>
|
||||
|
||||
<div class="viewcode-block" id="PhiNode.get_srcs"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.get_srcs">[docs]</a> <span class="k">def</span> <span class="nf">get_srcs</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">Label</span><span class="p">,</span> <span class="n">Operand</span><span class="p">]:</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Return the dictionnary associating for each previous block the corresponding variable.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">srcs</span></div>
|
||||
|
||||
<div class="viewcode-block" id="PhiNode.used"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.used">[docs]</a> <span class="k">def</span> <span class="nf">used</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="w"> </span><span class="sd">"""Return the variables used by the statement."""</span>
|
||||
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="o">.</span><span class="n">values</span><span class="p">())</span></div>
|
||||
|
||||
<div class="viewcode-block" id="PhiNode.rename"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.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="o">-></span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="w"> </span><span class="sd">"""Rename the variable defined by the φ node with a fresh name."""</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">var</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">var</span> <span class="o">=</span> <span class="n">renamer</span><span class="o">.</span><span class="n">fresh</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">var</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="PhiNode.rename_from"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename_from">[docs]</a> <span class="k">def</span> <span class="nf">rename_from</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="n">label</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">"""Rename the variable associated to the block identified by `label`."""</span>
|
||||
<span class="k">if</span> <span class="n">label</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="p">:</span>
|
||||
<span class="n">t</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="p">[</span><span class="n">label</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">Temporary</span><span class="p">):</span>
|
||||
<span class="k">if</span> <span class="n">renamer</span><span class="o">.</span><span class="n">defined</span><span class="p">(</span><span class="n">t</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="p">[</span><span class="n">label</span><span class="p">]</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="n">t</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="p">[</span><span class="n">label</span><span class="p">]</span></div>
|
||||
|
||||
<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="s2">"</span><span class="si">{}</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">var</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="p">)</span>
|
||||
|
||||
<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="bp">self</span><span class="o">.</span><span class="n">var</span><span class="p">,</span> <span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">srcs</span><span class="o">.</span><span class="n">items</span><span class="p">()))</span>
|
||||
|
||||
<div class="viewcode-block" id="PhiNode.printIns"><a class="viewcode-back" href="../../api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.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="s1">' # '</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</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>
|
||||
</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>
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -77,10 +80,13 @@
|
||||
<h1>All modules for which code is available</h1>
|
||||
<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/Dominators.html">Lib.Dominators</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/Graphes.html">Lib.Graphes</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/PhiNode.html">Lib.PhiNode</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/Terminator.html">Lib.Terminator</a></li>
|
||||
|
7
docs/html/_sources/api/Lib.Dominators.rst.txt
Normal file
7
docs/html/_sources/api/Lib.Dominators.rst.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Lib.Dominators module
|
||||
=====================
|
||||
|
||||
.. automodule:: Lib.Dominators
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
7
docs/html/_sources/api/Lib.Graphes.rst.txt
Normal file
7
docs/html/_sources/api/Lib.Graphes.rst.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Lib.Graphes module
|
||||
==================
|
||||
|
||||
.. automodule:: Lib.Graphes
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
7
docs/html/_sources/api/Lib.PhiNode.rst.txt
Normal file
7
docs/html/_sources/api/Lib.PhiNode.rst.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Lib.PhiNode module
|
||||
==================
|
||||
|
||||
.. automodule:: Lib.PhiNode
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
@ -9,10 +9,13 @@ Submodules
|
||||
|
||||
Lib.Allocator
|
||||
Lib.CFG
|
||||
Lib.Dominators
|
||||
Lib.Errors
|
||||
Lib.FunctionData
|
||||
Lib.Graphes
|
||||
Lib.LinearCode
|
||||
Lib.Operands
|
||||
Lib.PhiNode
|
||||
Lib.RiscV
|
||||
Lib.Statement
|
||||
Lib.Terminator
|
||||
|
@ -48,6 +48,7 @@
|
||||
<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.Graphes.html">Base library - Graphs</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Linear intermediate representation</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Temporary allocation</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Allocator.Allocator"><code class="docutils literal notranslate"><span class="pre">Allocator</span></code></a><ul>
|
||||
@ -65,6 +66,8 @@
|
||||
</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -48,6 +48,7 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
@ -90,6 +91,8 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
161
docs/html/api/Lib.Dominators.html
Normal file
161
docs/html/api/Lib.Dominators.html
Normal file
@ -0,0 +1,161 @@
|
||||
<!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.Dominators 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.PhiNode module" href="Lib.PhiNode.html" />
|
||||
<link rel="prev" title="Lib.Terminator module" href="Lib.Terminator.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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">SSA form - Dominance frontier</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Dominators.computeDom"><code class="docutils literal notranslate"><span class="pre">computeDom()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Dominators.printDT"><code class="docutils literal notranslate"><span class="pre">printDT()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Dominators.computeDT"><code class="docutils literal notranslate"><span class="pre">computeDT()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Dominators.computeDF"><code class="docutils literal notranslate"><span class="pre">computeDF()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</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.Dominators module</li>
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
<a href="../_sources/api/Lib.Dominators.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.Dominators">
|
||||
<span id="lib-dominators-module"></span><h1>Lib.Dominators module<a class="headerlink" href="#module-Lib.Dominators" title="Permalink to this heading"></a></h1>
|
||||
<p>Utility functions to work with dominators in 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>.</p>
|
||||
<p>Do not hesitate to look at the source of the functions
|
||||
to get a better understanding of the algorithms.</p>
|
||||
<dl class="py function">
|
||||
<dt class="sig sig-object py" id="Lib.Dominators.computeDom">
|
||||
<span class="sig-prename descclassname"><span class="pre">Lib.Dominators.</span></span><span class="sig-name descname"><span class="pre">computeDom</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cfg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG" title="Lib.CFG.CFG"><span class="pre">CFG</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">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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/Dominators.html#computeDom"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Dominators.computeDom" title="Permalink to this definition"></a></dt>
|
||||
<dd><p><cite>computeDom(cfg)</cite> computes the table associating blocks to their
|
||||
dominators in <cite>cfg</cite>.
|
||||
It works by solving the equation system.</p>
|
||||
<p>This is an helper function called during SSA entry.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt class="sig sig-object py" id="Lib.Dominators.printDT">
|
||||
<span class="sig-prename descclassname"><span class="pre">Lib.Dominators.</span></span><span class="sig-name descname"><span class="pre">printDT</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">graph</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.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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></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/Dominators.html#printDT"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Dominators.printDT" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Display a graphical rendering of the given domination tree.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt class="sig sig-object py" id="Lib.Dominators.computeDT">
|
||||
<span class="sig-prename descclassname"><span class="pre">Lib.Dominators.</span></span><span class="sig-name descname"><span class="pre">computeDT</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cfg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG" title="Lib.CFG.CFG"><span class="pre">CFG</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">dominators</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.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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></em>, <em class="sig-param"><span class="n"><span class="pre">dom_graphs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">basename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</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">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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/Dominators.html#computeDT"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Dominators.computeDT" title="Permalink to this definition"></a></dt>
|
||||
<dd><p><cite>computeDT(cfg, dominators)</cite> computes the domination tree of <cite>cfg</cite>
|
||||
using the previously computed <cite>dominators</cite>.
|
||||
It returns <cite>DT</cite>, a dictionary which associates a block with its children
|
||||
in the dominator tree.</p>
|
||||
<p>This is an helper function called during SSA entry.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py function">
|
||||
<dt class="sig sig-object py" id="Lib.Dominators.computeDF">
|
||||
<span class="sig-prename descclassname"><span class="pre">Lib.Dominators.</span></span><span class="sig-name descname"><span class="pre">computeDF</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cfg</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="Lib.CFG.html#Lib.CFG.CFG" title="Lib.CFG.CFG"><span class="pre">CFG</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">dominators</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.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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></em>, <em class="sig-param"><span class="n"><span class="pre">DT</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.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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></em>, <em class="sig-param"><span class="n"><span class="pre">dom_graphs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">basename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</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">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="Lib.CFG.html#Lib.CFG.Block" title="Lib.CFG.Block"><span class="pre">Block</span></a><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.html#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/Dominators.html#computeDF"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Dominators.computeDF" title="Permalink to this definition"></a></dt>
|
||||
<dd><p><cite>computeDF(…)</cite> computes the dominance frontier of a CFG.
|
||||
It returns <cite>DF</cite> which associates a block to its frontier.</p>
|
||||
<p>This is an helper function called during SSA entry.</p>
|
||||
</dd></dl>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="Lib.Terminator.html" class="btn btn-neutral float-left" title="Lib.Terminator module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="Lib.PhiNode.html" class="btn btn-neutral float-right" title="Lib.PhiNode 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>
|
@ -55,10 +55,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<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.LinearCode module" href="Lib.LinearCode.html" />
|
||||
<link rel="next" title="Lib.Graphes module" href="Lib.Graphes.html" />
|
||||
<link rel="prev" title="Lib.Operands module" href="Lib.Operands.html" />
|
||||
</head>
|
||||
|
||||
@ -59,10 +59,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -151,7 +154,7 @@ Offsets are decreasing relative to FP.</p>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="Lib.Operands.html" class="btn btn-neutral float-left" title="Lib.Operands 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-right" title="Lib.LinearCode module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
<a href="Lib.Graphes.html" class="btn btn-neutral float-right" title="Lib.Graphes module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
352
docs/html/api/Lib.Graphes.html
Normal file
352
docs/html/api/Lib.Graphes.html
Normal file
@ -0,0 +1,352 @@
|
||||
<!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.Graphes 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.LinearCode module" href="Lib.LinearCode.html" />
|
||||
<link rel="prev" title="Lib.FunctionData module" href="Lib.FunctionData.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 current"><a class="current reference internal" href="#">Base library - Graphs</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Graphes.GraphError"><code class="docutils literal notranslate"><span class="pre">GraphError</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GraphError.message"><code class="docutils literal notranslate"><span class="pre">GraphError.message</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Graphes.GeneralGraph"><code class="docutils literal notranslate"><span class="pre">GeneralGraph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.graph_dict"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.graph_dict</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.vertices"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.vertices()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.add_vertex"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.add_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.edges"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.dfs_traversal"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.dfs_traversal()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.is_reachable_from"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.is_reachable_from()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.connected_components"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.connected_components()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.GeneralGraph.bfs_traversal"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.bfs_traversal()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Graphes.Graph"><code class="docutils literal notranslate"><span class="pre">Graph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.edges"><code class="docutils literal notranslate"><span class="pre">Graph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.add_edge"><code class="docutils literal notranslate"><span class="pre">Graph.add_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.print_dot"><code class="docutils literal notranslate"><span class="pre">Graph.print_dot()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.delete_vertex"><code class="docutils literal notranslate"><span class="pre">Graph.delete_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.delete_edge"><code class="docutils literal notranslate"><span class="pre">Graph.delete_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.color"><code class="docutils literal notranslate"><span class="pre">Graph.color()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.Graph.color_with_k_colors"><code class="docutils literal notranslate"><span class="pre">Graph.color_with_k_colors()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.Graphes.DiGraph"><code class="docutils literal notranslate"><span class="pre">DiGraph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.pred"><code class="docutils literal notranslate"><span class="pre">DiGraph.pred()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.neighbourhoods"><code class="docutils literal notranslate"><span class="pre">DiGraph.neighbourhoods()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.edges"><code class="docutils literal notranslate"><span class="pre">DiGraph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.add_edge"><code class="docutils literal notranslate"><span class="pre">DiGraph.add_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.print_dot"><code class="docutils literal notranslate"><span class="pre">DiGraph.print_dot()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.delete_vertex"><code class="docutils literal notranslate"><span class="pre">DiGraph.delete_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.Graphes.DiGraph.delete_edge"><code class="docutils literal notranslate"><span class="pre">DiGraph.delete_edge()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</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.Graphes module</li>
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
<a href="../_sources/api/Lib.Graphes.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.Graphes">
|
||||
<span id="lib-graphes-module"></span><h1>Lib.Graphes module<a class="headerlink" href="#module-Lib.Graphes" title="Permalink to this heading"></a></h1>
|
||||
<p>Python Classes for Oriented and Non Oriented Graphs</p>
|
||||
<dl class="py exception">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GraphError">
|
||||
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.Graphes.</span></span><span class="sig-name descname"><span class="pre">GraphError</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Graphes.html#GraphError"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GraphError" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
|
||||
<p>Exception raised for self loops.</p>
|
||||
<dl class="py attribute">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GraphError.message">
|
||||
<span class="sig-name descname"><span class="pre">message</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#Lib.Graphes.GraphError.message" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.Graphes.</span></span><span class="sig-name descname"><span class="pre">GeneralGraph</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Graphes.html#GeneralGraph"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph" 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>General class regrouping similarities
|
||||
between directed and non oriented graphs.
|
||||
The only differences between the two are:</p>
|
||||
<ul class="simple">
|
||||
<li><p>how to compute the set of edges</p></li>
|
||||
<li><p>how to add an edge</p></li>
|
||||
<li><p>how to print the graph</p></li>
|
||||
<li><p>how to delete a vertex</p></li>
|
||||
<li><p>how to delete an edge</p></li>
|
||||
<li><p>we only color undirected graphs</p></li>
|
||||
</ul>
|
||||
<dl class="py attribute">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.graph_dict">
|
||||
<span class="sig-name descname"><span class="pre">graph_dict</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><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></em><a class="headerlink" href="#Lib.Graphes.GeneralGraph.graph_dict" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.vertices">
|
||||
<span class="sig-name descname"><span class="pre">vertices</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><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#GeneralGraph.vertices"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.vertices" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return the vertices of a graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.add_vertex">
|
||||
<span class="sig-name descname"><span class="pre">add_vertex</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">vertex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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/Graphes.html#GeneralGraph.add_vertex"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.add_vertex" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>If the vertex “vertex” is not in
|
||||
self.graph_dict, a key “vertex” with an empty
|
||||
list as a value is added to the dictionary.
|
||||
Otherwise nothing has to be done.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.edges">
|
||||
<span class="sig-name descname"><span class="pre">edges</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><span class="pre">Set</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#GeneralGraph.edges"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.edges" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return the edges of the graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.dfs_traversal">
|
||||
<span class="sig-name descname"><span class="pre">dfs_traversal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">root</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#GeneralGraph.dfs_traversal"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.dfs_traversal" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Compute a depth first search of the graph,
|
||||
from the vertex root.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.is_reachable_from">
|
||||
<span class="sig-name descname"><span class="pre">is_reachable_from</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">v1</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">v2</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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">bool</span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#GeneralGraph.is_reachable_from"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.is_reachable_from" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>True if there is a path from v1 to v2.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.connected_components">
|
||||
<span class="sig-name descname"><span class="pre">connected_components</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><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><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/Graphes.html#GeneralGraph.connected_components"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.connected_components" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Compute the list of all connected components of the graph,
|
||||
each component being a list of vetices.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.GeneralGraph.bfs_traversal">
|
||||
<span class="sig-name descname"><span class="pre">bfs_traversal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">root</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#GeneralGraph.bfs_traversal"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.GeneralGraph.bfs_traversal" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Compute a breadth first search of the graph,
|
||||
from the vertex root.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.Graphes.</span></span><span class="sig-name descname"><span class="pre">Graph</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Graphes.html#Graph"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <a class="reference internal" href="#Lib.Graphes.GeneralGraph" title="Lib.Graphes.GeneralGraph"><code class="xref py py-class docutils literal notranslate"><span class="pre">GeneralGraph</span></code></a></p>
|
||||
<p>Class for non oriented graphs.</p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.edges">
|
||||
<span class="sig-name descname"><span class="pre">edges</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><span class="pre">Set</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#Graph.edges"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.edges" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>A static method generating the set of edges
|
||||
(they appear twice in the dictionnary).
|
||||
Return a list of sets.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.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">edge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Tuple</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">Any</span><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/Graphes.html#Graph.add_edge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.add_edge" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Add an edge in the graph.
|
||||
edge should be a pair and not (c,c)
|
||||
(we call g.add_edge((v1,v2)))</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.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">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">colors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">{}</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/Graphes.html#Graph.print_dot"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.print_dot" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Print the graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.delete_vertex">
|
||||
<span class="sig-name descname"><span class="pre">delete_vertex</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">vertex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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/Graphes.html#Graph.delete_vertex"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.delete_vertex" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Delete a vertex and all the adjacent edges.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.delete_edge">
|
||||
<span class="sig-name descname"><span class="pre">delete_edge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">edge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Tuple</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">Any</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Graphes.html#Graph.delete_edge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.delete_edge" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Delete an edge.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.color">
|
||||
<span class="sig-name descname"><span class="pre">color</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">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#Graph.color"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.color" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Color the graph with an unlimited number of colors.
|
||||
Return a dict vertex -> color, where color is an integer (0, 1, …).</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.Graph.color_with_k_colors">
|
||||
<span class="sig-name descname"><span class="pre">color_with_k_colors</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">K</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">avoidingnodes</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</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">Tuple</span><span class="p"><span class="pre">[</span></span><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">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#Graph.color_with_k_colors"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.Graph.color_with_k_colors" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Color with <= K colors (if K is unspecified, use unlimited colors).</p>
|
||||
<p>Return 3 values:</p>
|
||||
<ul class="simple">
|
||||
<li><p>a dict vertex -> color</p></li>
|
||||
<li><p>a Boolean, True if the coloring succeeded</p></li>
|
||||
<li><p>the set of nodes actually colored</p></li>
|
||||
</ul>
|
||||
<p>Do not color vertices belonging to avoidingnodes.</p>
|
||||
<p>Continue even if the algo fails.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.Graphes.</span></span><span class="sig-name descname"><span class="pre">DiGraph</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph_dict</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/Lib/Graphes.html#DiGraph"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Bases: <a class="reference internal" href="#Lib.Graphes.GeneralGraph" title="Lib.Graphes.GeneralGraph"><code class="xref py py-class docutils literal notranslate"><span class="pre">GeneralGraph</span></code></a></p>
|
||||
<p>Class for directed graphs.</p>
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.pred">
|
||||
<span class="sig-name descname"><span class="pre">pred</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">v</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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">Set</span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#DiGraph.pred"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.pred" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return all predecessors of the vertex <cite>v</cite> in the graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.neighbourhoods">
|
||||
<span class="sig-name descname"><span class="pre">neighbourhoods</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><span class="pre">Tuple</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><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#DiGraph.neighbourhoods"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.neighbourhoods" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return all neighbourhoods in the graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.edges">
|
||||
<span class="sig-name descname"><span class="pre">edges</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><span class="pre">Set</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="../_modules/Lib/Graphes.html#DiGraph.edges"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.edges" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>A static method generating the set of edges</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.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">edge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Tuple</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">Any</span><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/Graphes.html#DiGraph.add_edge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.add_edge" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Add an edge in the graph.
|
||||
edge should be a pair and not (c,c)
|
||||
(we call g.add_edge((v1,v2)))</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.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">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</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/Graphes.html#DiGraph.print_dot"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.print_dot" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Print the graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.delete_vertex">
|
||||
<span class="sig-name descname"><span class="pre">delete_vertex</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">vertex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</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/Graphes.html#DiGraph.delete_vertex"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.delete_vertex" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Delete a vertex and all the adjacent edges.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.Graphes.DiGraph.delete_edge">
|
||||
<span class="sig-name descname"><span class="pre">delete_edge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">edge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Tuple</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">Any</span><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/Graphes.html#DiGraph.delete_edge"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.Graphes.DiGraph.delete_edge" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Delete an edge.</p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="Lib.FunctionData.html" class="btn btn-neutral float-left" title="Lib.FunctionData 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-right" title="Lib.LinearCode 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>
|
@ -19,7 +19,7 @@
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="next" title="Lib.Allocator module" href="Lib.Allocator.html" />
|
||||
<link rel="prev" title="Lib.FunctionData module" href="Lib.FunctionData.html" />
|
||||
<link rel="prev" title="Lib.Graphes module" href="Lib.Graphes.html" />
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
@ -48,6 +48,7 @@
|
||||
<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.Graphes.html">Base library - Graphs</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Linear intermediate representation</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.LinearCode.LinearCode"><code class="docutils literal notranslate"><span class="pre">LinearCode</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.LinearCode.LinearCode.fdata"><code class="docutils literal notranslate"><span class="pre">LinearCode.fdata</span></code></a></li>
|
||||
@ -66,6 +67,8 @@
|
||||
<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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -172,7 +175,7 @@ with the list of instructions given by f(i).</p>
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="Lib.FunctionData.html" class="btn btn-neutral float-left" title="Lib.FunctionData module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="Lib.Graphes.html" class="btn btn-neutral float-left" title="Lib.Graphes module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
||||
<a href="Lib.Allocator.html" class="btn btn-neutral float-right" title="Lib.Allocator module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
|
@ -94,10 +94,13 @@
|
||||
</ul>
|
||||
</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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
191
docs/html/api/Lib.PhiNode.html
Normal file
191
docs/html/api/Lib.PhiNode.html
Normal file
@ -0,0 +1,191 @@
|
||||
<!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.PhiNode 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.Dominators module" href="Lib.Dominators.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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">SSA form - Phi Nodes</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#Lib.PhiNode.PhiNode"><code class="docutils literal notranslate"><span class="pre">PhiNode</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.var"><code class="docutils literal notranslate"><span class="pre">PhiNode.var</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.srcs"><code class="docutils literal notranslate"><span class="pre">PhiNode.srcs</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.defined"><code class="docutils literal notranslate"><span class="pre">PhiNode.defined()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.get_srcs"><code class="docutils literal notranslate"><span class="pre">PhiNode.get_srcs()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.used"><code class="docutils literal notranslate"><span class="pre">PhiNode.used()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.rename"><code class="docutils literal notranslate"><span class="pre">PhiNode.rename()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.rename_from"><code class="docutils literal notranslate"><span class="pre">PhiNode.rename_from()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#Lib.PhiNode.PhiNode.printIns"><code class="docutils literal notranslate"><span class="pre">PhiNode.printIns()</span></code></a></li>
|
||||
</ul>
|
||||
</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.PhiNode module</li>
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
<a href="../_sources/api/Lib.PhiNode.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.PhiNode">
|
||||
<span id="lib-phinode-module"></span><h1>Lib.PhiNode module<a class="headerlink" href="#module-Lib.PhiNode" title="Permalink to this heading"></a></h1>
|
||||
<p>Classes for φ nodes in a RiscV CFG <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> under SSA Form:
|
||||
<a class="reference internal" href="#Lib.PhiNode.PhiNode" title="Lib.PhiNode.PhiNode"><code class="xref py py-class docutils literal notranslate"><span class="pre">PhiNode</span></code></a> for a statement of the form temp_x = φ(temp_0, …, temp_n).
|
||||
These particular kinds of statements are expected to be in the field
|
||||
b._phis for a <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> b.</p>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">Lib.PhiNode.</span></span><span class="sig-name descname"><span class="pre">PhiNode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</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.DataLocation" title="Lib.Operands.DataLocation"><span class="pre">DataLocation</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">srcs</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.Statement.html#Lib.Statement.Label" title="Lib.Statement.Label"><span class="pre">Label</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/PhiNode.html#PhiNode"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode" 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 φ node is a renaming in the CFG, of the form temp_x = φ(temp_0, …, temp_n).
|
||||
The field var contains the variable temp_x.
|
||||
The field srcs relies for each precedent block in the CFG, identified with its label,
|
||||
the variable temp_i of the φ node.</p>
|
||||
<dl class="py attribute">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.var">
|
||||
<span class="sig-name descname"><span class="pre">var</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.DataLocation" title="Lib.Operands.DataLocation"><span class="pre">DataLocation</span></a></em><a class="headerlink" href="#Lib.PhiNode.PhiNode.var" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py attribute">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.srcs">
|
||||
<span class="sig-name descname"><span class="pre">srcs</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Dict</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 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></em><a class="headerlink" href="#Lib.PhiNode.PhiNode.srcs" title="Permalink to this definition"></a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.defined">
|
||||
<span class="sig-name descname"><span class="pre">defined</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/PhiNode.html#PhiNode.defined"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode.defined" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return the variable defined by the φ node.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.get_srcs">
|
||||
<span class="sig-name descname"><span class="pre">get_srcs</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><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 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></span><a class="reference internal" href="../_modules/Lib/PhiNode.html#PhiNode.get_srcs"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode.get_srcs" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return the dictionnary associating for each previous block the corresponding variable.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.used">
|
||||
<span class="sig-name descname"><span class="pre">used</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/PhiNode.html#PhiNode.used"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode.used" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Return the variables used by the statement.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.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> <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/PhiNode.html#PhiNode.rename"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode.rename" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Rename the variable defined by the φ node with a fresh name.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.rename_from">
|
||||
<span class="sig-name descname"><span class="pre">rename_from</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>, <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><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/PhiNode.html#PhiNode.rename_from"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode.rename_from" title="Permalink to this definition"></a></dt>
|
||||
<dd><p>Rename the variable associated to the block identified by <cite>label</cite>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
<dt class="sig sig-object py" id="Lib.PhiNode.PhiNode.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/PhiNode.html#PhiNode.printIns"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#Lib.PhiNode.PhiNode.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>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
||||
<a href="Lib.Dominators.html" class="btn btn-neutral float-left" title="Lib.Dominators 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>
|
@ -65,10 +65,13 @@
|
||||
</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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -107,10 +107,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<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.Dominators module" href="Lib.Dominators.html" />
|
||||
<link rel="prev" title="Lib.CFG module" href="Lib.CFG.html" />
|
||||
</head>
|
||||
|
||||
@ -47,6 +48,7 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
@ -78,6 +80,8 @@
|
||||
<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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -259,6 +263,7 @@ to the potential label next_label.</p>
|
||||
</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>
|
||||
<a href="Lib.Dominators.html" class="btn btn-neutral float-right" title="Lib.Dominators module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
@ -46,10 +46,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -135,6 +138,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">Lib.Dominators module</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.computeDom"><code class="docutils literal notranslate"><span class="pre">computeDom()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.printDT"><code class="docutils literal notranslate"><span class="pre">printDT()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.computeDT"><code class="docutils literal notranslate"><span class="pre">computeDT()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.computeDF"><code class="docutils literal notranslate"><span class="pre">computeDF()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<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.MiniCInternalError"><code class="docutils literal notranslate"><span class="pre">MiniCInternalError</span></code></a></li>
|
||||
@ -155,6 +165,44 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Graphes.html">Lib.Graphes module</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GraphError"><code class="docutils literal notranslate"><span class="pre">GraphError</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GraphError.message"><code class="docutils literal notranslate"><span class="pre">GraphError.message</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph"><code class="docutils literal notranslate"><span class="pre">GeneralGraph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.graph_dict"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.graph_dict</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.vertices"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.vertices()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.add_vertex"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.add_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.edges"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.dfs_traversal"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.dfs_traversal()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.is_reachable_from"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.is_reachable_from()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.connected_components"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.connected_components()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph.bfs_traversal"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.bfs_traversal()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph"><code class="docutils literal notranslate"><span class="pre">Graph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.edges"><code class="docutils literal notranslate"><span class="pre">Graph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.add_edge"><code class="docutils literal notranslate"><span class="pre">Graph.add_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.print_dot"><code class="docutils literal notranslate"><span class="pre">Graph.print_dot()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.delete_vertex"><code class="docutils literal notranslate"><span class="pre">Graph.delete_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.delete_edge"><code class="docutils literal notranslate"><span class="pre">Graph.delete_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.color"><code class="docutils literal notranslate"><span class="pre">Graph.color()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph.color_with_k_colors"><code class="docutils literal notranslate"><span class="pre">Graph.color_with_k_colors()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph"><code class="docutils literal notranslate"><span class="pre">DiGraph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.pred"><code class="docutils literal notranslate"><span class="pre">DiGraph.pred()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.neighbourhoods"><code class="docutils literal notranslate"><span class="pre">DiGraph.neighbourhoods()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.edges"><code class="docutils literal notranslate"><span class="pre">DiGraph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.add_edge"><code class="docutils literal notranslate"><span class="pre">DiGraph.add_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.print_dot"><code class="docutils literal notranslate"><span class="pre">DiGraph.print_dot()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.delete_vertex"><code class="docutils literal notranslate"><span class="pre">DiGraph.delete_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph.delete_edge"><code class="docutils literal notranslate"><span class="pre">DiGraph.delete_edge()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.LinearCode.html">Lib.LinearCode module</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.LinearCode.html#Lib.LinearCode.LinearCode"><code class="docutils literal notranslate"><span class="pre">LinearCode</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.LinearCode.html#Lib.LinearCode.LinearCode.fdata"><code class="docutils literal notranslate"><span class="pre">LinearCode.fdata</span></code></a></li>
|
||||
@ -217,6 +265,20 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">Lib.PhiNode module</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode"><code class="docutils literal notranslate"><span class="pre">PhiNode</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.var"><code class="docutils literal notranslate"><span class="pre">PhiNode.var</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.srcs"><code class="docutils literal notranslate"><span class="pre">PhiNode.srcs</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.defined"><code class="docutils literal notranslate"><span class="pre">PhiNode.defined()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.get_srcs"><code class="docutils literal notranslate"><span class="pre">PhiNode.get_srcs()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.used"><code class="docutils literal notranslate"><span class="pre">PhiNode.used()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename"><code class="docutils literal notranslate"><span class="pre">PhiNode.rename()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename_from"><code class="docutils literal notranslate"><span class="pre">PhiNode.rename_from()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode.printIns"><code class="docutils literal notranslate"><span class="pre">PhiNode.printIns()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.RiscV.html">Lib.RiscV module</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.RiscV.html#Lib.RiscV.call"><code class="docutils literal notranslate"><span class="pre">call()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Lib.RiscV.html#Lib.RiscV.jump"><code class="docutils literal notranslate"><span class="pre">jump()</span></code></a></li>
|
||||
|
@ -46,10 +46,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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"><a class="reference internal" href="Lib.Terminator.html">Control Flow Graph - Terminators</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -92,6 +95,13 @@
|
||||
<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.Dominators.html">Lib.Dominators module</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.computeDom"><code class="docutils literal notranslate"><span class="pre">computeDom()</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.printDT"><code class="docutils literal notranslate"><span class="pre">printDT()</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.computeDT"><code class="docutils literal notranslate"><span class="pre">computeDT()</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Dominators.html#Lib.Dominators.computeDF"><code class="docutils literal notranslate"><span class="pre">computeDF()</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-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>
|
||||
@ -104,6 +114,13 @@
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.FunctionData.html#Lib.FunctionData.FunctionData"><code class="docutils literal notranslate"><span class="pre">FunctionData</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.Graphes.html">Lib.Graphes module</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GraphError"><code class="docutils literal notranslate"><span class="pre">GraphError</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.GeneralGraph"><code class="docutils literal notranslate"><span class="pre">GeneralGraph</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.Graph"><code class="docutils literal notranslate"><span class="pre">Graph</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Graphes.html#Lib.Graphes.DiGraph"><code class="docutils literal notranslate"><span class="pre">DiGraph</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.LinearCode.html">Lib.LinearCode module</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.LinearCode.html#Lib.LinearCode.LinearCode"><code class="docutils literal notranslate"><span class="pre">LinearCode</span></code></a></li>
|
||||
</ul>
|
||||
@ -133,6 +150,10 @@
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.Operands.html#Lib.Operands.Renamer"><code class="docutils literal notranslate"><span class="pre">Renamer</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.PhiNode.html">Lib.PhiNode module</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.PhiNode.html#Lib.PhiNode.PhiNode"><code class="docutils literal notranslate"><span class="pre">PhiNode</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Lib.RiscV.html">Lib.RiscV module</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.RiscV.html#Lib.RiscV.call"><code class="docutils literal notranslate"><span class="pre">call()</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Lib.RiscV.html#Lib.RiscV.jump"><code class="docutils literal notranslate"><span class="pre">jump()</span></code></a></li>
|
||||
|
@ -45,10 +45,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -82,6 +85,7 @@
|
||||
| <a href="#B"><strong>B</strong></a>
|
||||
| <a href="#C"><strong>C</strong></a>
|
||||
| <a href="#D"><strong>D</strong></a>
|
||||
| <a href="#E"><strong>E</strong></a>
|
||||
| <a href="#F"><strong>F</strong></a>
|
||||
| <a href="#G"><strong>G</strong></a>
|
||||
| <a href="#I"><strong>I</strong></a>
|
||||
@ -95,6 +99,7 @@
|
||||
| <a href="#S"><strong>S</strong></a>
|
||||
| <a href="#T"><strong>T</strong></a>
|
||||
| <a href="#U"><strong>U</strong></a>
|
||||
| <a href="#V"><strong>V</strong></a>
|
||||
| <a href="#W"><strong>W</strong></a>
|
||||
| <a href="#X"><strong>X</strong></a>
|
||||
| <a href="#Z"><strong>Z</strong></a>
|
||||
@ -118,22 +123,30 @@
|
||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.add_comment">add_comment() (Lib.LinearCode.LinearCode method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.add_edge">add_edge() (Lib.CFG.CFG method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.add_edge">(Lib.Graphes.DiGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.add_edge">(Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
</ul></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>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<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><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><a href="api/Lib.Operands.html#Lib.Operands.TemporaryPool.add_tmp">add_tmp() (Lib.Operands.TemporaryPool method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.add_vertex">add_vertex() (Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Errors.html#Lib.Errors.AllocationError">AllocationError</a>
|
||||
</li>
|
||||
@ -159,10 +172,12 @@
|
||||
<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><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.bfs_traversal">bfs_traversal() (Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<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>
|
||||
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator">BranchingTerminator (class in Lib.Terminator)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
@ -174,10 +189,22 @@
|
||||
<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><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.color">color() (Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.color_with_k_colors">color_with_k_colors() (Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment">Comment (class in Lib.Statement)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment.comment">comment (Lib.Statement.Comment attribute)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Dominators.html#Lib.Dominators.computeDF">computeDF() (in module Lib.Dominators)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Dominators.html#Lib.Dominators.computeDom">computeDom() (in module Lib.Dominators)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Dominators.html#Lib.Dominators.computeDT">computeDT() (in module Lib.Dominators)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.cond">cond (Lib.Statement.ConditionalJump attribute)</a>
|
||||
|
||||
@ -185,13 +212,13 @@
|
||||
<li><a href="api/Lib.Terminator.html#Lib.Terminator.BranchingTerminator.cond">(Lib.Terminator.BranchingTerminator attribute)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<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>
|
||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.conditional_jump">conditional_jump() (in module Lib.RiscV)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump">ConditionalJump (class in Lib.Statement)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.connected_components">connected_components() (Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer.copy">copy() (Lib.Operands.Renamer method)</a>
|
||||
</li>
|
||||
@ -206,18 +233,50 @@
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer.defined">defined() (Lib.Operands.Renamer method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.defined">(Lib.PhiNode.PhiNode method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.defined">(Lib.Statement.Instruction method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.defined">(Lib.Statement.Statement method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.delete_edge">delete_edge() (Lib.Graphes.DiGraph method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.delete_edge">(Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.delete_vertex">delete_vertex() (Lib.Graphes.DiGraph method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.delete_vertex">(Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.dfs_traversal">dfs_traversal() (Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph">DiGraph (class in Lib.Graphes)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.RiscV.html#Lib.RiscV.div">div() (in module Lib.RiscV)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="E">E</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.edges">edges() (Lib.Graphes.DiGraph method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.edges">(Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.edges">(Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="F">F</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
@ -254,6 +313,8 @@
|
||||
<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.CFG.gather_defs">gather_defs() (Lib.CFG.CFG method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph">GeneralGraph (class in Lib.Graphes)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.get_all_statements">get_all_statements() (Lib.CFG.Block method)</a>
|
||||
</li>
|
||||
@ -277,12 +338,12 @@
|
||||
</li>
|
||||
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_entries">get_entries() (Lib.CFG.CFG method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<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>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<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>
|
||||
@ -296,6 +357,8 @@
|
||||
</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.PhiNode.html#Lib.PhiNode.PhiNode.get_srcs">get_srcs() (Lib.PhiNode.PhiNode method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.get_start">get_start() (Lib.CFG.CFG method)</a>
|
||||
</li>
|
||||
@ -304,6 +367,12 @@
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.GP">GP (in module Lib.Operands)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.GP_REGS">GP_REGS (in module Lib.Operands)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph">Graph (class in Lib.Graphes)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.graph_dict">graph_dict (Lib.Graphes.GeneralGraph attribute)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GraphError">GraphError</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
@ -325,6 +394,8 @@
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.is_reachable_from">is_reachable_from() (Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.is_read_only">is_read_only() (Lib.Statement.Instruction method)</a>
|
||||
|
||||
<ul>
|
||||
@ -394,6 +465,13 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.CFG.html#module-Lib.CFG">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
Lib.Dominators
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Dominators.html#module-Lib.Dominators">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
@ -410,6 +488,13 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.FunctionData.html#module-Lib.FunctionData">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
Lib.Graphes
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Graphes.html#module-Lib.Graphes">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
@ -424,6 +509,13 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Operands.html#module-Lib.Operands">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
Lib.PhiNode
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.PhiNode.html#module-Lib.PhiNode">module</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
<li>
|
||||
@ -459,6 +551,8 @@
|
||||
<h2 id="M">M</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GraphError.message">message (Lib.Graphes.GraphError attribute)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Errors.html#Lib.Errors.MiniCInternalError">MiniCInternalError</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Errors.html#Lib.Errors.MiniCRuntimeError">MiniCRuntimeError</a>
|
||||
@ -476,14 +570,20 @@
|
||||
<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><a href="api/Lib.Dominators.html#module-Lib.Dominators">Lib.Dominators</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Errors.html#module-Lib.Errors">Lib.Errors</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.FunctionData.html#module-Lib.FunctionData">Lib.FunctionData</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#module-Lib.Graphes">Lib.Graphes</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.LinearCode.html#module-Lib.LinearCode">Lib.LinearCode</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Operands.html#module-Lib.Operands">Lib.Operands</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.PhiNode.html#module-Lib.PhiNode">Lib.PhiNode</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.RiscV.html#module-Lib.RiscV">Lib.RiscV</a>
|
||||
</li>
|
||||
@ -506,11 +606,13 @@
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Allocator.html#Lib.Allocator.NaiveAllocator">NaiveAllocator (class in Lib.Allocator)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Label.name">name (Lib.Statement.Label attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Condition.negate">negate() (Lib.Operands.Condition method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.neighbourhoods">neighbourhoods() (Lib.Graphes.DiGraph method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
@ -544,6 +646,10 @@
|
||||
<h2 id="P">P</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode">PhiNode (class in Lib.PhiNode)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.pred">pred() (Lib.Graphes.DiGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Allocator.html#Lib.Allocator.Allocator.prepare">prepare() (Lib.Allocator.Allocator method)</a>
|
||||
|
||||
<ul>
|
||||
@ -559,14 +665,22 @@
|
||||
<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.Graphes.html#Lib.Graphes.DiGraph.print_dot">(Lib.Graphes.DiGraph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.Graph.print_dot">(Lib.Graphes.Graph method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.print_dot">(Lib.LinearCode.LinearCode method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<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.Dominators.html#Lib.Dominators.printDT">printDT() (in module Lib.Dominators)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.printIns">printIns() (Lib.PhiNode.PhiNode method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Comment.printIns">(Lib.Statement.Comment method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.printIns">(Lib.Statement.Instruction method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Label.printIns">(Lib.Statement.Label method)</a>
|
||||
@ -594,9 +708,11 @@
|
||||
</li>
|
||||
<li><a href="api/Lib.CFG.html#Lib.CFG.CFG.remove_edge">remove_edge() (Lib.CFG.CFG method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.rename">rename() (Lib.Statement.AbsoluteJump method)</a>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename">rename() (Lib.PhiNode.PhiNode method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.AbsoluteJump.rename">(Lib.Statement.AbsoluteJump method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.ConditionalJump.rename">(Lib.Statement.ConditionalJump method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instru3A.rename">(Lib.Statement.Instru3A method)</a>
|
||||
@ -610,6 +726,8 @@
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename_from">rename_from() (Lib.PhiNode.PhiNode method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.Renamer">Renamer (class in Lib.Operands)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Allocator.html#Lib.Allocator.Allocator.replace">replace() (Lib.Allocator.Allocator method)</a>
|
||||
@ -643,6 +761,8 @@
|
||||
<li><a href="api/Lib.CFG.html#Lib.CFG.Block.set_terminator">set_terminator() (Lib.CFG.Block method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Operands.html#Lib.Operands.SP">SP (in module Lib.Operands)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.srcs">srcs (Lib.PhiNode.PhiNode attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
@ -698,15 +818,29 @@
|
||||
<h2 id="U">U</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.used">used() (Lib.Statement.Instruction method)</a>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.used">used() (Lib.PhiNode.PhiNode method)</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Instruction.used">(Lib.Statement.Instruction method)</a>
|
||||
</li>
|
||||
<li><a href="api/Lib.Statement.html#Lib.Statement.Statement.used">(Lib.Statement.Statement method)</a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="V">V</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.var">var (Lib.PhiNode.PhiNode attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.vertices">vertices() (Lib.Graphes.GeneralGraph method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="W">W</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
|
@ -47,10 +47,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -227,6 +230,44 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Graphes.html">Base library - Graphs</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GraphError"><code class="docutils literal notranslate"><span class="pre">GraphError</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GraphError.message"><code class="docutils literal notranslate"><span class="pre">GraphError.message</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph"><code class="docutils literal notranslate"><span class="pre">GeneralGraph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.graph_dict"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.graph_dict</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.vertices"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.vertices()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.add_vertex"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.add_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.edges"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.dfs_traversal"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.dfs_traversal()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.is_reachable_from"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.is_reachable_from()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.connected_components"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.connected_components()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.GeneralGraph.bfs_traversal"><code class="docutils literal notranslate"><span class="pre">GeneralGraph.bfs_traversal()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph"><code class="docutils literal notranslate"><span class="pre">Graph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.edges"><code class="docutils literal notranslate"><span class="pre">Graph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.add_edge"><code class="docutils literal notranslate"><span class="pre">Graph.add_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.print_dot"><code class="docutils literal notranslate"><span class="pre">Graph.print_dot()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.delete_vertex"><code class="docutils literal notranslate"><span class="pre">Graph.delete_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.delete_edge"><code class="docutils literal notranslate"><span class="pre">Graph.delete_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.color"><code class="docutils literal notranslate"><span class="pre">Graph.color()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.Graph.color_with_k_colors"><code class="docutils literal notranslate"><span class="pre">Graph.color_with_k_colors()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph"><code class="docutils literal notranslate"><span class="pre">DiGraph</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.pred"><code class="docutils literal notranslate"><span class="pre">DiGraph.pred()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.neighbourhoods"><code class="docutils literal notranslate"><span class="pre">DiGraph.neighbourhoods()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.edges"><code class="docutils literal notranslate"><span class="pre">DiGraph.edges()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.add_edge"><code class="docutils literal notranslate"><span class="pre">DiGraph.add_edge()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.print_dot"><code class="docutils literal notranslate"><span class="pre">DiGraph.print_dot()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.delete_vertex"><code class="docutils literal notranslate"><span class="pre">DiGraph.delete_vertex()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.Graphes.html#Lib.Graphes.DiGraph.delete_edge"><code class="docutils literal notranslate"><span class="pre">DiGraph.delete_edge()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.LinearCode.html">Linear intermediate representation</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode"><code class="docutils literal notranslate"><span class="pre">LinearCode</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.LinearCode.html#Lib.LinearCode.LinearCode.fdata"><code class="docutils literal notranslate"><span class="pre">LinearCode.fdata</span></code></a></li>
|
||||
@ -323,6 +364,27 @@
|
||||
<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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Dominators.html">SSA form - Dominance frontier</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Dominators.html#Lib.Dominators.computeDom"><code class="docutils literal notranslate"><span class="pre">computeDom()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Dominators.html#Lib.Dominators.printDT"><code class="docutils literal notranslate"><span class="pre">printDT()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Dominators.html#Lib.Dominators.computeDT"><code class="docutils literal notranslate"><span class="pre">computeDT()</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.Dominators.html#Lib.Dominators.computeDF"><code class="docutils literal notranslate"><span class="pre">computeDF()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.PhiNode.html">SSA form - Phi Nodes</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode"><code class="docutils literal notranslate"><span class="pre">PhiNode</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.var"><code class="docutils literal notranslate"><span class="pre">PhiNode.var</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.srcs"><code class="docutils literal notranslate"><span class="pre">PhiNode.srcs</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.defined"><code class="docutils literal notranslate"><span class="pre">PhiNode.defined()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.get_srcs"><code class="docutils literal notranslate"><span class="pre">PhiNode.get_srcs()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.used"><code class="docutils literal notranslate"><span class="pre">PhiNode.used()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename"><code class="docutils literal notranslate"><span class="pre">PhiNode.rename()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.rename_from"><code class="docutils literal notranslate"><span class="pre">PhiNode.rename_from()</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="api/Lib.PhiNode.html#Lib.PhiNode.PhiNode.printIns"><code class="docutils literal notranslate"><span class="pre">PhiNode.printIns()</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>These pages document the various Python sources in the Lib/
|
||||
@ -337,7 +399,7 @@ and pseudo-instructions, we give you the <a class="reference internal" href="api
|
||||
<p>RISC-V instructions take arguments of various kinds,
|
||||
as defined in the <a class="reference internal" href="api/Lib.Operands.html"><span class="doc">Lib.Operands module</span></a>.</p>
|
||||
<p>At some point, we will need some basic functions about oriented and non oriented graphs,
|
||||
those are present in <span class="xref std std-doc">api/Lib.Graphes</span>.</p>
|
||||
those are present in <a class="reference internal" href="api/Lib.Graphes.html"><span class="doc">Lib.Graphes module</span></a>.</p>
|
||||
</section>
|
||||
<section id="linear-intermediate-representation">
|
||||
<h2>Linear Intermediate representation<a class="headerlink" href="#linear-intermediate-representation" title="Permalink to this heading"></a></h2>
|
||||
@ -357,9 +419,9 @@ Each block ends with a terminator, as documented in the <a class="reference inte
|
||||
<section id="ssa-form">
|
||||
<h2>SSA form<a class="headerlink" href="#ssa-form" title="Permalink to this heading"></a></h2>
|
||||
<p>The translation of the CFG into SSA form makes use of dominance frontiers.
|
||||
Functions to work with dominance are defined in the <span class="xref std std-doc">api/Lib.Dominators</span>.</p>
|
||||
Functions to work with dominance are defined in the <a class="reference internal" href="api/Lib.Dominators.html"><span class="doc">Lib.Dominators module</span></a>.</p>
|
||||
<p>Phi nodes, a special kind of statement that appears in CFGs in SSA form,
|
||||
are defined in the <span class="xref std std-doc">api/Lib.PhiNode</span>.</p>
|
||||
are defined in the <a class="reference internal" href="api/Lib.PhiNode.html"><span class="doc">Lib.PhiNode module</span></a>.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="indices-and-tables">
|
||||
|
Binary file not shown.
@ -48,10 +48,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@ -104,6 +107,11 @@
|
||||
<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">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="api/Lib.Dominators.html#module-Lib.Dominators"><code class="xref">Lib.Dominators</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
@ -114,6 +122,11 @@
|
||||
<td>   
|
||||
<a href="api/Lib.FunctionData.html#module-Lib.FunctionData"><code class="xref">Lib.FunctionData</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="api/Lib.Graphes.html#module-Lib.Graphes"><code class="xref">Lib.Graphes</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
@ -124,6 +137,11 @@
|
||||
<td>   
|
||||
<a href="api/Lib.Operands.html#module-Lib.Operands"><code class="xref">Lib.Operands</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="api/Lib.PhiNode.html#module-Lib.PhiNode"><code class="xref">Lib.PhiNode</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
|
@ -48,10 +48,13 @@
|
||||
<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.Graphes.html">Base library - Graphs</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>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.Dominators.html">SSA form - Dominance frontier</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="api/Lib.PhiNode.html">SSA form - Phi Nodes</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user