* target.def (TARGET_ASM_EMIT_EXCEPT_PERSONALITY): New hook.
* doc/tm.texi.in: Add doc marker.
* doc/tm.texi: Rebuild.
* except.c (switch_to_exception_section): Always build.
(output_one_function_exception_table): Move section switch,
personality output, and label output ...
(output_function_exception_table): ... here. Use the new
personality hook.
* config/ia64/ia64.c (ia64_asm_emit_except_personality,
ia64_asm_init_sections, TARGET_ASM_EMIT_EXCEPT_PERSONALITY,
TARGET_ASM_INIT_SECTIONS): New.
(ia64_asm_unwind_emit): Rename from process_for_unwind_directive,
make static.
(TARGET_ASM_UNWIND_EMIT): Update to match.
* config/ia64/ia64-protos.h (process_for_unwind_directive): Remove.
* config/arm/arm.c (arm_asm_emit_except_personality): New.
(arm_asm_init_sections): New.
(TARGET_ASM_EMIT_EXCEPT_PERSONALITY, TARGET_ASM_INIT_SECTIONS): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163968
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-09-07 Richard Henderson <rth@redhat.com>
+
+ * target.def (TARGET_ASM_EMIT_EXCEPT_PERSONALITY): New hook.
+ * doc/tm.texi.in: Add doc marker.
+ * doc/tm.texi: Rebuild.
+ * except.c (switch_to_exception_section): Always build.
+ (output_one_function_exception_table): Move section switch,
+ personality output, and label output ...
+ (output_function_exception_table): ... here. Use the new
+ personality hook.
+
+ * config/ia64/ia64.c (ia64_asm_emit_except_personality,
+ ia64_asm_init_sections, TARGET_ASM_EMIT_EXCEPT_PERSONALITY,
+ TARGET_ASM_INIT_SECTIONS): New.
+ (ia64_asm_unwind_emit): Rename from process_for_unwind_directive,
+ make static.
+ (TARGET_ASM_UNWIND_EMIT): Update to match.
+ * config/ia64/ia64-protos.h (process_for_unwind_directive): Remove.
+
+ * config/arm/arm.c (arm_asm_emit_except_personality): New.
+ (arm_asm_init_sections): New.
+ (TARGET_ASM_EMIT_EXCEPT_PERSONALITY, TARGET_ASM_INIT_SECTIONS): New.
+
2010-09-07 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* config/arm/arm.md: Remove unused variable.
#ifdef TARGET_UNWIND_INFO
static void arm_unwind_emit (FILE *, rtx);
static bool arm_output_ttype (rtx);
+static void arm_asm_emit_except_personality (rtx);
+static void arm_asm_init_sections (void);
#endif
static void arm_dwarf_handle_frame_unspec (const char *, rtx, int);
static rtx arm_dwarf_register_span (rtx);
#undef TARGET_ARM_EABI_UNWINDER
#define TARGET_ARM_EABI_UNWINDER true
+
+#undef TARGET_ASM_EMIT_EXCEPT_PERSONALITY
+#define TARGET_ASM_EMIT_EXCEPT_PERSONALITY arm_asm_emit_except_personality
+
+#undef TARGET_ASM_INIT_SECTIONS
+#define TARGET_ASM_INIT_SECTIONS arm_asm_init_sections
#endif /* TARGET_UNWIND_INFO */
#undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
return TRUE;
}
+
+/* Implement TARGET_ASM_EMIT_EXCEPT_PERSONALITY. */
+
+static void
+arm_asm_emit_except_personality (rtx personality)
+{
+ fputs ("\t.personality\t", asm_out_file);
+ output_addr_const (asm_out_file, personality);
+ fputc ('\n', asm_out_file);
+}
+
+/* Implement TARGET_ASM_INITIALIZE_SECTIONS. */
+
+static void
+arm_asm_init_sections (void)
+{
+ exception_section = get_unnamed_section (0, output_section_asm_op,
+ "\t.handlerdata");
+}
#endif /* TARGET_UNWIND_INFO */
extern enum reg_class ia64_preferred_reload_class (rtx, enum reg_class);
extern enum reg_class ia64_secondary_reload_class (enum reg_class,
enum machine_mode, rtx);
-extern void process_for_unwind_directive (FILE *, rtx);
extern const char *get_bundle_name (int);
#endif /* RTX_CODE */
static int ia64_sched_reorder2 (FILE *, int, rtx *, int *, int);
static int ia64_variable_issue (FILE *, int, rtx, int);
+static void ia64_asm_unwind_emit (FILE *, rtx);
+static void ia64_asm_emit_except_personality (rtx);
+static void ia64_asm_init_sections (void);
+
static struct bundle_state *get_free_bundle_state (void);
static void free_bundle_state (struct bundle_state *);
static void initiate_bundle_states (void);
#define TARGET_GIMPLIFY_VA_ARG_EXPR ia64_gimplify_va_arg
#undef TARGET_ASM_UNWIND_EMIT
-#define TARGET_ASM_UNWIND_EMIT process_for_unwind_directive
+#define TARGET_ASM_UNWIND_EMIT ia64_asm_unwind_emit
+#undef TARGET_ASM_EMIT_EXCEPT_PERSONALITY
+#define TARGET_ASM_EMIT_EXCEPT_PERSONALITY ia64_asm_emit_except_personality
+#undef TARGET_ASM_INIT_SECTIONS
+#define TARGET_ASM_INIT_SECTIONS ia64_asm_init_sections
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P ia64_scalar_mode_supported_p
/* This function looks at a single insn and emits any directives
required to unwind this insn. */
-void
-process_for_unwind_directive (FILE *asm_out_file, rtx insn)
+static void
+ia64_asm_unwind_emit (FILE *asm_out_file, rtx insn)
{
bool unwind = (flag_unwind_tables
|| (flag_exceptions && !USING_SJLJ_EXCEPTIONS));
}
}
+/* Implement TARGET_ASM_EMIT_EXCEPT_PERSONALITY. */
+
+static void
+ia64_asm_emit_except_personality (rtx personality)
+{
+ fputs ("\t.personality\t", asm_out_file);
+ output_addr_const (asm_out_file, personality);
+ fputc ('\n', asm_out_file);
+}
+
+/* Implement TARGET_ASM_INITIALIZE_SECTIONS. */
+
+static void
+ia64_asm_init_sections (void)
+{
+ exception_section = get_unnamed_section (0, output_section_asm_op,
+ "\t.handlerdata");
+}
\f
enum ia64_builtins
{
The default is that no label is emitted.
@end deftypefn
+@deftypefn {Target Hook} void TARGET_ASM_EMIT_EXCEPT_PERSONALITY (rtx @var{personality})
+If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be used to emit a directive to install a personality hook into the unwind info. This hook should not be used if dwarf2 unwind info is used.
+@end deftypefn
+
@deftypefn {Target Hook} void TARGET_ASM_UNWIND_EMIT (FILE *@var{stream}, rtx @var{insn})
This target hook emits assembly directives required to unwind the
given instruction. This is only used when TARGET_UNWIND_INFO is set.
The default is that no label is emitted.
@end deftypefn
+@hook TARGET_ASM_EMIT_EXCEPT_PERSONALITY
+
@hook TARGET_ASM_UNWIND_EMIT
This target hook emits assembly directives required to unwind the
given instruction. This is only used when TARGET_UNWIND_INFO is set.
call_site_base += n;
}
-#ifndef TARGET_UNWIND_INFO
/* Switch to the section that should be used for exception tables. */
static void
switch_to_section (s);
}
-#endif
/* Output a reference from an exception table to the type_info object TYPE.
}
static void
-output_one_function_exception_table (const char * ARG_UNUSED (fnname),
- int section, rtx ARG_UNUSED (personality))
+output_one_function_exception_table (int section)
{
int tt_format, cs_format, lp_format, i;
#ifdef HAVE_AS_LEB128
int have_tt_data;
int tt_format_size = 0;
-#ifdef TARGET_UNWIND_INFO
- /* TODO: Move this into target file. */
- fputs ("\t.personality\t", asm_out_file);
- output_addr_const (asm_out_file, personality);
- fputs ("\n\t.handlerdata\n", asm_out_file);
- /* Note that varasm still thinks we're in the function's code section.
- The ".endp" directive that will immediately follow will take us back. */
-#else
- switch_to_exception_section (fnname);
-#endif
-
- /* If the target wants a label to begin the table, emit it here. */
- targetm.asm_out.emit_except_table_label (asm_out_file);
-
have_tt_data = (VEC_length (tree, cfun->eh->ttype_data)
|| (targetm.arm_eabi_unwinder
? VEC_length (tree, cfun->eh->ehspec_data.arm_eabi)
}
void
-output_function_exception_table (const char * ARG_UNUSED (fnname))
+output_function_exception_table (const char *fnname)
{
rtx personality = get_personality_function (current_function_decl);
return;
if (personality)
- assemble_external_libcall (personality);
+ {
+ assemble_external_libcall (personality);
+
+ if (targetm.asm_out.emit_except_personality)
+ targetm.asm_out.emit_except_personality (personality);
+ }
+
+ switch_to_exception_section (fnname);
+
+ /* If the target wants a label to begin the table, emit it here. */
+ targetm.asm_out.emit_except_table_label (asm_out_file);
- output_one_function_exception_table (fnname, 0, personality);
+ output_one_function_exception_table (0);
if (crtl->eh.call_site_record[1] != NULL)
- output_one_function_exception_table (fnname, 1, personality);
+ output_one_function_exception_table (1);
switch_to_section (current_function_section ());
}
void, (FILE *stream),
default_emit_except_table_label)
+/* Emit a directive for setting the personality for the function. */
+DEFHOOK
+(emit_except_personality,
+ "If the target implements @code{TARGET_ASM_UNWIND_EMIT}, this hook may be\
+ used to emit a directive to install a personality hook into the unwind\
+ info. This hook should not be used if dwarf2 unwind info is used.",
+ void, (rtx personality),
+ NULL)
+
/* Emit any directives required to unwind this instruction. */
DEFHOOK
(unwind_emit,