added type field to symconst
authorBeyhan <beyhan@ipd.info.uni-karlsruhe.de>
Tue, 6 Jul 2004 16:09:31 +0000 (16:09 +0000)
committerBeyhan <beyhan@ipd.info.uni-karlsruhe.de>
Tue, 6 Jul 2004 16:09:31 +0000 (16:09 +0000)
[r3325]

ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irnode_t.h

index ab9c65d..9bdef35 100644 (file)
@@ -679,8 +679,8 @@ new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
 }
 
 INLINE ir_node *
-new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
-                symconst_kind symkind)
+new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
+                     symconst_kind symkind, type *tp)
 {
   ir_node *res;
   ir_mode *mode;
@@ -692,23 +692,21 @@ new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol va
 
   res->attr.i.num = symkind;
   res->attr.i.sym = value;
-  /*
-  if (symkind == symconst_addr_name) {
-    res->attr.i.sym.ident_p = (ident *)value;
-  } else if (symkind == symconst_addr_ent) {
-    res->attr.i.sym.entity = (entity *)value;
-  } else {
-    assert (   (   (symkind ==symconst_type_tag)
-            || (symkind == symconst_size))
-            && (is_type(value)));
-    res->attr.i.sym.typ = (type *)value;
-  }
-  */
+  res->attr.i.tp  = tp;
+
   res = optimize_node (res);
   irn_vrfy_irg (res, irg);
   return res;
 }
 
+INLINE ir_node *
+new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
+                symconst_kind symkind)
+{
+  ir_node *res = new_rd_SymConst_type (db, irg, block, value, symkind, unknown_type);
+  return res;
+}
+
 INLINE ir_node *
 new_rd_Sync (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in)
 {
@@ -2242,6 +2240,13 @@ new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, type *ent)
                          store, objptr, ent));
 }
 
+ir_node *
+new_d_SymConst_type (dbg_info* db, symconst_symbol value, symconst_kind kind, type *tp)
+{
+  return new_rd_SymConst_type (db, current_ir_graph, current_ir_graph->start_block,
+                         value, kind, tp);
+}
+
 ir_node *
 new_d_SymConst (dbg_info* db, symconst_symbol value, symconst_kind kind)
 {
index 56cb597..78355bc 100644 (file)
@@ -1279,7 +1279,7 @@ ir_node *new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block,
 ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
                ir_mode *mode, tarval *con);
 
-/** Constructor for a SymConst node.
+/** Constructor for a SymConst_type node.
  *
  *  This is the constructor for a symbolic constant.
  *    There are four kinds of symbolic constants:
@@ -1305,7 +1305,15 @@ ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
  * @param *block  The ir block the node belongs to.
  * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
  * @param value   A type, entity or a ident depending on the SymConst kind.
+ * @param tp      The source type of the constant.
  */
+ir_node *
+new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
+                     symconst_kind symkind, type *tp);
+
+/** Constructor for a SymConst node.
+ *
+ *  Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
                          symconst_symbol value, symconst_kind symkind);
 
@@ -2645,7 +2653,7 @@ ir_node *new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp);
  */
 ir_node *new_d_Const  (dbg_info* db, ir_mode *mode, tarval *con);
 
-/** Constructor for a SymConst node.
+/** Constructor for a SymConst_type node.
  *
  *  Adds the node to the block in current_ir_block.
  *  This is the constructor for a symbolic constant.
@@ -2669,9 +2677,16 @@ ir_node *new_d_Const  (dbg_info* db, ir_mode *mode, tarval *con);
  *
  * @param *db     A pointer for debug information.
  * @param value   A type, entity or ident depending on the SymConst kind.
- * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
+ * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size
+ *                or symconst_addr_name.
+ * @param tp      The source type of the constant.
  *
  */
+ir_node *new_d_SymConst_type (dbg_info* db, symconst_symbol value, symconst_kind kind, type* tp);
+
+/** Constructor for a SymConst node.
+ *
+ *  Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
 ir_node *new_d_SymConst (dbg_info* db, symconst_symbol value, symconst_kind kind);
 
 /** Constructor for a simpleSel node.
index f0ca0dc..6b470ce 100644 (file)
@@ -92,6 +92,7 @@ typedef struct {
 typedef struct {
   symconst_symbol sym;  // old tori
   symconst_kind num;
+  type *tp;          /**< the source type, for analyses. default: type_unknown. */
 } symconst_attr;
 
 /** Sel attributes */