This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: remove dead argument from expand_cleanups
- From: Chris Lattner <sabre at nondot dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 Apr 2003 12:05:47 -0600 (CST)
- Subject: PATCH: remove dead argument from expand_cleanups
Yet-Another-Trival-Patch: All calls to expand_cleanups pass NULL_TREE as
the argument, allowing a conditional to be eliminated from a loop.
* stmt.c (expand_cleanups): Eliminate constant dont_do argument
Index: stmt.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.297
diff -u -r1.297 stmt.c
@@ -415,7 +414,7 @@
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 +735,7 @@
/* 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 +1026,7 @@
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 +1089,7 @@
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);
@@ -3795,7 +3793,7 @@
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 ();
@@ -4271,11 +4269,6 @@
/* 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.
@@ -4283,50 +4276,48 @@
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);
- else
- {
- if (! in_fixup && using_eh_for_cleanups_p)
- expand_eh_region_end_cleanup (TREE_VALUE (tail));
-
- if (reachable && !CLEANUP_EH_ONLY (tail))
- {
- /* Cleanups may be run multiple times. For example,
- when exiting a binding contour, we expand the
- cleanups associated with that contour. When a goto
- within that binding contour has a target outside that
- contour, it will expand all cleanups from its scope to
- the target. Though the cleanups are expanded multiple
- times, the control paths are non-overlapping so the
- cleanups will not be executed twice. */
-
- /* We may need to protect from outer cleanups. */
- if (in_fixup && using_eh_for_cleanups_p)
- {
- expand_eh_region_start ();
-
- expand_expr (TREE_VALUE (tail), const0_rtx, VOIDmode, 0);
-
- expand_eh_region_end_fixup (TREE_VALUE (tail));
- }
- else
- expand_expr (TREE_VALUE (tail), const0_rtx, VOIDmode, 0);
+ {
+ if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
+ expand_cleanups (TREE_VALUE (tail), in_fixup, reachable);
+ else
+ {
+ if (! in_fixup && using_eh_for_cleanups_p)
+ expand_eh_region_end_cleanup (TREE_VALUE (tail));
- free_temp_slots ();
- }
- }
- }
+ if (reachable && !CLEANUP_EH_ONLY (tail))
+ {
+ /* Cleanups may be run multiple times. For example,
+ when exiting a binding contour, we expand the
+ cleanups associated with that contour. When a goto
+ within that binding contour has a target outside that
+ contour, it will expand all cleanups from its scope to
+ the target. Though the cleanups are expanded multiple
+ times, the control paths are non-overlapping so the
+ cleanups will not be executed twice. */
+
+ /* We may need to protect from outer cleanups. */
+ if (in_fixup && using_eh_for_cleanups_p)
+ {
+ expand_eh_region_start ();
+
+ expand_expr (TREE_VALUE (tail), const0_rtx, VOIDmode, 0);
+
+ expand_eh_region_end_fixup (TREE_VALUE (tail));
+ }
+ else
+ expand_expr (TREE_VALUE (tail), const0_rtx, VOIDmode, 0);
+
+ free_temp_slots ();
+ }
+ }
+ }
}
/* Mark when the context we are emitting RTL for as a conditional
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/