From b774ac267f6492f992b779ea95cb20a1c89b5dca Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Fri, 28 Jun 2002 09:59:32 +0000 Subject: [PATCH] bugfixes - mode of Phi was mode_T - other Added support for prculiarity "inherited" [r421] --- ir/ir/ircgcons.c | 19 +++++++++++++++---- ir/ir/irdump.c | 28 +++++++++++++++++++--------- ir/ir/irnode.c | 4 +++- ir/ir/irprog.c | 1 + ir/ir/irprog.h | 4 ++-- ir/ir/irvrfy.c | 2 +- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/ir/ir/ircgcons.c b/ir/ir/ircgcons.c index 52676b095..0abe06644 100644 --- a/ir/ir/ircgcons.c +++ b/ir/ir/ircgcons.c @@ -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); } diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index 6c7a2839b..91bf36b09 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -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)); diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index c72de8507..fde6e4865 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -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; } diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index c53560235..8956173ff 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -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(); diff --git a/ir/ir/irprog.h b/ir/ir/irprog.h index 296c43471..af1cb9f06 100644 --- a/ir/ir/irprog.h +++ b/ir/ir/irprog.h @@ -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); diff --git a/ir/ir/irvrfy.c b/ir/ir/irvrfy.c index 8a8c6cdb2..87c450713 100644 --- a/ir/ir/irvrfy.c +++ b/ir/ir/irvrfy.c @@ -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])) -- 2.20.1