This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Valgrind-developers] Memcheck optimisation level; Makefile.amincludes
- From: Falk Hueffner <hueffner at informatik dot uni-tuebingen dot de>
- To: Nicholas Nethercote <njn25 at cam dot ac dot uk>
- Cc: Julian Seward <jseward at acm dot org>,Valgrind Developers <valgrind-developers at lists dot sourceforge dot net>,gcc at gcc dot gnu dot org
- Date: Wed, 25 Aug 2004 12:01:49 +0200
- Subject: Re: [Valgrind-developers] Memcheck optimisation level; Makefile.amincludes
- References: <Pine.LNX.4.60.0408241209100.28550@hermes-1.csi.cam.ac.uk><1093388744.4449.15.camel@localhost><1093410677.3058.29.camel@camp4.serpentine.com><200408250920.24024.jseward@acm.org><Pine.LNX.4.60.0408251012491.8646@hermes-1.csi.cam.ac.uk>
Nicholas Nethercote <njn25@cam.ac.uk> writes:
> So why are the total file sizes larger with -fomit-frame-pointer? Do
> any GCC people know?
One reason might be that accessing relative to stack pointer takes one
byte more than relative to frame pointer:
int f(int n) { volatile int a[4]; return a[1] + a[2]; }
% gcc -c -O3 test.c && objdump -dr test.o
00000000 <f>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: 8b 45 ec mov 0xffffffec(%ebp),%eax
9: 8b 4d f0 mov 0xfffffff0(%ebp),%ecx
c: 01 c8 add %ecx,%eax
e: c9 leave
f: c3 ret
% gcc -fomit-frame-pointer -c -O3 test.c && objdump -dr test.o
00000000 <f>:
0: 83 ec 1c sub $0x1c,%esp
3: 8b 44 24 04 mov 0x4(%esp,1),%eax
7: 8b 4c 24 08 mov 0x8(%esp,1),%ecx
b: 01 c8 add %ecx,%eax
d: 83 c4 1c add $0x1c,%esp
10: c3 ret
--
Falk