This is the mail archive of the gcc-patches@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]

Pass gcc_options structures to two target hooks


Although finish_options works with gcc_options structures rather than
with global state itself, it may use global state via target hooks.

This patch fixes that issue, adding gcc_options parameters to the two
hooks that it calls so that they can properly work when more than one
set of options is processed in a single execution of the driver (once
these hooks become available in the driver, that is).  It removes the
assertions in finish_options that global_options is in use, as there
are no longer implicit uses of global_options - and the assertions in
common_handle_option which also no longer implicitly uses
global_options and will not use other global state implicitly once
<http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02483.html> (pending
review, but not a prerequisite for this patch) is in.  The remaining
assertions about global state are in target_handle_option, and they
can go once the relevant pointers are passed to the target handlers
and all the target handlers actually use them.

There are three other hooks this function refers to but does not call,
two data hooks (targetm.unwind_tables_default,
targetm.have_named_sections) and one function hook it checks for being
NULL or note (targetm.ira_cover_classes).  Fortunately none of these
hooks are modified at runtime for any target; I added documentation
that they should not be.  (In general runtime modification of hooks
seems a bad idea; function hooks should make the necessary decisions
when called rather than being changed to point to other functions, and
data hooks that might need modification should be changed to function
hooks if so; modification may also cause problems for LTO-based
devirtualization of target hooks.  But while targetm is not const and
some modifications occur, it seems at least appropriate to document
when it is not safe to modify a hook.)

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
tested building cc1 for crosses to: arm-eabi ia64-elf hppa-linux-gnu
picochip-none.  (For the last of these targets, the change was
removing a prototype for a function that isn't defined anywhere.)  OK
to commit?

2010-11-24  Joseph Myers  <joseph@codesourcery.com>

	* target.def (supports_split_stack, except_unwind_info): Take
	gcc_options parameters.
	* targhooks.c (default_except_unwind_info,
	dwarf2_except_unwind_info, sjlj_except_unwind_info): Take
	gcc_options parameters.
	* targhooks.h (default_except_unwind_info,
	dwarf2_except_unwind_info, sjlj_except_unwind_info): Update
	prototypes.
	* doc/tm.texi.in (TARGET_IRA_COVER_CLASSES,
	TARGET_HAVE_NAMED_SECTIONS, TARGET_UNWIND_TABLES_DEFAULT):
	Document that hooks must not be modified.
	(TARGET_EXCEPT_UNWIND_INFO): Refer to opts argument.
	* doc/tm.texi: Regenerate.
	* defaults.h (STACK_OLD_CHECK_PROTECT, STACK_CHECK_PROTECT): Pass
	&global_options to targetm.except_unwind_info.
	* dwarf2out.c (dwarf2out_do_frame, dwarf2out_do_cfi_asm,
	dwarf2out_begin_prologue, dwarf2out_frame_init,
	dwarf2out_frame_finish, dwarf2out_assembly_start): Pass
	&global_options to targetm.except_unwind_info.
	* except.c (init_eh, finish_eh_generation,
	gate_convert_to_eh_region_ranges,
	output_one_function_exception_table): Pass &global_options to
	targetm.except_unwind_info.
	* expr.c (build_personality_function): Pass &global_options to
	targetm.except_unwind_info.
	* function.c (expand_function_end): Pass &global_options to
	targetm.except_unwind_info.
	* hooks.c (hook_bool_bool_gcc_optionsp_false): New.
	* hooks.h (hook_bool_bool_gcc_optionsp_false): Declare.
	* opts.c (finish_options): Pass opts to targetm.except_unwind_info
	and targetm.supports_split_stack.  Remove assertions about opts
	and opts_set.
	(common_handle_option): Remove assertions about opts, opts_set and
	dc.
	* tree-tailcall.c (suitable_for_tail_call_opt_p): Pass
	&global_options to targetm.except_unwind_info.
	* tree.c (build_common_builtin_nodes: Pass &global_options to
	targetm.except_unwind_info.
	* config/arm/arm.c (arm_except_unwind_info): Add gcc_options
	parameter.
	(arm_compute_func_type, arm_expand_prologue, thumb_pushpop,
	thumb1_expand_prologue, thumb1_output_function_prologue,
	arm_unwind_emit, arm_output_fn_unwind): Update calls to
	arm_except_unwind_info.
	* config/i386/i386.c (ix86_supports_split_stack): Add gcc_options
	parameter.
	* config/ia64/ia64.c (ia64_except_unwind_info): Add gcc_options
	parameter.
	(ia64_output_function_prologue, ia64_add_bundle_selector_before,
	ia64_reorg, ia64_asm_unwind_emit): Update calls to
	ia64_except_unwind_info.
	* config/pa/pa.c (pa_option_override): Pass &global_options to
	targetm.except_unwind_info.
	* config/picochip/picochip-protos.h (picochip_except_unwind_info):
	Remove prototype.

c-family:
2010-11-24  Joseph Myers  <joseph@codesourcery.com>

	* c-cppbuiltin.c (c_cpp_builtins): Pass &global_options to
	targetm.except_unwind_info.

Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 167113)
+++ gcc/doc/tm.texi	(working copy)
@@ -2872,6 +2872,9 @@ otherwise there is no default implementa
 macro or @code{IRA_COVER_CLASSES} in order to use the integrated register
 allocator with Chaitin-Briggs coloring. If the macro is not defined,
 the only available coloring algorithm is Chow's priority coloring.
+
+This hook must not be modified from @code{NULL} to non-@code{NULL} or
+vice versa by command-line option processing.
 @end deftypefn
 
 @defmac IRA_COVER_CLASSES
@@ -4936,8 +4939,8 @@ The default version of this hook invokes
 normally defined in @file{libgcc2.c}.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_SUPPORTS_SPLIT_STACK (bool)
-Whether this target supports splitting the stack.  This is called after options have been parsed, so the target may reject splitting the stack in some configurations.  The default version of this hook returns false.  If @var{report} is true, this function may issue a warning or error; if @var{report} is false, it must simply return a value
+@deftypefn {Target Hook} bool TARGET_SUPPORTS_SPLIT_STACK (bool @var{report}, struct gcc_options *@var{opts})
+Whether this target supports splitting the stack when the options described in @var{opts} have been passed.  This is called after options have been parsed, so the target may reject splitting the stack in some configurations.  The default version of this hook returns false.  If @var{report} is true, this function may issue a warning or error; if @var{report} is false, it must simply return a value
 @end deftypefn
 
 @node Varargs
@@ -7340,6 +7343,7 @@ Return NULL if function should go to def
 
 @deftypevr {Target Hook} bool TARGET_HAVE_NAMED_SECTIONS
 This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}.
