X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Finstrument.c;h=d322170e918103e3ce832fad396c510bcc3629c1;hb=d72b7e3a579f396c1820c57179c2c82a596b8811;hp=9d2e76e4921b2c08e5fa0fd20e21b5ef2b851207;hpb=8c1f62ae9c96c62a4192ca022c07889c27ca0c0e;p=libfirm diff --git a/ir/ir/instrument.c b/ir/ir/instrument.c index 9d2e76e49..d322170e9 100644 --- a/ir/ir/instrument.c +++ b/ir/ir/instrument.c @@ -22,7 +22,6 @@ * @brief Instrumentation of graphs. * @date 14.4.2008 * @author Michael Beck - * @version $Id$ */ #include "config.h" @@ -32,21 +31,15 @@ #include "ircons.h" #include "instrument.h" -/** - * Adds a Call at the beginning of the given irg. - */ void instrument_initcall(ir_graph *irg, ir_entity *ent) { - const ir_edge_t *edge; - ir_node *initial_exec; - ir_node *initial_mem; - ir_node *start_block; - ir_node *adr, *call, *new_mem; - ir_node *first_block = NULL; + ir_node *initial_exec; + ir_node *start_block; + ir_node *first_block = NULL; int i, idx, need_new_block; symconst_symbol sym; - edges_assure(irg); + assure_edges(irg); /* find the first block */ initial_exec = get_irg_initial_exec(irg); @@ -87,14 +80,12 @@ void instrument_initcall(ir_graph *irg, ir_entity *ent) /* place the call */ sym.entity_p = ent; - adr = new_r_SymConst(irg, mode_P_code, sym, symconst_addr_ent); - - call = new_r_Call(first_block, get_irg_no_mem(irg), adr, 0, NULL, get_entity_type(ent)); - new_mem = new_r_Proj(call, mode_M, pn_Call_M); + ir_node *const adr = new_r_SymConst(irg, mode_P_code, sym, symconst_addr_ent); + ir_node *const initial_mem = get_irg_initial_mem(irg); + ir_node *const call = new_r_Call(first_block, initial_mem, adr, 0, NULL, get_entity_type(ent)); + ir_node *const new_mem = new_r_Proj(call, mode_M, pn_Call_M); - initial_mem = get_irg_initial_mem(irg); - edges_reroute(initial_mem, new_mem); + edges_reroute_except(initial_mem, new_mem, call); /* beware: reroute routes anchor edges also, revert this */ set_irg_initial_mem(irg, initial_mem); - set_Call_mem(call, initial_mem); }