Commit 59ebc704 by Kazu Hirata Committed by Kazu Hirata

tree-eh.c (leh_tf_state): Change the type of dest_array to VEC(tree,heap)*.

	* tree-eh.c (leh_tf_state): Change the type of dest_array to
	VEC(tree,heap)*.
	(maybe_record_in_goto_queue, lower_try_finally_onedest,
	lower_try_finally_copy, lower_try_finally_switch,
	lower_try_finally): Use VEC instead of VARRAY.

From-SVN: r99693
parent 82383070
2005-05-14 Kazu Hirata <kazu@cs.umass.edu>
* tree-eh.c (leh_tf_state): Change the type of dest_array to
VEC(tree,heap)*.
(maybe_record_in_goto_queue, lower_try_finally_onedest,
lower_try_finally_copy, lower_try_finally_switch,
lower_try_finally): Use VEC instead of VARRAY.
2005-05-14 Hans-Peter Nilsson <hp@axis.com> 2005-05-14 Hans-Peter Nilsson <hp@axis.com>
* config/cris/cris.h (Node: Register Classes): Remove obsoleted * config/cris/cris.h (Node: Register Classes): Remove obsoleted
......
...@@ -320,7 +320,7 @@ struct leh_tf_state ...@@ -320,7 +320,7 @@ struct leh_tf_state
size_t goto_queue_active; size_t goto_queue_active;
/* The set of unique labels seen as entries in the goto queue. */ /* The set of unique labels seen as entries in the goto queue. */
varray_type dest_array; VEC(tree,heap) *dest_array;
/* A label to be added at the end of the completed transformed /* A label to be added at the end of the completed transformed
sequence. It will be set if may_fallthru was true *at one time*, sequence. It will be set if may_fallthru was true *at one time*,
...@@ -501,18 +501,18 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt) ...@@ -501,18 +501,18 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt)
if (! tf->dest_array) if (! tf->dest_array)
{ {
VARRAY_TREE_INIT (tf->dest_array, 10, "dest_array"); tf->dest_array = VEC_alloc (tree, heap, 10);
VARRAY_PUSH_TREE (tf->dest_array, lab); VEC_quick_push (tree, tf->dest_array, lab);
index = 0; index = 0;
} }
else else
{ {
int n = VARRAY_ACTIVE_SIZE (tf->dest_array); int n = VEC_length (tree, tf->dest_array);
for (index = 0; index < n; ++index) for (index = 0; index < n; ++index)
if (VARRAY_TREE (tf->dest_array, index) == lab) if (VEC_index (tree, tf->dest_array, index) == lab)
break; break;
if (index == n) if (index == n)
VARRAY_PUSH_TREE (tf->dest_array, lab); VEC_safe_push (tree, heap, tf->dest_array, lab);
} }
} }
break; break;
...@@ -996,7 +996,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf) ...@@ -996,7 +996,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
do_goto_redirection (q, finally_label, NULL); do_goto_redirection (q, finally_label, NULL);
replace_goto_queue (tf); replace_goto_queue (tf);
if (VARRAY_TREE (tf->dest_array, 0) == tf->fallthru_label) if (VEC_index (tree, tf->dest_array, 0) == tf->fallthru_label)
{ {
/* Reachable by goto to fallthru label only. Redirect it /* Reachable by goto to fallthru label only. Redirect it
to the new label (already created, sadly), and do not to the new label (already created, sadly), and do not
...@@ -1060,10 +1060,7 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf) ...@@ -1060,10 +1060,7 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
tree label; tree label;
} *labels; } *labels;
if (tf->dest_array) return_index = VEC_length (tree, tf->dest_array);
return_index = VARRAY_ACTIVE_SIZE (tf->dest_array);
else
return_index = 0;
labels = xcalloc (sizeof (*labels), return_index + 1); labels = xcalloc (sizeof (*labels), return_index + 1);
q = tf->goto_queue; q = tf->goto_queue;
...@@ -1152,10 +1149,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf) ...@@ -1152,10 +1149,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
lower_eh_constructs_1 (state, &finally); lower_eh_constructs_1 (state, &finally);
/* Prepare for switch statement generation. */ /* Prepare for switch statement generation. */
if (tf->dest_array) nlabels = VEC_length (tree, tf->dest_array);
nlabels = VARRAY_ACTIVE_SIZE (tf->dest_array);
else
nlabels = 0;
return_index = nlabels; return_index = nlabels;
eh_index = return_index + tf->may_return; eh_index = return_index + tf->may_return;
fallthru_index = eh_index + tf->may_throw; fallthru_index = eh_index + tf->may_throw;
...@@ -1389,10 +1383,7 @@ lower_try_finally (struct leh_state *state, tree *tp) ...@@ -1389,10 +1383,7 @@ lower_try_finally (struct leh_state *state, tree *tp)
how many destinations are reached by the finally block. Use this to how many destinations are reached by the finally block. Use this to
determine how we process the finally block itself. */ determine how we process the finally block itself. */
if (this_tf.dest_array) ndests = VEC_length (tree, this_tf.dest_array);
ndests = VARRAY_ACTIVE_SIZE (this_tf.dest_array);
else
ndests = 0;
ndests += this_tf.may_fallthru; ndests += this_tf.may_fallthru;
ndests += this_tf.may_return; ndests += this_tf.may_return;
ndests += this_tf.may_throw; ndests += this_tf.may_throw;
...@@ -1424,6 +1415,7 @@ lower_try_finally (struct leh_state *state, tree *tp) ...@@ -1424,6 +1415,7 @@ lower_try_finally (struct leh_state *state, tree *tp)
append_to_statement_list (x, tp); append_to_statement_list (x, tp);
} }
VEC_free (tree, heap, this_tf.dest_array);
if (this_tf.goto_queue) if (this_tf.goto_queue)
free (this_tf.goto_queue); free (this_tf.goto_queue);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment