On the MIPS GCC target, is there a way to write an inline assembler
constraint for a specific register?
<http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Machine-Constraints.html>
says how to do this for some architectures, but not most, such as MIPS.
For example, I'd like to be able to use the $v0 or $2 register. With
i386, I can use "a" to match %EAX, but how do I match a specific
register in MIPS?
Here's an example of how I've been working around the issue using
variables in specified registers. This is slightly inferior, and
possibly incorrect.
void print(const char *string) {
const register int num asm("v0") = 4;
const register char *const str asm("a0") = string;
asm volatile("syscall" : : "r"(num), "r"(str));
}
Is there a way to write this without the extra variables?