80 likes | 146 Views
CS410 Chapter 9 Assembly Code Generation. Slide 9-87: Accumulator Register. 3 + 4 addi $t1, $zero, 3 addi $ACC, $t1, 4. Slide 9-90: Accumulator Register. memory (FP – 12) lw $ACC, -12($FP). Slide 9-100: Accumulator Register. move [memory(FP), 4] addi $ACC, $zero, 4
E N D
Slide 9-87: Accumulator Register • 3 + 4 addi $t1, $zero, 3 addi $ACC, $t1, 4
Slide 9-90: Accumulator Register • memory (FP – 12) lw $ACC, -12($FP)
Slide 9-100: Accumulator Register • move [memory(FP), 4] addi $ACC, $zero, 4 sw $ACC, 0($FP)
Slide 9-108: Larger Tile Example • move[memory(FP-4), 7] addi $ACC, $zero, 7 sw $ACC, -4($FP)
Slide 9-118: Larger Tile Example • move[memory(r2-x), r1] addi $ACC, $zero, r1 sw $ACC, -x($r2)
Slide 9-131: Larger Tiles: conditional jump • CondJump(“jumplab”) if (3 == 4); addi $ACC, $zero, 3 addi $t1, $zero, 4 beq $t1, $ACC, truelab1 addi $ACC, $zero, 0 j endlab1 truelab1: addi $ACC, $zero, 1 endlab1: bgtz $ACC, jumplab
Slide 9-146: Constant Stack Offsets • Figure 9.2 (p241): x = 9-(8-(7-6)) addi $ACC, $zero, 9 addi $t1, $zero, 8 addi $t2, $zero, 7 addi $t3, $zero, 6 sub $t3, $t2, $t3 sub $t1, $t1, $t3 sub $ACC, $ACC, $t1