+It must not be modified by command-line option processing.
 @end deftypevr
 
 @anchor{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}
@@ -8860,7 +8864,7 @@ Otherwise, if your target supports this 
 or @code{OBJECT_FORMAT_ELF}), GCC will provide a default definition of 1.
 @end defmac
 
-@deftypefn {Target Hook} {enum unwind_info_type} TARGET_EXCEPT_UNWIND_INFO (void)
+@deftypefn {Target Hook} {enum unwind_info_type} TARGET_EXCEPT_UNWIND_INFO (struct gcc_options *@var{opts})
 This hook defines the mechanism that will be used for exception handling
 by the target.  If the target has ABI specified unwind tables, the hook
 should return @code{UI_TARGET}.  If the target is to use the
@@ -8873,19 +8877,23 @@ This may end up simplifying other parts 
 default implementation of this hook never returns @code{UI_NONE}.
 
 Note that the value returned by this hook should be constant.  It should
-not depend on anything except command-line switches.  In particular, the
+not depend on anything except the command-line switches described by
+@var{opts}.  In particular, the
 setting @code{UI_SJLJ} must be fixed at compiler start-up as C pre-processor
 macros and builtin functions related to exception handling are set up
 depending on this setting.
 
 The default implementation of the hook first honors the
 @option{--enable-sjlj-exceptions} configure option, then
-@code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}.
+@code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}.  If
+@code{DWARF2_UNWIND_INFO} depends on command-line options, the target
+must define this hook so that @var{opts} is used correctly.
 @end deftypefn
 
 @deftypevr {Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT
 This variable should be set to @code{true} if the target ABI requires unwinding
-tables even when exceptions are not used.
+tables even when exceptions are not used.  It must not be modified by
+command-line option processing.
 @end deftypevr
 
 @defmac MUST_USE_SJLJ_EXCEPTIONS
Index: gcc/doc/tm.texi.in
===================================================================
--- gcc/doc/tm.texi.in	(revision 167113)
+++ gcc/doc/tm.texi.in	(working copy)
@@ -2862,6 +2862,9 @@ otherwise there is no default implementa
 macro or @code{IRA_COVER_CLASSES} in order to use the integrated register
 allocator with Chaitin-Briggs coloring. If the macro is not defined,
 the only available coloring algorithm is Chow's priority coloring.
+
+This hook must not be modified from @code{NULL} to non-@code{NULL} or
+vice versa by command-line option processing.
 @end deftypefn
 
 @defmac IRA_COVER_CLASSES
@@ -7315,6 +7318,7 @@ Return NULL if function should go to def
 
 @hook TARGET_HAVE_NAMED_SECTIONS
 This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}.
