Question: The problems in this Exercise refer to the following function, given as array code: What would change in your answer from 2.33.4 if registers $t0$t7
The problems in this Exercise refer to the following function, given as array code:![a. void copy(int a[], int b[], int n) { int i; for(i=0; i-n;i++) a[i]=b[i]; b. } void shift(int a[], int n) {](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1698/1/3/6/40365378153b0a7d1698136402789.jpg)
What would change in your answer from 2.33.4 if registers $t0–$t7 and $a0–$a3 in the MIPS calling convention were all callee-saved, just like $s0–$s7?
Data from 2.33.4
Compare the worst-case number of executed instructions per non-last loop iteration in your array-based code from 2.33.1 and your
pointer-based code from 2.33.3. Note: the worst case occurs when branch conditions are such that the longest path through the code is taken, i.e., if there is an if statement, the result of the condition check is such that the path with more instructions is taken. However, if the result of the condition check would cause the loop to exit, then we assume that the path that keeps us in the loop is taken.
Data from 2.33.1
Translate this function into MIPS assembly.
Data from 2.33.3
Translate your pointer-based C code from 2.33.2 into MIPS assembly.
Data from 2.33.2
Convert this function into pointer-based code (in C).
a. void copy(int a[], int b[], int n) { int i; for(i=0; i-n;i++) a[i]=b[i]; b. } void shift(int a[], int n) { int i; for(i=0; i-n-1; i++) a[i]=a[i+1]; }
Step by Step Solution
3.47 Rating (167 Votes )
There are 3 Steps involved in it
If registers t0t7 and a0a3 in the MIPS calling convention are all calleesaved similar to s0s7 it mea... View full answer
Get step-by-step solutions from verified subject matter experts
