4 * @author Sebastian Hack
6 * Insert duplicates for phi operands which interfere with the phi.
8 * Copyright (C) 2005 Universitaet Karlsruhe
9 * Released under the GPL
13 #include "irgraph_t.h"
21 static void eliminate_phi_int_walker(ir_node *irn, void *data)
23 const be_main_session_env_t *env = data;
24 const arch_register_class_t *cls =
25 arch_get_irn_reg_class(env->main_env->arch_env, irn, arch_pos_make_out(0));
27 if(is_Phi(irn) && cls != NULL) {
29 ir_node *phi_bl = get_nodes_block(irn);
31 for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
32 ir_node *operand = get_irn_n(irn, i);
33 ir_node *bl = get_Block_cfgpred_block(phi_bl, i);
35 if(values_interfere(irn, operand)) {
36 ir_node *copy = new_Copy(env->main_env->node_factory, cls, env->irg, bl, operand);
37 set_irn_n(irn, i, copy);
43 void be_eliminate_phi_interferences(const be_main_session_env_t *env)
45 irg_walk_graph(env->irg, eliminate_phi_int_walker, NULL, (void *) env);