void def_use::run_on(node* n, bool defs) { bool is_region = (n->type == NT_REGION); bool is_op = (n->type == NT_OP || n->type == NT_IF); if (is_op) { if (0) { sblog << "def_use processing op "; dump::dump_op(n); sblog << "\n"; } if (defs) process_defs(n, n->dst, false); else process_uses(n); } else if (is_region & defs) { region_node *r = static_cast<region_node*>(n); if (r->loop_phi) process_phi(r->loop_phi, true, false); } if (n->is_container() && n->subtype != NST_ALU_PACKED_INST) { container_node *c = static_cast<container_node*>(n); for (node_iterator I = c->begin(), E = c->end(); I != E; ++I) { run_on(*I, defs); } } if (is_region) { region_node *r = static_cast<region_node*>(n); if (r->phi) process_phi(r->phi, defs, !defs); if (r->loop_phi && !defs) process_phi(r->loop_phi, false, true); } }
void IR_GVN::process_bb(IR_BB * bb, bool & change) { C<IR*> * ct; for (IR * ir = IR_BB_ir_list(bb).get_head(&ct); ir != NULL; ir = IR_BB_ir_list(bb).get_next(&ct)) { switch (IR_type(ir)) { case IR_ST: case IR_STPR: case IR_IST: process_st(ir, change); break; case IR_CALL: case IR_ICALL: process_call(ir, change); break; case IR_TRUEBR: case IR_FALSEBR: comp_vn(BR_det(ir), change); break; case IR_SWITCH: comp_vn(SWITCH_vexp(ir), change); break; case IR_IGOTO: comp_vn(IGOTO_vexp(ir), change); break; case IR_RETURN: comp_vn(RET_exp(ir), change); break; case IR_REGION: process_region(ir, change); break; case IR_PHI: process_phi(ir, change); break; case IR_GOTO: break; default: IS_TRUE0(0); } } }