gcc asm with empty input operand constraint

Viewed 112

When using extended asm in gcc, it is clear and documented what this does:

__asm__ ("some instructions" : /* No outputs */ : "r" (var));

It asks gcc to place var into a register and pass it to me as %0. It also creates a dependency on var, such that this instruction will not be moved prior to the last point var was changed, not will it be moved relative to other volatiles (which is another documentation subtlety).

What's not clear is what this does:

__asm__ ("" : : "" (var));

My first initial thought is that the empty constraint might be the same as "X" - ie: put it anywhere. But it isn't. For me (using Arm cortex), the "X" or "r" places var in, say, r4. The "" does not.

It creates the same ordering dependency but doesn't appear to do anything else. Which might be the intent but is this documented anywhere?

0 Answers
Related