changed semantics of Unknown: now has a mode.
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 20 Jan 2004 16:44:06 +0000 (16:44 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 20 Jan 2004 16:44:06 +0000 (16:44 +0000)
[r2330]

12 files changed:
ir/ir/ircgcons.c
ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irgopt.c
ir/ir/irgraph.c
ir/ir/irgraph.h
ir/ir/irgraph_t.h
ir/ir/irprog.h
ir/ir/irvrfy.c
ir/tr/entity.c
ir/tr/entity.h
ir/tr/type.c

index 5419cef..75f40cc 100644 (file)
@@ -173,11 +173,11 @@ static void prepare_irg_end_except(ir_graph * irg, irg_data_t * data);
  * cause cycles we don't want to see, as Unknwon is in the Start Block
  * or the procedure. Use unknown of outermost irg where the start
  * block has no predecessors. */
-static INLINE ir_node *get_cg_Unknown(void) {
+static INLINE ir_node *get_cg_Unknown(ir_mode *m) {
   assert((get_Block_n_cfgpreds(get_irg_start_block(get_irp_main_irg())) == 1) &&
         (get_nodes_block(get_Block_cfgpred(get_irg_start_block(get_irp_main_irg()), 0)) ==
          get_irg_start_block(get_irp_main_irg())));
-  return get_irg_unknown(get_irp_main_irg());
+  return new_r_Unknown(get_irp_main_irg(), m);
 }
 
 
@@ -230,10 +230,10 @@ static void prepare_irg(ir_graph * irg, irg_data_t * data) {
 
   /* Unbekannten Aufrufer sofort eintragen. */
   if (data->open) {
-    set_Block_cg_cfgpred(start_block, 0, get_cg_Unknown());
+    set_Block_cg_cfgpred(start_block, 0, get_cg_Unknown(mode_X));
     for (proj = get_irn_link(get_irg_start(irg)); proj; proj = get_irn_link(proj)) {
       if (get_irn_op(proj) == op_Filter) {
-       set_Filter_cg_pred(proj, 0, get_cg_Unknown());
+       set_Filter_cg_pred(proj, 0, get_cg_Unknown(get_irn_mode(proj)));
       }
     }
     data->count = 1;
@@ -440,13 +440,13 @@ static void construct_start(entity * caller, entity * callee,
        /* "frame_base" wird nur durch Unknown dargestellt. Man kann ihn aber
         * auch explizit darstellen, wenn sich daraus Vorteile für die
         * Datenflussanalyse ergeben. */
-       set_Filter_cg_pred(filter, data->count, get_cg_Unknown());
+       set_Filter_cg_pred(filter, data->count, get_cg_Unknown(get_irn_mode(filter)));
        break;
       case pns_globals:
        /* "globals" wird nur durch Unknown dargestellt. Man kann ihn aber auch
         * explizit darstellen, wenn sich daraus Vorteile für die
         * Datenflussanalyse ergeben. */
-       set_Filter_cg_pred(filter, data->count, get_cg_Unknown());
+       set_Filter_cg_pred(filter, data->count, get_cg_Unknown(get_irn_mode(filter)));
        break;
       default:
        /* not reached */
@@ -473,7 +473,7 @@ static void fill_mem(int length, irg_data_t * data[], ir_node * in[]) {
        in[i] = new_Bad();
       }
     } else { /* unknown */
-      in[i] = get_cg_Unknown();
+      in[i] = get_cg_Unknown(mode_M);
     }
   }
 }
@@ -491,7 +491,7 @@ static void fill_except_mem(int length, irg_data_t * data[], ir_node * in[]) {
        in[i] = new_Bad();
       }
     } else { /* unknown */
-      in[i] = get_cg_Unknown();
+      in[i] = get_cg_Unknown(mode_M);
     }
   }
 }
