Lib.PhiNode module

Classes for φ nodes in a RiscV CFG CFG under SSA Form: PhiNode 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 Block b.

class Lib.PhiNode.PhiNode(var: DataLocation, srcs: Dict[Label, Operand])[source]

Bases: Statement

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 links each corresponding predecessor in the CFG —identified by its label—, to the variable temp_i of the φ node.

var: DataLocation
srcs: Dict[Label, Operand]
defined() List[Operand][source]

Return the variable defined by the φ node.

get_srcs() Dict[Label, Operand][source]

Return the dictionnary associating for each previous block the corresponding variable.

used() List[Operand][source]

Return the variables used by the statement.

rename(renamer: Renamer) None[source]

Rename the variable defined by the φ node with a fresh name.

rename_from(renamer: Renamer, label: Label) None[source]

Rename the variable associated to the block identified by label.

printIns(stream)[source]

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