Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

state what is meant by the term performance management

Answered: 1 week ago