+It must not be modified by command-line option processing.
 @end deftypevr
 
 @anchor{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}
@@ -8843,19 +8847,23 @@ This may end up simplifying other parts 
 default implementation of this hook never returns @code{UI_NONE}.
 
 Note that the value returned by this hook should be constant.  It should
-not depend on anything except command-line switches.  In particular, the
+not depend on anything except the command-line switches described by
+@var{opts}.  In particular, the
 setting @code{UI_SJLJ} must be fixed at compiler start-up as C pre-processor
 macros and builtin functions related to exception handling are set up
 depending on this setting.
 
 The default implementation of the hook first honors the
 @option{--enable-sjlj-exceptions} configure option, then
-@code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}.
+@code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}.  If
+@code{DWARF2_UNWIND_INFO} depends on command-line options, the target
+must define this hook so that @var{opts} is used correctly.
 @end deftypefn
 
 @hook TARGET_UNWIND_TABLES_DEFAULT
 This variable should be set to @code{true} if the target ABI requires unwinding
-tables even when exceptions are not used.
+tables even when exceptions are not used.  It must not be modified by
+command-line option processing.
 @end deftypevr
 
 @defmac MUST_USE_SJLJ_EXCEPTIONS
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	(revision 167113)
+++ gcc/targhooks.c	(working copy)
@@ -1309,7 +1309,7 @@ default_debug_unwind_info (void)
 /* Determine the exception handling mechanism for the target.  */
 
 enum unwind_info_type
-default_except_unwind_info (void)
+default_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
   /* ??? Change the one user to the hook, then poison this.  */
 #ifdef MUST_USE_SJLJ_EXCEPTIONS
@@ -1335,7 +1335,7 @@ default_except_unwind_info (void)
 /* To be used by targets that force dwarf2 unwind enabled.  */
 
 enum unwind_info_type
-dwarf2_except_unwind_info (void)
+dwarf2_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
   /* Obey the configure switch to turn on sjlj exceptions.  */
 #ifdef CONFIG_SJLJ_EXCEPTIONS
@@ -1349,7 +1349,7 @@ dwarf2_except_unwind_info (void)
 /* To be used by targets that force sjlj unwind enabled.  */
 
 enum unwind_info_type
-sjlj_except_unwind_info (void)
+sjlj_except_unwind_info (struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
   return UI_SJLJ;
 }
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(revision 167113)
+++ gcc/targhooks.h	(working copy)
@@ -163,9 +163,9 @@ extern reg_class_t default_preferred_out
 extern bool default_class_likely_spilled_p (reg_class_t);
 
 extern enum unwind_info_type default_debug_unwind_info (void);
-extern enum unwind_info_type default_except_unwind_info (void);
-extern enum unwind_info_type dwarf2_except_unwind_info (void);
-extern enum unwind_info_type sjlj_except_unwind_info (void);
+extern enum unwind_info_type default_except_unwind_info (struct gcc_options *);
+extern enum unwind_info_type dwarf2_except_unwind_info (struct gcc_options *);
+extern enum unwind_info_type sjlj_except_unwind_info (struct gcc_options *);
 
 extern int default_label_align_after_barrier_max_skip (rtx);
 extern int default_loop_align_max_skip (rtx);
Index: gcc/hooks.c
===================================================================
--- gcc/hooks.c	(revision 167113)
+++ gcc/hooks.c	(working copy)
@@ -56,6 +56,14 @@ hook_bool_bool_false (bool a ATTRIBUTE_U
   return false;
 }
 
+/* Generic hook that takes (bool, struct gcc_options *) and returns false.  */
+bool
+hook_bool_bool_gcc_optionsp_false (bool a ATTRIBUTE_UNUSED,
+				   struct gcc_options *opts ATTRIBUTE_UNUSED)
+{
+  return false;
+}
+
 /* Generic hook that takes const int, const int) and returns true.  */
 bool hook_bool_const_int_const_int_true (const int a ATTRIBUTE_UNUSED,
                                          const int b ATTRIBUTE_UNUSED)
Index: gcc/hooks.h
===================================================================
--- gcc/hooks.h	(revision 167113)
+++ gcc/hooks.h	(working copy)
@@ -28,6 +28,7 @@
 extern bool hook_bool_void_false (void);
 extern bool hook_bool_void_true (void);
 extern bool hook_bool_bool_false (bool);
