Added routine remove_irp_irg.
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 29 Aug 2001 15:07:44 +0000 (15:07 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 29 Aug 2001 15:07:44 +0000 (15:07 +0000)
Changed comment to free_ir_graph.

[r247]

ir/ir/irgraph.c
ir/ir/irgraph.h
ir/ir/irprog.c
ir/ir/irprog.h

index be11632..f29aaf7 100644 (file)
@@ -102,6 +102,8 @@ new_ir_graph (entity *ent, int n_loc)
 /* Frees the passed irgraph.
    Deallocates all nodes in this graph and the ir_graph structure.
    Sets the field irgraph in the corresponding entity to NULL.
+   Does not remove the irgraph from the list in irprog (requires
+   inefficient search, call remove_irp_irg by hand).
    Does not free types, entities or modes that are used only by this
    graph, nor the entity standing for this graph. */
 void free_ir_graph (ir_graph *irg) {
index 70c3f16..2968402 100644 (file)
@@ -75,6 +75,8 @@ ir_graph *new_ir_graph (entity *ent, int n_loc);
 /* Frees the passed irgraph.
    Deallocates all nodes in this graph and the ir_graph structure.
    Sets the field irgraph in the corresponding entity to NULL.
+   Does not remove the irgraph from the list in irprog (requires
+   inefficient search, call remove_irp_irg by hand).
    Does not free types, entities or modes that are used only by this
    graph, nor the entity standing for this graph. */
 void free_ir_graph (ir_graph *irg);
index 963ae93..4de4696 100644 (file)
@@ -67,12 +67,26 @@ type *get_glob_type(void) {
 }
 
 /* Adds irg to the list of ir graphs in irp. */
-void      add_irp_irg(ir_graph *irg) {
+void add_irp_irg(ir_graph *irg) {
   assert (irg != NULL);
   assert(irp && irp->graphs);
   ARR_APP1 (ir_graph *, irp->graphs, irg);
 }
 
+/* Removes irg from the list or irgs, shrinks the list by one.
+   @@@ does not work properly. */
+void remove_irp_irg(ir_graph *irg){
+  int i;
+  assert(irg);
+  for (i = 1; i < (ARR_LEN (irp->graphs))-1; i++)
+    if (irp->graphs[i+1] == irg) {
+      for(i++; i < (ARR_LEN (irp->graphs)) - 1; i++)
+       irp->graphs[i] = irp->graphs[i+1];
+      ARR_SETLEN(ir_graph*, irp->graphs, (ARR_LEN(irp->graphs)) - 1);
+      break;
+    }
+}
+
 int get_irp_n_irgs() {
   assert (irp && irp->graphs);
   /* Strangely the first element of the array is NULL.  Why??  */
index e8b2296..84622d3 100644 (file)
@@ -61,6 +61,9 @@ void      set_irp_main_irg(ir_graph *main_irg);
 
 /* Adds irg to the list of ir graphs in irp. */
 void      add_irp_irg(ir_graph *irg);
+/* Removes irg from the list or irgs, shrinks the list by one.
+   @@@ does not work properly. */
+void      remove_irp_irg(ir_graph *irg);
 int       get_irp_n_irgs();
 ir_graph *get_irp_irg(int pos);
 void      set_irp_irg(int pos, ir_graph *irg);