Mips

Instruction

Inheritance diagram of lief._lief.assembly.mips.Instruction
class lief.assembly.mips.Instruction

Bases: Instruction

This class represents a Mips instruction (including mips64, mips32)

property opcode lief.assembly.mips.OPCODE

The instruction opcode as defined in LLVM

property operands Iterator[lief.assembly.mips.Operand | None]

Iterator over the operands of the current instruction

Opcodes

See: lief.assembly.mips.OPCODE

Operands

Inheritance diagram of lief._lief.assembly.mips.operands.Immediate, lief._lief.assembly.mips.Operand, lief._lief.assembly.mips.operands.Register, lief._lief.assembly.mips.operands.Memory, lief._lief.assembly.mips.operands.PCRelative
class lief.assembly.mips.Operand

Bases: object

This class represents an operand for a Mips instruction

property to_string str

Pretty representation of the operand

Immediate

Inheritance diagram of lief._lief.assembly.mips.operands.Immediate
class lief.assembly.mips.operands.Immediate

Bases: Operand

This class represents an immediate operand (i.e. a constant)

For instance:

addiu $4, $5, 8
              |
              +---> Immediate(8)
property value int

The constant value wrapped by this operand

Register

Inheritance diagram of lief._lief.assembly.mips.operands.Register
class lief.assembly.mips.operands.Register

Bases: Operand

This class represents a register operand.

For instance:

move $4, $5
      |   |
      |   +---------> Register($5)
      |
      +-------------> Register($4)
property value lief.assembly.mips.REG

The effective lief.assembly.mips.REG wrapped by this operand

Memory

Inheritance diagram of lief._lief.assembly.mips.operands.Memory
class lief.assembly.mips.operands.Memory

Bases: Operand

This class represents a memory operand.

lw    $4, 8($5)            ldxc1  $f2, $4($7)
       |  | |                      |   |  |
+------+  | +---+          +-------+   |  +-----+
|         |     |          |           |        |
v         v     v          v           v        v
Reg      Disp  Base       Reg         Index    Base
property base lief.assembly.mips.REG

The base register.

For lw $4, 8($5) it would return $5.

property offset lief.assembly.mips.REG | int | None

The addressing offset.

It can be either:

  • A register (e.g. ldxc1 $f2, $4($7))

  • A displacement (e.g. lw $4, 8($5))

PCRelative

Inheritance diagram of lief._lief.assembly.mips.operands.PCRelative
class lief.assembly.mips.operands.PCRelative

Bases: Operand

This class represents a PC-relative operand.

bal 0x100
    |
    v
 PC Relative operand
property value int

The effective value that is relative to the current pc register