+extern bool hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *);
 extern bool hook_bool_const_int_const_int_true (const int, const int);
 extern bool hook_bool_mode_false (enum machine_mode);
 extern bool hook_bool_mode_true (enum machine_mode);
Index: gcc/c-family/c-cppbuiltin.c
===================================================================
--- gcc/c-family/c-cppbuiltin.c	(revision 167113)
+++ gcc/c-family/c-cppbuiltin.c	(working copy)
@@ -627,7 +627,7 @@ c_cpp_builtins (cpp_reader *pfile)
 				   1000 + flag_abi_version);
 
   /* libgcc needs to know this.  */
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     cpp_define (pfile, "__USING_SJLJ_EXCEPTIONS__");
 
   /* limits.h and stdint.h need to know these.  */
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 167113)
+++ gcc/target.def	(working copy)
@@ -1831,13 +1831,14 @@ DEFHOOK
 
 DEFHOOK
 (supports_split_stack,
- "Whether this target supports splitting the stack.  This is called\
+ "Whether this target supports splitting the stack when the options\
+ described in @var{opts} have been passed.  This is called\
  after options have been parsed, so the target may reject splitting\
  the stack in some configurations.  The default version of this hook\
  returns false.  If @var{report} is true, this function may issue a warning\
  or error; if @var{report} is false, it must simply return a value",
- bool, (bool),
- hook_bool_bool_false)
+ bool, (bool report, struct gcc_options *opts),
+ hook_bool_bool_gcc_optionsp_false)
 
 /* Returns NULL if target supports the insn within a doloop block,
    otherwise it returns an error message.  */
@@ -2576,7 +2577,7 @@ DEFHOOK
 DEFHOOK
 (except_unwind_info,
  "",
- enum unwind_info_type, (void),
+ enum unwind_info_type, (struct gcc_options *opts),
  default_except_unwind_info)
 
 /* Leave the boolean fields at the end.  */
Index: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(revision 167113)
+++ gcc/defaults.h	(working copy)
@@ -1292,16 +1292,20 @@ see the files COPYING3 and COPYING.RUNTI
 #ifdef STACK_CHECK_PROTECT
 #define STACK_OLD_CHECK_PROTECT STACK_CHECK_PROTECT
 #else
-#define STACK_OLD_CHECK_PROTECT \
- (targetm.except_unwind_info () == UI_SJLJ ? 75 * UNITS_PER_WORD : 8 * 1024)
+#define STACK_OLD_CHECK_PROTECT					\
+ (targetm.except_unwind_info (&global_options) == UI_SJLJ	\
+  ? 75 * UNITS_PER_WORD						\
+  : 8 * 1024)
 #endif
 
 /* Minimum amount of stack required to recover from an anticipated stack
    overflow detection.  The default value conveys an estimate of the amount
    of stack required to propagate an exception.  */
 #ifndef STACK_CHECK_PROTECT
-#define STACK_CHECK_PROTECT \
- (targetm.except_unwind_info () == UI_SJLJ ? 75 * UNITS_PER_WORD : 12 * 1024)
+#define STACK_CHECK_PROTECT					\
+ (targetm.except_unwind_info (&global_options) == UI_SJLJ	\
+  ? 75 * UNITS_PER_WORD						\
+  : 12 * 1024)
 #endif
 
 /* Make the maximum frame size be the largest we can and still only need
Index: gcc/tree-tailcall.c
===================================================================
--- gcc/tree-tailcall.c	(revision 167113)
+++ gcc/tree-tailcall.c	(working copy)
@@ -152,7 +152,7 @@ suitable_for_tail_call_opt_p (void)
   /* If we are using sjlj exceptions, we may need to add a call to
      _Unwind_SjLj_Unregister at exit of the function.  Which means
      that we cannot do any sibcall transformations.  */
-  if (targetm.except_unwind_info () == UI_SJLJ
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ
       && current_function_has_exception_handlers ())
     return false;
 
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 167113)
+++ gcc/tree.c	(working copy)
@@ -9343,7 +9343,8 @@ build_common_builtin_nodes (void)
   ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
   local_define_builtin ("__builtin_unwind_resume", ftype,
 			BUILT_IN_UNWIND_RESUME,
-			(targetm.except_unwind_info () == UI_SJLJ
+			((targetm.except_unwind_info (&global_options)
+			  == UI_SJLJ)
 			 ? "_Unwind_SjLj_Resume" : "_Unwind_Resume"),
 			ECF_NORETURN);
 
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 167113)
+++ gcc/dwarf2out.c	(working copy)
@@ -153,7 +153,7 @@ dwarf2out_do_frame (void)
     return true;
 
   if ((flag_unwind_tables || flag_exceptions)
-      && targetm.except_unwind_info () == UI_DWARF2)
+      && targetm.except_unwind_info (&global_options) == UI_DWARF2)
     return true;
 
   return false;
@@ -189,7 +189,7 @@ dwarf2out_do_cfi_asm (void)
      dwarf2 unwind info for exceptions, then emit .debug_frame by hand.  */
   if (!HAVE_GAS_CFI_SECTIONS_DIRECTIVE
       && !flag_unwind_tables && !flag_exceptions
-      && targetm.except_unwind_info () != UI_DWARF2)
+      && targetm.except_unwind_info (&global_options) != UI_DWARF2)
     return false;
 
   saved_do_cfi_asm = true;
@@ -4072,7 +4072,7 @@ dwarf2out_begin_prologue (unsigned int l
      call-site information.  We must emit this label if it might be used.  */
   if (!do_frame
       && (!flag_exceptions
-	  || targetm.except_unwind_info () != UI_TARGET))
+	  || targetm.except_unwind_info (&global_options) != UI_TARGET))
     return;
 
   fnsec = function_section (current_function_decl);
@@ -4256,7 +4256,7 @@ dwarf2out_frame_init (void)
   dwarf2out_def_cfa (NULL, STACK_POINTER_REGNUM, INCOMING_FRAME_SP_OFFSET);
 
   if (targetm.debug_unwind_info () == UI_DWARF2
-      || targetm.except_unwind_info () == UI_DWARF2)
+      || targetm.except_unwind_info (&global_options) == UI_DWARF2)
     initial_return_save (INCOMING_RETURN_ADDR_RTX);
 }
 
@@ -4269,7 +4269,7 @@ dwarf2out_frame_finish (void)
 
   /* Output another copy for the unwinder.  */
   if ((flag_unwind_tables || flag_exceptions)
-      && targetm.except_unwind_info () == UI_DWARF2)
+      && targetm.except_unwind_info (&global_options) == UI_DWARF2)
     output_call_frame_info (1);
 }
 
@@ -22014,7 +22014,7 @@ dwarf2out_assembly_start (void)
   if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
       && dwarf2out_do_cfi_asm ()
       && (!(flag_unwind_tables || flag_exceptions)
-	  || targetm.except_unwind_info () != UI_DWARF2))
+	  || targetm.except_unwind_info (&global_options) != UI_DWARF2))
     fprintf (asm_out_file, "\t.cfi_sections\t.debug_frame\n");
 }
 
