This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] except.c: Split ehspec_data into ehspec_data_tree and ehspec_data_uchar.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 24 Dec 2006 13:56:09 -0800
- Subject: [patch] except.c: Split ehspec_data into ehspec_data_tree and ehspec_data_uchar.
Hi,
Attached is a patch to split ehspec_data into ehspec_data_tree and
ehspec_d.
When we convert ehspec_data to VEC, we can have to use VEC with a
single type. We cannot mix VEC of tree and uchar. The patch splits
ehspec_data into ehspec_data_tree and ehspec_data_uchar.
I thought about using union, but I think that may be a bit ugly.
Tested on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2006-12-24 Kazu Hirata <kazu@codesourcery.com>
* except.c (eh_status): Remove ehspec_data. Add
ehspec_data_tree and ehspec_data_uchar.
(add_ehspec_entry, assign_filter_values,
output_function_exception_table): Adjust uses of ehspec_data.
Index: except.c
===================================================================
--- except.c (revision 120179)
+++ except.c (working copy)
@@ -232,7 +232,8 @@ struct eh_status GTY(())
int last_region_number;
VEC(tree,gc) *ttype_data;
- varray_type ehspec_data;
+ varray_type ehspec_data_tree;
+ varray_type ehspec_data_uchar;
varray_type action_record_data;
htab_t GTY ((param_is (struct ehl_map_entry))) exception_handler_label_map;
@@ -1246,8 +1247,9 @@ add_ttypes_entry (htab_t ttypes_hash, tr
return n->filter;
}
-/* Add LIST to cfun->eh->ehspec_data, using EHSPEC_HASH and TYPES_HASH
- to speed up the search. Return the filter value to be used. */
+/* Add LIST to cfun->eh->ehspec_data_tree or
+ cfun->eh->ehspec_data_uchar, using EHSPEC_HASH and TYPES_HASH to
+ speed up the search. Return the filter value to be used. */
static int
add_ehspec_entry (htab_t ehspec_hash, htab_t ttypes_hash, tree list)
@@ -1265,26 +1267,29 @@ add_ehspec_entry (htab_t ehspec_hash, ht
n = XNEW (struct ttypes_filter);
n->t = list;
- n->filter = -(VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) + 1);
+ if (targetm.arm_eabi_unwinder)
+ n->filter = -(VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data_tree) + 1);
+ else
+ n->filter = -(VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data_uchar) + 1);
*slot = n;
/* Generate a 0 terminated list of filter values. */
for (; list ; list = TREE_CHAIN (list))
{
if (targetm.arm_eabi_unwinder)
- VARRAY_PUSH_TREE (cfun->eh->ehspec_data, TREE_VALUE (list));
+ VARRAY_PUSH_TREE (cfun->eh->ehspec_data_tree, TREE_VALUE (list));
else
{
/* Look up each type in the list and encode its filter
value as a uleb128. */
- push_uleb128 (&cfun->eh->ehspec_data,
+ push_uleb128 (&cfun->eh->ehspec_data_uchar,
add_ttypes_entry (ttypes_hash, TREE_VALUE (list)));
}
}
if (targetm.arm_eabi_unwinder)
- VARRAY_PUSH_TREE (cfun->eh->ehspec_data, NULL_TREE);
+ VARRAY_PUSH_TREE (cfun->eh->ehspec_data_tree, NULL_TREE);
else
- VARRAY_PUSH_UCHAR (cfun->eh->ehspec_data, 0);
+ VARRAY_PUSH_UCHAR (cfun->eh->ehspec_data_uchar, 0);
}
return n->filter;
@@ -1303,9 +1308,9 @@ assign_filter_values (void)
cfun->eh->ttype_data = VEC_alloc (tree, gc, 16);
if (targetm.arm_eabi_unwinder)
- VARRAY_TREE_INIT (cfun->eh->ehspec_data, 64, "ehspec_data");
+ VARRAY_TREE_INIT (cfun->eh->ehspec_data_tree, 64, "ehspec_data");
else
- VARRAY_UCHAR_INIT (cfun->eh->ehspec_data, 64, "ehspec_data");
+ VARRAY_UCHAR_INIT (cfun->eh->ehspec_data_uchar, 64, "ehspec_data");
ttypes = htab_create (31, ttypes_filter_hash, ttypes_filter_eq, free);
ehspec = htab_create (31, ehspec_filter_hash, ehspec_filter_eq, free);
@@ -3629,6 +3634,7 @@ output_function_exception_table (const c
#endif
int have_tt_data;
int tt_format_size = 0;
+ int ehspec_data_len;
if (eh_personality_libfunc)
assemble_external_libcall (eh_personality_libfunc);
@@ -3651,8 +3657,12 @@ output_function_exception_table (const c
/* If the target wants a label to begin the table, emit it here. */
targetm.asm_out.except_table_label (asm_out_file);
+ if (targetm.arm_eabi_unwinder)
+ ehspec_data_len = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data_tree);
+ else
+ ehspec_data_len = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data_uchar);
have_tt_data = (VEC_length (tree, cfun->eh->ttype_data) > 0
- || VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) > 0);
+ || ehspec_data_len > 0);
/* Indicate the format of the @TType entries. */
if (! have_tt_data)
@@ -3789,16 +3799,19 @@ output_function_exception_table (const c
#endif
/* ??? Decode and interpret the data for flag_debug_asm. */
- n = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data);
+ if (targetm.arm_eabi_unwinder)
+ n = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data_tree);
+ else
+ n = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data_uchar);
for (i = 0; i < n; ++i)
{
if (targetm.arm_eabi_unwinder)
{
- tree type = VARRAY_TREE (cfun->eh->ehspec_data, i);
+ tree type = VARRAY_TREE (cfun->eh->ehspec_data_tree, i);
output_ttype (type, tt_format, tt_format_size);
}
else
- dw2_asm_output_data (1, VARRAY_UCHAR (cfun->eh->ehspec_data, i),
+ dw2_asm_output_data (1, VARRAY_UCHAR (cfun->eh->ehspec_data_uchar, i),
(i ? NULL : "Exception specification table"));
}