ZHCUAV7Z september 1995 – march 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
以下示例中的代码合法声明并使用了局部标签:
Label1: CMP r1, #0 ; Compare r1 to zero.
BCS $1 ; If carry is set, branch to $1;
ADDS r0, r0, #1 ; else increment to r0
MOVCS pc, lr ; and return.
$1: LDR r2, [r5], #4 ; Load indirect of r5 into r2
; with write back.
.newblock ; Undefine $1 so it can be used
; again.
ADDS r1, r1, r2 ; Add r2 to r1.
BPL $1 ; If the negative bit isn't set,
; branch to $1;
MVNS r1, r1 ; else negate r1.
$1: MOV pc, lr ; Return.
以下代码非法使用了局部标签:
BCS $1 ; If carry is set, branch to $1;
ADDS r0, r0, #1 ; else increment to r0
MOVCS pc, lr ; and return.
$1: LDR r2, [r5], #4 ; Load indirect of r5 into r2
; with write-back.
ADDS r1, r1, r2 ; Add r2 to r1.
BPL $1 ; If the negative bit isn't set,
; branch to $1;
MVNS r1, r1 ; else negate r1.
$1: MOV pc, lr ; Return.
$1 标签在由第二条分支指令重用之前已定义。因此,重新定义 $1 是非法的。