Index: gcc/expr.c
===================================================================
--- gcc/expr.c	(revision 167113)
+++ gcc/expr.c	(working copy)
@@ -10290,7 +10290,7 @@ build_personality_function (const char *
   tree decl, type;
   char *name;
 
-  switch (targetm.except_unwind_info ())
+  switch (targetm.except_unwind_info (&global_options))
     {
     case UI_NONE:
       return NULL;
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 167113)
+++ gcc/opts.c	(working copy)
@@ -632,12 +632,6 @@ finish_options (struct gcc_options *opts
 {
   enum unwind_info_type ui_except;
 
-  /* These assertions are because of the use of target hooks that
-     still access global data rather than being passed an options
-     structure pointer.  */
-  gcc_assert (opts == &global_options);
-  gcc_assert (opts_set = &global_options_set);
-
   if (opts->x_dump_base_name && ! IS_ABSOLUTE_PATH (opts->x_dump_base_name))
     {
       /* First try to make OPTS->X_DUMP_BASE_NAME relative to the
@@ -727,7 +721,7 @@ finish_options (struct gcc_options *opts
      generating unwind info.  If opts->x_flag_exceptions is turned on
      we need to turn off the partitioning optimization.  */
 
-  ui_except = targetm.except_unwind_info ();
+  ui_except = targetm.except_unwind_info (opts);
 
   if (opts->x_flag_exceptions
       && opts->x_flag_reorder_blocks_and_partition
@@ -827,7 +821,7 @@ finish_options (struct gcc_options *opts
     opts->x_flag_split_stack = 0;
   else if (opts->x_flag_split_stack)
     {
-      if (!targetm.supports_split_stack (true))
+      if (!targetm.supports_split_stack (true, opts))
 	{
 	  error_at (loc, "%<-fsplit-stack%> is not supported by "
 		    "this compiler configuration");
@@ -1173,9 +1167,6 @@ common_handle_option (struct gcc_options
   int value = decoded->value;
   enum opt_code code = (enum opt_code) scode;
 
-  gcc_assert (opts == &global_options);
-  gcc_assert (opts_set == &global_options_set);
-  gcc_assert (dc == global_dc);
   gcc_assert (decoded->canonical_option_num_elements <= 2);
 
   switch (code)
Index: gcc/function.c
===================================================================
--- gcc/function.c	(revision 167113)
+++ gcc/function.c	(working copy)
@@ -4900,7 +4900,7 @@ expand_function_end (void)
   /* Output the label for the actual return from the function.  */
   emit_label (return_label);
 
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     {
       /* Let except.c know where it should emit the call to unregister
 	 the function context for sjlj exceptions.  */
@@ -5059,7 +5059,7 @@ expand_function_end (void)
      may trap are not moved into the epilogue by scheduling, because
      we don't always emit unwind information for the epilogue.  */
   if (cfun->can_throw_non_call_exceptions
-      && targetm.except_unwind_info () != UI_SJLJ)
+      && targetm.except_unwind_info (&global_options) != UI_SJLJ)
     emit_insn (gen_blockage ());
 
   /* If stack protection is enabled for this function, check the guard.  */
Index: gcc/except.c
===================================================================
--- gcc/except.c	(revision 167113)
+++ gcc/except.c	(working copy)
@@ -209,7 +209,7 @@ init_eh (void)
 
   /* Create the SjLj_Function_Context structure.  This should match
      the definition in unwind-sjlj.c.  */
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     {
       tree f_jbuf, f_per, f_lsda, f_prev, f_cs, f_data, tmp;
 
@@ -1375,13 +1375,13 @@ finish_eh_generation (void)
   basic_block bb;
 
   /* Construct the landing pads.  */
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     sjlj_build_landing_pads ();
   else
     dw2_build_landing_pads ();
   break_superblocks ();
 
-  if (targetm.except_unwind_info () == UI_SJLJ
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ
       /* Kludge for Alpha/Tru64 (see alpha_gp_save_rtx).  */
       || single_succ_edge (ENTRY_BLOCK_PTR)->insns.r)
     commit_edge_insertions ();
@@ -2622,7 +2622,7 @@ gate_convert_to_eh_region_ranges (void)
   /* Nothing to do for SJLJ exceptions or if no regions created.  */
   if (cfun->eh->region_tree == NULL)
     return false;
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     return false;
   return true;
 }
@@ -2961,7 +2961,7 @@ output_one_function_exception_table (int
 		       eh_data_format_name (tt_format));
 
 #ifndef HAVE_AS_LEB128
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     call_site_len = sjlj_size_of_call_site_table ();
   else
     call_site_len = dw2_size_of_call_site_table (section);
@@ -3028,14 +3028,14 @@ output_one_function_exception_table (int
   dw2_asm_output_delta_uleb128 (cs_end_label, cs_after_size_label,
 				"Call-site table length");
   ASM_OUTPUT_LABEL (asm_out_file, cs_after_size_label);
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     sjlj_output_call_site_table ();
   else
     dw2_output_call_site_table (cs_format, section);
   ASM_OUTPUT_LABEL (asm_out_file, cs_end_label);
 #else
   dw2_asm_output_data_uleb128 (call_site_len, "Call-site table length");
-  if (targetm.except_unwind_info () == UI_SJLJ)
+  if (targetm.except_unwind_info (&global_options) == UI_SJLJ)
     sjlj_output_call_site_table ();
   else
     dw2_output_call_site_table (cs_format, section);
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 167113)
+++ gcc/config/i386/i386.c	(working copy)
@@ -8931,7 +8931,8 @@ ix86_builtin_setjmp_frame_value (void)
    field in the TCB, so they can not be used together.  */
 
 static bool
-ix86_supports_split_stack (bool report ATTRIBUTE_UNUSED)
+ix86_supports_split_stack (bool report ATTRIBUTE_UNUSED,
+			   struct gcc_options *opts ATTRIBUTE_UNUSED)
 {
   bool ret = true;
 
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	(revision 167113)
+++ gcc/config/ia64/ia64.c	(working copy)
@@ -262,7 +262,7 @@ static void ia64_asm_emit_except_persona
 static void ia64_asm_init_sections (void);
 
 static enum unwind_info_type ia64_debug_unwind_info (void);
-static enum unwind_info_type ia64_except_unwind_info (void);
+static enum unwind_info_type ia64_except_unwind_info (struct gcc_options *);
 
 static struct bundle_state *get_free_bundle_state (void);
 static void free_bundle_state (struct bundle_state *);
@@ -3957,7 +3957,7 @@ ia64_output_function_prologue (FILE *fil
 	     current_frame_info.n_output_regs,
 	     current_frame_info.n_rotate_regs);
 
-  if (ia64_except_unwind_info () != UI_TARGET)
+  if (ia64_except_unwind_info (&global_options) != UI_TARGET)
     return;
 
   /* Emit the .prologue directive.  */
@@ -4015,7 +4015,7 @@ ia64_output_function_prologue (FILE *fil
 static void
 ia64_output_function_end_prologue (FILE *file)
 {
-  if (ia64_except_unwind_info () != UI_TARGET)
+  if (ia64_except_unwind_info (&global_options) != UI_TARGET)
     return;
 
   fputs ("\t.body\n", file);
@@ -8637,7 +8637,7 @@ ia64_add_bundle_selector_before (int tem
   ia64_emit_insn_before (b, insn);
 #if NR_BUNDLES == 10
   if ((template0 == 4 || template0 == 5)
-      && ia64_except_unwind_info () == UI_TARGET)
+      && ia64_except_unwind_info (&global_options) == UI_TARGET)
     {
       int i;
       rtx note = NULL_RTX;
@@ -9478,7 +9478,7 @@ ia64_reorg (void)
   /* A call must not be the last instruction in a function, so that the
      return address is still within the function, so that unwinding works
      properly.  Note that IA-64 differs from dwarf2 on this point.  */
-  if (ia64_except_unwind_info () == UI_TARGET)
+  if (ia64_except_unwind_info (&global_options) == UI_TARGET)
     {
       rtx insn;
       int saw_stop = 0;
@@ -9944,7 +9944,7 @@ process_cfa_offset (FILE *asm_out_file, 
 static void
 ia64_asm_unwind_emit (FILE *asm_out_file, rtx insn)
 {
-  bool unwind = ia64_except_unwind_info () == UI_TARGET;
+  bool unwind = ia64_except_unwind_info (&global_options) == UI_TARGET;
   bool frame = dwarf2out_do_frame ();
   rtx note, pat;
   bool handled_one;
@@ -10081,7 +10081,7 @@ ia64_debug_unwind_info (void)
 /* Implement TARGET_EXCEPT_UNWIND_INFO.  */
 
 static enum unwind_info_type
-ia64_except_unwind_info (void)
+ia64_except_unwind_info (struct gcc_options *opts)
 {
   /* Honor the --enable-sjlj-exceptions configure switch.  */
 #ifdef CONFIG_UNWIND_EXCEPTIONS
@@ -10091,7 +10091,7 @@ ia64_except_unwind_info (void)
 
   /* For simplicity elsewhere in this file, indicate that all unwind
      info is disabled if we're not emitting unwind tables.  */
-  if (!flag_exceptions && !flag_unwind_tables)
+  if (!opts->x_flag_exceptions && !opts->x_flag_unwind_tables)
     return UI_NONE;
 
   return UI_TARGET;
Index: gcc/config/picochip/picochip-protos.h
===================================================================
--- gcc/config/picochip/picochip-protos.h	(revision 167113)
+++ gcc/config/picochip/picochip-protos.h	(working copy)
@@ -120,8 +120,6 @@ extern int picochip_flag_schedule_insns2
 
 extern void picochip_asm_output_anchor (rtx symbol);
 
-extern enum unwind_info_type picochip_except_unwind_info (void);
-
 /* Instruction set capability flags.  These are initialised to the
    appropriate values by picochip_option_override, once the user has
    selected a CPU type. */
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 167113)
+++ gcc/config/arm/arm.c	(working copy)
@@ -201,7 +201,7 @@ static bool arm_output_ttype (rtx);
 static void arm_asm_emit_except_personality (rtx);
 static void arm_asm_init_sections (void);
 #endif
-static enum unwind_info_type arm_except_unwind_info (void);
+static enum unwind_info_type arm_except_unwind_info (struct gcc_options *);
 static void arm_dwarf_handle_frame_unspec (const char *, rtx, int);
 static rtx arm_dwarf_register_span (rtx);
 
@@ -2071,7 +2071,8 @@ arm_compute_func_type (void)
   if (optimize > 0
       && (TREE_NOTHROW (current_function_decl)
           || !(flag_unwind_tables
-               || (flag_exceptions && arm_except_unwind_info () != UI_SJLJ)))
+               || (flag_exceptions
+		   && arm_except_unwind_info (&global_options) != UI_SJLJ)))
       && TREE_THIS_VOLATILE (current_function_decl))
     type |= ARM_FT_VOLATILE;
 
@@ -15773,7 +15774,7 @@ arm_expand_prologue (void)
      using the EABI unwinder, to prevent faulting instructions from being
      swapped with a stack adjustment.  */
   if (crtl->profile || !TARGET_SCHED_PROLOG
-      || (arm_except_unwind_info () == UI_TARGET
+      || (arm_except_unwind_info (&global_options) == UI_TARGET
 	  && cfun->can_throw_non_call_exceptions))
     emit_insn (gen_blockage ());
 
@@ -19656,7 +19657,7 @@ thumb_pushpop (FILE *f, unsigned long ma
       return;
     }
 
-  if (push && arm_except_unwind_info () == UI_TARGET)
+  if (push && arm_except_unwind_info (&global_options) == UI_TARGET)
     {
       fprintf (f, "\t.save\t{");
       for (regno = 0; regno < 15; regno++)
@@ -20596,7 +20597,7 @@ thumb1_expand_prologue (void)
      using the EABI unwinder, to prevent faulting instructions from being
      swapped with a stack adjustment.  */
   if (crtl->profile || !TARGET_SCHED_PROLOG
-      || (arm_except_unwind_info () == UI_TARGET
+      || (arm_except_unwind_info (&global_options) == UI_TARGET
 	  && cfun->can_throw_non_call_exceptions))
     emit_insn (gen_blockage ());
 
@@ -20710,7 +20711,7 @@ thumb1_output_function_prologue (FILE *f
   if (crtl->args.pretend_args_size)
     {
       /* Output unwind directive for the stack adjustment.  */
-      if (arm_except_unwind_info () == UI_TARGET)
+      if (arm_except_unwind_info (&global_options) == UI_TARGET)
 	fprintf (f, "\t.pad #%d\n",
 		 crtl->args.pretend_args_size);
 
@@ -20780,7 +20781,7 @@ thumb1_output_function_prologue (FILE *f
 
       work_register = thumb_find_work_register (live_regs_mask);
 
-      if (arm_except_unwind_info () == UI_TARGET)
+      if (arm_except_unwind_info (&global_options) == UI_TARGET)
 	asm_fprintf (f, "\t.pad #16\n");
 
       asm_fprintf
@@ -22388,7 +22389,7 @@ arm_unwind_emit (FILE * asm_out_file, rt
 {
   rtx pat;
 
-  if (arm_except_unwind_info () != UI_TARGET)
+  if (arm_except_unwind_info (&global_options) != UI_TARGET)
     return;
 
   if (!(flag_unwind_tables || crtl->uses_eh_lsda)
@@ -22462,7 +22463,7 @@ arm_asm_init_sections (void)
 /* Implement TARGET_EXCEPT_UNWIND_INFO.  */
 
 static enum unwind_info_type
-arm_except_unwind_info (void)
+arm_except_unwind_info (struct gcc_options *opts)
 {
   /* Honor the --enable-sjlj-exceptions configure switch.  */
 #ifdef CONFIG_SJLJ_EXCEPTIONS
@@ -22475,7 +22476,7 @@ arm_except_unwind_info (void)
     {
       /* For simplicity elsewhere in this file, indicate that all unwind
 	 info is disabled if we're not emitting unwind tables.  */
-      if (!flag_exceptions && !flag_unwind_tables)
+      if (!opts->x_flag_exceptions && !opts->x_flag_unwind_tables)
 	return UI_NONE;
       else
 	return UI_TARGET;
@@ -22515,7 +22516,7 @@ arm_dwarf_handle_frame_unspec (const cha
 void
 arm_output_fn_unwind (FILE * f, bool prologue)
 {
-  if (arm_except_unwind_info () != UI_TARGET)
+  if (arm_except_unwind_info (&global_options) != UI_TARGET)
     return;
 
   if (prologue)
Index: gcc/config/pa/pa.c
===================================================================
--- gcc/config/pa/pa.c	(revision 167113)
+++ gcc/config/pa/pa.c	(working copy)
@@ -543,7 +543,8 @@ pa_option_override (void)
      call frame information.  There is no benefit in using this optimization
      on PA8000 and later processors.  */
   if (pa_cpu >= PROCESSOR_8000
-      || (targetm.except_unwind_info () == UI_DWARF2 && flag_exceptions)
+      || (targetm.except_unwind_info (&global_options) == UI_DWARF2
+	  && flag_exceptions)
       || flag_unwind_tables)
     target_flags &= ~MASK_JUMP_IN_DELAY;
 

-- 
Joseph S. Myers
joseph@codesourcery.com


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