X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeirgmod.c;h=a2b2c1f6e9b9f80834b33502565e8465ba656c56;hb=8535fe8732b0acf822be252812a7158ce5b8134a;hp=4fbbc06ecdcda69d93d44f55711546277c4944e1;hpb=f12d101c1fa82ce72f667b0eaa74f0cbe2c11adf;p=libfirm diff --git a/ir/be/beirgmod.c b/ir/be/beirgmod.c index 4fbbc06ec..a2b2c1f6e 100644 --- a/ir/be/beirgmod.c +++ b/ir/be/beirgmod.c @@ -1,5 +1,19 @@ +/** + * This file contains the following IRG modifications for be routines: + * - backend dominance information + * - SSA construction for a set of nodes + * - insertion of Perm nodes + * - empty block elimination + * - a simple dead node elimination (set inputs of unreachable nodes to BAD) + * + * Author: Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig + * Date: 04.05.2005 + * Copyright: (c) Universitaet Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * CVS-Id: $Id$ + */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include @@ -40,8 +54,8 @@ #include "beirgmod.h" -#define DBG_MODULE "firm.be.irgmod" #define DBG_LEVEL SET_LEVEL_0 +DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;) /* ____ _ @@ -158,7 +172,6 @@ static void determine_phi_blocks(pset *copies, pset *copy_blocks, pset *phi_bloc { ir_node *bl; waitq *worklist = new_waitq(); - FIRM_DBG_REGISTER(firm_dbg_module_t *dbg, DBG_MODULE); /* * Fill the worklist queue and the rest of the orig blocks array. @@ -239,7 +252,6 @@ static ir_node *search_def(ir_node *usage, int pos, pset *copies, pset *copy_blo { ir_node *curr_bl; ir_node *start_irn; - FIRM_DBG_REGISTER(firm_dbg_module_t *dbg, DBG_MODULE); curr_bl = get_nodes_block(usage); @@ -350,8 +362,6 @@ static void fix_usages(pset *copies, pset *copy_blocks, pset *phi_blocks, pset * int pos; } *outs; - FIRM_DBG_REGISTER(firm_dbg_module_t *dbg, DBG_MODULE); - obstack_init(&obst); /* @@ -362,9 +372,11 @@ static void fix_usages(pset *copies, pset *copy_blocks, pset *phi_blocks, pset * for (irn = pset_first(copies); irn; irn = pset_next(copies)) { const ir_edge_t *edge; foreach_out_edge(irn, edge) { - if (!pset_find_ptr(ignore_uses, get_edge_src_irn(edge))) { + ir_node *src = get_edge_src_irn(edge); + /* ignore all users from ignore_uses or keep-alives (user is End node) */ + if (! pset_find_ptr(ignore_uses, src) && ! is_End(src)) { struct out tmp; - tmp.irn = get_edge_src_irn(edge); + tmp.irn = src; tmp.pos = get_edge_src_pos(edge); obstack_grow(&obst, &tmp, sizeof(tmp)); n_outs++; @@ -438,7 +450,7 @@ static void remove_odd_phis(pset *copies, pset *unused_copies) sched_remove(irn); } } -#endif +#endif /* if 0 */ void be_ssa_constr_phis_ignore(be_dom_front_info_t *info, be_lv_t *lv, int n, ir_node *nodes[], pset *phis, pset *ignore_uses) { @@ -470,7 +482,6 @@ void be_ssa_constr_set_phis_ignore(be_dom_front_info_t *df, be_lv_t *lv, pset *n int save_optimize = get_optimize(); int save_normalize = get_opt_normalize(); int phis_set_created = 0; - FIRM_DBG_REGISTER(firm_dbg_module_t *dbg, DBG_MODULE); ir_node *irn; @@ -563,7 +574,6 @@ ir_node *insert_Perm_after(const arch_env_t *arch_env, ir_node *bl = is_Block(pos) ? pos : get_nodes_block(pos); ir_graph *irg = get_irn_irg(bl); pset *live = pset_new_ptr_default(); - FIRM_DBG_REGISTER(firm_dbg_module_t *dbg, "be.node"); ir_node *curr, *irn, *perm, **nodes; int i, n; @@ -706,3 +716,10 @@ int be_remove_empty_blocks(ir_graph *irg) { } return changed; } + +void be_init_irgmod(void) +{ + FIRM_DBG_REGISTER(dbg, "firm.be.irgmod"); +} + +BE_REGISTER_MODULE_CONSTRUCTOR(be_init_irgmod);