You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
4.5 KiB
HTML

<html lang="en">
<head>
<title>Xtensa Jump Relaxation - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Xtensa-Relaxation.html#Xtensa-Relaxation" title="Xtensa Relaxation">
<link rel="prev" href="Xtensa-Call-Relaxation.html#Xtensa-Call-Relaxation" title="Xtensa Call Relaxation">
<link rel="next" href="Xtensa-Immediate-Relaxation.html#Xtensa-Immediate-Relaxation" title="Xtensa Immediate Relaxation">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2015 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Xtensa-Jump-Relaxation"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Xtensa-Immediate-Relaxation.html#Xtensa-Immediate-Relaxation">Xtensa Immediate Relaxation</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Xtensa-Call-Relaxation.html#Xtensa-Call-Relaxation">Xtensa Call Relaxation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Xtensa-Relaxation.html#Xtensa-Relaxation">Xtensa Relaxation</a>
<hr>
</div>
<h5 class="subsubsection">9.52.4.3 Jump Relaxation</h5>
<p><a name="index-relaxation-of-jump-instructions-2470"></a><a name="index-jump-instructions_002c-relaxation-2471"></a>
Jump instruction may require relaxation because the Xtensa jump instruction
(<code>J</code>) provide a PC-relative offset of only 128 Kbytes in either
direction. One option is to use jump long (<code>J.L</code>) instruction, which
depending on jump distance may be assembled as jump (<code>J</code>) or indirect
jump (<code>JX</code>). However it needs a free register. When there's no spare
register it is possible to plant intermediate jump sites (trampolines)
between the jump instruction and its target. These sites may be located in
areas unreachable by normal code execution flow, in that case they only
contain intermediate jumps, or they may be inserted in the middle of code
block, in which case there's an additional jump from the beginning of the
trampoline to the instruction past its end. So, for example:
<pre class="smallexample"> j 1f
...
retw
...
mov a10, a2
call8 func
...
1:
...
</pre>
<p>might be relaxed to:
<pre class="smallexample"> j .L0_TR_1
...
retw
.L0_TR_1:
j 1f
...
mov a10, a2
call8 func
...
1:
...
</pre>
<p>or to:
<pre class="smallexample"> j .L0_TR_1
...
retw
...
mov a10, a2
j .L0_TR_0
.L0_TR_1:
j 1f
.L0_TR_0:
call8 func
...
1:
...
</pre>
<p>The Xtensa assempler uses trampolines with jump around only when it cannot
find suitable unreachable trampoline. There may be multiple trampolines
between the jump instruction and its target.
<p>This relaxation does not apply to jumps to undefined symbols, assuming they
will reach their targets once resolved.
<p>Jump relaxation is enabled by default because it does not affect code size
or performance while the code itself is small. This relaxation may be
disabled completely with &lsquo;<samp><span class="samp">--no-trampolines</span></samp>&rsquo; or &lsquo;<samp><span class="samp">--no-transform</span></samp>&rsquo;
command-line options (see <a href="Xtensa-Options.html#Xtensa-Options">Command Line Options</a>).
</body></html>