Commit 9e2f83a5 by Zdenek Dvorak Committed by Zdenek Dvorak

tree-ssa-loop-niter.c (record_estimate): Use GGC_NEW to allocate struct nb_iter_bound.

	* tree-ssa-loop-niter.c (record_estimate): Use GGC_NEW to allocate
	struct nb_iter_bound.
	(free_numbers_of_iterations_estimates_loop): Use ggc_free.
	* gengtype.c (open_base_files): Add cfhloop.h to the list of includes.
	* cfgloopmanip.c (place_new_loop): Vector larray is gc-allocated.
	* tree-scalar-evolution.c: Include gt-tree-scalar-evolution.h.
	(struct scev_info_str, scalar_evolution_info): Add GTY markers.
	(new_scev_info_str): Use GGC_NEW to allocate struct scev_info_str.
	(del_scev_info): Use ggc_free.
	(scev_initialize): Allocate scalar_evolution_info in gc memory.
	* loop-init.c: Include ggc.h.
	(loop_optimizer_init): Use GGC_CNEW to allocate struct loops.
	(loop_optimizer_finalize): Use ggc_free.
	* tree-ssa-loop.c (pass_tree_unswitch, pass_vectorize,
	pass_linear_transfom, pass_empty_loop, pass_complete_unroll,
	pass_iv_optimize): Add TODO_ggc_collect.
	* function.h (struct function): Remove skip marker from x_current_loops.
	* cfgloop.c: Include ggc.h.
	(flow_loops_free, flow_loop_free): Free the loop descriptions in gc
	memory.
	(establish_preds): Vector superloops is gc allocated.
	(alloc_loop): Allocate loop using GGC_CNEW.  Allocate head of
	loop->exits list.
	(flow_loops_find): Vector larray is gc allocated.
	(loop_exit_free): Use ggc_free.
	(rescan_loop_exit): Use GGC_NEW to allocate struct loop_exit.  Reflect
	that head of exits list is now not a part of struct loop.
	(record_loop_exits): Allocate exits table in gc memory.
	(get_loop_exit_edges, verify_loop_structure, single_exit): Reflect that
	head of exits list is now not a part of struct loop.
	* cfgloop.h (struct lpt_decision, struct nb_iter_bound,
	struct loop_exit): Add GTY marker.
	(struct loop): Add GTY marker.  Make superloops vector gc allocated.
	Add skip marker to aux field.  Make head of exits list a separate
	object.
	(struct loops): Add GTY marker.  Make larray vector gc allocated.
	Add param marker to exits table.
	(get_loops): Type changed.
	* Makefile.in (tree-scalar-evolution.o): Add gt-tree-scalar-evolution.h
	dependency.
	(cfgloop.o, loop-init.o): Add ggc.h dependency.
	(GTFILES): Add cfgloop.h and tree-scalar-evolution.c.
	* basic-block.h (struct basic_block_def): Remove skip marker from
	loop_father field.