@@ -499,7 +499,7 @@ static void fill_except_mem(int length, irg_data_t * data[], ir_node * in[]) {
 
 /* Abhängigkeiten für ein Ergebnis über alle aufgerufenen Methoden
  * bestimmen. */
-static void fill_result(int pos, int length, irg_data_t * data[], ir_node * in[]) {
+static void fill_result(int pos, int length, irg_data_t * data[], ir_node * in[], ir_mode *m) {
   int i;
   for (i = 0; i < length; ++i) {
     if (data[i]) { /* explicit */
@@ -509,7 +509,7 @@ static void fill_result(int pos, int length, irg_data_t * data[], ir_node * in[]
        in[i] = new_Bad();
       }
     } else { /* unknown */
-      in[i] = get_cg_Unknown();
+      in[i] = get_cg_Unknown(m);
     }
   }
 }
@@ -612,7 +612,7 @@ static void construct_call(ir_node * call) {
        in[i] = new_Bad();
       }
     } else { /* unknown */
-      in[i] = get_cg_Unknown();
+      in[i] = get_cg_Unknown(mode_X);
     }
   }
   set_interprocedural_view(0);
@@ -662,7 +662,7 @@ static void construct_call(ir_node * call) {
          in[i] = new_Bad();
        }
       } else { /* unknown */
-       in[i] = get_cg_Unknown();
+       in[i] = get_cg_Unknown(mode_X);
       }
     }
 
@@ -744,7 +744,7 @@ static void construct_call(ir_node * call) {
        set_irn_link(filter, get_irn_link(post_block));
        set_irn_link(post_block, filter);
       }
-      fill_result(get_Proj_proj(filter), n_callees, data, in);
+      fill_result(get_Proj_proj(filter), n_callees, data, in, get_irn_mode(filter));
       set_Filter_cg_pred_arr(filter, n_callees, in);
     }
   }
index 37aa0c6..7975e95 100644 (file)
@@ -732,9 +732,9 @@ new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *val, ir_no
 }
 
 INLINE ir_node *
-new_rd_Unknown (ir_graph *irg)
+new_rd_Unknown (ir_graph *irg, ir_mode *m)
 {
-  return irg->unknown;
+  return new_ir_node (NULL, irg, irg->start_block, op_Unknown, m, 0, NULL);
 }
 
 INLINE ir_node *
