00 d8 mov mov pop leave ret mov cltd idiv mov add mov

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: = = = = = = = 0 1 2 3 4 5 6 Indirect: jmp *.L62(,%edx,4)   Start of jump table: .L62   Must scale by factor of 4 (labels are 32 ­bits = 4 bytes on IA32)   Fetch target from effecIve address .L62 + edx*4   target = JTab[x]; goto *target; (only for 0 ≤ x ≤ 6) x86 University of Washington Code Blocks (ParMal) switch(x) { ... case 2: // .L57 w = y/z; /* Fall Through */ case 3: // .L58 w += z; break; ... default: // .L61 w = 2; } .L61: // Default case movl $2, %ebx #w=2 movl %ebx, %eax # Return w popl %ebx leave ret .L57: // Case 2: movl 12(%ebp), %eax # y cltd # Div prep idivl %ecx # y/z movl %eax, %ebx # w = y/z # Fall through .L58: // Case 3: addl %ecx, %ebx # w+= z movl %ebx, %eax # Return w popl %ebx leave ret x86 University of Washington Code Blocks (Rest) switch(x) { case 1: // .L56 w = y*z; break; ... case 5: case 6: // .L60 w -= z; break; ... } .L60: // subl movl popl leave ret .L56: // movl imull movl popl leave ret x86 Cases 5&6: %ecx, %ebx # w –= z %ebx, %eax # Return w %ebx Case 1: 12(%ebp), %ebx # w = y %ecx, %ebx # w*= z %ebx, %eax # Return w %ebx University of Washington IA32 Object Code   Setup   Label .L6...
View Full Document

Ask a homework question - tutors are online