Lib.Terminator module
MIF08, CAP, CFG library - Terminators.
Each block
of a CFG
ends with a branching instruction called a terminator.
There are three kinds of terminators:
Lib.Statement.AbsoluteJump
is a non-conditional jump to another block of the CFGBranchingTerminator
is a conditional branching instruction with two successor blocks. Unlike the classConditionalJump
that was used inLinearCode
, both successor labels have to be specified.Return
marks the end of the function
During the construction of the CFG, jump2terminator()
builds
a terminator for each extracted chunk of instructions.
- class Lib.Terminator.Return[source]
Bases:
Statement
A terminator that marks the end of the function.
- class Lib.Terminator.BranchingTerminator(cond: Condition, op1: Operand, op2: Operand, label_then: Label, label_else: Label)[source]
Bases:
Instruction
A terminating statement with a condition.
- Lib.Terminator.Terminator = Lib.Terminator.Return | Lib.Statement.AbsoluteJump | Lib.Terminator.BranchingTerminator
Type alias for terminators
- Lib.Terminator.jump2terminator(j: ConditionalJump | AbsoluteJump | None, next_label: Label | None) Return | AbsoluteJump | BranchingTerminator [source]
Construct the Terminator associated to the potential jump j to the potential label next_label.