This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gc-improv] Convert sese.c to use obstack


create_if_region_on_edge is called by move_sese_in_condition is called
by gloog, where it is used to setup local variable if_region. I have
created an obstack in gloog.

Bootstrapped and regtested together with tree-ssa-structalias.c patch
under x86_64-unknown-linux-gnu, committed to gc-improv.

I am pleased to say that this completes the conversion of the middle
end. The front ends have been already converted a while ago, the
backends remain. The backend conversion looks like it is going to be
straightforward, testing excepted.

2009-11-02  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* sese.h: Include obstack.h.
	(create_if_region_on_edge): Remove prototype.
	(move_sese_in_condition): New parameter of type struct obstack *.
	* graphite-clast-to-gimple.c: Include obstack.h
	(gloog): New local variable graphite_obstack.  Initialize obstack,
	pass it to move_sese_in_condition, free.
	* sese.c (create_if_region_on_edge): Make static. New parameter
	graphite_obstack.  Use obstack allocation.
	(move_sese_in_condition): New parameter graphite_obstack.  Pass it
	to create_if_region_on_edge.
	* Makefile.in (SESE_H): New.
	(sese.o, graphite.o): Replace sese.h $(SESE_H) in dependencies.
	(graphite-poly.o, graphite-scop-detection.o): Likewise.
	(graphite-sese-to-poly.o): Likewise.
	(graphite-clast-to-gimple.o): Likewise.  Add $(OBSTACK_H) to
	dependencies.



-- 
Laurynas
Index: gcc/ChangeLog.gc-improv
===================================================================
--- gcc/ChangeLog.gc-improv	(revision 153802)
+++ gcc/ChangeLog.gc-improv	(working copy)
@@ -1,5 +1,24 @@
 2009-11-02  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
 
+	* sese.h: Include obstack.h.
+	(create_if_region_on_edge): Remove prototype.
+	(move_sese_in_condition): New parameter of type struct obstack *.
+	* graphite-clast-to-gimple.c: Include obstack.h
+	(gloog): New local variable graphite_obstack.  Initialize obstack,
+	pass it to move_sese_in_condition, free.
+	* sese.c (create_if_region_on_edge): Make static. New parameter
+	graphite_obstack.  Use obstack allocation.
+	(move_sese_in_condition): New parameter graphite_obstack.  Pass it
+	to create_if_region_on_edge.
+	* Makefile.in (SESE_H): New.
+	(sese.o, graphite.o): Replace sese.h $(SESE_H) in dependencies.
+	(graphite-poly.o, graphite-scop-detection.o): Likewise.
+	(graphite-sese-to-poly.o): Likewise.
+	(graphite-clast-to-gimple.o): Likewise.  Add $(OBSTACK_H) to
+	dependencies.
+
+2009-11-02  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
+
 	* tree-ssa-structalias.c: (heapvar_for_stmt): Set GTY param_is
 	argument to struct heapvar_map.
 	(heapvar_insert): Use typed GC allocation.
Index: gcc/sese.c
===================================================================
--- gcc/sese.c	(revision 153800)
+++ gcc/sese.c	(working copy)
@@ -1296,15 +1296,20 @@
 
 /* Creates an IFSESE with CONDITION on edge ENTRY.  */
 
