C 17 18 19 20 21 a c code 1 2 3 4 5 6 7 8 9 10 11 12

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: t encodings for jumps, but some of the most commonly used ones are PC-relative. That is, they encode the difference between the address of the target instruction and the address of the instruction immediately following the jump. These offsets can be encoded using one, two, or four bytes. A second encoding method is to give an “absolute” address, using four bytes to directly specify the target. The assembler and linker select the appropriate encodings of the jump destinations. As an example, the following fragment of assembly code was generated by compiling a file silly.c. It contains two jumps: the jle instruction on line 1 jumps forward to a higher address, while the jg instruction on line 8 jumps back to a lower one. 1 2 3 4 5 6 7 8 9 10 jle .L4 .p2align 4,,7 .L5: movl %edx,%eax sarl $1,%eax subl %eax,%edx testl %edx,%edx jg .L5 .L4: movl %edx,%eax If <, goto dest2 Aligns next instruction to multiple of 8 dest1: If >, goto dest1 dest2: Note that line 2 is a directive to the assembler...
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