Due on October 30th @ 3:00 PM (in class, to Drew, or at Engineering front office) |
Not accepted late |
Due on October 30th @ 3:00 PM (in class, to Drew, or at Engineering front office) |
Not accepted late |
Convert the following function into 3AC
int g; int a(int b, int c){ if (b){ return 0; } else { b = b - 1 * c; } return b; }
Convert the following function into 3AC
int v(int a){ while (a < 2){ while (a < 3){ a++; } a++; } return a; }
Convert the following procedure into A. Assume variables are local unless otherwise specified
enter k getarg 1, [b] [i] = [b] lbl_1: [t] = [i] LT64 10 ifz [v] goto lbl_2 [i] = [i] ADD64 1 WRITE [i] goto lbl_1 lbl_2: nop leave k
Assume a language that allows for pass-by-reference or pass-by-value parameters. What would the 3AC code look like for a pass-by-reference call? Illustrate with an example.