* dwarf2out.c (dwarf2out_begin_prologue): Rename IA64_UNWIND_INFO
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Jul 2004 01:07:53 +0000 (01:07 +0000)
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Jul 2004 01:07:53 +0000 (01:07 +0000)
to TARGET_UNWIND_INFO.
* except.c (output_function_exception_table): Ditto.
* except.h: Ditto.
* opts.c (decode_options): Ditto.
* passes.c (rest_of_handle_final): Ditto.
* final.c (final_start_function): Ditto.
(final_scan_insn, final_scan_insn): Replace IA64_UNWIND_EMIT with
target hook.
* targhooks.h (default_unwind_emit): Declare.
* targhooks.c (default_unwind_emit): New function.
* target-def.h: Define and use TARGET_UNWIND_EMIT.
* target.h (struct gcc_target): Add unwind_emit.
* config/ia64/ia64.c (TARGET_UNWIND_EMIT): Define.
* config/ia64/ia64.h: Rename IA64_UNWIND_INFO to TARGET_UNWIND_INFO.
Remove IA64_UNWIND_EMIT.
* doc/tm.texi: Document TARGET_UNWIND_EMIT and TARGET_UNWIND_INFO.

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

14 files changed:
gcc/ChangeLog
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/doc/tm.texi
gcc/dwarf2out.c
gcc/except.c
gcc/except.h
gcc/final.c
gcc/opts.c
gcc/passes.c
gcc/target-def.h
gcc/target.h
gcc/targhooks.c
gcc/targhooks.h

index 6ada078..badfc8c 100644 (file)
@@ -1,3 +1,23 @@
+2004-07-15  Paul Brook  <paul@codesourcery.com>
+
+       * dwarf2out.c (dwarf2out_begin_prologue): Rename IA64_UNWIND_INFO
+       to TARGET_UNWIND_INFO.
+       * except.c (output_function_exception_table): Ditto.
+       * except.h: Ditto.
+       * opts.c (decode_options): Ditto.
+       * passes.c (rest_of_handle_final): Ditto.
+       * final.c (final_start_function): Ditto.
+       (final_scan_insn, final_scan_insn): Replace IA64_UNWIND_EMIT with
+       target hook.
+       * targhooks.h (default_unwind_emit): Declare.
+       * targhooks.c (default_unwind_emit): New function.
+       * target-def.h: Define and use TARGET_UNWIND_EMIT.
+       * target.h (struct gcc_target): Add unwind_emit.
+       * config/ia64/ia64.c (TARGET_UNWIND_EMIT): Define.
+       * config/ia64/ia64.h: Rename IA64_UNWIND_INFO to TARGET_UNWIND_INFO.
+       Remove IA64_UNWIND_EMIT.
+       * doc/tm.texi: Document TARGET_UNWIND_EMIT and TARGET_UNWIND_INFO.
+
 2004-07-14  Richard Henderson  <rth@redhat.com>
 
        * print-tree.c (print_node): Handle SSA_NAME.
index c3a9f5f..85ac56b 100644 (file)
@@ -416,6 +416,9 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef TARGET_GIMPLIFY_VA_ARG_EXPR
 #define TARGET_GIMPLIFY_VA_ARG_EXPR ia64_gimplify_va_arg
 
+#undef TARGET_UNWIND_EMIT
+#define TARGET_UNWIND_EMIT process_for_unwind_directive
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Return 1 if OP is a valid operand for the MEM of a CALL insn.  */
index 28fe2d5..a0ff480 100644 (file)
@@ -2265,8 +2265,7 @@ do {                                                                      \
 
 extern int ia64_final_schedule;
 
-#define IA64_UNWIND_INFO       1
-#define IA64_UNWIND_EMIT(f,i)  process_for_unwind_directive (f,i)
+#define TARGET_UNWIND_INFO     1
 
 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 15 : INVALID_REGNUM)
 
index 72f0fb4..dad9e9a 100644 (file)
@@ -7503,6 +7503,11 @@ true if this is a placeholder label for an omitted FDE.
 The default is that FDEs are not given nonlocal labels.
 @end deftypefn
 
+@deftypefn {Taget Hook} void TARGET_UNWIND_EMIT (FILE * @var{stream}, rtx @var{insn})
+This target hook emits and assembly directives required to unwind the
+given instruction.  This is only used when TARGET_UNWIND_INFO is set.
+@end deftypefn
+
 @node Exception Region Output
 @subsection Assembler Commands for Exception Regions
 
