This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
A few small cleanups...
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Chris Lattner <sabre at nondot dot org>
- Date: Sun, 20 Apr 2003 15:58:03 -0700
- Subject: A few small cleanups...
Chris asked me to review and apply these patches. I reviewed them,
then I applied them to my local tree and did a bootstrap, and then I
forgot about them for a week. My apologies.
This has now been checked in. I went a little farther than the
original and e.g. renamed genrtl_decl_cleanup to genrtl_cleanup_stmt.
diff -b was used below, because there is reindentation secondary to
the actual change.
zw
2003-04-20 Chris Lattner <sabre at nondot dot org>
Zack Weinberg <zack at codesourcery dot com>
* c-common.h, c-semantics.c: Rename genrtl_decl_cleanup to
genrtl_cleanup_stmt. Correct comment at head of
genrtl_cleanup_stmt (no such thing as a DECL_CLEANUP).
* stmt.c (struct nesting): Kill n_function_calls.
(expand_start_bindings): Don't set
thisblock->data.block.n_function_calls.
(expand_end_bindings): Compare function_call_count against 0.
(expand_cleanups): Kill DONT_DO argument; all callers passed
NULL_TREE. All callers updated to match.
===================================================================
Index: c-common.h
--- c-common.h 11 Apr 2003 04:26:48 -0000 1.177
+++ c-common.h 20 Apr 2003 22:55:25 -0000
@@ -1191,7 +1191,7 @@ extern void genrtl_compound_stmt
extern void genrtl_asm_stmt PARAMS ((tree, tree,
tree, tree,
tree, int));
-extern void genrtl_decl_cleanup PARAMS ((tree));
+extern void genrtl_cleanup_stmt PARAMS ((tree));
extern int stmts_are_full_exprs_p PARAMS ((void));
extern int anon_aggr_type_p PARAMS ((tree));
===================================================================
Index: c-semantics.c
--- c-semantics.c 17 Apr 2003 01:22:46 -0000 1.54
+++ c-semantics.c 20 Apr 2003 22:55:25 -0000
@@ -777,10 +777,10 @@ genrtl_asm_stmt (cv_qualifier, string, o
input_filename, lineno);
}
-/* Generate the RTL for a DECL_CLEANUP. */
+/* Generate the RTL for a CLEANUP_STMT. */
void
-genrtl_decl_cleanup (t)
+genrtl_cleanup_stmt (t)
tree t;
{
tree decl = CLEANUP_DECL (t);
@@ -904,7 +904,7 @@ expand_stmt (t)
break;
case CLEANUP_STMT:
- genrtl_decl_cleanup (t);
+ genrtl_cleanup_stmt (t);
break;
default:
===================================================================
Index: stmt.c
--- stmt.c 18 Apr 2003 06:45:12 -0000 1.298
+++ stmt.c 20 Apr 2003 22:55:28 -0000
@@ -204,8 +204,6 @@ struct nesting GTY(())
/* Chain of labels defined inside this binding contour.
For contours that have stack levels or cleanups. */
struct label_chain *label_chain;
- /* Number of function calls seen, as of start of this block. */
- int n_function_calls;
/* Nonzero if this is associated with an EH region. */
int exception_region;
/* The saved target_temp_slot_level from our outer block.
@@ -415,7 +413,7 @@ static void expand_null_return_1 PARAMS
static enum br_predictor return_prediction PARAMS ((rtx));
static void expand_value_return PARAMS ((rtx));
static int tail_recursion_args PARAMS ((tree, tree));
-static void expand_cleanups PARAMS ((tree, tree, int, int));
+static void expand_cleanups PARAMS ((tree, int, int));
static void check_seenlabel PARAMS ((void));
static void do_jump_if_equal PARAMS ((rtx, rtx, rtx, int));
static int estimate_case_costs PARAMS ((case_node_ptr));
@@ -735,7 +733,7 @@ expand_goto_internal (body, label, last_
/* Execute the cleanups for blocks we are exiting. */
if (block->data.block.cleanups != 0)
{
- expand_cleanups (block->data.block.cleanups, NULL_TREE, 1, 1);
+ expand_cleanups (block->data.block.cleanups, 1, 1);
do_pending_stack_adjust ();
}
}
@@ -1026,7 +1024,7 @@ fixup_gotos (thisblock, stack_level, cle
if (TREE_ADDRESSABLE (lists)
&& TREE_VALUE (lists) != 0)
{
- expand_cleanups (TREE_VALUE (lists), NULL_TREE, 1, 1);
+ expand_cleanups (TREE_VALUE (lists), 1, 1);
/* Pop any pushes done in the cleanups,
in case function is about to return. */
do_pending_stack_adjust ();
@@ -1089,7 +1087,7 @@ fixup_gotos (thisblock, stack_level, cle
start_sequence ();
(*lang_hooks.decls.pushlevel) (0);
(*lang_hooks.decls.set_block) (f->context);
- expand_cleanups (TREE_VALUE (lists), NULL_TREE, 1, 1);
+ expand_cleanups (TREE_VALUE (lists), 1, 1);
do_pending_stack_adjust ();
cleanup_insns = get_insns ();
(*lang_hooks.decls.poplevel) (1, 0, 0);
@@ -3418,7 +3416,6 @@ expand_start_bindings_and_block (flags,
thisblock->depth = ++nesting_depth;
thisblock->data.block.stack_level = 0;
thisblock->data.block.cleanups = 0;
- thisblock->data.block.n_function_calls = 0;
thisblock->data.block.exception_region = 0;
thisblock->data.block.block_target_temp_slot_level = target_temp_slot_level;
@@ -3740,8 +3737,7 @@ expand_end_bindings (vars, mark_ends, do
/* If necessary, make handlers for nonlocal gotos taking
place in the function calls in this block. */
- if (function_call_count != thisblock->data.block.n_function_calls
- && nonlocal_labels
+ if (function_call_count != 0 && nonlocal_labels
/* Make handler for outermost block
if there were any nonlocal gotos to this function. */
&& (thisblock->next == 0 ? current_function_has_nonlocal_label
@@ -3795,7 +3791,7 @@ expand_end_bindings (vars, mark_ends, do
reachable = (! insn || GET_CODE (insn) != BARRIER);
/* Do the cleanups. */
- expand_cleanups (thisblock->data.block.cleanups, NULL_TREE, 0, reachable);
+ expand_cleanups (thisblock->data.block.cleanups, 0, reachable);
if (reachable)
do_pending_stack_adjust ();
@@ -4272,11 +4268,6 @@ expand_anon_union_decl (decl, cleanup, d
/* Expand a list of cleanups LIST.
Elements may be expressions or may be nested lists.
- If DONT_DO is nonnull, then any list-element
- whose TREE_PURPOSE matches DONT_DO is omitted.
- This is sometimes used to avoid a cleanup associated with
- a value that is being returned out of the scope.
-
If IN_FIXUP is nonzero, we are generating this cleanup for a fixup
goto and handle protection regions specially in that case.
@@ -4284,18 +4275,15 @@ expand_anon_union_decl (decl, cleanup, d
code about this finalization. */
static void
-expand_cleanups (list, dont_do, in_fixup, reachable)
+expand_cleanups (list, in_fixup, reachable)
tree list;
- tree dont_do;
int in_fixup;
int reachable;
{
tree tail;
for (tail = list; tail; tail = TREE_CHAIN (tail))
- if (dont_do == 0 || TREE_PURPOSE (tail) != dont_do)
- {
if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
- expand_cleanups (TREE_VALUE (tail), dont_do, in_fixup, reachable);
+ expand_cleanups (TREE_VALUE (tail), in_fixup, reachable);
else
{
if (! in_fixup && using_eh_for_cleanups_p)
@@ -4325,7 +4313,6 @@ expand_cleanups (list, dont_do, in_fixup
expand_expr (TREE_VALUE (tail), const0_rtx, VOIDmode, 0);
free_temp_slots ();
- }
}
}
}