bugfixes
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Fri, 28 Jun 2002 09:59:32 +0000 (09:59 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Fri, 28 Jun 2002 09:59:32 +0000 (09:59 +0000)
 - mode of Phi was mode_T
 - other
Added support for prculiarity "inherited"

[r421]

ir/ir/ircgcons.c
ir/ir/irdump.c
ir/ir/irnode.c
ir/ir/irprog.c
ir/ir/irprog.h
ir/ir/irvrfy.c

index 52676b0..0abe066 100644 (file)
@@ -273,11 +273,15 @@ static void prepare_irg_end(ir_graph * irg, irg_data_t * data) {
     /* res */
     data->res = NEW_ARR_F(ir_node *, n_res);
     for (j = n_res - 1; j >= 0; --j) {
+      ir_mode *mode = NULL;
+      /* In[0] could be a Bad node with wrong mode. */
       for (i = n_ret - 1; i >= 0; --i) {
        in[i] = get_Return_res(ret_arr[i], j);
+       if (!mode && get_irn_mode(in[i]) != mode_T)
+         mode = get_irn_mode(in[i]);
       }
-      /* Has in[0] always the valid mode? */
-      data->res[j] = new_Phi(n_ret, in, get_irn_mode(in[0]));
+      assert(mode); /* @@@ else we must create a Bad node */
+      data->res[j] = new_Phi(n_ret, in, mode);
     }
     DEL_ARR_F(in);
   }
@@ -376,10 +380,16 @@ static void move_nodes(ir_node * from_block, ir_node * to_block, ir_node * node)
 
 /* Abhängigkeiten vom Start-Block und den Filter-Operationen im
  * Start-Block auf den Aufrufer hinzufügen. */
-static void construct_start(entity * caller, entity * callee, ir_node * call, ir_node * exec) {
+static void construct_start(entity * caller, entity * callee,
+                           ir_node * call, ir_node * exec) {
   irg_data_t * data = get_entity_link(callee);
   ir_graph * irg = get_entity_irg(callee);
   ir_node * start = get_irg_start(irg), * filter;
+
+  assert(irg);
+  assert(get_entity_peculiarity(callee) == existent); /* Else data is not initalized. */
+  assert((0 <= data->count) &&
+        (data->count < get_Block_cg_n_cfgpreds(get_nodes_Block(start))));
   set_Block_cg_cfgpred(get_nodes_Block(start), data->count, exec);
   for (filter = get_irn_link(start); filter; filter = get_irn_link(filter)) {
     if (get_irn_op(filter) != op_Filter) continue;
@@ -504,7 +514,8 @@ static void construct_call(ir_node * call) {
   /* post_block kann bereits interprozedurale Steuerflussvorgänger
    * besitzen. Diese müssen dann auch noch für den pre_block gesetzt werden. */
   if (get_Block_cg_cfgpred_arr(post_block)) {
-    set_Block_cg_cfgpred_arr(pre_block, get_Block_cg_n_cfgpreds(post_block), get_Block_cg_cfgpred_arr(post_block));
+    set_Block_cg_cfgpred_arr(pre_block, get_Block_cg_n_cfgpreds(post_block),
+                            get_Block_cg_cfgpred_arr(post_block));
     remove_Block_cg_cfgpred_arr(post_block);
   }
 
index 6c7a283..91bf36b 100644 (file)
@@ -692,20 +692,30 @@ dump_type_info (type_or_ent *tore, void *env) {
       xfprintf (F, DEFAULT_TYPE_ATTRIBUTE);
       xfprintf (F, "label: ");
       xfprintf (F, "\"ent %I\" " ENTITY_NODE_ATTR , get_entity_ident(ent));
-      if(dynamic_allocated == get_entity_allocation(ent))
-       xfprintf (F, " info1:\"dynamic allocated\n");
-      else
-       xfprintf (F, " info1:\"static allocated\n");
+      switch (get_entity_allocation(ent)) {
+        case dynamic_allocated:   fprintf (F, " info1:\"dynamic allocated\n");   break;
+        case automatic_allocated: fprintf (F, " info1:\"automatic allocated\n"); break;
+        case static_allocated:    fprintf (F, " info1:\"static allocated\n");    break;
+      }
       switch (get_entity_visibility(ent)) {
        case local:              fprintf (F, "local\n");             break;
        case external_visible:   fprintf (F, "external_visible\n");  break;
-       case external_allocated: fprintf (F, "external_allocate\n");break;
+       case external_allocated: fprintf (F, "external_allocate\n"); break;
       }
       switch (get_entity_variability(ent)) {
-       case uninitialized: fprintf (F, "uninitialized");break;
-       case initialized:   fprintf (F, "initialized");  break;
-       case part_constant: fprintf (F, "part_constant");break;
-       case constant:      fprintf (F, "constant");     break;
+       case uninitialized: fprintf (F, "uninitialized\n");break;
+       case initialized:   fprintf (F, "initialized\n");  break;
+       case part_constant: fprintf (F, "part_constant\n");break;
+       case constant:      fprintf (F, "constant\n");     break;
+      }
+      switch (get_entity_volatility(ent)) {
+       case non_volatile: fprintf (F, "non_volatile\n"); break;
+       case is_volatile:  fprintf (F, "is_volatile\n");  break;
+      }
+      switch (get_entity_peculiarity(ent)) {
+       case description: fprintf (F, "description\n"); break;
+        case inherited:   fprintf (F, "inherited\n"); break;
+       case existent:    fprintf (F, "existent\n");    break;
       }
       if (is_method_type(get_entity_type(ent)))
        xfprintf (F, "\n irg = %p ", get_entity_irg(ent));
index c72de85..fde6e48 100644 (file)
@@ -611,7 +611,9 @@ void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
 }
 
 void set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred) {
-  assert(node->op == op_Block && node->attr.block.in_cg && 0 <= pos && pos < ARR_LEN(node->attr.block.in_cg) - 1);
+  assert(node->op == op_Block &&
+        node->attr.block.in_cg &&
+        0 <= pos && pos < ARR_LEN(node->attr.block.in_cg) - 1);
   node->attr.block.in_cg[pos + 1] = pred;
 }
 
index c535602..8956173 100644 (file)
@@ -40,6 +40,7 @@ ir_prog *new_ir_prog (void) {
   res->types  = NEW_ARR_F (type *, 1);
   res->glob_type = new_type_class(id_from_str (GLOBAL_TYPE_NAME,
                                               strlen(GLOBAL_TYPE_NAME)));
+  // @@@ Das ist hier das 2. mal!!
   add_irp_type(res->glob_type);
 
   res->const_code_irg = new_const_code_irg();
index 296c434..af1cb9f 100644 (file)
@@ -69,8 +69,8 @@ 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. */
+/* Removes irg from the list of irgs, deallocates it and
+   shrinks the list by one. */
 void      remove_irp_irg(ir_graph *irg);
 int       get_irp_n_irgs();
 ir_graph *get_irp_irg(int pos);
index 8a8c6cd..87c4507 100644 (file)
@@ -299,7 +299,7 @@ irn_vrfy (ir_node *n)
          );
     break;
   case iro_Phi:
-           /* Phi: BB x dataM^n --> dataM */
+    /* Phi: BB x dataM^n --> dataM */
     /* for some reason "<=" aborts. Is there a problem with get_store? */
     for (i=1; i < get_irn_arity(n); i++) {
       if (!is_Bad(in[i]))