as: Xtensa Jump Relaxation
1
1 9.55.4.3 Jump Relaxation
1 ........................
1
1 Jump instruction may require relaxation because the Xtensa jump
1 instruction ('J') provide a PC-relative offset of only 128 Kbytes in
1 either direction. One option is to use jump long ('J.L') instruction,
1 which depending on jump distance may be assembled as jump ('J') or
1 indirect jump ('JX'). However it needs a free register. When there's
1 no spare register it is possible to plant intermediate jump sites
1 (trampolines) between the jump instruction and its target. These sites
1 may be located in areas unreachable by normal code execution flow, in
1 that case they only contain intermediate jumps, or they may be inserted
1 in the middle of code block, in which case there's an additional jump
1 from the beginning of the trampoline to the instruction past its end.
1 So, for example:
1
1 j 1f
1 ...
1 retw
1 ...
1 mov a10, a2
1 call8 func
1 ...
1 1:
1 ...
1
1 might be relaxed to:
1
1 j .L0_TR_1
1 ...
1 retw
1 .L0_TR_1:
1 j 1f
1 ...
1 mov a10, a2
1 call8 func
1 ...
1 1:
1 ...
1
1 or to:
1
1 j .L0_TR_1
1 ...
1 retw
1 ...
1 mov a10, a2
1 j .L0_TR_0
1 .L0_TR_1:
1 j 1f
1 .L0_TR_0:
1 call8 func
1 ...
1 1:
1 ...
1
1 The Xtensa assembler uses trampolines with jump around only when it
1 cannot find suitable unreachable trampoline. There may be multiple
1 trampolines between the jump instruction and its target.
1
1 This relaxation does not apply to jumps to undefined symbols,
1 assuming they will reach their targets once resolved.
1
1 Jump relaxation is enabled by default because it does not affect code
1 size or performance while the code itself is small. This relaxation may
1 be disabled completely with '--no-trampolines' or '--no-transform'
1 command-line options (⇒Command Line Options Xtensa Options.).
1