- 论坛徽章:
- 20
|
本帖最后由 nswcfd 于 2016-07-13 20:51 编辑
比较一下汇编,并没有被优化掉
未优化的
0x00000000004004c4 <+0>: push %rbp
0x00000000004004c5 <+1>: mov %rsp,%rbp
0x00000000004004c8 <+4>: sub $0x50,%rsp
0x00000000004004cc <+8>: movl $0x73696854,-0x30(%rbp)
0x00000000004004d3 <+15>: movl $0x20736920,-0x2c(%rbp)
0x00000000004004da <+22>: movl $0x65742061,-0x28(%rbp)
0x00000000004004e1 <+29>: movl $0x6d207473,-0x24(%rbp)
0x00000000004004e8 <+36>: movl $0x61737365,-0x20(%rbp)
0x00000000004004ef <+43>: movl $0xa2e6567,-0x1c(%rbp)
0x00000000004004f6 <+50>: movl $0x0,-0x18(%rbp)
0x00000000004004fd <+57>: movw $0x0,-0x14(%rbp)
0x0000000000400503 <+63>: movl $0x19,-0x4(%rbp)
0x000000000040050a <+70>: lea -0x30(%rbp),%rax
0x000000000040050e <+74>: lea -0x50(%rbp),%rdx
0x0000000000400512 <+78>: mov -0x4(%rbp),%ecx
0x0000000000400515 <+81>: mov %rax,%rsi
0x0000000000400518 <+84>: mov %rdx,%rdi
0x000000000040051b <+87>: cld
0x000000000040051c <+88>: rep movsb %ds %rsi),%es %rdi)
0x000000000040051e <+90>: lea -0x50(%rbp),%rax
0x0000000000400522 <+94>: mov %rax,%rdi
0x0000000000400525 <+97>: callq 0x4003b8 <puts@plt>
优化之后的
0x00000000004004c4 <+0>: sub $0x48,%rsp
0x00000000004004c8 <+4>: movl $0x73696854,0x20(%rsp)
0x00000000004004d0 <+12>: movl $0x20736920,0x24(%rsp)
0x00000000004004d8 <+20>: movl $0x65742061,0x28(%rsp)
0x00000000004004e0 <+28>: movl $0x6d207473,0x2c(%rsp)
0x00000000004004e8 <+36>: movl $0x61737365,0x30(%rsp)
0x00000000004004f0 <+44>: movl $0xa2e6567,0x34(%rsp)
0x00000000004004f8 <+52>: movl $0x0,0x38(%rsp)
0x0000000000400500 <+60>: movw $0x0,0x3c(%rsp)
0x0000000000400507 <+67>: lea 0x20(%rsp),%rsi
0x000000000040050c <+72>: mov %rsp,%rdi
0x000000000040050f <+75>: mov $0x19,%ecx
0x0000000000400514 <+80>: cld
0x0000000000400515 <+81>: rep movsb %ds %rsi),%es %rdi)
0x0000000000400517 <+83>: callq 0x4003b8 <puts@plt>
|
|