From-SVN: r124727
parent 9c49a5e4
2007-05-15 Zdenek Dvorak <dvorakz@suse.cz>
* tree-ssa-loop-niter.c (record_estimate): Use GGC_NEW to allocate
struct nb_iter_bound.
(free_numbers_of_iterations_estimates_loop): Use ggc_free.
* gengtype.c (open_base_files): Add cfhloop.h to the list of includes.
* cfgloopmanip.c (place_new_loop): Vector larray is gc-allocated.
* tree-scalar-evolution.c: Include gt-tree-scalar-evolution.h.
(struct scev_info_str, scalar_evolution_info): Add GTY markers.
(new_scev_info_str): Use GGC_NEW to allocate struct scev_info_str.
(del_scev_info): Use ggc_free.
(scev_initialize): Allocate scalar_evolution_info in gc memory.
* loop-init.c: Include ggc.h.
(loop_optimizer_init): Use GGC_CNEW to allocate struct loops.
(loop_optimizer_finalize): Use ggc_free.
* tree-ssa-loop.c (pass_tree_unswitch, pass_vectorize,
pass_linear_transfom, pass_empty_loop, pass_complete_unroll,
pass_iv_optimize): Add TODO_ggc_collect.
* function.h (struct function): Remove skip marker from x_current_loops.
* cfgloop.c: Include ggc.h.
(flow_loops_free, flow_loop_free): Free the loop descriptions in gc
memory.
(establish_preds): Vector superloops is gc allocated.
(alloc_loop): Allocate loop using GGC_CNEW. Allocate head of
loop->exits list.
(flow_loops_find): Vector larray is gc allocated.
(loop_exit_free): Use ggc_free.
(rescan_loop_exit): Use GGC_NEW to allocate struct loop_exit. Reflect
that head of exits list is now not a part of struct loop.
(record_loop_exits): Allocate exits table in gc memory.
(get_loop_exit_edges, verify_loop_structure, single_exit): Reflect that
head of exits list is now not a part of struct loop.
* cfgloop.h (struct lpt_decision, struct nb_iter_bound,
struct loop_exit): Add GTY marker.
(struct loop): Add GTY marker. Make superloops vector gc allocated.
Add skip marker to aux field. Make head of exits list a separate
object.
(struct loops): Add GTY marker. Make larray vector gc allocated.
Add param marker to exits table.
(get_loops): Type changed.
* Makefile.in (tree-scalar-evolution.o): Add gt-tree-scalar-evolution.h
dependency.
(cfgloop.o, loop-init.o): Add ggc.h dependency.
(GTFILES): Add cfgloop.h and tree-scalar-evolution.c.
* basic-block.h (struct basic_block_def): Remove skip marker from
loop_father field.
2007-05-14 Uros Bizjak <ubizjak@gmail.com> 2007-05-14 Uros Bizjak <ubizjak@gmail.com>
* builtins.c (expand_builtin_mathfn): Use EXPAND_NORMAL instead * builtins.c (expand_builtin_mathfn): Use EXPAND_NORMAL instead
......
...@@ -2188,7 +2188,8 @@ tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -2188,7 +2188,8 @@ tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \ tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \ coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \
$(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \ $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
$(TIMEVAR_H) $(CFGLOOP_H) $(SCEV_H) tree-pass.h $(FLAGS_H) tree-chrec.h $(TIMEVAR_H) $(CFGLOOP_H) $(SCEV_H) tree-pass.h $(FLAGS_H) tree-chrec.h \
gt-tree-scalar-evolution.h
tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
...@@ -2571,7 +2572,8 @@ cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -2571,7 +2572,8 @@ cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(REGS_H) $(EMIT_RTL_H) $(CFGLAYOUT_H) tree-pass.h $(CFGLOOP_H) $(EXPR_H) $(REGS_H) $(EMIT_RTL_H) $(CFGLAYOUT_H) tree-pass.h $(CFGLOOP_H) $(EXPR_H)
cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \ cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(FLAGS_H) $(FUNCTION_H) \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(FLAGS_H) $(FUNCTION_H) \
$(OBSTACK_H) toplev.h $(TREE_FLOW_H) $(TREE_H) pointer-set.h output.h $(OBSTACK_H) toplev.h $(TREE_FLOW_H) $(TREE_H) pointer-set.h output.h \
$(GGC_H)
cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h $(TM_H) \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h $(TM_H) \
$(OBSTACK_H) output.h $(OBSTACK_H) output.h
...@@ -2589,7 +2591,7 @@ loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ ...@@ -2589,7 +2591,7 @@ loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) output.h \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) output.h \
coretypes.h $(TM_H) cfghooks.h $(OBSTACK_H) coretypes.h $(TM_H) cfghooks.h $(OBSTACK_H)
loop-init.o : loop-init.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ loop-init.o : loop-init.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(GGC_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) \ $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) \
coretypes.h $(TM_H) $(OBSTACK_H) tree-pass.h $(TIMEVAR_H) $(FLAGS_H) coretypes.h $(TM_H) $(OBSTACK_H) tree-pass.h $(TIMEVAR_H) $(FLAGS_H)
loop-unswitch.o : loop-unswitch.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_H) \ loop-unswitch.o : loop-unswitch.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TM_H) \
...@@ -2977,7 +2979,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \ ...@@ -2977,7 +2979,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/coverage.c $(srcdir)/rtl.h \ $(srcdir)/coverage.c $(srcdir)/rtl.h \
$(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/function.h $(srcdir)/libfuncs.h $(SYMTAB_H) \ $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/function.h $(srcdir)/libfuncs.h $(SYMTAB_H) \
$(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \ $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
$(srcdir)/ipa-reference.h $(srcdir)/output.h \ $(srcdir)/ipa-reference.h $(srcdir)/output.h $(srcdir)/cfgloop.h \
$(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \ $(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \
$(srcdir)/reload.h \ $(srcdir)/reload.h \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \ $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
...@@ -2991,7 +2993,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \ ...@@ -2991,7 +2993,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \ $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \
$(srcdir)/sdbout.c $(srcdir)/stor-layout.c \ $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
$(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \ $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
$(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \ $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h $(srcdir)/tree-scalar-evolution.c \
$(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \ $(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
$(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \ $(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
$(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \ $(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \
......
...@@ -221,7 +221,7 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb") ...@@ -221,7 +221,7 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb")
PTR GTY ((skip (""))) aux; PTR GTY ((skip (""))) aux;
/* Innermost loop containing the block. */ /* Innermost loop containing the block. */
struct loop * GTY ((skip (""))) loop_father; struct loop *loop_father;
/* The dominance and postdominance information node. */ /* The dominance and postdominance information node. */
struct et_node * GTY ((skip (""))) dom[2]; struct et_node * GTY ((skip (""))) dom[2];
......
...@@ -34,6 +34,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -34,6 +34,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-flow.h" #include "tree-flow.h"
#include "pointer-set.h" #include "pointer-set.h"
#include "output.h" #include "output.h"
#include "ggc.h"
static void flow_loops_cfg_dump (FILE *); static void flow_loops_cfg_dump (FILE *);
...@@ -174,25 +175,27 @@ flow_loops_dump (FILE *file, void (*loop_dump_aux) (const struct loop *, FILE *, ...@@ -174,25 +175,27 @@ flow_loops_dump (FILE *file, void (*loop_dump_aux) (const struct loop *, FILE *,
} }
/* Free data allocated for LOOP. */ /* Free data allocated for LOOP. */
void void
flow_loop_free (struct loop *loop) flow_loop_free (struct loop *loop)
{ {
struct loop_exit *exit, *next; struct loop_exit *exit, *next;
VEC_free (loop_p, heap, loop->superloops); VEC_free (loop_p, gc, loop->superloops);
/* Break the list of the loop exit records. They will be freed when the /* Break the list of the loop exit records. They will be freed when the
corresponding edge is rescanned or removed, and this avoids corresponding edge is rescanned or removed, and this avoids
accessing the (already released) head of the list stored in the accessing the (already released) head of the list stored in the
loop structure. */ loop structure. */
for (exit = loop->exits.next; exit != &loop->exits; exit = next) for (exit = loop->exits->next; exit != loop->exits; exit = next)
{ {
next = exit->next; next = exit->next;
exit->next = exit; exit->next = exit;
exit->prev = exit; exit->prev = exit;
} }
free (loop); ggc_free (loop->exits);
ggc_free (loop);
} }
/* Free all the memory allocated for LOOPS. */ /* Free all the memory allocated for LOOPS. */
...@@ -214,8 +217,7 @@ flow_loops_free (struct loops *loops) ...@@ -214,8 +217,7 @@ flow_loops_free (struct loops *loops)
flow_loop_free (loop); flow_loop_free (loop);
} }
VEC_free (loop_p, heap, loops->larray); VEC_free (loop_p, gc, loops->larray);
loops->larray = NULL;
} }
} }
...@@ -286,7 +288,7 @@ establish_preds (struct loop *loop, struct loop *father) ...@@ -286,7 +288,7 @@ establish_preds (struct loop *loop, struct loop *father)
cfun->max_loop_depth = MAX (cfun->max_loop_depth, (int) depth); cfun->max_loop_depth = MAX (cfun->max_loop_depth, (int) depth);
VEC_truncate (loop_p, loop->superloops, 0); VEC_truncate (loop_p, loop->superloops, 0);
VEC_reserve (loop_p, heap, loop->superloops, depth); VEC_reserve (loop_p, gc, loop->superloops, depth);
for (i = 0; VEC_iterate (loop_p, father->superloops, i, ploop); i++) for (i = 0; VEC_iterate (loop_p, father->superloops, i, ploop); i++)
VEC_quick_push (loop_p, loop->superloops, ploop); VEC_quick_push (loop_p, loop->superloops, ploop);
VEC_quick_push (loop_p, loop->superloops, father); VEC_quick_push (loop_p, loop->superloops, father);
...@@ -335,9 +337,11 @@ flow_loop_tree_node_remove (struct loop *loop) ...@@ -335,9 +337,11 @@ flow_loop_tree_node_remove (struct loop *loop)
struct loop * struct loop *
alloc_loop (void) alloc_loop (void)
{ {
struct loop *loop = XCNEW (struct loop); struct loop *loop = GGC_CNEW (struct loop);
loop->exits = GGC_CNEW (struct loop_exit);
loop->exits->next = loop->exits->prev = loop->exits;
loop->exits.next = loop->exits.prev = &loop->exits;
return loop; return loop;
} }
...@@ -417,7 +421,7 @@ flow_loops_find (struct loops *loops) ...@@ -417,7 +421,7 @@ flow_loops_find (struct loops *loops)
} }
/* Allocate loop structures. */ /* Allocate loop structures. */
loops->larray = VEC_alloc (loop_p, heap, num_loops + 1); loops->larray = VEC_alloc (loop_p, gc, num_loops + 1);
/* Dummy loop containing whole function. */ /* Dummy loop containing whole function. */
root = alloc_loop (); root = alloc_loop ();
...@@ -961,7 +965,7 @@ loop_exit_free (void *ex) ...@@ -961,7 +965,7 @@ loop_exit_free (void *ex)
exit->next->prev = exit->prev; exit->next->prev = exit->prev;
exit->prev->next = exit->next; exit->prev->next = exit->next;
free (exit); ggc_free (exit);
} }
} }
...@@ -1000,11 +1004,11 @@ rescan_loop_exit (edge e, bool new_edge, bool removed) ...@@ -1000,11 +1004,11 @@ rescan_loop_exit (edge e, bool new_edge, bool removed)
aloop != cloop; aloop != cloop;
aloop = loop_outer (aloop)) aloop = loop_outer (aloop))
{ {
exit = XNEW (struct loop_exit); exit = GGC_NEW (struct loop_exit);
exit->e = e; exit->e = e;
exit->next = aloop->exits.next; exit->next = aloop->exits->next;
exit->prev = &aloop->exits; exit->prev = aloop->exits;
exit->next->prev = exit; exit->next->prev = exit;
exit->prev->next = exit; exit->prev->next = exit;
...@@ -1050,10 +1054,11 @@ record_loop_exits (void) ...@@ -1050,10 +1054,11 @@ record_loop_exits (void)
current_loops->state |= LOOPS_HAVE_RECORDED_EXITS; current_loops->state |= LOOPS_HAVE_RECORDED_EXITS;
gcc_assert (current_loops->exits == NULL); gcc_assert (current_loops->exits == NULL);
current_loops->exits = htab_create (2 * number_of_loops (), current_loops->exits = htab_create_alloc (2 * number_of_loops (),
loop_exit_hash, loop_exit_hash,
loop_exit_eq, loop_exit_eq,
loop_exit_free); loop_exit_free,
ggc_calloc, ggc_free);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
...@@ -1123,7 +1128,7 @@ get_loop_exit_edges (const struct loop *loop) ...@@ -1123,7 +1128,7 @@ get_loop_exit_edges (const struct loop *loop)
scan the body of the loop. */ scan the body of the loop. */
if (current_loops->state & LOOPS_HAVE_RECORDED_EXITS) if (current_loops->state & LOOPS_HAVE_RECORDED_EXITS)
{ {
for (exit = loop->exits.next; exit->e; exit = exit->next) for (exit = loop->exits->next; exit->e; exit = exit->next)
VEC_safe_push (edge, heap, edges, exit->e); VEC_safe_push (edge, heap, edges, exit->e);
} }
else else
...@@ -1441,7 +1446,7 @@ verify_loop_structure (void) ...@@ -1441,7 +1446,7 @@ verify_loop_structure (void)
/* Check the recorded loop exits. */ /* Check the recorded loop exits. */
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
{ {
if (loop->exits.e != NULL) if (!loop->exits || loop->exits->e != NULL)
{ {
error ("corrupted head of the exits list of loop %d", error ("corrupted head of the exits list of loop %d",
loop->num); loop->num);
...@@ -1451,7 +1456,7 @@ verify_loop_structure (void) ...@@ -1451,7 +1456,7 @@ verify_loop_structure (void)
{ {
/* Check that the list forms a cycle, and all elements except /* Check that the list forms a cycle, and all elements except
for the head are nonnull. */ for the head are nonnull. */
for (mexit = &loop->exits, exit = mexit->next, i = 0; for (mexit = loop->exits, exit = mexit->next, i = 0;
exit->e && exit != mexit; exit->e && exit != mexit;
exit = exit->next) exit = exit->next)
{ {
...@@ -1459,7 +1464,7 @@ verify_loop_structure (void) ...@@ -1459,7 +1464,7 @@ verify_loop_structure (void)
mexit = mexit->next; mexit = mexit->next;
} }
if (exit != &loop->exits) if (exit != loop->exits)
{ {
error ("corrupted exits list of loop %d", loop->num); error ("corrupted exits list of loop %d", loop->num);
err = 1; err = 1;
...@@ -1468,7 +1473,7 @@ verify_loop_structure (void) ...@@ -1468,7 +1473,7 @@ verify_loop_structure (void)
if ((current_loops->state & LOOPS_HAVE_RECORDED_EXITS) == 0) if ((current_loops->state & LOOPS_HAVE_RECORDED_EXITS) == 0)
{ {
if (loop->exits.next != &loop->exits) if (loop->exits->next != loop->exits)
{ {
error ("nonempty exits list of loop %d, but exits are not recorded", error ("nonempty exits list of loop %d, but exits are not recorded",
loop->num); loop->num);
...@@ -1530,7 +1535,7 @@ verify_loop_structure (void) ...@@ -1530,7 +1535,7 @@ verify_loop_structure (void)
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
{ {
eloops = 0; eloops = 0;
for (exit = loop->exits.next; exit->e; exit = exit->next) for (exit = loop->exits->next; exit->e; exit = exit->next)
eloops++; eloops++;
if (eloops != sizes[loop->num]) if (eloops != sizes[loop->num])
{ {
...@@ -1585,12 +1590,12 @@ loop_exit_edge_p (const struct loop *loop, edge e) ...@@ -1585,12 +1590,12 @@ loop_exit_edge_p (const struct loop *loop, edge e)
edge edge
single_exit (const struct loop *loop) single_exit (const struct loop *loop)
{ {
struct loop_exit *exit = loop->exits.next; struct loop_exit *exit = loop->exits->next;
if ((current_loops->state & LOOPS_HAVE_RECORDED_EXITS) == 0) if ((current_loops->state & LOOPS_HAVE_RECORDED_EXITS) == 0)
return NULL; return NULL;
if (exit->e && exit->next == &loop->exits) if (exit->e && exit->next == loop->exits)
return exit->e; return exit->e;
else else
return NULL; return NULL;
......
...@@ -39,7 +39,7 @@ enum lpt_dec ...@@ -39,7 +39,7 @@ enum lpt_dec
LPT_UNROLL_STUPID LPT_UNROLL_STUPID
}; };
struct lpt_decision struct lpt_decision GTY (())
{ {
enum lpt_dec decision; enum lpt_dec decision;
unsigned times; unsigned times;
...@@ -47,7 +47,7 @@ struct lpt_decision ...@@ -47,7 +47,7 @@ struct lpt_decision
/* The structure describing a bound on number of iterations of a loop. */ /* The structure describing a bound on number of iterations of a loop. */
struct nb_iter_bound struct nb_iter_bound GTY ((chain_next ("%h.next")))
{ {
/* The statement STMT is executed at most ... */ /* The statement STMT is executed at most ... */
tree stmt; tree stmt;
...@@ -72,10 +72,10 @@ struct nb_iter_bound ...@@ -72,10 +72,10 @@ struct nb_iter_bound
/* Description of the loop exit. */ /* Description of the loop exit. */
struct loop_exit struct loop_exit GTY (())
{ {
/* The exit edge. */ /* The exit edge. */
edge e; struct edge_def *e;
/* Previous and next exit in the list of the exits of the loop. */ /* Previous and next exit in the list of the exits of the loop. */
struct loop_exit *prev; struct loop_exit *prev;
...@@ -88,18 +88,19 @@ struct loop_exit ...@@ -88,18 +88,19 @@ struct loop_exit
typedef struct loop *loop_p; typedef struct loop *loop_p;
DEF_VEC_P (loop_p); DEF_VEC_P (loop_p);
DEF_VEC_ALLOC_P (loop_p, heap); DEF_VEC_ALLOC_P (loop_p, heap);
DEF_VEC_ALLOC_P (loop_p, gc);
/* Structure to hold information for each natural loop. */ /* Structure to hold information for each natural loop. */
struct loop struct loop GTY ((chain_next ("%h.next")))
{ {
/* Index into loops array. */ /* Index into loops array. */
int num; int num;
/* Basic block of loop header. */ /* Basic block of loop header. */
basic_block header; struct basic_block_def *header;
/* Basic block of loop latch. */ /* Basic block of loop latch. */
basic_block latch; struct basic_block_def *latch;
/* For loop unrolling/peeling decision. */ /* For loop unrolling/peeling decision. */
struct lpt_decision lpt_decision; struct lpt_decision lpt_decision;
...@@ -114,7 +115,7 @@ struct loop ...@@ -114,7 +115,7 @@ struct loop
unsigned num_nodes; unsigned num_nodes;
/* Superloops of the loop, starting with the outermost loop. */ /* Superloops of the loop, starting with the outermost loop. */
VEC (loop_p, heap) *superloops; VEC (loop_p, gc) *superloops;
/* The first inner (child) loop or NULL if innermost loop. */ /* The first inner (child) loop or NULL if innermost loop. */
struct loop *inner; struct loop *inner;
...@@ -126,7 +127,7 @@ struct loop ...@@ -126,7 +127,7 @@ struct loop
struct loop *copy; struct loop *copy;
/* Auxiliary info specific to a pass. */ /* Auxiliary info specific to a pass. */
void *aux; PTR GTY ((skip (""))) aux;
/* The number of times the latch of the loop is executed. /* The number of times the latch of the loop is executed.
This is an INTEGER_CST or an expression containing symbolic This is an INTEGER_CST or an expression containing symbolic
...@@ -158,7 +159,7 @@ struct loop ...@@ -158,7 +159,7 @@ struct loop
struct nb_iter_bound *bounds; struct nb_iter_bound *bounds;
/* Head of the cyclic list of the exits of the loop. */ /* Head of the cyclic list of the exits of the loop. */
struct loop_exit exits; struct loop_exit *exits;
}; };
/* Flags for state of loop structure. */ /* Flags for state of loop structure. */
...@@ -177,18 +178,18 @@ enum ...@@ -177,18 +178,18 @@ enum
#define AVOID_CFG_MODIFICATIONS (LOOPS_MAY_HAVE_MULTIPLE_LATCHES) #define AVOID_CFG_MODIFICATIONS (LOOPS_MAY_HAVE_MULTIPLE_LATCHES)
/* Structure to hold CFG information about natural loops within a function. */ /* Structure to hold CFG information about natural loops within a function. */
struct loops struct loops GTY (())
{ {
/* State of loops. */ /* State of loops. */
int state; int state;
/* Array of the loops. */ /* Array of the loops. */
VEC (loop_p, heap) *larray; VEC (loop_p, gc) *larray;
/* Maps edges to the list of their descriptions as loop exits. Edges /* Maps edges to the list of their descriptions as loop exits. Edges
whose sources or destinations have loop_father == NULL (which may whose sources or destinations have loop_father == NULL (which may
happen during the cfg manipulations) should not appear in EXITS. */ happen during the cfg manipulations) should not appear in EXITS. */
htab_t exits; htab_t GTY((param_is (struct loop_exit))) exits;
/* Pointer to root of loop hierarchy tree. */ /* Pointer to root of loop hierarchy tree. */
struct loop *tree_root; struct loop *tree_root;
...@@ -428,7 +429,7 @@ loop_outer (const struct loop *loop) ...@@ -428,7 +429,7 @@ loop_outer (const struct loop *loop)
/* Returns the list of loops in current_loops. */ /* Returns the list of loops in current_loops. */
static inline VEC (loop_p, heap) * static inline VEC (loop_p, gc) *
get_loops (void) get_loops (void)
{ {
if (!current_loops) if (!current_loops)
......
...@@ -399,7 +399,7 @@ static void ...@@ -399,7 +399,7 @@ static void
place_new_loop (struct loop *loop) place_new_loop (struct loop *loop)
{ {
loop->num = number_of_loops (); loop->num = number_of_loops ();
VEC_safe_push (loop_p, heap, current_loops->larray, loop); VEC_safe_push (loop_p, gc, current_loops->larray, loop);
} }
/* Given LOOP structure with filled header and latch, find the body of the /* Given LOOP structure with filled header and latch, find the body of the
......
...@@ -191,7 +191,7 @@ struct function GTY(()) ...@@ -191,7 +191,7 @@ struct function GTY(())
struct gimple_df *gimple_df; struct gimple_df *gimple_df;
/* The loops in this function. */ /* The loops in this function. */
struct loops * GTY((skip)) x_current_loops; struct loops *x_current_loops;
/* Value histograms attached to particular statements. */ /* Value histograms attached to particular statements. */
htab_t GTY((skip)) value_histograms; htab_t GTY((skip)) value_histograms;
......
...@@ -1535,7 +1535,7 @@ open_base_files (void) ...@@ -1535,7 +1535,7 @@ open_base_files (void)
"hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h", "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
"tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
"cfglayout.h", "except.h", "output.h", NULL "cfglayout.h", "except.h", "output.h", "cfgloop.h", NULL
}; };
const char *const *ifp; const char *const *ifp;
outf_p gtype_desc_c; outf_p gtype_desc_c;
......
...@@ -31,6 +31,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -31,6 +31,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-pass.h" #include "tree-pass.h"
#include "timevar.h" #include "timevar.h"
#include "flags.h" #include "flags.h"
#include "ggc.h"
/* Initialize loop structures. This is used by the tree and RTL loop /* Initialize loop structures. This is used by the tree and RTL loop
...@@ -43,7 +44,7 @@ loop_optimizer_init (unsigned flags) ...@@ -43,7 +44,7 @@ loop_optimizer_init (unsigned flags)
struct loops *loops; struct loops *loops;
gcc_assert (!current_loops); gcc_assert (!current_loops);
loops = XCNEW (struct loops); loops = GGC_CNEW (struct loops);
/* Find the loops. */ /* Find the loops. */
...@@ -116,7 +117,7 @@ loop_optimizer_finalize (void) ...@@ -116,7 +117,7 @@ loop_optimizer_finalize (void)
if (current_loops->state & LOOPS_HAVE_RECORDED_EXITS) if (current_loops->state & LOOPS_HAVE_RECORDED_EXITS)
release_recorded_exits (); release_recorded_exits ();
flow_loops_free (current_loops); flow_loops_free (current_loops);
free (current_loops); ggc_free (current_loops);
current_loops = NULL; current_loops = NULL;
FOR_ALL_BB (bb) FOR_ALL_BB (bb)
......
...@@ -258,7 +258,7 @@ static tree analyze_scalar_evolution_1 (struct loop *, tree, tree); ...@@ -258,7 +258,7 @@ static tree analyze_scalar_evolution_1 (struct loop *, tree, tree);
/* The cached information about a ssa name VAR, claiming that inside LOOP, /* The cached information about a ssa name VAR, claiming that inside LOOP,
the value of VAR can be expressed as CHREC. */ the value of VAR can be expressed as CHREC. */
struct scev_info_str struct scev_info_str GTY(())
{ {
tree var; tree var;
tree chrec; tree chrec;
...@@ -285,7 +285,7 @@ tree chrec_known; ...@@ -285,7 +285,7 @@ tree chrec_known;
static bitmap already_instantiated; static bitmap already_instantiated;
static htab_t scalar_evolution_info; static GTY ((param_is (struct scev_info_str))) htab_t scalar_evolution_info;
/* Constructs a new SCEV_INFO_STR structure. */ /* Constructs a new SCEV_INFO_STR structure. */
...@@ -295,7 +295,7 @@ new_scev_info_str (tree var) ...@@ -295,7 +295,7 @@ new_scev_info_str (tree var)
{ {
struct scev_info_str *res; struct scev_info_str *res;
res = XNEW (struct scev_info_str); res = GGC_NEW (struct scev_info_str);
res->var = var; res->var = var;
res->chrec = chrec_not_analyzed_yet; res->chrec = chrec_not_analyzed_yet;
...@@ -326,7 +326,7 @@ eq_scev_info (const void *e1, const void *e2) ...@@ -326,7 +326,7 @@ eq_scev_info (const void *e1, const void *e2)
static void static void
del_scev_info (void *e) del_scev_info (void *e)
{ {
free (e); ggc_free (e);
} }
/* Get the index corresponding to VAR in the current LOOP. If /* Get the index corresponding to VAR in the current LOOP. If
...@@ -2746,8 +2746,12 @@ scev_initialize (void) ...@@ -2746,8 +2746,12 @@ scev_initialize (void)
loop_iterator li; loop_iterator li;
struct loop *loop; struct loop *loop;
scalar_evolution_info = htab_create (100, hash_scev_info, scalar_evolution_info = htab_create_alloc (100,
eq_scev_info, del_scev_info); hash_scev_info,
eq_scev_info,
del_scev_info,
ggc_calloc,
ggc_free);
already_instantiated = BITMAP_ALLOC (NULL); already_instantiated = BITMAP_ALLOC (NULL);
initialize_scalar_evolutions_analyzer (); initialize_scalar_evolutions_analyzer ();
...@@ -3008,3 +3012,5 @@ scev_const_prop (void) ...@@ -3008,3 +3012,5 @@ scev_const_prop (void)
} }
return 0; return 0;
} }
#include "gt-tree-scalar-evolution.h"
...@@ -2364,7 +2364,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound, ...@@ -2364,7 +2364,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound,
list. */ list. */
if (upper) if (upper)
{ {
struct nb_iter_bound *elt = XNEW (struct nb_iter_bound); struct nb_iter_bound *elt = GGC_NEW (struct nb_iter_bound);
elt->bound = i_bound; elt->bound = i_bound;
elt->stmt = at_stmt; elt->stmt = at_stmt;
...@@ -3023,7 +3023,7 @@ free_numbers_of_iterations_estimates_loop (struct loop *loop) ...@@ -3023,7 +3023,7 @@ free_numbers_of_iterations_estimates_loop (struct loop *loop)
for (bound = loop->bounds; bound; bound = next) for (bound = loop->bounds; bound; bound = next)
{ {
next = bound->next; next = bound->next;
free (bound); ggc_free (bound);
} }
loop->bounds = NULL; loop->bounds = NULL;
......
...@@ -171,7 +171,8 @@ struct tree_opt_pass pass_tree_unswitch = ...@@ -171,7 +171,8 @@ struct tree_opt_pass pass_tree_unswitch =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_func | TODO_verify_loops, /* todo_flags_finish */ TODO_ggc_collect | TODO_dump_func
| TODO_verify_loops, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
...@@ -202,7 +203,8 @@ struct tree_opt_pass pass_vectorize = ...@@ -202,7 +203,8 @@ struct tree_opt_pass pass_vectorize =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
TODO_verify_loops, /* todo_flags_start */ TODO_verify_loops, /* todo_flags_start */
TODO_dump_func | TODO_update_ssa, /* todo_flags_finish */ TODO_dump_func | TODO_update_ssa
| TODO_ggc_collect, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
...@@ -237,7 +239,8 @@ struct tree_opt_pass pass_linear_transform = ...@@ -237,7 +239,8 @@ struct tree_opt_pass pass_linear_transform =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_func | TODO_verify_loops, /* todo_flags_finish */ TODO_dump_func | TODO_verify_loops
| TODO_ggc_collect, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
...@@ -361,7 +364,8 @@ struct tree_opt_pass pass_empty_loop = ...@@ -361,7 +364,8 @@ struct tree_opt_pass pass_empty_loop =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_func | TODO_verify_loops, /* todo_flags_finish */ TODO_dump_func | TODO_verify_loops
| TODO_ggc_collect, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
...@@ -427,7 +431,8 @@ struct tree_opt_pass pass_complete_unroll = ...@@ -427,7 +431,8 @@ struct tree_opt_pass pass_complete_unroll =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_func | TODO_verify_loops, /* todo_flags_finish */ TODO_dump_func | TODO_verify_loops
| TODO_ggc_collect, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
...@@ -496,9 +501,8 @@ struct tree_opt_pass pass_iv_optimize = ...@@ -496,9 +501,8 @@ struct tree_opt_pass pass_iv_optimize =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_dump_func TODO_dump_func | TODO_verify_loops
| TODO_verify_loops | TODO_update_ssa | TODO_ggc_collect, /* todo_flags_finish */
| TODO_update_ssa, /* todo_flags_finish */
0 /* letter */ 0 /* letter */
}; };
......
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