Xtensa Directives - Using as
Description: Using as

Previous: Xtensa Relaxation, Up: Xtensa-Dependent

#### 9.46.5 Directives

The Xtensa assembler 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-transform
         L:  add a0, a1, a2
             .begin transform
         M:  add a0, a1, a2
             .end transform
         N:  add a0, a1, a2
             .end no-transform

The `ADD` opcodes at `L` and `N` in the outer `no-transform` region both result in `ADD` machine instructions, but the assembler selects an `ADD.N` instruction for the `ADD` at `M` in the inner `transform` region.

The advantage of this style is that it works well inside macros which can preserve the context of their callers.

The following directives are available: