From f2c04f1b3755231eaab8723a6ef7b5587e3c7712 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 4 May 2004 11:34:43 +0000 Subject: [PATCH] remember all end nodes in irg for dumping convenience. [r2847] --- ir/ir/ircgcons.c | 2 ++ ir/ir/ircons.c | 4 ++-- ir/ir/irdump.c | 17 +++++++++++------ ir/ir/irdump.h | 1 + ir/ir/irgopt.c | 16 +++++++++------- ir/ir/irgraph.c | 30 ++++++++++++++++++++++++++---- ir/ir/irgraph.h | 10 ++++++++++ ir/ir/irgraph_t.h | 2 ++ 8 files changed, 63 insertions(+), 19 deletions(-) diff --git a/ir/ir/ircgcons.c b/ir/ir/ircgcons.c index 6efb84f1e..9330293ff 100644 --- a/ir/ir/ircgcons.c +++ b/ir/ir/ircgcons.c @@ -838,5 +838,7 @@ void cg_destruct(void) { set_irg_frame(irg, skip_nop(get_irg_frame(irg))); set_irg_globals(irg, skip_nop(get_irg_globals(irg))); set_irg_callee_info_state(irg, irg_callee_info_none); + set_irg_end_reg(irg, get_irg_end(irg)); + set_irg_end_except(irg, get_irg_end(irg)); } } diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 7e6ce473b..53c10de4c 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -761,7 +761,7 @@ new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block) ir_node *res; res = new_ir_node (db, irg, block, op_EndReg, mode_T, -1, NULL); - /* res->attr.end.irg = irg; */ + irg->end_reg = res; irn_vrfy_irg (res, irg); return res; @@ -773,7 +773,7 @@ new_rd_EndExcept (dbg_info *db, ir_graph *irg, ir_node *block) ir_node *res; res = new_ir_node (db, irg, block, op_EndExcept, mode_T, -1, NULL); - /* res->attr.end.irg = irg; */ + irg->end_except = res; irn_vrfy_irg (res, irg); return res; diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index d0855bf1b..9227cdbc3 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -318,7 +318,7 @@ static void collect_node(ir_node * node, void *env) { * graphs not visited. * Free the list with DEL_ARR_F. */ static ir_node ** construct_block_lists(ir_graph *irg) { - int i; + int i, rem_view = interprocedural_view; ir_graph *rem = current_ir_graph; current_ir_graph = irg; @@ -327,6 +327,14 @@ static ir_node ** construct_block_lists(ir_graph *irg) { irg_walk_graph(current_ir_graph, clear_link, collect_node, current_ir_graph); + /* Collect also EndReg and EndExcept. We do not want to change the walker. */ + interprocedural_view = 0; + set_irg_visited(current_ir_graph, get_irg_visited(current_ir_graph)-1); + irg_walk(get_irg_end_reg(current_ir_graph), clear_link, collect_node, current_ir_graph); + set_irg_visited(current_ir_graph, get_irg_visited(current_ir_graph)-1); + irg_walk(get_irg_end_except(current_ir_graph), clear_link, collect_node, current_ir_graph); + interprocedural_view = rem_view; + current_ir_graph = rem; return ird_get_irg_link(irg); } @@ -1678,9 +1686,7 @@ dump_ir_graph (ir_graph *irg) char *suffix; rem = current_ir_graph; - /* printf("comparing %s %s\n", get_irg_dump_name(irg), dump_file_filter); */ - - if(strncmp(get_irg_dump_name(irg),dump_file_filter,strlen(dump_file_filter))!=0) return; + if(strncmp(get_entity_name(get_irg_ent(irg)),dump_file_filter,strlen(dump_file_filter))!=0) return; current_ir_graph = irg; if (interprocedural_view) suffix = "-pure-ip"; @@ -1709,8 +1715,7 @@ dump_ir_block_graph (ir_graph *irg) int i; char *suffix; - /* printf("comparing %s %s\n", get_irg_dump_name(irg), dump_file_filter); */ - if(strncmp(get_irg_dump_name(irg),dump_file_filter,strlen(dump_file_filter))!=0) return; + if(strncmp(get_entity_name(get_irg_ent(irg)),dump_file_filter,strlen(dump_file_filter))!=0) return; if (interprocedural_view) suffix = "-ip"; else suffix = ""; diff --git a/ir/ir/irdump.h b/ir/ir/irdump.h index 6d66d3f67..24ccd057d 100644 --- a/ir/ir/irdump.h +++ b/ir/ir/irdump.h @@ -43,6 +43,7 @@ * @todo GL: A hack -- add parameter to dumper function. */ extern char *dump_file_suffix; +/** Set this to the name (not the ld_name) of the method to be dumped. */ extern char *dump_file_filter; /** diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index a2537d945..353b192cd 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -374,6 +374,8 @@ copy_graph_env (void) { /* fix the fields in current_ir_graph */ old_end = get_irg_end(current_ir_graph); set_irg_end (current_ir_graph, get_new_node(old_end)); + set_irg_end_except (current_ir_graph, get_irg_end(current_ir_graph)); + set_irg_end_reg (current_ir_graph, get_irg_end(current_ir_graph)); free_End(old_end); set_irg_end_block (current_ir_graph, get_new_node(get_irg_end_block(current_ir_graph))); if (get_irn_link(get_irg_frame(current_ir_graph)) == NULL) { @@ -1276,22 +1278,22 @@ place_floats_early(ir_node *n, pdeq *worklist) ir_node *dep_block; if ((irn_not_visited(dep)) && (get_op_pinned(intern_get_irn_op(dep)) == floats)) { - place_floats_early(dep, worklist); + place_floats_early(dep, worklist); } /* Because all loops contain at least one pinned node, now all our inputs are either pinned or place_early has already been finished on them. We do not have any unfinished inputs! */ dep_block = get_nodes_Block(dep); if ((!is_Bad(dep_block)) && - (get_Block_dom_depth(dep_block) > depth)) { - b = dep_block; - depth = get_Block_dom_depth(dep_block); + (get_Block_dom_depth(dep_block) > depth)) { + b = dep_block; + depth = get_Block_dom_depth(dep_block); } /* Avoid that the node is placed in the Start block */ if ((depth == 1) && (get_Block_dom_depth(get_nodes_Block(n)) > 1)) { - b = get_Block_cfg_out(get_irg_start_block(current_ir_graph), 0); - assert(b != get_irg_start_block(current_ir_graph)); - depth = 2; + b = get_Block_cfg_out(get_irg_start_block(current_ir_graph), 0); + assert(b != get_irg_start_block(current_ir_graph)); + depth = 2; } } set_nodes_Block(n, b); diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index d27e0827a..edf604579 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -125,8 +125,10 @@ new_ir_graph (entity *ent, int n_loc) remove_irp_type_from_list(res->frame_type); /** Nodes needed in every graph **/ - res->end_block = new_immBlock (); - res->end = new_End (); + res->end_block = new_immBlock (); + res->end = new_End (); + res->end_reg = res->end; + res->end_except = res->end; res->start_block = new_immBlock (); res->start = new_Start (); @@ -187,8 +189,10 @@ ir_graph *new_const_code_irg(void) { res->ent = NULL; res->frame_type = NULL; res->start_block = new_immBlock (); - res->end_block = new_immBlock (); - res->end = new_End (); + res->end_block = new_immBlock (); + res->end = new_End (); + res->end_reg = res->end; + res->end_except = res->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); */ @@ -309,6 +313,24 @@ set_irg_end (ir_graph *irg, ir_node *node) irg->end = node; } +ir_node * +get_irg_end_reg (ir_graph *irg) { + return irg->end_reg; +} +void set_irg_end_reg (ir_graph *irg, ir_node *node) { + assert(get_irn_op(node) == op_EndReg || get_irn_op(node) == op_End); + irg->end_reg = node; +} + +ir_node *get_irg_end_except (ir_graph *irg) { + return irg->end_except; +} + +void set_irg_end_except (ir_graph *irg, ir_node *node) { + assert(get_irn_op(node) == op_EndExcept || get_irn_op(node) == op_End); + irg->end_except = node; +} + ir_node * get_irg_cstore (ir_graph *irg) { diff --git a/ir/ir/irgraph.h b/ir/ir/irgraph.h index e5896c7f4..792c8d5dd 100644 --- a/ir/ir/irgraph.h +++ b/ir/ir/irgraph.h @@ -143,6 +143,16 @@ void set_irg_end_block (ir_graph *irg, ir_node *node); ir_node *get_irg_end (ir_graph *irg); void set_irg_end (ir_graph *irg, ir_node *node); +/* The fields end_reg and end_except contain the end nodes of the + interprocedural view. If the view is not constructed they contain + the nomal end node. */ +ir_node *get_irg_end_reg (ir_graph *irg); +void set_irg_end_reg (ir_graph *irg, ir_node *node); + +ir_node *get_irg_end_except (ir_graph *irg); +void set_irg_end_except (ir_graph *irg, ir_node *node); + + /* @@@ oblivious, no more supported. */ ir_node *get_irg_cstore (ir_graph *irg); void set_irg_cstore (ir_graph *irg, ir_node *node); diff --git a/ir/ir/irgraph_t.h b/ir/ir/irgraph_t.h index b35c62324..bc9544881 100644 --- a/ir/ir/irgraph_t.h +++ b/ir/ir/irgraph_t.h @@ -42,6 +42,8 @@ struct ir_graph { struct ir_node *start; /**< start node of this ir_graph */ struct ir_node *end_block; /**< block the end node will belong to */ struct ir_node *end; /**< end node of this ir_graph */ + struct ir_node *end_reg; /**< end node of this ir_graph */ + struct ir_node *end_except; /**< end node of this ir_graph */ struct ir_node *cstore; /**< constant store -- no more needed!! */ struct ir_node *frame; /**< method's frame */ struct ir_node *globals; /**< pointer to the data segment containing all -- 2.20.1