оптимизация -Os gcc4.2.0
Код
#include <avr/io.h>
uint8_t PIN_[2]={
(uint8_t)(&PINB),
(uint8_t)(&PIND)
};
int main_1()
{
volatile uint8_t tmp1= *(volatile uint8_t *)((uint16_t)PIN_[0]);
return tmp1;
}
результат:
Код
test.o: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000034 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000002 00000000 00000000 00000068 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 0000006a 2**0
ALLOC
3 .debug_abbrev 00000090 00000000 00000000 0000006a 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 000000b3 00000000 00000000 000000fa 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
5 .debug_line 00000088 00000000 00000000 000001ad 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
6 .debug_frame 0000001c 00000000 00000000 00000235 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
7 .debug_pubnames 00000026 00000000 00000000 00000251 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
8 .debug_aranges 00000014 00000000 00000000 00000277 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
9 .debug_str 0000012d 00000000 00000000 0000028b 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <main_1>:
(uint8_t)(&PINB),
(uint8_t)(&PIND)
};
int main_1()
{
0: cf 93 push r28
2: df 93 push r29
4: cd b7 in r28, 0x3d; 61
6: de b7 in r29, 0x3e; 62
8: 21 97 sbiw r28, 0x01; 1
a: 0f b6 in r0, 0x3f; 63
c: f8 94 cli
e: de bf out 0x3e, r29; 62
10: 0f be out 0x3f, r0; 63
12: cd bf out 0x3d, r28; 61
volatile uint8_t tmp1= *(volatile uint8_t *)((uint16_t)PIN_[0]);
14: e0 91 00 00 lds r30, 0x0000
18: ff 27 eor r31, r31
1a: 80 81 ld r24, Z
1c: 89 83 std Y+1, r24; 0x01
return tmp1;
1e: 89 81 ldd r24, Y+1; 0x01
} 20: 99 27 eor r25, r25
22: 21 96 adiw r28, 0x01; 1
24: 0f b6 in r0, 0x3f; 63
26: f8 94 cli
28: de bf out 0x3e, r29; 62
2a: 0f be out 0x3f, r0; 63
2c: cd bf out 0x3d, r28; 61
2e: df 91 pop r29
30: cf 91 pop r28
32: 08 95 ret