242
Chapter 42. Xtensa Dependent Features
bnez.n
a2, M
j L
M:
(The
BNEZ.N
instruction would be used in this example only if the density option is available. Other
wise,
BNEZ
would be used.)
42.4.2. Function Call Relaxation
Function calls may require relaxation because the Xtensa immediate call instructions (
CALL0
,
CALL4
,
CALL8
and
CALL12
) provide a PC relative offset of only 512 Kbytes in either direction. For larger
programs, it may be necessary to use indirect calls (
CALLX0
,
CALLX4
,
CALLX8
and
CALLX12
) where
the target address is specified in a register. The Xtensa assembler can automatically relax immediate
call instructions into indirect call instructions. This relaxation is done by loading the address of the
called function into the callee's return address register and then using a
CALLX
instruction. So, for
example:
call8 func
might be relaxed to:
.literal .L1, func
l32r
a8, .L1
callx8
a8
Because the addresses of targets of function calls are not generally known until link time, the assem
bler must assume the worst and relax all the calls to functions in other source files, not just those that
really will be out of range. The linker can recognize calls that were unnecessarily relaxed, but it can
only partially remove the overhead introduced by the assembler.
Call relaxation has a negative effect on both code size and performance, so this relaxation is disabled
by default. If a program is too large and some of the calls are out of range, function call relaxation can
be enabled using the
longcalls
command line option or the
longcalls
directive (Section 42.5.3
longcalls).
42.4.3. Other Immediate Field Relaxation
The
MOVI
machine instruction can only materialize values in the range from 2048 to 2047. Values
outside this range are best materialized with
L32R
instructions. Thus:
movi a0, 100000
is assembled into the following machine code:
.literal .L1, 100000
l32r a0, .L1
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved