Question: The following three problems in this Exercise refer to a function f that calls another function func. The code for C function func is already

The following three problems in this Exercise refer to a function f that calls another function func. The code for C function func is already compiled in another module using the MIPS calling convention from Figure 2.14. The function declaration for func is “int func(int a, int b);”. The code for function f is as follows:

Figure 2.14Name Register number $zero $v0-$vl $a0-$a3 $t0-$t7 $50-$s7 $t8-$t9 $gp $sp $fp $ra 0 2-3 4-7 8-15 16-23 24-25a. b. int f(int a, int b, int c, int d) { return func(func(a,b),c+d); } int f(int a, int b, int c, int d) {

Right before your function f from Problem 2.19.4 returns, what do we know about contents of registers $t5, $s3, $ra, and $sp? Keep in mind that we know what the entire function f looks like, but for function func we only know its declaration.

Data from problem 2.19.4

Translate function f into MIPS assembly language, also using the MIPS calling convention from Figure 2.14. If you need to use registers $t0 through $t7, use the lower-numbered registers first.

Name Register number $zero $v0-$vl $a0-$a3 $t0-$t7 $50-$s7 $t8-$t9 $gp $sp $fp $ra 0 2-3 4-7 8-15 16-23 24-25 28 29 30 31 The constant value 0 Values for results and expression evaluation Arguments Temporaries Usage Saved More temporaries Global pointer Stack pointer Frame pointer Return address Preserved on call? n.a. no no no yes no yes yes yes yes

Step by Step Solution

3.39 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets break down what we know about the contents of registers t5 s3 ra and sp right before the function f returns t5 This register is a temporary regis... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Organization Design Questions!