used ircons_t.h now
[libfirm] / ir / ir / irgraph.c
index aa2bf57..86e356a 100644 (file)
@@ -74,7 +74,7 @@ new_ir_graph (entity *ent, int n_loc)
 
   res = (ir_graph *) malloc (sizeof (ir_graph));
   memset(res, 0, sizeof (ir_graph));
-  res->kind=k_ir_graph;
+  res->kind = k_ir_graph;
 
   /* inform statistics here, as blocks will be already build on this graph */
   stat_new_graph(res, ent);
@@ -85,20 +85,20 @@ new_ir_graph (entity *ent, int n_loc)
   /*-- initialized for each graph. --*/
   if (get_opt_precise_exc_context()) {
     res->n_loc = n_loc + 1 + 1; /* number of local variables that are never
-                                  dereferenced in this graph plus one for
-                                  the store plus one for links to fragile
-                                  operations.  n_loc is not the number of
-                                  parameters to the procedure!  */
+                   dereferenced in this graph plus one for
+                   the store plus one for links to fragile
+                   operations.  n_loc is not the number of
+                   parameters to the procedure!  */
   }
   else {
     res->n_loc = n_loc + 1;  /* number of local variables that are never
-                               dereferenced in this graph plus one for
-                               the store. This is not the number of parameters
-                               to the procedure!  */
+                dereferenced in this graph plus one for
+                the store. This is not the number of parameters
+                to the procedure!  */
   }
 
   res->visited = 0;     /* visited flag, for the ir walker */
-  res->block_visited=0; /* visited flag, for the 'block'-walker */
+  res->block_visited = 0; /* visited flag, for the 'block'-walker */
 
 #if USE_EXPLICIT_PHI_IN_STACK
   res->Phi_in_stack = new_Phi_in_stack();  /* A stack needed for automatic Phi
@@ -123,7 +123,7 @@ new_ir_graph (entity *ent, int n_loc)
   res->ent = ent;
   set_entity_irg(ent, res);
 
-  /*-- contain "inner" methods as in Pascal. --*/
+  /*--  a class type so that it can contain "inner" methods as in Pascal. --*/
   res->frame_type = new_type_class(mangle(get_entity_ident(ent), frame_type_suffix));
 
   /* Remove type from type list.  Must be treated differently than other types. */
@@ -237,7 +237,13 @@ void free_ir_graph (ir_graph *irg) {
   if (irg->outs_state != no_outs) free_outs(irg);
   if (irg->frame_type)  free_type(irg->frame_type);
   if (irg->value_table) del_identities(irg->value_table);
-  if (irg->ent) set_entity_irg(irg->ent, NULL);  /* not set in const code irg */
+  if (irg->ent) {
+    peculiarity pec = get_entity_peculiarity (irg->ent);
+    set_entity_peculiarity (irg->ent, peculiarity_description);
+    set_entity_irg(irg->ent, NULL);  /* not set in const code irg */
+    set_entity_peculiarity (irg->ent, pec);
+  }
+
   free_End(irg->end);
   obstack_free(irg->obst,NULL);
   free(irg->obst);