@@ -977,8 +977,8 @@ INLINE ir_node *new_r_Bad    (ir_graph *irg) {
 INLINE ir_node *new_r_Confirm (ir_graph *irg, ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp) {
   return new_rd_Confirm (NULL, irg, block, val, bound, cmp);
 }
-INLINE ir_node *new_r_Unknown (ir_graph *irg) {
-  return new_rd_Unknown(irg);
+INLINE ir_node *new_r_Unknown (ir_graph *irg, ir_mode *m) {
+  return new_rd_Unknown(irg, m);
 }
 INLINE ir_node *new_r_CallBegin (ir_graph *irg, ir_node *block, ir_node *callee) {
   return new_rd_CallBegin(NULL, irg, block, callee);
@@ -2166,9 +2166,9 @@ new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp)
 }
 
 ir_node *
-new_d_Unknown (void)
+new_d_Unknown (ir_mode *m)
 {
-  return current_ir_graph->unknown;
+  return new_rd_Unknown(current_ir_graph, m);
 }
 
 ir_node *
@@ -2490,8 +2490,8 @@ ir_node *new_Bad    (void) {
 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp) {
   return new_d_Confirm (NULL, val, bound, cmp);
 }
-ir_node *new_Unknown(void) {
-  return new_d_Unknown();
+ir_node *new_Unknown(ir_mode *m) {
+  return new_d_Unknown(m);
 }
 ir_node *new_CallBegin (ir_node *callee) {
   return new_d_CallBegin(NULL, callee);
index 810d951..cfbb8c5 100644 (file)
@@ -1181,7 +1181,7 @@ ir_node *new_rd_Id     (dbg_info *db, ir_graph *irg, ir_node *block,
 ir_node *new_rd_Bad    (ir_graph *irg);
 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
                         ir_node *val, ir_node *bound, pn_Cmp cmp);
-ir_node *new_rd_Unknown(ir_graph *irg);
+ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
@@ -1277,7 +1277,7 @@ ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
 ir_node *new_r_Bad    (ir_graph *irg);
 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
                        ir_node *val, ir_node *bound, pn_Cmp cmp);
-ir_node *new_r_Unknown(ir_graph *irg);
+ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
@@ -1347,7 +1347,7 @@ ir_node *new_d_Tuple  (dbg_info* db, int arity, ir_node *in[]);
 ir_node *new_d_Id     (dbg_info* db, ir_node *val, ir_mode *mode);
 ir_node *new_d_Bad    (void);
 ir_node *new_d_Confirm (dbg_info* db, ir_node *val, ir_node *bound, pn_Cmp cmp);
-ir_node *new_d_Unknown(void);
+ir_node *new_d_Unknown(ir_mode *m);
 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
 ir_node *new_d_EndReg (dbg_info *db);
 ir_node *new_d_EndExcept(dbg_info *db);
@@ -1417,7 +1417,7 @@ ir_node *new_Tuple  (int arity, ir_node *in[]);
 ir_node *new_Id     (ir_node *val, ir_mode *mode);
 ir_node *new_Bad    (void);
 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
-ir_node *new_Unknown(void);
+ir_node *new_Unknown(ir_mode *m);
 
 /*---------------------------------------------------------------------*/
 /* The comfortable interface.                                          */
index 462c8de..1c5c25b 100644 (file)
@@ -359,11 +359,13 @@ copy_graph_env (void) {
     copy_preds(get_irg_bad(current_ir_graph), NULL);
   }
   set_irg_bad(current_ir_graph, get_new_node(get_irg_bad(current_ir_graph)));
+  /* GL removed: we need unknown with mode for analyses.
   if (get_irn_link(get_irg_unknown(current_ir_graph)) == NULL) {
     copy_node(get_irg_unknown(current_ir_graph), NULL);
     copy_preds(get_irg_unknown(current_ir_graph), NULL);
   }
   set_irg_unknown(current_ir_graph, get_new_node(get_irg_unknown(current_ir_graph)));
+  */
 }
 
 /* Copies all reachable nodes to a new obstack.  Removes bad inputs
index 67114c2..61e5a61 100644 (file)
@@ -128,7 +128,7 @@ new_ir_graph (entity *ent, int n_loc)
   res->start_block = new_immBlock ();
   res->start   = new_Start ();
   res->bad     = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
-  res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
+  //res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
 
   /* Proj results of start node */
   projX        = new_Proj (res->start, mode_X, pns_initial_exec);
@@ -188,7 +188,7 @@ ir_graph *new_const_code_irg(void) {
   res->end       = new_End ();
   mature_block(get_cur_block());
   res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
-  res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
+  //res->unknown = new_ir_node (NULL, res, res->start_block, op_Unknown, mode_T, 0, NULL);
   res->start   = new_Start ();
 
   /* Proj results of start node */
@@ -358,6 +358,7 @@ set_irg_bad (ir_graph *irg, ir_node *node)
   irg->bad = node;
 }
 
+/* GL removed: we need unknown with mode for analyses.
 ir_node *
 get_irg_unknown (ir_graph *irg)
 {
@@ -369,6 +370,7 @@ set_irg_unknown (ir_graph *irg, ir_node *node)
 {
   irg->unknown = node;
 }
+*/
 
 ir_node *
 get_irg_current_block (ir_graph *irg)
index 54263f1..c4a18f2 100644 (file)
@@ -167,8 +167,10 @@ ir_node *get_irg_bad (ir_graph *irg);
 void     set_irg_bad (ir_graph *irg, ir_node *node);
 
 /* Use new_Unknown() instead!! */
+/* GL removed: we need unknown with mode for analyses.
 ir_node *get_irg_unknown (ir_graph *irg);
 void     set_irg_unknown (ir_graph *irg, ir_node *node);
+*/
 
 int      get_irg_n_locs (ir_graph *irg);
 
index ed1b903..0d0740c 100644 (file)
@@ -49,7 +49,8 @@ struct ir_graph {
   struct ir_node *args;              /**< methods arguments */
   struct ir_node *bad;              /**< bad node of this ir_graph, the one and
                                         only in this graph */
-  struct ir_node *unknown;           /**< unknown node of this ir_graph */
+  /* GL removed: we need unknown with mode for analyses. */
+  //  struct ir_node *unknown;           /**< unknown node of this ir_graph */
   struct obstack *obst;                     /**< obstack where all of the ir_nodes live */
   struct ir_node *current_block;     /**< block for newly gen_*()-erated
                                        ir_nodes */
index 08c829b..636da18 100644 (file)
@@ -86,7 +86,7 @@ void      set_irp_main_irg(ir_graph *main_irg);
 void      add_irp_irg(ir_graph *irg);
 
 /** Removes irg from the list of irgs, deallocates it and
-   shrinks the list by one. */
+    shrinks the list by one. */
 void      remove_irp_irg(ir_graph *irg);
 
 /** Returns the number of ir graphs in the irp. */
index 6ee42f8..de9d70f 100644 (file)
@@ -271,7 +271,7 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
   if (opcode != iro_Phi && opcode != iro_Block)
     for (i = 0; i < get_irn_arity(n); i++) {
       opcode1 = get_irn_opcode(get_irn_n(n, i));
-      if (opcode1 == iro_Bad || opcode1 == iro_Unknown)
+      if (opcode1 == iro_Bad /*|| opcode1 == iro_Unknown*/)  /* GL: for analyses mode must be correct. */
         return 1;
     }
 
index f1923f3..8665d57 100644 (file)
@@ -441,7 +441,6 @@ set_atomic_ent_value(entity *ent, ir_node *val) {
 /* Returns true if the the node is representable as code on
  *  const_code_irg. */
 int is_irn_const_expression(ir_node *n) {
-  ir_node *pred;
   ir_mode *m;
 
   m = get_irn_mode(n);
@@ -482,7 +481,7 @@ ir_node *copy_const_value(ir_node *n) {
   case iro_Conv:
     nn = new_Conv(copy_const_value(get_Conv_op(n)), m); break;
   case iro_Unknown:
-    nn = new_Unknown(); break;
+    nn = new_Unknown(m); break;
   default:
     DDMN(n);
     assert(0 && "opdope invalid or not implemented");
index 39bb819..72ac0bf 100644 (file)
@@ -221,7 +221,7 @@ typedef enum {
   allocation_dynamic,   /**< The entity is allocated during runtime, explicitly
                             by an Alloc node. */
   allocation_static     /**< The entity is allocated statically.  We can use a
-                             SymConst(?) as address of the entity. */
+                             Const as address of the entity. */
 } ent_allocation;
 
 /** Returns the allocation type of an entity. */
@@ -230,7 +230,7 @@ ent_allocation get_entity_allocation (entity *ent);
 /** Sets the allocation type of an entity. */
 void           set_entity_allocation (entity *ent, ent_allocation al);
 
-/** Return the name of the visibility */
+/** Return the name of the allocation type. */
 const char *get_allocation_name(ent_allocation vis);
 
 /**
index 61b98b1..2800dd7 100644 (file)
@@ -1127,8 +1127,8 @@ INLINE type *new_type_array         (ident *name, int n_dimensions,
 
   current_ir_graph = get_const_code_irg();
   for (i = 0; i < n_dimensions; i++) {
-    res->attr.aa.lower_bound[i]  = new_Unknown();
-    res->attr.aa.upper_bound[i]  = new_Unknown();
+    res->attr.aa.lower_bound[i]  = new_Unknown(mode_Iu);
+    res->attr.aa.upper_bound[i]  = new_Unknown(mode_Iu);
     res->attr.aa.order[i] = i;
   }
   current_ir_graph = rem;