@@ -7552,6 +7557,11 @@ If this macro is defined to anything, the DWARF 2 unwinder will be used
 instead of inline unwinders and @code{__unwind_function} in the non-@code{setjmp} case.
 @end defmac
 
+@defmac TARGET_UNWIND_INFO
+Define this macro if your target has ABI specified unwind tables.  Usually
+these will be output by @code{TARGET_UNWIND_EMIT}.
+@end defmac
+
 @defmac MUST_USE_SJLJ_EXCEPTIONS
 This macro need only be defined if @code{DWARF2_UNWIND_INFO} is
 runtime-variable.  In that case, @file{except.h} cannot correctly
index 109c8d0..a3014cc 100644 (file)
@@ -2360,7 +2360,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
 
   current_function_func_begin_label = 0;
 
-#ifdef IA64_UNWIND_INFO
+#ifdef TARGET_UNWIND_INFO
   /* ??? current_function_func_begin_label is also used by except.c
      for call-site information.  We must emit this label if it might
      be used.  */
@@ -2379,7 +2379,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
                          current_function_funcdef_no);
   current_function_func_begin_label = get_identifier (label);
 
-#ifdef IA64_UNWIND_INFO
+#ifdef TARGET_UNWIND_INFO
   /* We can elide the fde allocation if we're not emitting debug info.  */
   if (! dwarf2out_do_frame ())
     return;
index 5321cd1..e5d32f9 100644 (file)
@@ -3598,7 +3598,8 @@ output_function_exception_table (void)
   if (! cfun->uses_eh_lsda)
     return;
 
-#ifdef IA64_UNWIND_INFO
+#ifdef TARGET_UNWIND_INFO
+  /* TODO: Move this into target file.  */
   fputs ("\t.personality\t", asm_out_file);
   output_addr_const (asm_out_file, eh_personality_libfunc);
   fputs ("\n\t.handlerdata\n", asm_out_file);
index 7a58990..5846148 100644 (file)
@@ -130,7 +130,7 @@ extern tree (*lang_eh_runtime_type) (tree);
 
 #ifndef MUST_USE_SJLJ_EXCEPTIONS
 # if !(defined (EH_RETURN_DATA_REGNO)                  \
-       && (defined (IA64_UNWIND_INFO)                  \
+       && (defined (TARGET_UNWIND_INFO)                        \
           || (DWARF2_UNWIND_INFO                       \
               && (defined (EH_RETURN_HANDLER_RTX)      \
                   || defined (HAVE_eh_return)))))
@@ -152,8 +152,8 @@ extern tree (*lang_eh_runtime_type) (tree);
 #  if !defined(EH_RETURN_HANDLER_RTX) && !defined(HAVE_eh_return)
     #error "EH_RETURN_HANDLER_RTX or eh_return required"
 #  endif
-#  if !defined(DWARF2_UNWIND_INFO) && !defined(IA64_UNWIND_INFO)
-    #error "{DWARF2,IA64}_UNWIND_INFO required"
+#  if !defined(DWARF2_UNWIND_INFO) && !defined(TARGET_UNWIND_INFO)
+    #error "{DWARF2,TARGET}_UNWIND_INFO required"
 #  endif
 # endif
 #else
index 412d0fa..fccb846 100644 (file)
@@ -1347,7 +1347,7 @@ final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file,
 
   (*debug_hooks->begin_prologue) (last_linenum, last_filename);
 
-#if defined (DWARF2_UNWIND_INFO) || defined (IA64_UNWIND_INFO)
+#if defined (DWARF2_UNWIND_INFO) || defined (TARGET_UNWIND_INFO)
   if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG)
     dwarf2out_begin_prologue (0, NULL);
 #endif
@@ -1732,9 +1732,10 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
              && !scan_ahead_for_unlikely_executed_note (insn))
            text_section ();
 
-#ifdef IA64_UNWIND_INFO
-         IA64_UNWIND_EMIT (asm_out_file, insn);
+#ifdef TARGET_UNWIND_INFO
+         targetm.asm_out.unwind_emit (asm_out_file, insn);
 #endif
+
          if (flag_debug_asm)
            fprintf (asm_out_file, "\t%s basic block %d\n",
                     ASM_COMMENT_START, NOTE_BASIC_BLOCK (insn)->index);
@@ -2525,11 +2526,14 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
        if (prescan > 0)
          break;
 
