X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Fircgcons.c;h=74215b9aec89659e55fcb06effb58a2724e1206f;hb=20a054e20083e0b0e996aceabf561254c663277a;hp=a5304a7da42ad9bcc892eaae8e770dbf80ed316b;hpb=174de862b13187b2d27e0084bcfbfaea3c744ac5;p=libfirm diff --git a/ir/ir/ircgcons.c b/ir/ir/ircgcons.c index a5304a7da..74215b9ae 100644 --- a/ir/ir/ircgcons.c +++ b/ir/ir/ircgcons.c @@ -1,20 +1,38 @@ /* - * Project: libFIRM - * File name: ir/ir/ircgcons.c - * Purpose: Construction and removal of interprocedural representation - * (explicit interprocedural dependencies). - * Author: Hubert Schmid - * Modified by: - * Created: 09.06.2002 - * CVS-ID: $Id$ - * Copyright: (c) 2002-2003 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +/** + * @file + * @brief Construction and removal of interprocedural representation + * (explicit interprocedural dependencies). + * @author Hubert Schmid + * @date 09.06.2002 + * @version $Id$ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif +#ifdef HAVE_STRING_H #include +#endif + #include #include "ircgcons.h" @@ -26,7 +44,7 @@ #include "irgmod.h" #include "irgwalk.h" #include "irflag_t.h" - +#include "irtools.h" /* Return the current state of the interprocedural view. */ ip_view_state get_irp_ip_view_state(void) { @@ -53,8 +71,8 @@ typedef struct { } irg_data_t; static irg_data_t * irg_data_create(void) { - irg_data_t * data = xmalloc(sizeof(irg_data_t)); - memset(data, 0, sizeof(irg_data_t)); /* init */ + irg_data_t *data = xmalloc(sizeof(*data)); + memset(data, 0, sizeof(*data)); /* init */ return data; } @@ -65,7 +83,7 @@ static irg_data_t * irg_data_create(void) { * - are external visible * - are dereferenced somewhere within the program (i.e., the address of the * method is stored somewhere). */ -static void caller_init(int arr_length, entity ** free_methods) { +static void caller_init(int arr_length, ir_entity ** free_methods) { int i, j; for (i = get_irp_n_irgs() - 1; i >= 0; --i) { set_entity_link(get_irg_entity(get_irp_irg(i)), irg_data_create()); @@ -81,24 +99,21 @@ static void caller_init(int arr_length, entity ** free_methods) { for (call = get_irn_link(get_irg_end(irg)); call; call = get_irn_link(call)) { if (get_irn_op(call) != op_Call) continue; for (j = get_Call_n_callees(call) - 1; j >= 0; --j) { - entity * ent = get_Call_callee(call, j); - if (ent != unknown_entity) { - irg_data_t * data = get_entity_link(ent); + ir_entity * ent = get_Call_callee(call, j); + if (get_entity_irg(ent)) { + irg_data_t * data = get_entity_link(ent); # ifndef CATE_jni - assert(get_entity_irg(ent) && data); - ++data->count; + assert(get_entity_irg(ent) && data); + ++data->count; # endif /* ndef CATE_jni */ - } + } else { + set_entity_link(ent, NULL); + } } } } } - -static INLINE void clear_link(ir_node * node, void * env) { - set_irn_link(node, NULL); -} - /* static INLINE ir_node * tail(ir_node * node) { ir_node * link; @@ -150,19 +165,25 @@ static void link(ir_node * head, ir_node * node) { * ... -> Proj -> NULL. */ static void collect_phicallproj(void) { int i; + for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_graph * irg = get_irp_irg(i); ir_node * start = get_irg_start(irg); ir_node * end = get_irg_end(irg); current_ir_graph = irg; assert(irg && start); + + set_using_irn_link(irg); + /* Die speziellen Parameter der Start-Operation extra verlinken, * auch wenn sie nicht im intraprozeduralen Graphen erreichbar * sind. */ link(start, get_irg_frame(irg)); link(start, get_irg_globals(irg)); /* walk */ - irg_walk_graph(irg, clear_link, (irg_walk_func *) collect_phicallproj_walker, &end); + irg_walk_graph(irg, firm_clear_link, (irg_walk_func *) collect_phicallproj_walker, &end); + + clear_using_irn_link(irg); } } @@ -284,12 +305,12 @@ static void prepare_irg_end(ir_graph * irg, irg_data_t * data) { int n_ret = 0; for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) { - if (get_irn_op(cfgpred_arr[i]) == op_Return) { + if (is_Return(cfgpred_arr[i])) { if (ret_arr) { - ARR_APP1(ir_node *, ret_arr, cfgpred_arr[i]); + ARR_APP1(ir_node *, ret_arr, cfgpred_arr[i]); } else { - ret_arr = NEW_ARR_F(ir_node *, 1); - ret_arr[0] = cfgpred_arr[i]; + ret_arr = NEW_ARR_F(ir_node *, 1); + ret_arr[0] = cfgpred_arr[i]; } ++n_ret; } @@ -351,12 +372,12 @@ static void prepare_irg_end_except(ir_graph * irg, irg_data_t * data) { int n_except = 0; ir_node ** cfgpred_arr = get_Block_cfgpred_arr(end_block); for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) { - if (get_irn_op(cfgpred_arr[i]) != op_Return) { + if (! is_Return(cfgpred_arr[i])) { if (except_arr) { - ARR_APP1(ir_node *, except_arr, cfgpred_arr[i]); + ARR_APP1(ir_node *, except_arr, cfgpred_arr[i]); } else { - except_arr = NEW_ARR_F(ir_node *, 1); - except_arr[0] = cfgpred_arr[i]; + except_arr = NEW_ARR_F(ir_node *, 1); + except_arr[0] = cfgpred_arr[i]; } ++n_except; } @@ -369,15 +390,18 @@ static void prepare_irg_end_except(ir_graph * irg, irg_data_t * data) { data->except = new_EndExcept(); /* mem */ for (i = n_except - 1; i >= 0; --i) { - ir_node * node = skip_Proj(skip_Tuple(except_arr[i])); - if (get_irn_op(node) == op_Call) { - in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 3); - } else if (get_irn_op(node) == op_Raise) { - in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 1); + ir_node *node = skip_Proj(skip_Tuple(except_arr[i])); + ir_op *op = get_irn_op(node); + if (op == op_Call) { + in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_Call_M_except); + } else if (op == op_Raise) { + in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_Raise_M); + } else if (op == op_CopyB) { + in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, pn_CopyB_M_except); } else { - assert(is_fragile_op(node)); - /* We rely that all cfops have the memory output at the same position. */ - in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 0); + assert(is_fragile_op(node)); + /* We rely that all cfops have the memory output at the same position. */ + in[i] = new_r_Proj(irg, get_nodes_block(node), node, mode_M, 0); } } data->except_mem = new_Phi(n_except, in, mode_M); @@ -394,7 +418,7 @@ static void prepare_irg_end_except(ir_graph * irg, irg_data_t * data) { /* Zwischengespeicherte Daten wieder freigeben. */ static void cleanup_irg(ir_graph * irg) { - entity * ent = get_irg_entity(irg); + ir_entity * ent = get_irg_entity(irg); irg_data_t * data = get_entity_link(ent); assert(data); if (data->res) DEL_ARR_F(data->res); @@ -444,17 +468,19 @@ 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(ir_entity * caller, ir_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); ir_node *filter; + (void) caller; assert(irg); assert(get_entity_peculiarity(callee) == peculiarity_existent); /* Else data is not initalized. */ assert((0 <= data->count) && - (data->count < get_Block_cg_n_cfgpreds(get_nodes_block(start)))); + (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)) { @@ -496,9 +522,9 @@ static void fill_mem(int length, irg_data_t * data[], ir_node * in[]) { for (i = 0; i < length; ++i) { if (data[i]) { /* explicit */ if (data[i]->reg) { - in[i] = data[i]->mem; + in[i] = data[i]->mem; } else { - in[i] = new_Bad(); + in[i] = new_Bad(); } } else { /* unknown */ in[i] = get_cg_Unknown(mode_M); @@ -514,9 +540,9 @@ static void fill_except_mem(int length, irg_data_t * data[], ir_node * in[]) { for (i = 0; i < length; ++i) { if (data[i]) { /* explicit */ if (data[i]->except) { - in[i] = data[i]->except_mem; + in[i] = data[i]->except_mem; } else { - in[i] = new_Bad(); + in[i] = new_Bad(); } } else { /* unknown */ in[i] = get_cg_Unknown(mode_M); @@ -532,9 +558,9 @@ static void fill_result(int pos, int length, irg_data_t * data[], ir_node * in[] for (i = 0; i < length; ++i) { if (data[i]) { /* explicit */ if (data[i]->reg) { - in[i] = data[i]->res[pos]; + in[i] = data[i]->res[pos]; } else { - in[i] = new_Bad(); + in[i] = new_Bad(); } } else { /* unknown */ in[i] = get_cg_Unknown(m); @@ -588,22 +614,29 @@ static bool is_outermost_graph(ir_graph *irg) { * Methoden auf die CallBegin-Operation, und von der Aufrufstelle auf die * aufgerufenen Methoden eintragen. */ static void construct_call(ir_node * call) { - int n_callees = get_Call_n_callees(call); - ir_node * post_block = get_nodes_block(call); /* block nach dem Aufruf */ - ir_node * pre_block = create_Block(get_Block_n_cfgpreds(post_block), - get_Block_cfgpred_arr(post_block)); /* block vor dem Aufruf (mit CallBegin) */ - ir_node * except_block = NULL, * proj; - ir_node * jmp = new_Break(); /* Sprung für intraprozedurale Darstellung (in - * pre_block) */ - ir_node * call_begin = new_CallBegin(call); /* (in pre_block) */ + int i, n_callees; + ir_node *post_block, *pre_block, *except_block, * proj, *jmp, *call_begin; + ir_node ** in; + ir_entity * caller; + ir_entity ** callees; + ir_graph ** irgs; + irg_data_t ** data; + + n_callees = get_Call_n_callees(call); + post_block = get_nodes_block(call); /* block nach dem Aufruf */ + pre_block = create_Block(get_Block_n_cfgpreds(post_block), + get_Block_cfgpred_arr(post_block)); /* block vor dem Aufruf (mit CallBegin) */ + except_block = NULL; + jmp = new_Break(); /* Sprung für intraprozedurale Darstellung (in * pre_block) */ + call_begin = new_CallBegin(call); /* (in pre_block) */ /* CallBegin might be entry to endless recursion. */ add_End_keepalive(get_irg_end(get_irn_irg(pre_block)), pre_block); - ir_node ** in = NEW_ARR_F(ir_node *, n_callees); - entity * caller = get_irg_entity(current_ir_graph); /* entity des aktuellen ir_graph */ - entity ** callees = NEW_ARR_F(entity *, n_callees); /* aufgerufene Methoden: entity */ - ir_graph ** irgs = NEW_ARR_F(ir_graph *, n_callees); /* aufgerufene Methoden: ir_graph */ - irg_data_t ** data = NEW_ARR_F(irg_data_t *, n_callees); /* aufgerufene Methoden: irg_data_t */ - int i; + + in = NEW_ARR_F(ir_node *, n_callees); + caller = get_irg_entity(current_ir_graph); /* entity des aktuellen ir_graph */ + callees = NEW_ARR_F(ir_entity *, n_callees); /* aufgerufene Methoden: entity */ + irgs = NEW_ARR_F(ir_graph *, n_callees); /* aufgerufene Methoden: ir_graph */ + data = NEW_ARR_F(irg_data_t *, n_callees); /* aufgerufene Methoden: irg_data_t */ /* post_block kann bereits interprozedurale Steuerflussvorgänger * besitzen. Diese müssen dann auch noch für den pre_block gesetzt werden. */ @@ -623,6 +656,9 @@ static void construct_call(ir_node * call) { callees[i] = get_Call_callee(call, i); irgs[i] = get_entity_irg(callees[i]); data[i] = get_entity_link(callees[i]); + /* Only entities that have an irg got a irg_data data structure. + In others there is some arbitrary garbage in the link field. */ + if (!irgs[i]) { assert(!data[i]); data[i] = NULL; } } /* @@ -636,10 +672,10 @@ static void construct_call(ir_node * call) { for (i = 0; i < n_callees; ++i) { if (data[i]) { /* explicit */ if (data[i]->reg) { - in[i] = new_r_Proj(irgs[i], get_nodes_block(data[i]->reg), - data[i]->reg, mode_X, data[i]->count); + in[i] = new_r_Proj(irgs[i], get_nodes_block(data[i]->reg), + data[i]->reg, mode_X, data[i]->count); } else { - in[i] = new_Bad(); + in[i] = new_Bad(); } } else { /* unknown */ in[i] = get_cg_Unknown(mode_X); @@ -656,23 +692,22 @@ static void construct_call(ir_node * call) { bool exc_to_end = false; if (exc_branches_to_end(current_ir_graph, proj)) { /* The Call aborts the procedure if it returns with an exception. - If this is an outermost procedure, the normal handling of exceptions - will generate a Break that goes to the end block. This is illegal - Frim. So directly branch to the end block with all exceptions. */ + If this is an outermost procedure, the normal handling of exceptions + will generate a Break that goes to the end block. This is illegal + Frim. So directly branch to the end block with all exceptions. */ exc_to_end = true; if (is_outermost_graph(current_ir_graph)) { - except_block = get_irg_end_block(current_ir_graph); + except_block = get_irg_end_block(current_ir_graph); } else { - irg_data_t * tmp_data = get_entity_link(get_irg_entity(current_ir_graph)); - except_block = get_nodes_block(tmp_data->except); + irg_data_t * tmp_data = get_entity_link(get_irg_entity(current_ir_graph)); + except_block = get_nodes_block(tmp_data->except); } - } else - { + } else { except_block = create_Block(1, &proj); set_nodes_block(proj, except_block); exchange(proj, new_Break()); set_irg_current_block(current_ir_graph, pre_block); - set_irn_n(except_block, 0, new_Proj(call, mode_X, 1)); + set_irn_n(except_block, 0, new_Proj(call, mode_X, pn_Call_X_except)); set_irg_current_block(current_ir_graph, post_block); } @@ -683,16 +718,16 @@ static void construct_call(ir_node * call) { set_interprocedural_view(1); for (i = 0; i < n_callees; ++i) { - entity * callee = get_Call_callee(call, i); + ir_entity * callee = get_Call_callee(call, i); if (data[i]) { /* explicit */ - if (data[i]->except) { - in[i] = new_r_Proj(get_entity_irg(callee), get_nodes_block(data[i]->except), - data[i]->except, mode_X, data[i]->count); - } else { - in[i] = new_Bad(); - } + if (data[i]->except) { + in[i] = new_r_Proj(get_entity_irg(callee), get_nodes_block(data[i]->except), + data[i]->except, mode_X, data[i]->count); + } else { + in[i] = new_Bad(); + } } else { /* unknown */ - in[i] = get_cg_Unknown(mode_X); + in[i] = get_cg_Unknown(mode_X); } } @@ -701,14 +736,14 @@ static void construct_call(ir_node * call) { /* append all existing preds of the end block to new in array. * Normal access routine guarantees that with first visit we * get the normal preds, and from then on the _cg_ preds. - * (interporcedural view is set!) + * (interprocedural view is set!) * Do not add the exc pred of end we are replacing! */ for (i = get_Block_n_cfgpreds(except_block)-1; i >= 0; --i) { - ir_node *pred = get_Block_cfgpred(except_block, i); - if (pred != proj) { - ARR_APP1(ir_node *, in, pred); - preds++; - } + ir_node *pred = get_Block_cfgpred(except_block, i); + if (pred != proj) { + ARR_APP1(ir_node *, in, pred); + preds++; + } } } set_Block_cg_cfgpred_arr(except_block, preds, in); @@ -719,7 +754,8 @@ static void construct_call(ir_node * call) { * eintragen. */ set_irg_current_block(current_ir_graph, pre_block); for (i = 0; i < n_callees; ++i) { - construct_start(caller, callees[i], call, new_Proj(call_begin, mode_X, i)); + if (irgs[i]) /* Else there is not graph to call */ + construct_start(caller, callees[i], call, new_Proj(call_begin, mode_X, i)); } /* Proj-Operationen in Filter-Operationen umwandeln und @@ -729,39 +765,39 @@ static void construct_call(ir_node * call) { if (get_irn_op(proj) != op_Proj) continue; if (skip_Proj(get_Proj_pred(proj)) != call) continue; if (get_Proj_pred(proj) == call) { - if (get_Proj_proj(proj) == 0) { /* memory */ - ir_node * filter; - - set_nodes_block(proj, post_block); - filter = exchange_proj(proj); - /* filter in die Liste der Phis aufnehmen */ - if (get_irn_link(filter) == NULL) { /* note CSE */ - set_irn_link(filter, get_irn_link(post_block)); - set_irn_link(post_block, filter); - } - fill_mem(n_callees, data, in); - set_Filter_cg_pred_arr(filter, n_callees, in); - } else if (get_Proj_proj(proj) == 1) { /* except */ - /* nothing: siehe oben */ - } else if (get_Proj_proj(proj) == 2) { /* results */ - /* nothing */ - } else if (get_Proj_proj(proj) == 3) { /* except_mem */ + if (get_Proj_proj(proj) == pn_Call_M_regular) { /* memory */ + ir_node * filter; + + set_nodes_block(proj, post_block); + filter = exchange_proj(proj); + /* filter in die Liste der Phis aufnehmen */ + if (get_irn_link(filter) == NULL) { /* note CSE */ + set_irn_link(filter, get_irn_link(post_block)); + set_irn_link(post_block, filter); + } + fill_mem(n_callees, data, in); + set_Filter_cg_pred_arr(filter, n_callees, in); + } else if (get_Proj_proj(proj) == pn_Call_X_except) { /* except */ + /* nothing: siehe oben */ + } else if (get_Proj_proj(proj) == pn_Call_T_result) { /* results */ + /* nothing */ + } else if (get_Proj_proj(proj) == pn_Call_M_except) { /* except_mem */ ir_node * filter; - set_nodes_block(proj, post_block); - assert(except_block); - set_irg_current_block(current_ir_graph, except_block); - filter = exchange_proj(proj); - /* filter in die Liste der Phis aufnehmen */ - if (get_irn_link(filter) == NULL) { /* note CSE */ - set_irn_link(filter, get_irn_link(except_block)); - set_irn_link(except_block, filter); - } - set_irg_current_block(current_ir_graph, post_block); - fill_except_mem(n_callees, data, in); - set_Filter_cg_pred_arr(filter, n_callees, in); + set_nodes_block(proj, post_block); + assert(except_block); + set_irg_current_block(current_ir_graph, except_block); + filter = exchange_proj(proj); + /* filter in die Liste der Phis aufnehmen */ + if (get_irn_link(filter) == NULL) { /* note CSE */ + set_irn_link(filter, get_irn_link(except_block)); + set_irn_link(except_block, filter); + } + set_irg_current_block(current_ir_graph, post_block); + fill_except_mem(n_callees, data, in); + set_Filter_cg_pred_arr(filter, n_callees, in); } else { - assert(0 && "not reached"); + assert(0 && "not reached"); } } else { /* result */ ir_node * filter; @@ -771,8 +807,8 @@ static void construct_call(ir_node * call) { filter = exchange_proj(proj); /* filter in die Liste der Phis aufnehmen */ if (get_irn_link(filter) == NULL) { /* not CSE */ - set_irn_link(filter, get_irn_link(post_block)); - set_irn_link(post_block, filter); + 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, get_irn_mode(filter)); set_Filter_cg_pred_arr(filter, n_callees, in); @@ -785,7 +821,7 @@ static void construct_call(ir_node * call) { } -void cg_construct(int arr_len, entity ** free_methods_arr) { +void cg_construct(int arr_len, ir_entity ** free_methods_arr) { int i; if (get_irp_ip_view_state() == ip_view_valid) return; @@ -800,7 +836,7 @@ void cg_construct(int arr_len, entity ** free_methods_arr) { /* prepare irgs */ for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_graph * irg = get_irp_irg(i); - entity * ent = get_irg_entity(irg); + ir_entity * ent = get_irg_entity(irg); irg_data_t * data = get_entity_link(ent); if (data->count) { prepare_irg(irg, data); @@ -818,15 +854,16 @@ void cg_construct(int arr_len, entity ** free_methods_arr) { /* construct calls */ for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_node * node; - int n_callees; current_ir_graph = get_irp_irg(i); for (node = get_irn_link(get_irg_end(current_ir_graph)); node; node = get_irn_link(node)) { if (get_irn_op(node) == op_Call) { - n_callees = get_Call_n_callees(node); - if (n_callees > 1 || (n_callees == 1 && get_Call_callee(node, 0) != unknown_entity)) { - construct_call(node); - } + int j, n_callees = get_Call_n_callees(node); + for (j = 0; j < n_callees; ++j) + if (get_entity_irg(get_Call_callee(node, j))) + break; + if (j < n_callees) /* There is an entity with a graph */ + construct_call(node); } } } @@ -841,10 +878,14 @@ void cg_construct(int arr_len, entity ** free_methods_arr) { -static void destruct_walker(ir_node * node, void * env) { +static void destruct_walker(ir_node * node, void * env) +{ + (void) env; if (get_irn_op(node) == op_Block) { remove_Block_cg_cfgpred_arr(node); - /* Do not turn Break into Jmp. Better: merge blocks right away. */ + /* Do not turn Break into Jmp. Better: merge blocks right away. + Well, but there are Breaks left. + See exc1 from ajacs-rts/Exceptions.java. */ if (get_Block_n_cfgpreds(node) == 1) { ir_node *pred = get_Block_cfgpred(node, 0); if (get_irn_op(pred) == op_Break) @@ -854,12 +895,12 @@ static void destruct_walker(ir_node * node, void * env) { set_irg_current_block(current_ir_graph, get_nodes_block(node)); exchange(node, new_Proj(get_Filter_pred(node), get_irn_mode(node), get_Filter_proj(node))); } else if (get_irn_op(node) == op_Break) { - //set_irg_current_block(current_ir_graph, get_nodes_block(node)); - //exchange(node, new_Jmp()); + set_irg_current_block(current_ir_graph, get_nodes_block(node)); + exchange(node, new_Jmp()); } else if (get_irn_op(node) == op_Call) { remove_Call_callee_arr(node); } else if (get_irn_op(node) == op_Proj) { - /* some ProjX end up in strage blocks. */ + /* some ProjX end up in strange blocks. */ set_nodes_block(node, get_nodes_block(get_Proj_pred(node))); } } @@ -870,14 +911,17 @@ void cg_destruct(void) { if (get_irp_ip_view_state() != ip_view_no) { for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_graph * irg = get_irp_irg(i); - irg_walk_graph(irg, destruct_walker, clear_link, NULL); - set_irg_frame(irg, skip_Id(get_irg_frame(irg))); - set_irg_globals(irg, skip_Id(get_irg_globals(irg))); + irg_walk_graph(irg, destruct_walker, firm_clear_link, NULL); + + set_irg_frame (irg, skip_Id(get_irg_frame(irg))); + set_irg_globals (irg, skip_Id(get_irg_globals(irg))); set_irg_initial_mem(irg, skip_Id(get_irg_initial_mem(irg))); + set_irg_end_reg (irg, get_irg_end(irg)); + set_irg_end_except (irg, get_irg_end(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)); } + set_irp_ip_view(ip_view_no); } }