From d9663f1d01e157474633dd840b9db18c6356243b Mon Sep 17 00:00:00 2001 From: Beyhan Date: Tue, 6 Jul 2004 16:09:31 +0000 Subject: [PATCH] added type field to symconst [r3325] --- ir/ir/ircons.c | 33 +++++++++++++++++++-------------- ir/ir/ircons.h | 21 ++++++++++++++++++--- ir/ir/irnode_t.h | 1 + 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index ab9c65d55..9bdef3545 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -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) { diff --git a/ir/ir/ircons.h b/ir/ir/ircons.h index 56cb597b9..78355bc92 100644 --- a/ir/ir/ircons.h +++ b/ir/ir/ircons.h @@ -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. diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index f0ca0dc91..6b470ced4 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -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 */ -- 2.20.1