How to optimize Intel's JMP instruction?

"Li Ping" <>
24 Jul 2002 02:17:02 -0400

          From comp.compilers

Related articles
How to optimize Intel's JMP instruction? (Li Ping) (2002-07-24)
Re: How to optimize Intel's JMP instruction? (R.S. Veldema) (2002-07-25)
| List of all articles for this month |

From: "Li Ping" <>
Newsgroups: comp.compilers
Date: 24 Jul 2002 02:17:02 -0400
Keywords: optimize, question
Posted-Date: 24 Jul 2002 02:17:02 EDT

This problem seems more complex than I thought. A good
compiler/assembler should use the short jump instruction whenever
possible. However, it's not as easy as it appears. Because there could
be other optimizable JMP instructions between this one and the target

Here's an example. This is an excerpt from a list file produced by
MASM 6.15. This assembler always chooses the shortest possible
encoding for each JMP truction. In the example below, it's the 2nd JMP

00000000 @2:
org $+3
00000003 E9 00000081 jmp @1
00000008 EB 7F jmp @1
org $+118
00000080 E9 FFFFFF7B jmp @2
org $+4
00000089 @1:

Question: How could a compiler/assembler optimize the JMP instruction?
Algorithm, data structures?

[See the comp.compilers archives. This is a well-studied problem. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.