For instructions that require register operands, (such as the add instruction), global variables, function parameters, and local variables must be declared with the keyword register .
Using C Variables with Instructions that Require Register Operands shows inline assembly language statements that correctly use C-language variables as operands in instructions that require register operands.
int my_global asm("r14")= 25; /* global variable */
int my_loc asm("r15")= 1;
asm void red(register int *my_param)
{
register int result;
fralloc
add result, r4, my_global /* line 10 */
add result, my_global, my_param /* line 11 */
add result, my_param, my_loc /* line 12 */
frfree
blr
}
In Using C Variables with Instructions that Require Register Operands, the statement on line 10, 11, and 12 are all correct because their operands are all declared with the register keyword.