The name of an inline assembly language statement label must follow these rules:
- A label name cannot be the same as the identifier of any local variables of the function in which the label name appears.
- A label name does not have to start in the first column of the function in which it appears; a label name can be preceded by white space.
- A label name can begin with an "at-sign" character (@) unless the label immediately follows a local variable declaration.
- A label name must end with a colon character (:) unless it begins with an at-sign character (@).
- For example, red: and @red are valid, but red is not valid.
- A label name can be the same as an assembly language statement mnemonic.
For example, this statement is valid:
add: add r3, r4, r5
Examples:
asm void func1(){
int i;
@x: add r0,#1 //Invalid !!!
}
asm void func2(){
int i;
x: add r0,#1 //OK
@y: add r3, r4, r5 //OK
}
This is an example of a complete inline assembly language function:
asm void red(void){
x1: add r3,r4,r5
@x2: add r6,r7,r8
}