3.5.6. Local 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 area.

A local label can be used in place of symbol in source lines in an assembly language module (see Format of source lines):

A local label is generally used where you might use a program-relative label (see Labels).

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).

Use the ROUT directive to limit the scope of local labels (see ROUT). 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:

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:

%{F|B}{A|T}n{routname}

where:

n

is the number of the local label.

routname

is the name of the current scope.

%

introduces the reference.

F

instructs the assembler to search forwards only.

B

instructs the assembler to search backwards only.

A

instructs the assembler to search all macro levels.

T

instructs the assembler to look at this macro level only.

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

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

If routname is specified in either a label or a reference to a label, the assembler checks it against the name of the nearest preceding ROUT directive. If it does not match, the assembler generates an error message and the assembly fails.

Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0204J
Non-ConfidentialID101213