[PATCH] Empty BINCL/EINCL

Devang Patel dpatel@apple.com
Fri Jun 20 19:27:00 GMT 2003


GCC emits BINCL/EINCL stabs for a header even if its content
is #ifdef'ed out. This results in empty BINCL/EINCL pair. Now,
use of -gused (my previous patch) introduces even more empty
pairs. And in PCH usage model, precomp contains tons of
empty BINCL/EINCLs with -gused (because not many symbols
are used while pre-compiling prefix header). So this patch
introduces empty BINCL/EINCL optimization by emitting BINCL
stabs lazily. If BINCL stab is pending when it is time to emit
EINCL stab, it eliminates entire pair. It has significant impact on
size of .o files created.

Here is size comparison for h.cc and h.c.
- h.cc is a three line hello world program that includes iostream.h.
and uses std::cout.
-h.c is hello world using printf().
- EBEO = empty BINCL/EINCL optimization

-g		-gused	-g 		-gused 	no dbg		name
				+ EBEO	+ EBEO	

125908	10904	121324	4052	2488		h.cc
     6452	  1612	     6240	1032	  812			h.c

One added benefit is that this has significant positive impact on
GDB startup time.

OK to commit if gcc & gdb dejagnu tests does not report any regression?

-Devang

2003-06-20  Devang Patel <dpatel@apple.com>

         * dbxout.c (binclstatus): New enum.
         (emit_bincl_stab): New function.
         (emit_pending_bincls): Same.
         (emit_pending_bincls_if_required): Same.
         (struct dbx_file): New members: bincl_status, 
pending_bincl_name and prev.
         (pending_bincls): New static var.
         (dbxout_init): Initialize new dbx_file members.
         (dbxout_start_source_file): Same.
         (dbxout_end_source_file): Emit EINCL stab only if BINCL is 
already processed.
         (dbxout_begin_block): Emit pending BINCL stabs.
         (dbxout_end_block): Same.
         (dbxout_function_decl): Same.
         (dbxout_continue): Same.
         (dbxout_type): Same.
         (dbxout_symbol): Same.
         (dbxout_symbol_location): Same.
         (dbxout_parms): Same.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: empty_bincl.diff
Type: application/octet-stream
Size: 6750 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030620/aaf12211/attachment.obj>
-------------- next part --------------

(empty_bincl.diff)


More information about the Gcc-patches mailing list