Assembler Reference

3.5.6Local labels

A local label is a number in the range 0-99, optionally followed by a name. The same number can be used for more than one local label in an ELF section.

Local labels are typically used for loops and conditional code within a routine, or for small subroutines that are only used locally. They are particularly useful in macros (see MACRO and MEND on page 7-27).

Use the ROUT directive to limit the scope of local labels (see ROUT on page 7-68). A reference to a local label refers to a matching label within the same scope. If there is no matching label within the scope in either direction, the assembler generates an error message and the assembly fails.

You can use the same number for more than one local label even within the same scope. By default, the assembler links a local label reference to:

the most recent local label of the same number, if there is one within the scope

the next following local label of the same number, if there is not a preceding one within the scope.

Use the optional parameters to modify this search pattern if required.

Syntax

The syntax of a local label is:

n{routname}

The syntax of a reference to a local label is:

%{FB}{AT}n{routname}

where:

nis the number of the local label.

routname is the name of the current scope.

%introduces the reference.

Finstructs the assembler to search forwards only.

Binstructs the assembler to search backwards only.

Ainstructs the assembler to search all macro levels.

Tinstructs the assembler to look at this macro level only.

If neither F or B is specified, the assembler searches backwards first, then forwards.

If neither A or T is specified, the assembler searches all macros from the current level to the top level, but does not search lower level macros.

3-16

Copyright © 2000, 2001 ARM Limited. All rights reserved.

ARM DUI 0068B

Page 94
Image 94
ARM VERSION 1.2 manual Syntax of a local label is, Syntax of a reference to a local label is