]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* target.def (supports_split_stack, except_unwind_info): Take
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Nov 2010 13:16:03 +0000 (13:16 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 25 Nov 2010 13:16:03 +0000 (13:16 +0000)
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:
* c-cppbuiltin.c (c_cpp_builtins): Pass &global_options to
targetm.except_unwind_info.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167145 138bc75d-0d04-0410-961f-82ee72b054a4

23 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/config/arm/arm.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/config/pa/pa.c
gcc/config/picochip/picochip-protos.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/dwarf2out.c
gcc/except.c
gcc/expr.c
gcc/function.c
gcc/hooks.c
gcc/hooks.h
gcc/opts.c
gcc/target.def
gcc/targhooks.c
gcc/targhooks.h
gcc/tree-tailcall.c
gcc/tree.c

index c5d09798f4ff270fc3395d93f41e1c95bcd018da..8c5473b4f88a3a8d3167a97799867d65fe45b029 100644 (file)
@@ -1,3 +1,61 @@
+2010-11-25  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.
+
 2010-11-25  Kai Tietz  <kai.tietz@onevision.com>
 
        * cgraphunit.c (process_function_and_variable_attributes):
index 1b14b0ebbbefe06fb015a98f93f2e81dbc573424..41ae904d66cd438ba8862ed89b420f630006684c 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-25  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-cppbuiltin.c (c_cpp_builtins): Pass &global_options to
+       targetm.except_unwind_info.
+
 2010-11-23  Joseph Myers  <joseph@codesourcery.com>
 
        * c-opts.c (c_common_handle_option): Pass location to
index ca779648b20479cd2e82877ce1c009923225d676..50dced35b567236d306acad408b9de8d69f09670 100644 (file)
@@ -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 b195dbdfa5e52a07f3a20385c56f2ea8ba052bd5..ef42e45c57f4149db5ace0054072b39289cd0474 100644 (file)
@@ -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 mask, int push, int *cfa_offset,
       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, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
   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, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
 
       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, rtx insn)
 {
   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 char *label, rtx pattern, int index)
 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 4e2e6e1db804e00c7888076562c15f388bd0fa44..a66a0c4778b77712ff6784ab1879f2dfdb2266d4 100644 (file)
@@ -9037,7 +9037,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 bd42f2b6328d2b22885ec51e2fdf76b3893b3a9c..878cd72a6526c6756962486ffcc6f02f7a5f77df 100644 (file)
@@ -262,7 +262,7 @@ static void ia64_asm_emit_except_personality (rtx);
 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 *);
@@ -4020,7 +4020,7 @@ ia64_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
             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.  */
@@ -4078,7 +4078,7 @@ ia64_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
 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);
@@ -8700,7 +8700,7 @@ ia64_add_bundle_selector_before (int template0, rtx insn)
   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;
@@ -9541,7 +9541,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;
@@ -10007,7 +10007,7 @@ process_cfa_offset (FILE *asm_out_file, rtx pat, bool unwind)
 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;
@@ -10144,7 +10144,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
@@ -10154,7 +10154,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 8b6f5d85418c8c266ea5dfd973517279310ba55e..81d85b9ae64d28f9baa13a77ef65ad289226c2e5 100644 (file)
@@ -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;
 
index b806ea23f743dfdaf976069be407a73ce3951396..965098eec4520100dbd10c293f95d63b1707769a 100644 (file)
@@ -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 fb4a8284422df88b41087c20deaf9fb348a44d97..77e7685f3b0232592783c4f33bec00dadaf7e5d0 100644 (file)
@@ -1292,16 +1292,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #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 6cb25072c13640ec43881f2fc57417cc5a61f60d..6bc5f1f17f2ec918037cb7cd69c16d116fc1e3b6 100644 (file)
@@ -2872,6 +2872,9 @@ otherwise there is no default implementation.  You must define either this
 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 a function called
 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 default text section.
 
 @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 information (if it defines
 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 of target-specific code.  The
 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 DONT_USE_BUILTIN_SETJMP
index 1e4432bce59386b1a5e9c87e104aa1f85cadcba0..47d5be2980a34c8ae7e8d4c80e2cb3204a4224ce 100644 (file)
@@ -2862,6 +2862,9 @@ otherwise there is no default implementation.  You must define either this
 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 default text section.
 
 @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 of target-specific code.  The
 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 DONT_USE_BUILTIN_SETJMP
index 32bb4dc929aab2671874488e069f690a53df74e4..3195a9271c21527ddec71d4672d85220dd949aab 100644 (file)
@@ -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 line ATTRIBUTE_UNUSED,
      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 5ee9ba3ca488eddac8359c2f4853f9c3980133a6..2912caeaa0d3983361d30a68fbe26671d8155ef9 100644 (file)
@@ -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 section)
                       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 section)
   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 889c34ef6d04ec426ae1b41722055414de7ae0cb..56a6249cb50a72ce1d1702731fdfb4efd7264807 100644 (file)
@@ -10290,7 +10290,7 @@ build_personality_function (const char *lang)
   tree decl, type;
   char *name;
 
-  switch (targetm.except_unwind_info ())
+  switch (targetm.except_unwind_info (&global_options))
     {
     case UI_NONE:
       return NULL;
index 0ed674d4b3c7bf9d7c66ac55d30d6288346879fb..c69a5c55554ef741418afd2194d216deca1e865a 100644 (file)
@@ -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 19e294fcbd2b9c5508524af614c9a9deed355504..f859dd96507155f29ee0a0a16e5d89fd4eab15e4 100644 (file)
@@ -56,6 +56,14 @@ hook_bool_bool_false (bool a ATTRIBUTE_UNUSED)
   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 5bfa1ad047eea3595f7433d6c5e79b710d2a2284..7962fe818ba028e02a49af1f8d979001b021ff76 100644 (file)
@@ -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 fb6e6dc048f0c6e5adcd5f122ad0173010e249a3..cd69fe1bd9ff31f82eaf909af019f3a6ca6128c3 100644 (file)
@@ -632,12 +632,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 {
   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, struct gcc_options *opts_set,
      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, struct gcc_options *opts_set,
     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 *opts,
   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 22d5660b13d7493575a60bfd97c9fd3c24c90688..a486ffad4858b6add41c47de78ba5e2b14616e5b 100644 (file)
@@ -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 f55fa8519d8a82d746362de000690f2b1707d5f2..cdc280981cb8c288adbd0acd3235b3214d96e41f 100644 (file)
@@ -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)
 {
   /* Obey the configure switch to turn on sjlj exceptions.  */
 #ifdef CONFIG_SJLJ_EXCEPTIONS
@@ -1329,7 +1329,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
@@ -1343,7 +1343,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 aff1b2745edae965a0b0ee91e4708f5b0245e28b..ce73f994cb8126b32748babe004dff2bc2ac7bcc 100644 (file)
@@ -163,9 +163,9 @@ extern reg_class_t default_preferred_output_reload_class (rtx, reg_class_t);
 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 10ae450886fd5828a61d1b6d28ae7fd47b747243..a9bf62835c7c0761fde89a3b138214ace89b8905 100644 (file)
@@ -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 52df2bef72ef7cfce6768fc1f4fe3534c75a04a9..2f8d96ef4a2054da68715d6135ebb7835a68e0c6 100644 (file)
@@ -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);