如果我编码
asm volatile("" ::: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
"r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17",
"r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25",
"r26", "r27", "r28", "r29", "r30", "r31", "memory");
并且反汇编avr-gcc的结果我可以看到avr-gcc假定X,Y和Z没有被破坏。然而,它们被隐含地声明为破坏,因为它们是对(r26,r27),(r28,r29)和(r30,r31)。 avr-gcc似乎将X,Y,Z视为单独的寄存器。
如果我试图解决这个问题
asm volatile("" ::: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
"r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17",
"r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25",
"r26", "r27", "r28", "r29", "r30", "r31", "X", "Y", "Z", "memory");
然后avr-gcc抱怨
test.cpp:212:91: error: unknown register name ‘Z’ in ‘asm’
test.cpp:212:91: error: unknown register name ‘Y’ in ‘asm’
test.cpp:212:91: error: unknown register name ‘X’ in ‘asm’
根据编译器错误以及根据Register Layout的文档,看起来好像无法指定X,Y和Z.
我怎样才能告诉avr-gcc除“r0”之外的所有寄存器都被破坏了?特别是如何判断X,Y,Z是否被破坏?