|Vax span-dependent jumps firstname.lastname@example.org (1990-12-23)|
|Re: Vax span-dependent jumps email@example.com (1990-12-30)|
|Re: Vax span-dependent jumps firstname.lastname@example.org (1991-01-02)|
|Re: Vax span-dependent jumps email@example.com (1991-01-03)|
|From:||firstname.lastname@example.org (Colin Plumb)|
|Keywords:||optimize, code, assembler|
|Organization:||University of Waterloo|
|References:||<9012111913.AA07310@cs-sun-fsa.cpsc.ucalgary.ca> <email@example.com.UUCP> <firstname.lastname@example.org> <1990Dec30.email@example.com> <17633@paperboy.OSF.ORG>|
|Date:||Thu, 3 Jan 91 22:54:59 GMT|
Well, the nastiest case in production is the Inmos Transputer, which has a
different instruction length for each 4 bits of offset. 4 bits is 1 byte
of instruction, 8 bits is 2 bytes, 12 bits is 3, etc. A worst-case jump is
Since every constant in the program is expressed this way, the problem is
put off until the linker. The linker has a nasty habit of being slow.
Eventually Cogent Research (where I used to work) rewrote it. Basically,
they build a list of all the non-constant offsets and the labels they're
relative to. Keep track of the distance between labels, beginning by assuming
they're all one byte long. Then run over the list extending things until
it stabilizes. I'm sure someone could come up with an example which only
lengthens one instruction per scan, and each instruction lengthens a few times,
but as long as it's only label1-label2, it's monotonically increasing
and you have reasonable worst-case run-time (and a lot faster than the wierd
heuristics that were in use before, in practice).
If you allow stranger expressions, I suppose it's possible for this to
produce non-optimal results, but it won't happen very often in practice.
Return to the
Search the comp.compilers archives again.