This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Valgrind-developers] Memcheck optimisation level; Makefile.amincludes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]