// Method declaration block method uses proc { abs { local0 = s0; local1 = s1; local2 = s2; local3 = s3; local4 = s4; local5 = s5; } abs const { stringConst: asciiz "..."; align; } const data { staticBuffer: byte[ ... ]; align: } data code { public enter: lda $sp, -sav6($sp); stq $ra, savRet($sp); stq $s0, sav0($sp); stq $s1, sav1($sp); stq $s2, sav2($sp); stq $s3, sav3($sp); stq $s4, sav4($sp); stq $s5, sav5($sp); init: mov $a0, $s0; mov $a1, $s1; mov $a2, $s2; mov $a3, $s3; mov $a4, $s4; body: return: ldq $s5, sav5($sp); ldq $s4, sav4($sp); ldq $s3, sav3($sp); ldq $s2, sav2($sp); ldq $s1, sav1($sp); ldq $s0, sav0($sp); ldq $ra, savRet($sp); lda $sp, +sav6($sp); ret; } code } block method // Method invocation mov $actual5, $a5; mov $actual4, $a4; mov $actual3, $a3; mov $actual2, $a2; mov $actual1, $a1; mov $actual0, $a0; bsr method.enter; // If statement { if: // Condition brFalse $t0, else; then: // Then part br end; else: // Else part end: } // Loop { for: // Initialisation while: // Condition brFalse $t0, end; do: // Substatement continue: // Increment br while; end: } // Switch with branch table { switch: // Expression blt $t0, default; cmplt $t0, TABLESIZE, $t1; blbc $t1, default; ldiq $t1, branchTable; s8addq $t0, $t1; ldq $t0, ($t0); jmp ($t0); branchTable: case0; case1; case2; case0: // case 0 code br end; case1: // case 1 code br end; case2: // case 2 code br end; default: // default code end: } // Switch with comparisons { switch: // Expression cmpeq $t0, 0, $t1; blbs $t1, case0; cmpeq $t0, 1, $t1; blbs $t1, case1; cmpeq $t0, 2, $t1; blbs $t1, case2; br default; case0: // case 0 code br end; case1: // case 1 code br end; case2: // case 2 code br end; default: // default code end: }