Question: Caller/Callee Saved Registers Consider the following two C source code for two functions, foo and bar. Assume function parameters are passed on the stack and

Caller/Callee Saved Registers Consider the following two C source code for two functions, foo and bar.

Assume function parameters are passed on the stack and must be loaded into a register before being used in a function, and the foo function is called once. Fill out the table below with the number of ldr/str pairs that will be executed when the variable is mapped to a callee-saved register vs a caller-saved register, and circle the better assignment for each variable.

Caller/Callee Saved Registers Consider the following two C source code for two

If there were only 5 general-purpose registers available on the machine which would execute this code, what would be the optimal number of caller-saved and callee-save registers? _____________ caller -saved registers _____________ callee -saved registers

functions, foo and bar. Assume function parameters are passed on the stack

Problem 6: Caller/Callee Saved Registers Consider the following two C source code for two functions, foo and bar int foo (int a, int b, int c) int bar (int x) I int e64, f int y0, z, do [ printf ("Yo!n") z=y*x; e-bar (e) while(e > 0) if (z 0) return f else return x; Assume function parameters are passed on the stack and must be loaded into a register before being used in a function, and the foo function is called once. Fill out the table below with the number of ldr/str pairs that will be executed when the variable is mapped to a callee-saved register vs a caller-saved register, and circle the better assignment for each variable. Variable name ldr/str pairs executed ildr/str pairs executed if callee-saved caller-saved If there were only 5 general-purpose registers available on the machine which would execute this code, what would be the optimal number of caller-saved and callee-save registers? caller-saved registers callee-saved registers Problem 6: Caller/Callee Saved Registers Consider the following two C source code for two functions, foo and bar int foo (int a, int b, int c) int bar (int x) I int e64, f int y0, z, do [ printf ("Yo!n") z=y*x; e-bar (e) while(e > 0) if (z 0) return f else return x; Assume function parameters are passed on the stack and must be loaded into a register before being used in a function, and the foo function is called once. Fill out the table below with the number of ldr/str pairs that will be executed when the variable is mapped to a callee-saved register vs a caller-saved register, and circle the better assignment for each variable. Variable name ldr/str pairs executed ildr/str pairs executed if callee-saved caller-saved If there were only 5 general-purpose registers available on the machine which would execute this code, what would be the optimal number of caller-saved and callee-save registers? caller-saved registers callee-saved registers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!