[prev] 3 [next]

Rendering C in MIPS: Expressions (cont)

Simple example of rendering assignment and sequence:

int x;        x: .space 4
int y;        y: .space 4

x = 2;           li   $t0, 2
                 sw   $t0, x

y = x;           lw   $t0, x
                 sw   $t0, y

y = y+3;         lw   $t0, y
                 addi $t0, 3
                 sw   $t0, y