• Home
  • Raw
  • Download

Lines Matching refs:phi_candidate

98   PhiCandidate& phi_candidate = result.first->second;  in CreatePhiCandidate()  local
99 return phi_candidate; in CreatePhiCandidate()
131 uint32_t SSARewriter::TryRemoveTrivialPhi(PhiCandidate* phi_candidate) { in TryRemoveTrivialPhi() argument
133 for (uint32_t arg_id : phi_candidate->phi_args()) { in TryRemoveTrivialPhi()
134 if (arg_id == same_id || arg_id == phi_candidate->result_id()) { in TryRemoveTrivialPhi()
141 assert(phi_candidate->copy_of() == 0 && in TryRemoveTrivialPhi()
143 return phi_candidate->result_id(); in TryRemoveTrivialPhi()
156 phi_candidate->MarkCopyOf(same_id); in TryRemoveTrivialPhi()
162 ReplacePhiUsersWith(*phi_candidate, same_id); in TryRemoveTrivialPhi()
167 uint32_t SSARewriter::AddPhiOperands(PhiCandidate* phi_candidate) { in AddPhiOperands() argument
168 assert(phi_candidate->phi_args().size() == 0 && in AddPhiOperands()
172 for (uint32_t pred : pass_->cfg()->preds(phi_candidate->bb()->id())) { in AddPhiOperands()
209 ? GetReachingDef(phi_candidate->var_id(), pred_bb) in AddPhiOperands()
211 phi_candidate->phi_args().push_back(arg_id); in AddPhiOperands()
219 if (defining_phi && defining_phi != phi_candidate) { in AddPhiOperands()
220 defining_phi->AddUser(phi_candidate->result_id()); in AddPhiOperands()
228 phi_candidate->MarkIncomplete(); in AddPhiOperands()
229 incomplete_phis_.push(phi_candidate); in AddPhiOperands()
230 return phi_candidate->result_id(); in AddPhiOperands()
234 uint32_t repl_id = TryRemoveTrivialPhi(phi_candidate); in AddPhiOperands()
235 if (repl_id == phi_candidate->result_id()) { in AddPhiOperands()
238 phi_candidate->MarkComplete(); in AddPhiOperands()
239 phis_to_generate_.push_back(phi_candidate); in AddPhiOperands()
273 PhiCandidate& phi_candidate = CreatePhiCandidate(var_id, bb); in GetReachingDef() local
276 WriteVariable(var_id, bb, phi_candidate.result_id()); in GetReachingDef()
277 val_id = AddPhiOperands(&phi_candidate); in GetReachingDef()
477 uint32_t SSARewriter::GetPhiArgument(const PhiCandidate* phi_candidate, in GetPhiArgument() argument
479 assert(phi_candidate->IsReady() && in GetPhiArgument()
482 uint32_t arg_id = phi_candidate->phi_args()[ix]; in GetPhiArgument()
511 for (const PhiCandidate* phi_candidate : phis_to_generate_) { in ApplyReplacements() local
513 std::cerr << "Phi candidate: " << phi_candidate->PrettyPrint(pass_->cfg()) in ApplyReplacements()
517 assert(phi_candidate->is_complete() && in ApplyReplacements()
521 auto* local_var = pass_->get_def_use_mgr()->GetDef(phi_candidate->var_id()); in ApplyReplacements()
528 for (uint32_t pred_label : pass_->cfg()->preds(phi_candidate->bb()->id())) { in ApplyReplacements()
529 uint32_t op_val_id = GetPhiArgument(phi_candidate, arg_ix++); in ApplyReplacements()
549 phi_candidate->result_id(), phi_operands)); in ApplyReplacements()
552 pass_->context()->set_instr_block(&*phi_inst, phi_candidate->bb()); in ApplyReplacements()
553 auto insert_it = phi_candidate->bb()->begin(); in ApplyReplacements()
556 phi_candidate->var_id(), phi_candidate->result_id(), in ApplyReplacements()
562 &*insert_it, phi_candidate->var_id(), phi_candidate->result_id(), in ApplyReplacements()
607 void SSARewriter::FinalizePhiCandidate(PhiCandidate* phi_candidate) { in FinalizePhiCandidate() argument
608 assert(phi_candidate->phi_args().size() > 0 && in FinalizePhiCandidate()
612 for (uint32_t pred : pass_->cfg()->preds(phi_candidate->bb()->id())) { in FinalizePhiCandidate()
614 uint32_t& arg_id = phi_candidate->phi_args()[ix++]; in FinalizePhiCandidate()
619 ? GetReachingDef(phi_candidate->var_id(), pred_bb) in FinalizePhiCandidate()
620 : pass_->GetUndefVal(phi_candidate->var_id()); in FinalizePhiCandidate()
625 phi_candidate->MarkComplete(); in FinalizePhiCandidate()
629 if (TryRemoveTrivialPhi(phi_candidate) == phi_candidate->result_id()) { in FinalizePhiCandidate()
632 assert(!phi_candidate->copy_of() && "A completed Phi cannot be trivial."); in FinalizePhiCandidate()
633 phis_to_generate_.push_back(phi_candidate); in FinalizePhiCandidate()
646 PhiCandidate* phi_candidate = incomplete_phis_.front(); in FinalizePhiCandidates() local
648 FinalizePhiCandidate(phi_candidate); in FinalizePhiCandidates()