That is if p is a pointer to data of type and the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d here. Aside: Why the names “callee save” and “caller save?” Consider the following scenario: int P() { int x = f(); Q(); return x; } /* Some computation */ Procedure P wants the value it has computed for x to remain valid across the call to Q. If x is in a caller save register, then P (the caller) must save the value before calling P and restore it after Q returns. If x is in a callee save register, and Q (the callee) wants to use this register, then Q must save the value before using the register and restore it before returning. In either case, saving involves pushing the register value onto the stack, while restoring involves popping from the stack back to the register. End Aside. 136 CHAPTER 3. MACHINE-LEVEL REPRESENTATION OF C PROGRAMS As an example, consider the following code: 1 2 3 4 5 6 7 int P(int x) { int y = x*x; int z = Q(y); return y + z; } Procedure P computes y before calling Q, but it must also ensure that the value of y is available after Q returns. It can do this by one of two means:...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online