- Code: Select all
d:\>avr-gcc -v
Using built-in specs.
Target: avr
Configured with: ../gcc-4.3.3/configure --enable-win32-registry=WinAVR-20100110
--with-gmp=/usr/local --with-mpfr=/usr/local --prefix=/c/WinAVR --target=avr --e
nable-languages=c,c++,objc --with-dwarf2 --enable-doc --disable-shared --disable
-libada --disable-libssp --disable-nls --with-pkgversion='WinAVR 20100110' --wit
h-bugurl='URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=br
owse'
Thread model: single
gcc version 4.3.3 (WinAVR 20100110)
Опциы компиляции:
- Code: Select all
avr-gcc.exe -Wall -gdwarf-2 -Os -fsigned-char -ffunction-sections -MD -MP -MT $(OUTPUT)/$(*F).o -MF $(OUTPUT)/dep/$(@F).d -c $< -o $(OUTPUT)/$(@F)
Незамысловатый соретс:
- Code: Select all
void trace_u8( U8 val )
{
printf("%u",val);
}
U32 y;
int main(void)
{
U8 a1, a2, a3, a4;
a1 = y;
a2 = y >> 8;
a3 = y >> 16;
a4 = y >> 24;
trace_u8(a1);
trace_u8(a2);
trace_u8(a3);
trace_u8(a4);
}
Вот в такое ГовнеЦЦо он компайлится:
- Code: Select all
@0000020D: trace_u8
92: {
+0000020D: D000 RCALL PC+0x0001 Relative call subroutine
+0000020E: D000 RCALL PC+0x0001 Relative call subroutine
+0000020F: B7ED IN R30,0x3D In from I/O location
+00000210: B7FE IN R31,0x3E In from I/O location
+00000211: 9631 ADIW R30,0x01 Add immediate to word
+00000212: E123 LDI R18,0x13 Load immediate
+00000213: E031 LDI R19,0x01 Load immediate
+00000214: B7AD IN R26,0x3D In from I/O location
+00000215: B7BE IN R27,0x3E In from I/O location
+00000216: 9612 ADIW R26,0x02 Add immediate to word
+00000217: 933C ST X,R19 Store indirect
+00000218: 932E ST -X,R18 Store indirect and predecrement
+00000219: 9711 SBIW R26,0x01 Subtract immediate from word
+0000021A: 8382 STD Z+2,R24 Store indirect with displacement
+0000021B: 8213 STD Z+3,R1 Store indirect with displacement
+0000021C: 940E0CE7 CALL 0x00000CE7 Call subroutine
+0000021E: 900F POP R0 Pop register from stack
+0000021F: 900F POP R0 Pop register from stack
+00000220: 900F POP R0 Pop register from stack
+00000221: 900F POP R0 Pop register from stack
94: }
+00000222: 9508 RET Subroutine return
---- main.c ----
156: {
+00000223: 92EF PUSH R14 Push register on stack
+00000224: 92FF PUSH R15 Push register on stack
+00000225: 930F PUSH R16 Push register on stack
+00000226: 931F PUSH R17 Push register on stack
160: a1 = y;
+00000227: 90E00157 LDS R14,0x0157 Load direct from data space
+00000229: 90F00158 LDS R15,0x0158 Load direct from data space
+0000022B: 91000159 LDS R16,0x0159 Load direct from data space
+0000022D: 9110015A LDS R17,0x015A Load direct from data space
165: trace_u8(a1);
+0000022F: 2D8E MOV R24,R14 Copy register
+00000230: DFDC RCALL PC-0x0023 Relative call subroutine
166: trace_u8(a2);
+00000231: 27BB CLR R27 Clear Register
+00000232: 2FA1 MOV R26,R17 Copy register
+00000233: 2F90 MOV R25,R16 Copy register
+00000234: 2D8F MOV R24,R15 Copy register
+00000235: DFD7 RCALL PC-0x0028 Relative call subroutine
167: trace_u8(a3);
+00000236: 01C8 MOVW R24,R16 Copy register pair
+00000237: 27AA CLR R26 Clear Register
+00000238: 27BB CLR R27 Clear Register
+00000239: DFD3 RCALL PC-0x002C Relative call subroutine
168: trace_u8(a4);
+0000023A: 2EE1 MOV R14,R17 Copy register
+0000023B: 24FF CLR R15 Clear Register
+0000023C: 2700 CLR R16 Clear Register
+0000023D: 2711 CLR R17 Clear Register
+0000023E: 2D8E MOV R24,R14 Copy register
+0000023F: DFCD RCALL PC-0x0032 Relative call subroutine
Сам распарсишь, или тебе разжевать? К распарсиванию как минимум 2 момента говнооптимизации.