-ifsese
-create_if_region_on_edge (edge entry, tree condition)
+static ifsese
+create_if_region_on_edge (edge entry, tree condition,
+			  struct obstack * graphite_obstack)
 {
   edge e;
   edge_iterator ei;
-  sese sese_region = GGC_NEW (struct sese_s);
-  sese true_region = GGC_NEW (struct sese_s);
-  sese false_region = GGC_NEW (struct sese_s);
-  ifsese if_region = GGC_NEW (struct ifsese_s);
+  sese sese_region = (sese) obstack_alloc (graphite_obstack,
+					   sizeof (struct sese_s));
+  sese true_region = (sese) obstack_alloc (graphite_obstack,
+					   sizeof (struct sese_s));
+  sese false_region = (sese) obstack_alloc (graphite_obstack,
+					    sizeof (struct sese_s));
+  ifsese if_region = (ifsese) obstack_alloc (graphite_obstack,
+					     sizeof (struct ifsese_s));
   edge exit = create_empty_if_region_on_edge (entry, condition);
 
   if_region->region = sese_region;
@@ -1338,13 +1343,14 @@
 */
 
 ifsese
-move_sese_in_condition (sese region)
+move_sese_in_condition (sese region, struct obstack * graphite_obstack)
 {
   basic_block pred_block = split_edge (SESE_ENTRY (region));
   ifsese if_region = NULL;
 
   SESE_ENTRY (region) = single_succ_edge (pred_block);
-  if_region = create_if_region_on_edge (single_pred_edge (pred_block), integer_one_node);
+  if_region = create_if_region_on_edge (single_pred_edge (pred_block),
+					integer_one_node, graphite_obstack);
   if_region_set_false_region (if_region, region);
 
   return if_region;
Index: gcc/sese.h
===================================================================
--- gcc/sese.h	(revision 153800)
+++ gcc/sese.h	(working copy)
@@ -22,6 +22,8 @@
 #ifndef GCC_SESE_H
 #define GCC_SESE_H
 
+#include "obstack.h"
+
 /* A Single Entry, Single Exit region is a part of the CFG delimited
    by two edges.  */
 typedef struct sese_s
@@ -306,8 +308,7 @@
 } *ifsese;
 
 extern void if_region_set_false_region (ifsese, sese);
-extern ifsese create_if_region_on_edge (edge, tree);
-extern ifsese move_sese_in_condition (sese);
+extern ifsese move_sese_in_condition (sese, struct obstack *);
 extern edge get_true_edge_from_guard_bb (basic_block);
 extern edge get_false_edge_from_guard_bb (basic_block);
 
Index: gcc/graphite-clast-to-gimple.c
===================================================================
--- gcc/graphite-clast-to-gimple.c	(revision 153800)
+++ gcc/graphite-clast-to-gimple.c	(working copy)
@@ -23,6 +23,7 @@
 #include "coretypes.h"
 #include "tm.h"
 #include "ggc.h"
+#include "obstack.h"
 #include "tree.h"
 #include "rtl.h"
 #include "basic-block.h"
@@ -1158,6 +1159,7 @@
   VEC (tree, heap) *newivs = VEC_alloc (tree, heap, 10);
   loop_p context_loop;
   sese region = SCOP_REGION (scop);
+  struct obstack graphite_obstack;
   ifsese if_region = NULL;
   htab_t rename_map, newivs_index;
   cloog_prog_clast pc;
@@ -1177,7 +1179,8 @@
   recompute_all_dominators ();
   graphite_verify ();
 
-  if_region = move_sese_in_condition (region);
+  gcc_obstack_init (&graphite_obstack);
+  if_region = move_sese_in_condition (region, &graphite_obstack);
   sese_insert_phis_for_liveouts (region,
 				 if_region->region->exit->src,
 				 if_region->false_region->exit,
@@ -1205,6 +1208,7 @@
   recompute_all_dominators ();
   graphite_verify ();
 
+  obstack_free (&graphite_obstack, NULL);
   htab_delete (rename_map);
   htab_delete (newivs_index);
   VEC_free (tree, heap, newivs);
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 153801)
+++ gcc/Makefile.in	(working copy)
@@ -938,6 +938,7 @@
 GCC_PLUGIN_H = gcc-plugin.h $(CONFIG_H) $(SYSTEM_H)
 PLUGIN_H = plugin.h $(GCC_PLUGIN_H)
 PLUGIN_VERSION_H = plugin-version.h configargs.h
+SESE_H = sese.h $(OBSTACK_H)
 
 #
 # Now figure out from those variables how to compile and link.
@@ -2545,12 +2546,12 @@
    $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
    $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) tree-chrec.h \
    $(TREE_DATA_REF_H) tree-scalar-evolution.h tree-pass.h domwalk.h value-prof.h \
-   pointer-set.h $(GIMPLE_H) sese.h
+   pointer-set.h $(GIMPLE_H) $(SESE_H)
 graphite.o: graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
    $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
    $(PREDICT_H) $(TREE_DATA_REF_H) tree-pass.h graphite.h \
-   pointer-set.h value-prof.h graphite-ppl.h sese.h \
+   pointer-set.h value-prof.h graphite-ppl.h $(SESE_H) \
    graphite-scop-detection.h graphite-clast-to-gimple.h \
    graphite-poly.h graphite-sese-to-poly.h
 graphite-blocking.o: graphite-blocking.c $(CONFIG_H) $(SYSTEM_H) \
@@ -2564,9 +2565,9 @@
    $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
    $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
    $(TREE_DATA_REF_H) tree-pass.h domwalk.h graphite.h \
-   pointer-set.h value-prof.h graphite-ppl.h sese.h \
+   pointer-set.h value-prof.h graphite-ppl.h $(SESE_H) \
    graphite-scop-detection.h graphite-clast-to-gimple.h graphite-poly.h \
-   graphite-dependences.h
+   graphite-dependences.h $(OBSTACK_H)
 graphite-dependences.o: graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h \
    $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
@@ -2583,21 +2584,21 @@
    $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
    $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
    $(TREE_DATA_REF_H) tree-pass.h domwalk.h graphite.h graphite-dependences.h \
-   pointer-set.h value-prof.h graphite-ppl.h sese.h output.h graphite-poly.h
+   pointer-set.h value-prof.h graphite-ppl.h $(SESE_H) output.h graphite-poly.h
 graphite-ppl.o: graphite-ppl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(GGC_H) graphite-ppl.h
 graphite-scop-detection.o: graphite-scop-detection.c $(CONFIG_H) $(SYSTEM_H) \
    $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
    $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
    $(TREE_DATA_REF_H) tree-pass.h domwalk.h graphite.h $(TM_H) \
-   value-prof.h graphite-ppl.h sese.h pointer-set.h coretypes.h \
+   value-prof.h graphite-ppl.h $(SESE_H) pointer-set.h coretypes.h \
    graphite-scop-detection.h graphite-poly.h
 graphite-sese-to-poly.o: graphite-sese-to-poly.c $(CONFIG_H) \
    $(SYSTEM_H) coretypes.h $(TM_H) \
    $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
    $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
    $(TREE_DATA_REF_H) tree-pass.h domwalk.h graphite.h \
-   pointer-set.h value-prof.h graphite-ppl.h sese.h \
+   pointer-set.h value-prof.h graphite-ppl.h $(SESE_H) \
    graphite-scop-detection.h graphite-sese-to-poly.h $(PARAMS_H) \
    graphite-clast-to-gimple.h graphite-poly.h
 tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]