This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
exception-section patch, part 1
- To: egcs-patches at cygnus dot com
- Subject: exception-section patch, part 1
- From: Bruno Haible <haible at ilog dot fr>
- Date: Tue, 30 Jun 1998 23:46:01 +0200 (MET DST)
This patch introduces the command-line option which triggers the
optimization.
Sun Jun 28 19:49:33 1998 Bruno Haible <bruno@linuix.math.u-bordeaux.fr>
* except.h (flag_extra_section_for_exceptions): New variable.
* except.c (flag_extra_section_for_exceptions): Define.
* toplev.c (main): Initialize flag_extra_section_for_exceptions.
(f_options): New flag -fexception-section.
(compile_file): Adjust flag_extra_section_for_exceptions.
diff -c3p egcs-19980628/gcc/except.h.bak egcs-19980628/gcc/except.h
*** egcs-19980628/gcc/except.h.bak Thu Jun 25 16:11:46 1998
--- egcs-19980628/gcc/except.h Tue Jun 30 13:08:34 1998
*************** extern int exceptions_via_longjmp;
*** 344,349 ****
--- 357,366 ----
/* One to enable asynchronous exception support. */
extern int asynchronous_exceptions;
+
+ /* One to emit exception handler code in a separate section. */
+
+ extern int flag_extra_section_for_exceptions;
/* One to protect cleanup actions with a handler that calls
__terminate, zero otherwise. */
diff -c3p egcs-19980628/gcc/except.c.bak egcs-19980628/gcc/except.c
*** egcs-19980628/gcc/except.c.bak Thu Jun 25 16:11:47 1998
--- egcs-19980628/gcc/except.c Tue Jun 30 13:08:35 1998
*************** int exceptions_via_longjmp = 2;
*** 416,421 ****
--- 416,425 ----
int asynchronous_exceptions = 0;
+ /* One to emit exception handler code in a separate section. */
+
+ int flag_extra_section_for_exceptions = 0;
+
/* One to protect cleanup actions with a handler that calls
__terminate, zero otherwise. */
diff -c3p egcs-19980628/gcc/toplev.c.bak egcs-19980628/gcc/toplev.c
*** egcs-19980628/gcc/toplev.c.bak Sat Jun 27 17:51:49 1998
--- egcs-19980628/gcc/toplev.c Tue Jun 30 13:08:35 1998
*************** struct { char *string; int *variable; in
*** 773,778 ****
--- 774,780 ----
{"new-exceptions", &flag_new_exceptions, 1},
{"sjlj-exceptions", &exceptions_via_longjmp, 1},
{"asynchronous-exceptions", &asynchronous_exceptions, 1},
+ {"exception-section", &flag_extra_section_for_exceptions, 1},
{"profile-arcs", &profile_arc_flag, 1},
{"test-coverage", &flag_test_coverage, 1},
{"branch-probabilities", &flag_branch_probabilities, 1},
*************** compile_file (name)
*** 2500,2505 ****
--- 2506,2526 ----
if (flag_function_sections && write_symbols != NO_DEBUG)
warning ("-ffunction-sections may affect debugging on some targets.");
+ #if defined (EH_TEXT_SECTION_ASM_OP) || defined (ASM_OUTPUT_SECTION_NAME)
+ if (profile_flag || profile_block_flag)
+ {
+ if (flag_extra_section_for_exceptions == 1)
+ warning ("-fexception-section disabled; it makes profiling impossible.");
+ flag_extra_section_for_exceptions = 0;
+ }
+ if (flag_extra_section_for_exceptions == 2)
+ flag_extra_section_for_exceptions = 1;
+ #else
+ if (flag_extra_section_for_exceptions == 1)
+ warning ("-fexception-section not supported for this target.");
+ flag_extra_section_for_exceptions = 0;
+ #endif
+
/* ??? Note: There used to be a conditional here
to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
This was to guarantee separation between gcc_compiled. and
*************** main (argc, argv, envp)
*** 3847,3852 ****
--- 3878,3886 ----
flag_schedule_insns_after_reload = 1;
#endif
flag_regmove = 1;
+ #if (defined (EH_TEXT_SECTION_ASM_OP) || defined (ASM_OUTPUT_SECTION_NAME)) && 0 /* not yet */
+ flag_extra_section_for_exceptions = 2;
+ #endif
/* We don't set flag_strict_aliasing here because we're still
testing the functionality. After it has been tested, it
should be turned on here. */
diff -c3p egcs-19980628/gcc/invoke.texi.bak egcs-19980628/gcc/invoke.texi
*** egcs-19980628/gcc/invoke.texi.bak Thu Jun 25 17:14:14 1998
--- egcs-19980628/gcc/invoke.texi Tue Jun 30 13:05:23 1998
*************** in the following sections.
*** 147,153 ****
@smallexample
-fbranch-probabilities
-fcaller-saves -fcse-follow-jumps -fcse-skip-blocks
! -fdelayed-branch -fexpensive-optimizations
-ffast-math -ffloat-store -fforce-addr -fforce-mem
-ffunction-sections -fgcse -finline-functions
-fkeep-inline-functions -fno-default-inline
--- 147,153 ----
@smallexample
-fbranch-probabilities
-fcaller-saves -fcse-follow-jumps -fcse-skip-blocks
! -fdelayed-branch -fexception-section -fexpensive-optimizations
-ffast-math -ffloat-store -fforce-addr -fforce-mem
-ffunction-sections -fgcse -finline-functions
-fkeep-inline-functions -fno-default-inline
*************** Similar to @samp{-fschedule-insns}, but
*** 2330,2335 ****
--- 2330,2344 ----
instruction scheduling after register allocation has been done. This is
especially useful on machines with a relatively small number of
registers and where memory load instructions take more than one cycle.
+
+ @item -fexception-section
+ Place all exception handling code in a separate section. This improves
+ locality of reference in the instruction space and reduces the working
+ set size of programs compiled with exception support (@samp{-fexceptions}).
+
+ With this option, no debugging information is produced for the exception
+ handling code. Also, this option cannot be used simultaneously with
+ profiling support (@samp{-p}, @samp{-pg} or @samp{-a}).
@item -ffunction-sections
Place each function into its own section in the output file if the