l05 - Why Frame Pointers? C Code f(1); ...; g(2) Assembly...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: Why Frame Pointers? C Code f(1); ...; g(2) Assembly addiu $29,$29,-16 # space for 4 args li $4,1 # argument setup for f jal f # call f addiu $29,$29,16 # pop stack ... # code for ... addiu $29,$29,-16 # space for 4 args li $4,2 # argument setup for g jal g # call g addiu $29,$29,16 # pop stack Why Frame Pointers? Assembly addiu $29,$29,-16 # space for 4 args li $4,1 # argument setup for f jal f # call f # addiu $29,$29,16 no more pop stack ... # code for ... addiu $29,$29,-16 # space for 4 args li $4,2 # argument setup for g jal g # call g # addiu $29,$29,16 no more pop stack Save initial $sp in the frame pointer Optimization Calculate max stack adjustment , change $sp once Assembly entry: addiu $29,$29,-24 # allocate space once sw $31,20($29) # save return address ... li $4,1 # argument setup for f jal f # call f ... # code for ... li $4,2 # argument setup for g jal g # call g Stack pointer must be double-word aligned. More Argument Passing What if I want to pass a half-word ( short ) or a byte...
View Full Document

This note was uploaded on 06/25/2008 for the course ECE 3140 taught by Professor Mckee/long during the Spring '07 term at Cornell University (Engineering School).

Page1 / 9

l05 - Why Frame Pointers? C Code f(1); ...; g(2) Assembly...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online