-#ifdef IA64_UNWIND_INFO
-       IA64_UNWIND_EMIT (asm_out_file, insn);
+#ifdef TARGET_UNWIND_INFO
+       /* ??? This will put the directives in the wrong place if
+          get_insn_template outputs assembly directly.  However calling it
+          before get_insn_template breaks if the insns is split.  */
+       targetm.asm_out.unwind_emit (asm_out_file, insn);
 #endif
-       /* Output assembler code from the template.  */
 
+       /* Output assembler code from the template.  */
        output_asm_insn (template, recog_data.operand);
 
        /* If necessary, report the effect that the instruction has on
index 5a4873c..cb9b5f9 100644 (file)
@@ -578,10 +578,10 @@ decode_options (unsigned int argc, const char **argv)
   target_flags = 0;
   set_target_switch ("");
 
-  /* Unwind tables are always present in an ABI-conformant IA-64
-     object file, so the default should be ON.  */
-#ifdef IA64_UNWIND_INFO
-  flag_unwind_tables = IA64_UNWIND_INFO;
+  /* Unwind tables are always present when a target has ABI-specified unwind
+     tables, so the default should be ON.  */
+#ifdef TARGET_UNWIND_INFO
+  flag_unwind_tables = TARGET_UNWIND_INFO;
 #endif
 
 #ifdef OPTIMIZATION_OPTIONS
index 52b71a3..60b4c08 100644 (file)
@@ -457,7 +457,7 @@ rest_of_handle_final (void)
     final (get_insns (), asm_out_file, optimize, 0);
     final_end_function ();
 
-#ifdef IA64_UNWIND_INFO
+#ifdef TARGET_UNWIND_INFO
     /* ??? The IA-64 ".handlerdata" directive must be issued before
        the ".endp" directive that closes the procedure descriptor.  */
     output_function_exception_table ();
@@ -465,7 +465,7 @@ rest_of_handle_final (void)
 
     assemble_end_function (current_function_decl, fnname);
 
-#ifndef IA64_UNWIND_INFO
+#ifndef TARGET_UNWIND_INFO
     /* Otherwise, it feels unclean to switch sections in the middle.  */
     output_function_exception_table ();
 #endif
index 5671b1b..4cf40b5 100644 (file)
@@ -62,6 +62,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_ASM_EMIT_UNWIND_LABEL default_emit_unwind_label
 #endif
 
+#ifndef TARGET_UNWIND_EMIT
+#define TARGET_UNWIND_EMIT default_unwind_emit
+#endif
+
 #ifndef TARGET_ASM_INTERNAL_LABEL
 #define TARGET_ASM_INTERNAL_LABEL default_internal_label
 #endif
@@ -195,6 +199,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                        TARGET_ASM_INTEGER,                     \
                        TARGET_ASM_GLOBALIZE_LABEL,             \
                         TARGET_ASM_EMIT_UNWIND_LABEL,           \
+                       TARGET_UNWIND_EMIT,                     \
                        TARGET_ASM_INTERNAL_LABEL,              \
                        TARGET_ASM_ASSEMBLE_VISIBILITY,         \
                        TARGET_ASM_FUNCTION_PROLOGUE,           \
index f4f4984..2a304a0 100644 (file)
@@ -85,6 +85,9 @@ struct gcc_target
        this is only a placeholder for an omitted FDE.  */
     void (* unwind_label) (FILE *, tree, int, int);
 
+    /* Emit any directives required to unwind this instruction.  */
+    void (* unwind_emit) (FILE *, rtx);
+
     /* Output an internal label.  */
     void (* internal_label) (FILE *, const char *, unsigned long);
 
index be4d144..3eff2fd 100644 (file)
@@ -190,3 +190,14 @@ hook_pass_by_reference_must_pass_in_stack (CUMULATIVE_ARGS *c ATTRIBUTE_UNUSED,
 {
   return targetm.calls.must_pass_in_stack (mode, type);
 }
+
+
+/* Emit any directives required to unwind this instruction.  */
+
+void
+default_unwind_emit (FILE * stream ATTRIBUTE_UNUSED,
+                    rtx insn ATTRIBUTE_UNUSED)
+{
+  /* Should never happen.  */
+  abort ();
+}
index 6d3295c..5fa6a55 100644 (file)
@@ -39,3 +39,5 @@ extern bool hook_pass_by_reference_false
   (CUMULATIVE_ARGS *, enum machine_mode mode, tree, bool);
 extern bool hook_pass_by_reference_must_pass_in_stack
   (CUMULATIVE_ARGS *, enum machine_mode mode, tree, bool);
+
+extern void default_unwind_emit (FILE *, rtx);