The Xtensa assember supports a region-based directive syntax:
.begin directive [options]
...
.end directive
All the Xtensa-specific directives that apply to a region of code use this syntax.
The directive applies to code between the .begin and the
.end. The state of the option after the .end reverts to
what it was before the .begin.
A nested .begin/.end region can further
change the state of the directive without having to be aware of its
outer state. For example, consider:
.begin no-density
L: add a0, a1, a2
.begin density
M: add a0, a1, a2
.end density
N: add a0, a1, a2
.end no-density
The generic ADD opcodes at L and N in the outer
no-density region both result in ADD machine instructions,
but the assembler selects an ADD.N instruction for the generic
ADD at M in the inner density region.
The advantage of this style is that it works well inside macros which can preserve the context of their callers.
When command-line options and assembler directives are used at the same
time and conflict, the one that overrides a default behavior takes
precedence over one that is the same as the default. For example, if
the code density option is available, the default is to select density
instructions whenever possible. So, if the above is assembled with the
--no-density flag, which overrides the default, all the generic
ADD instructions result in ADD machine instructions. If
assembled with the --density flag, which is already the default,
the no-density directive takes precedence and only one of
the generic ADD instructions is optimized to be a ADD.N
machine instruction. An underscore prefix identifying a specific opcode
always takes precedence over directives and command-line flags.
The following directives are available: