2024-10-20 19:14:34 +02:00
<!DOCTYPE html>
< html class = "writer-html5" lang = "en" >
< head >
2024-11-04 13:43:55 +01:00
< meta charset = "utf-8" / > < meta name = "generator" content = "Docutils 0.18.1: http://docutils.sourceforge.net/" / >
2024-10-20 19:14:34 +02:00
< 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 >