SPRU513Y August 2001 – June 2022 SM320F28335-EP
This is an example of code that declares and uses a local label legally:
$1:
ADDB AL, #-7
B $1, GEQ
.newblock ; undefine $1 to use it again.
$1 MOV T, AL
MPYB ACC, T, #7
CMP AL, #1000
B $1, LT
The following code uses a local label illegally:
$1:
ADDB AL, #-7
B $1, GEQ
$1 MOV T, AL ; WRONG - $1 is multiply defined.
MPYB ACC, T, #7
CMP AL, #1000
B $1, LT
The $1 label is not undefined before being reused by the second branch instruction. Therefore, $1 is redefined, which is illegal.