2024-10-06 19:58:11 +02:00
<!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.Statement — 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 >
2024-10-20 19:14:34 +02:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../../api/Lib.Graphes.html" > Base library - Graphs< / a > < / li >
2024-10-06 19:58:11 +02:00
< 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 >
2024-10-13 18:38:13 +02:00
< 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 >
2024-10-20 19:14:34 +02:00
< 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 >
2024-10-06 19:58:11 +02:00
< / 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.Statement< / 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.Statement< / h1 > < div class = "highlight" > < pre >
< span > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > The base class for RISCV ASM statements is :py:class:`Statement`.< / span >
< span class = "sd" > It is inherited by :py:class:`Comment`, :py:class:`Label`< / span >
< span class = "sd" > and :py:class:`Instruction`. In turn, :py:class:`Instruction`< / span >
< span class = "sd" > is inherited by :py:class:`Instru3A`< / span >
< span class = "sd" > (for regular non-branching 3-address instructions),< / span >
< span class = "sd" > :py:class:`AbsoluteJump` and :py:class:`ConditionalJump`.< / 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 = "p" > (< / span > < span class = "n" > List< / span > < span class = "p" > ,< / span > < span class = "n" > Dict< / span > < span class = "p" > ,< / span > < span class = "n" > TypeVar< / span > < span class = "p" > )< / span >
< span class = "kn" > from< / span > < span class = "nn" > Lib.Operands< / span > < span class = "kn" > import< / span > < span class = "p" > (< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > Renamer< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > ,< / span > < span class = "n" > Condition< / span > < span class = "p" > )< / span >
< span class = "kn" > from< / span > < span class = "nn" > Lib.Errors< / span > < span class = "kn" > import< / span > < span class = "n" > MiniCInternalError< / span >
< div class = "viewcode-block" id = "regset_to_string" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.regset_to_string" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > regset_to_string< / span > < span class = "p" > (< / span > < span class = "n" > registerset< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > str< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " Utility function: pretty-prints a set of locations." " " < / span >
< span class = "k" > return< / span > < span class = "s2" > " {" < / span > < span class = "o" > +< / span > < span class = "s2" > " ," < / span > < span class = "o" > .< / span > < span class = "n" > join< / span > < span class = "p" > (< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > x< / span > < span class = "p" > )< / span > < span class = "k" > for< / span > < span class = "n" > x< / span > < span class = "ow" > in< / span > < span class = "n" > registerset< / span > < span class = "p" > )< / span > < span class = "o" > +< / span > < span class = "s2" > " }" < / span > < / div >
< span class = "c1" > # Temporary until we can use Typing.Self in python 3.11< / span >
< span class = "n" > TStatement< / span > < span class = "o" > =< / span > < span class = "n" > TypeVar< / span > < span class = "p" > (< / span > < span class = "s2" > " TStatement" < / span > < span class = "p" > ,< / span > < span class = "n" > bound< / span > < span class = "o" > =< / span > < span class = "s2" > " Statement" < / span > < span class = "p" > )< / span >
< div class = "viewcode-block" id = "Statement" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Statement" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > unsafe_hash< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > Statement< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " A Statement, which is an instruction, a comment or a label." " " < / span >
< div class = "viewcode-block" id = "Statement.defined" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Statement.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" > " " " Operands defined (written) in this instruction" " " < / span >
< span class = "k" > return< / span > < span class = "p" > []< / span > < / div >
< div class = "viewcode-block" id = "Statement.used" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Statement.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" > " " " Operands used (read) in this instruction" " " < / span >
< span class = "k" > return< / span > < span class = "p" > []< / span > < / div >
< div class = "viewcode-block" id = "Statement.substitute" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Statement.substitute" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > substitute< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > :< / span > < span class = "n" > TStatement< / span > < span class = "p" > ,< / span > < span class = "n" > subst< / span > < span class = "p" > :< / span > < span class = "n" > Dict< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > Operand< / span > < span class = "p" > ])< / span > < span class = "o" > -> < / span > < span class = "n" > TStatement< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " Return a new instruction, cloned from this one, replacing operands< / span >
< span class = "sd" > that appear as key in subst by their value." " " < / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: Operands < / span > < span class = "si" > {}< / span > < span class = "s2" > are not present in instruction < / span > < span class = "si" > {}< / span > < span class = "s2" > " < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > subst< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "p" > ))< / span > < / div >
< div class = "viewcode-block" id = "Statement.with_args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Statement.with_args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > with_args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > :< / span > < span class = "n" > TStatement< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > :< / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ])< / span > < span class = "o" > -> < / span > < span class = "n" > TStatement< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " Return a new instruction, cloned from this one, where operands have< / span >
< span class = "sd" > been replaced by new_args." " " < / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: Operands < / span > < span class = "si" > {}< / span > < span class = "s2" > are not present in instruction < / span > < span class = "si" > {}< / span > < span class = "s2" > " < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > new_args< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "p" > ))< / span > < / div >
< div class = "viewcode-block" id = "Statement.printIns" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Statement.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 = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Print the statement on the given output.< / span >
< span class = "sd" > Should never be called on the base class.< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > raise< / span > < span class = "ne" > NotImplementedError< / span > < / div > < / div >
< div class = "viewcode-block" id = "Comment" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Comment" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > unsafe_hash< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > Comment< / span > < span class = "p" > (< / span > < span class = "n" > Statement< / span > < span class = "p" > ):< / span >
< span class = "w" > < / span > < span class = "sd" > " " " A comment." " " < / span >
< span class = "n" > comment< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span >
< span class = "k" > def< / span > < span class = "fm" > __str__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span > < span class = "c1" > # use only for print_dot !< / span >
< span class = "k" > return< / 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" > comment< / span > < span class = "p" > )< / span >
< div class = "viewcode-block" id = "Comment.printIns" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Comment.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 = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > comment< / 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 >
< div class = "viewcode-block" id = "Label" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Label" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > unsafe_hash< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > Label< / span > < span class = "p" > (< / span > < span class = "n" > Statement< / span > < span class = "p" > ,< / span > < span class = "n" > Operand< / span > < span class = "p" > ):< / span >
< span class = "w" > < / span > < span class = "sd" > " " " A label is both a Statement and an Operand." " " < / span >
< span class = "n" > name< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span >
< span class = "k" > def< / span > < span class = "fm" > __str__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "p" > (< / span > < span class = "s2" > " lbl_< / 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" > name< / span > < span class = "p" > ))< / span >
< span class = "k" > def< / span > < span class = "fm" > __repr__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "p" > (< / 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" > name< / span > < span class = "p" > ))< / span >
< div class = "viewcode-block" id = "Label.printIns" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Label.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 = "nb" > str< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > +< / span > < span class = "s1" > ' :' < / 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 >
< div class = "viewcode-block" id = "Instruction" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > init< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > Instruction< / span > < span class = "p" > (< / span > < span class = "n" > Statement< / span > < span class = "p" > ):< / span >
< span class = "n" > ins< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span >
< span class = "n" > _read_only< / span > < span class = "p" > :< / span > < span class = "nb" > bool< / span >
< div class = "viewcode-block" id = "Instruction.is_read_only" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction.is_read_only" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > is_read_only< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > True if the instruction only reads from its operands.< / span >
< span class = "sd" > Otherwise, the first operand is considered as the destination< / span >
< span class = "sd" > and others are source.< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _read_only< / span > < / div >
< div class = "viewcode-block" id = "Instruction.rename" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction.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 = "k" > raise< / span > < span class = "ne" > NotImplementedError< / span > < / div >
< div class = "viewcode-block" id = "Instruction.args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction.args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ]:< / span >
< span class = "w" > < / span > < span class = "sd" > " " " List of operands the instruction takes" " " < / span >
< span class = "k" > raise< / span > < span class = "ne" > NotImplementedError< / span > < / div >
< div class = "viewcode-block" id = "Instruction.defined" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction.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 = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > is_read_only< / span > < span class = "p" > ():< / span >
< span class = "n" > defs< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > defs< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ()[< / span > < span class = "mi" > 0< / span > < span class = "p" > ]]< / span >
< span class = "k" > return< / span > < span class = "n" > defs< / span > < / div >
< div class = "viewcode-block" id = "Instruction.used" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction.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 = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > is_read_only< / span > < span class = "p" > ():< / span >
< span class = "n" > uses< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ()< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > uses< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ()[< / span > < span class = "mi" > 1< / span > < span class = "p" > :]< / span >
< span class = "k" > return< / span > < span class = "n" > uses< / 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" > s< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span >
< span class = "n" > first< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > for< / span > < span class = "n" > arg< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ():< / span >
< span class = "k" > if< / span > < span class = "n" > first< / span > < span class = "p" > :< / span >
< span class = "n" > s< / span > < span class = "o" > +=< / span > < span class = "s1" > ' ' < / span > < span class = "o" > +< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > )< / span >
< span class = "n" > first< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > s< / span > < span class = "o" > +=< / span > < span class = "s1" > ' , ' < / span > < span class = "o" > +< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > s< / 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" > ins< / span > < span class = "p" > ,< / span > < span class = "o" > *< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ()))< / span >
< div class = "viewcode-block" id = "Instruction.printIns" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instruction.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 = "w" > < / span > < span class = "sd" > " " " Print the instruction on the given output." " " < / span >
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "s1" > ' ' < / span > < span class = "p" > ,< / 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 >
< div class = "viewcode-block" id = "Instru3A" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instru3A" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > init< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > Instru3A< / span > < span class = "p" > (< / span > < span class = "n" > Instruction< / span > < span class = "p" > ):< / span >
< span class = "n" > _args< / span > < span class = "p" > :< / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ]< / span >
< span class = "k" > def< / span > < span class = "fm" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > ins< / span > < span class = "p" > ,< / span > < span class = "o" > *< / span > < span class = "n" > args< / span > < span class = "p" > :< / span > < span class = "n" > Operand< / span > < span class = "p" > ):< / span >
< span class = "c1" > # convention is to use lower-case in RISCV< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > =< / span > < span class = "n" > ins< / span > < span class = "o" > .< / span > < span class = "n" > lower< / span > < span class = "p" > ()< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _args< / span > < span class = "o" > =< / span > < span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > args< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _read_only< / span > < span class = "o" > =< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > ==< / span > < span class = "s2" > " call" < / span >
< span class = "ow" > or< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > ==< / span > < span class = "s2" > " ld" < / span >
< span class = "ow" > or< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > ==< / span > < span class = "s2" > " lw" < / span >
< span class = "ow" > or< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > ==< / span > < span class = "s2" > " lb" < / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > .< / span > < span class = "n" > startswith< / span > < span class = "p" > (< / span > < span class = "s2" > " b" < / span > < span class = "p" > )< / span > < span class = "ow" > or< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > ==< / span > < span class = "s2" > " j" < / span > < span class = "p" > ):< / span >
< span class = "k" > raise< / span > < span class = "n" > MiniCInternalError< / span >
< div class = "viewcode-block" id = "Instru3A.args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instru3A.args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _args< / span > < / div >
< div class = "viewcode-block" id = "Instru3A.rename" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instru3A.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 = "n" > old_replaced< / span > < span class = "o" > =< / span > < span class = "nb" > dict< / span > < span class = "p" > ()< / span >
< span class = "k" > for< / span > < span class = "n" > i< / span > < span class = "p" > ,< / span > < span class = "n" > arg< / span > < span class = "ow" > in< / span > < span class = "nb" > enumerate< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _args< / span > < span class = "p" > ):< / span >
< span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > ):< / span >
< span class = "k" > if< / span > < span class = "n" > i< / span > < span class = "o" > ==< / span > < span class = "mi" > 0< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > is_read_only< / span > < span class = "p" > ():< / span >
< span class = "n" > old_replaced< / span > < span class = "p" > [< / span > < span class = "n" > arg< / 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" > arg< / span > < span class = "p" > )< / span >
< span class = "n" > new_t< / 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 = "n" > arg< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > arg< / span > < span class = "ow" > in< / span > < span class = "n" > old_replaced< / span > < span class = "o" > .< / span > < span class = "n" > keys< / span > < span class = "p" > ():< / span >
< span class = "n" > new_t< / span > < span class = "o" > =< / span > < span class = "n" > old_replaced< / span > < span class = "p" > [< / span > < span class = "n" > arg< / span > < span class = "p" > ]< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > new_t< / 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" > arg< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _args< / span > < span class = "p" > [< / span > < span class = "n" > i< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "n" > new_t< / span > < / div >
< div class = "viewcode-block" id = "Instru3A.substitute" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instru3A.substitute" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > substitute< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > subst< / span > < span class = "p" > :< / span > < span class = "n" > Dict< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > Operand< / span > < span class = "p" > ]):< / span >
< span class = "k" > for< / span > < span class = "n" > op< / span > < span class = "ow" > in< / span > < span class = "n" > subst< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > op< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ():< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: Operand < / span > < span class = "si" > {}< / span > < span class = "s2" > is not present in instruction < / span > < span class = "si" > {}< / span > < span class = "s2" > " < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > op< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "p" > ))< / span >
< span class = "n" > args< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "n" > subst< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > ,< / span > < span class = "n" > arg< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > )< / span > < span class = "k" > else< / span > < span class = "n" > arg< / span >
< span class = "k" > for< / span > < span class = "n" > arg< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ()]< / span >
< span class = "k" > return< / span > < span class = "n" > Instru3A< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "p" > ,< / span > < span class = "o" > *< / span > < span class = "n" > args< / span > < span class = "p" > )< / span > < / div >
< div class = "viewcode-block" id = "Instru3A.with_args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.Instru3A.with_args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > with_args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > :< / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ]):< / span >
< span class = "k" > if< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > new_args< / span > < span class = "p" > )< / span > < span class = "o" > !=< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _args< / span > < span class = "p" > ):< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: Expected < / span > < span class = "si" > {}< / span > < span class = "s2" > operands for < / span > < span class = "si" > {}< / span > < span class = "s2" > , got < / span > < span class = "si" > {}< / span > < span class = "s2" > ." < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _args< / span > < span class = "p" > ),< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > Instru3A< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "p" > ,< / span > < span class = "o" > *< / span > < span class = "n" > new_args< / span > < span class = "p" > )< / span > < / div >
< span class = "k" > def< / span > < span class = "fm" > __hash__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "nb" > hash< / span > < span class = "p" > (< / span > < span class = "nb" > super< / span > < span class = "p" > )< / span > < / div >
< div class = "viewcode-block" id = "AbsoluteJump" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.AbsoluteJump" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > init< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > AbsoluteJump< / span > < span class = "p" > (< / span > < span class = "n" > Instruction< / span > < span class = "p" > ):< / span >
< span class = "w" > < / span > < span class = "sd" > " " " An Absolute Jump is a specific kind of instruction" " " < / span >
< span class = "n" > ins< / span > < span class = "o" > =< / span > < span class = "s2" > " j" < / span >
< span class = "n" > label< / span > < span class = "p" > :< / span > < span class = "n" > Label< / span >
< span class = "n" > _read_only< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > def< / span > < span class = "fm" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > label< / span > < span class = "p" > :< / span > < span class = "n" > Label< / span > < span class = "p" > ):< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > label< / span > < span class = "o" > =< / span > < span class = "n" > label< / span >
< div class = "viewcode-block" id = "AbsoluteJump.args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.AbsoluteJump.args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "p" > [< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > label< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "AbsoluteJump.rename" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.AbsoluteJump.rename" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > rename< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > renamer< / span > < span class = "p" > :< / span > < span class = "n" > Renamer< / span > < span class = "p" > ):< / span >
< span class = "k" > pass< / span > < / div >
< div class = "viewcode-block" id = "AbsoluteJump.substitute" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.AbsoluteJump.substitute" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > substitute< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > subst< / span > < span class = "p" > :< / span > < span class = "n" > Dict< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > Operand< / span > < span class = "p" > ]):< / span >
< span class = "k" > if< / span > < span class = "n" > subst< / span > < span class = "o" > !=< / span > < span class = "p" > {}:< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: No possible substitution on instruction < / span > < span class = "si" > {}< / span > < span class = "s2" > " < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < / div >
< div class = "viewcode-block" id = "AbsoluteJump.with_args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.AbsoluteJump.with_args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > with_args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > :< / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ]):< / span >
< span class = "k" > if< / span > < span class = "n" > new_args< / span > < span class = "o" > !=< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ():< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: No possible substitution on instruction < / span > < span class = "si" > {}< / span > < span class = "s2" > . Old args=< / span > < span class = "si" > {}< / span > < span class = "s2" > , new args=< / span > < span class = "si" > {}< / span > < span class = "s2" > " < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > (),< / span > < span class = "n" > new_args< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < / div >
< span class = "k" > def< / span > < span class = "fm" > __hash__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "nb" > hash< / span > < span class = "p" > (< / span > < span class = "nb" > super< / span > < span class = "p" > )< / span >
< div class = "viewcode-block" id = "AbsoluteJump.targets" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.AbsoluteJump.targets" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > targets< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Label< / span > < span class = "p" > ]:< / span >
< span class = "w" > < / span > < span class = "sd" > " " " Return the labels targetted by the AbsoluteJump." " " < / span >
< span class = "k" > return< / span > < span class = "p" > [< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > label< / span > < span class = "p" > ]< / span > < / div > < / div >
< div class = "viewcode-block" id = "ConditionalJump" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.ConditionalJump" > [docs]< / a > < span class = "nd" > @dataclass< / span > < span class = "p" > (< / span > < span class = "n" > init< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "k" > class< / span > < span class = "nc" > ConditionalJump< / span > < span class = "p" > (< / span > < span class = "n" > Instruction< / span > < span class = "p" > ):< / span >
< span class = "w" > < / span > < span class = "sd" > " " " A Conditional Jump is a specific kind of instruction" " " < / span >
< span class = "n" > cond< / span > < span class = "p" > :< / span > < span class = "n" > Condition< / span >
< span class = "n" > label< / span > < span class = "p" > :< / span > < span class = "n" > Label< / span >
< span class = "n" > op1< / span > < span class = "p" > :< / span > < span class = "n" > Operand< / span >
< span class = "n" > op2< / span > < span class = "p" > :< / span > < span class = "n" > Operand< / span >
< span class = "n" > _read_only< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > def< / span > < span class = "fm" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > cond< / span > < span class = "p" > :< / span > < span class = "n" > Condition< / span > < span class = "p" > ,< / span > < span class = "n" > op1< / span > < span class = "p" > :< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > op2< / span > < span class = "p" > :< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > label< / span > < span class = "p" > :< / span > < span class = "n" > Label< / span > < span class = "p" > ):< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > cond< / span > < span class = "o" > =< / span > < span class = "n" > cond< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > label< / span > < span class = "o" > =< / span > < span class = "n" > label< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "o" > =< / span > < span class = "n" > op1< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "o" > =< / span > < span class = "n" > op2< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > ins< / span > < span class = "o" > =< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > cond< / span > < span class = "p" > )< / span >
< div class = "viewcode-block" id = "ConditionalJump.args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.ConditionalJump.args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "p" > [< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > label< / span > < span class = "p" > ]< / span > < / div >
< div class = "viewcode-block" id = "ConditionalJump.rename" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.ConditionalJump.rename" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > rename< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > renamer< / span > < span class = "p" > :< / span > < span class = "n" > Renamer< / span > < span class = "p" > ):< / span >
< span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > ):< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "o" > =< / span > < span class = "n" > renamer< / span > < span class = "o" > .< / span > < span class = "n" > replace< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > ):< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "o" > =< / span > < span class = "n" > renamer< / span > < span class = "o" > .< / span > < span class = "n" > replace< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "p" > )< / span > < / div >
< div class = "viewcode-block" id = "ConditionalJump.substitute" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.ConditionalJump.substitute" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > substitute< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > subst< / span > < span class = "p" > :< / span > < span class = "n" > Dict< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ,< / span > < span class = "n" > Operand< / span > < span class = "p" > ]):< / span >
< span class = "k" > for< / span > < span class = "n" > op< / span > < span class = "ow" > in< / span > < span class = "n" > subst< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > op< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > args< / span > < span class = "p" > ():< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: Operand < / span > < span class = "si" > {}< / span > < span class = "s2" > is not present in instruction < / span > < span class = "si" > {}< / span > < span class = "s2" > " < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "n" > op< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "p" > ))< / span >
< span class = "n" > op1< / span > < span class = "o" > =< / span > < span class = "n" > subst< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "p" > )< / span > < span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > )< / span > \
< span class = "k" > else< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op1< / span >
< span class = "n" > op2< / span > < span class = "o" > =< / span > < span class = "n" > subst< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "p" > )< / span > < span class = "k" > if< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span > < span class = "p" > ,< / span > < span class = "n" > Temporary< / span > < span class = "p" > )< / span > \
< span class = "k" > else< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > op2< / span >
< span class = "k" > return< / span > < span class = "n" > ConditionalJump< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > cond< / span > < span class = "p" > ,< / span > < span class = "n" > op1< / span > < span class = "p" > ,< / span > < span class = "n" > op2< / span > < span class = "p" > ,< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > label< / span > < span class = "p" > )< / span > < / div >
< div class = "viewcode-block" id = "ConditionalJump.with_args" > < a class = "viewcode-back" href = "../../api/Lib.Statement.html#Lib.Statement.ConditionalJump.with_args" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > with_args< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > :< / span > < span class = "n" > List< / span > < span class = "p" > [< / span > < span class = "n" > Operand< / span > < span class = "p" > ]):< / span >
< span class = "k" > if< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > new_args< / span > < span class = "p" > )< / span > < span class = "o" > !=< / span > < span class = "mi" > 3< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span >
< span class = "s2" > " substitute: Expected 3 operands for < / span > < span class = "si" > {}< / span > < span class = "s2" > , got < / span > < span class = "si" > {}< / span > < span class = "s2" > ." < / span >
< span class = "o" > .< / span > < span class = "n" > format< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > ))< / span >
< span class = "k" > assert< / span > < span class = "nb" > isinstance< / span > < span class = "p" > (< / span > < span class = "n" > new_args< / span > < span class = "p" > [< / span > < span class = "mi" > 2< / span > < span class = "p" > ],< / span > < span class = "n" > Label< / span > < span class = "p" > )< / span >
< span class = "n" > label< / span > < span class = "p" > :< / span > < span class = "n" > Label< / span > < span class = "o" > =< / span > < span class = "n" > new_args< / span > < span class = "p" > [< / span > < span class = "mi" > 2< / span > < span class = "p" > ]< / span >
< span class = "k" > return< / span > < span class = "n" > ConditionalJump< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > cond< / span > < span class = "p" > ,< / span > < span class = "n" > new_args< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ],< / span > < span class = "n" > new_args< / span > < span class = "p" > [< / span > < span class = "mi" > 1< / span > < span class = "p" > ],< / span > < span class = "n" > label< / span > < span class = "p" > )< / span > < / div >
< span class = "k" > def< / span > < span class = "fm" > __hash__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "nb" > hash< / span > < span class = "p" > (< / span > < span class = "nb" > super< / span > < span class = "p" > )< / span > < / div >
< / 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 >