From f9b36e5483d60c3f4a509bd1f20b73881f42108f Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 20 Jan 2004 16:44:06 +0000 Subject: [PATCH] changed semantics of Unknown: now has a mode. [r2330] --- ir/ir/ircgcons.c | 26 +++++++++++++------------- ir/ir/ircons.c | 16 ++++++++-------- ir/ir/ircons.h | 8 ++++---- ir/ir/irgopt.c | 2 ++ ir/ir/irgraph.c | 6 ++++-- ir/ir/irgraph.h | 2 ++ ir/ir/irgraph_t.h | 3 ++- ir/ir/irprog.h | 2 +- ir/ir/irvrfy.c | 2 +- ir/tr/entity.c | 3 +-- ir/tr/entity.h | 4 ++-- ir/tr/type.c | 4 ++-- 12 files changed, 42 insertions(+), 36 deletions(-) diff --git a/ir/ir/ircgcons.c b/ir/ir/ircgcons.c index 5419cefd1..75f40ccf2 100644 --- a/ir/ir/ircgcons.c +++ b/ir/ir/ircgcons.c @@ -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); } } diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 37aa0c615..7975e9552 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -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); diff --git a/ir/ir/ircons.h b/ir/ir/ircons.h index 810d95161..cfbb8c565 100644 --- a/ir/ir/ircons.h +++ b/ir/ir/ircons.h @@ -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. */ diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index 462c8de44..1c5c25b90 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -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 diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index 67114c247..61e5a61d5 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -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) diff --git a/ir/ir/irgraph.h b/ir/ir/irgraph.h index 54263f1ed..c4a18f239 100644 --- a/ir/ir/irgraph.h +++ b/ir/ir/irgraph.h @@ -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); diff --git a/ir/ir/irgraph_t.h b/ir/ir/irgraph_t.h index ed1b90311..0d0740c33 100644 --- a/ir/ir/irgraph_t.h +++ b/ir/ir/irgraph_t.h @@ -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 */ diff --git a/ir/ir/irprog.h b/ir/ir/irprog.h index 08c829b41..636da1886 100644 --- a/ir/ir/irprog.h +++ b/ir/ir/irprog.h @@ -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. */ diff --git a/ir/ir/irvrfy.c b/ir/ir/irvrfy.c index 6ee42f873..de9d70ff1 100644 --- a/ir/ir/irvrfy.c +++ b/ir/ir/irvrfy.c @@ -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; } diff --git a/ir/tr/entity.c b/ir/tr/entity.c index f1923f33d..8665d572f 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -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"); diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 39bb81977..72ac0bf1f 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -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); /** diff --git a/ir/tr/type.c b/ir/tr/type.c index 61b98b11c..2800dd74c 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -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; -- 2.20.1