This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
some aux field clearing
- To: gcc-patches at gcc dot gnu dot org
- Subject: some aux field clearing
- From: Richard Henderson <rth at redhat dot com>
- Date: Fri, 26 Oct 2001 00:51:24 -0700
While looking for the Alpha cfg abort, I found a pile
of other places that use the cfg aux fields and don't
clear them.
r~
* cfg.c (clear_aux_for_blocks): Split out of ...
(free_aux_for_blocks): here.
(clear_aux_for_edges): Split from ...
(free_aux_for_edges): here.
* basic-block.h: Declare them.
* lcm.c (compute_antinout_edge): Use them.
(compute_laterin, compute_available, compute_nearerout): Likewise.
(optimize_mode_switching): Likewise.
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.125
diff -c -p -d -r1.125 basic-block.h
*** basic-block.h 2001/10/23 13:34:22 1.125
--- basic-block.h 2001/10/26 07:11:53
*************** extern void flow_edge_list_print PARAMS
*** 649,657 ****
--- 649,659 ----
int, FILE *));
extern void alloc_aux_for_block PARAMS ((basic_block, int));
extern void alloc_aux_for_blocks PARAMS ((int));
+ extern void clear_aux_for_blocks PARAMS ((void));
extern void free_aux_for_blocks PARAMS ((void));
extern void alloc_aux_for_edge PARAMS ((edge, int));
extern void alloc_aux_for_edges PARAMS ((int));
+ extern void clear_aux_for_edges PARAMS ((void));
extern void free_aux_for_edges PARAMS ((void));
/* This function is always defined so it can be called from the
Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.11
diff -c -p -d -r1.11 cfg.c
*** cfg.c 2001/10/16 22:24:16 1.11
--- cfg.c 2001/10/26 07:11:53
*************** alloc_aux_for_blocks (size)
*** 618,639 ****
}
}
! /* Free data allocated in block_aux_obstack and clear AUX pointers
! of all blocks. */
void
! free_aux_for_blocks ()
{
int i;
- if (!first_block_aux_obj)
- abort ();
- obstack_free (&block_aux_obstack, first_block_aux_obj);
for (i = 0; i < n_basic_blocks; i++)
BASIC_BLOCK (i)->aux = NULL;
ENTRY_BLOCK_PTR->aux = NULL;
EXIT_BLOCK_PTR->aux = NULL;
first_block_aux_obj = NULL;
}
/* Allocate an memory edge of SIZE as BB->aux. The obstack must
--- 618,648 ----
}
}
! /* Clear AUX pointers of all blocks. */
void
! clear_aux_for_blocks ()
{
int i;
for (i = 0; i < n_basic_blocks; i++)
BASIC_BLOCK (i)->aux = NULL;
ENTRY_BLOCK_PTR->aux = NULL;
EXIT_BLOCK_PTR->aux = NULL;
+ }
+
+ /* Free data allocated in block_aux_obstack and clear AUX pointers
+ of all blocks. */
+
+ void
+ free_aux_for_blocks ()
+ {
+ if (!first_block_aux_obj)
+ abort ();
+ obstack_free (&block_aux_obstack, first_block_aux_obj);
first_block_aux_obj = NULL;
+
+ clear_aux_for_blocks ();
}
/* Allocate an memory edge of SIZE as BB->aux. The obstack must
*************** alloc_aux_for_edges (size)
*** 687,703 ****
}
}
! /* Free data allocated in edge_aux_obstack and clear AUX pointers
! of all edges. */
void
! free_aux_for_edges ()
{
int i;
- if (!first_edge_aux_obj)
- abort ();
- obstack_free (&edge_aux_obstack, first_edge_aux_obj);
for (i = -1; i < n_basic_blocks; i++)
{
basic_block bb;
--- 696,708 ----
}
}
! /* Clear AUX pointers of all edges. */
void
! clear_aux_for_edges ()
{
int i;
for (i = -1; i < n_basic_blocks; i++)
{
basic_block bb;
*************** free_aux_for_edges ()
*** 710,714 ****
--- 715,732 ----
for (e = bb->succ; e; e = e->succ_next)
e->aux = NULL;
}
+ }
+
+ /* Free data allocated in edge_aux_obstack and clear AUX pointers
+ of all edges. */
+
+ void
+ free_aux_for_edges ()
+ {
+ if (!first_edge_aux_obj)
+ abort ();
+ obstack_free (&edge_aux_obstack, first_edge_aux_obj);
first_edge_aux_obj = NULL;
+
+ clear_aux_for_edges ();
}
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lcm.c,v
retrieving revision 1.29
diff -c -p -d -r1.29 lcm.c
*** lcm.c 2001/10/07 16:50:52 1.29
--- lcm.c 2001/10/26 07:11:53
*************** compute_antinout_edge (antloc, transp, a
*** 177,182 ****
--- 177,184 ----
}
}
+ clear_aux_for_edges ();
+ clear_aux_for_blocks ();
free (worklist);
}
*************** compute_laterin (edge_list, earliest, an
*** 354,359 ****
--- 356,362 ----
laterin[n_basic_blocks],
later[(size_t) e->aux]);
+ clear_aux_for_edges ();
free (worklist);
}
*************** compute_available (avloc, kill, avout, a
*** 565,570 ****
--- 568,575 ----
}
}
+ clear_aux_for_edges ();
+ clear_aux_for_blocks ();
free (worklist);
}
*************** compute_nearerout (edge_list, farthest,
*** 695,700 ****
--- 700,706 ----
nearerout[n_basic_blocks],
nearer[(size_t) e->aux]);
+ clear_aux_for_edges ();
free (tos);
}
*************** optimize_mode_switching (file)
*** 1273,1278 ****
--- 1279,1285 ----
}
}
+ clear_aux_for_edges ();
free_edge_list (edge_list);
}