+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.
#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. */
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)
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
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
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. */
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;
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);
#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)))))
# 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
(*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
&& !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);
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
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
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 ();
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
#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
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, \
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);
{
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 ();
+}
(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);