# Lib.Statement module

The base class for RISCV ASM statements is `Statement`. It is inherited by `Comment`, `Label` and `Instruction`. In turn, `Instruction` is inherited by `Instru3A` (for regular non-branching 3-address instructions), `AbsoluteJump` and `ConditionalJump`.

Lib.Statement.regset_to_string(registerset) → str

  Utility function: pretty-prints a set of locations.

class Lib.Statement.Statement

  Bases: `object`

  A Statement, which is an instruction, a comment or a label.

  defined() → List[ Operand ]

    Operands defined (written) in this instruction

  used() → List[ Operand ]

    Operands used (read) in this instruction

  substitute(subst: Dict[ Operand , Operand ]) → TStatement
  printIns(stream)

    Print the statement on the given output. Should never be called on the base class.

class Lib.Statement.Comment(comment: str)

  Bases: `Statement`

  A comment.

  comment: str
  printIns(stream)

    Print the statement on the given output. Should never be called on the base class.

class Lib.Statement.Label(name: str)

  Bases: `Statement`, `Operand`

  A label is both a Statement and an Operand.

  name: str
  printIns(stream)

    Print the statement on the given output. Should never be called on the base class.

class Lib.Statement.Instruction

  Bases: `Statement`

  ins: str
  is_read_only()

    True if the instruction only reads from its operands.

    Otherwise, the first operand is considered as the destination and others are source.

  rename(renamer: Renamer ) → None
  args() → List[ Operand ]

    List of operands the instruction takes

  defined()

    Operands defined (written) in this instruction

  used() → List[ Operand ]

    Operands used (read) in this instruction

  printIns(stream)

    Print the instruction on the given output.

class Lib.Statement.Instru3A(ins, *args: Lib.Operands.Operand )

  Bases: `Instruction`

  args()

    List of operands the instruction takes

  rename(renamer: Renamer )
  substitute(subst: Dict[ Operand , Operand ])

class Lib.Statement.AbsoluteJump(label: Label )

  Bases: `Instruction`

  An Absolute Jump is a specific kind of instruction

  ins: str = 'j'
  label: Label
  args()

    List of operands the instruction takes

  rename(renamer: Renamer )
  substitute(subst: Dict[ Operand , Operand ])
  targets() → List[ Label ]

class Lib.Statement.ConditionalJump(cond: Condition, op1: Operand, op2: Operand, label: Label )

  Bases: `Instruction`

  A Conditional Jump is a specific kind of instruction

  cond: Condition
  label: Label
  op1: Operand
  op2: Operand
  args()

    List of operands the instruction takes

  rename(renamer: Renamer )
  substitute(subst: Dict[ Operand , Operand ])