Lines Matching defs:phi
458 for (aco_ptr<Instruction>& phi : block.instructions) {
459 if (!is_phi(phi))
463 /* Killed phi definitions increase pressure in the predecessor but not
466 * predecessors, we need to count killed unspilled phi definitions here. */
467 if (phi->definitions[0].isTemp() && phi->definitions[0].isKill() &&
468 !ctx.spills_entry[block_idx].count(phi->definitions[0].getTemp()))
469 reg_pressure += phi->definitions[0].getTemp();
516 /* variable is not live at loop entry: probably a phi operand */
672 /* variable is not even live at the predecessor: probably from a phi */
697 for (aco_ptr<Instruction>& phi : block->instructions) {
698 if (!is_phi(phi))
700 if (!phi->definitions[0].isTemp())
704 phi->opcode == aco_opcode::p_phi ? block->logical_preds : block->linear_preds;
706 for (unsigned i = 0; i < phi->operands.size(); i++) {
707 if (phi->operands[i].isUndefined())
709 is_all_spilled &= phi->operands[i].isTemp() &&
710 ctx.spills_exit[preds[i]].count(phi->operands[i].getTemp());
714 /* The phi is spilled at all predecessors. Keep it spilled. */
715 ctx.spills_entry[block_idx][phi->definitions[0].getTemp()] =
716 ctx.allocate_spill_id(phi->definitions[0].regClass());
717 spilled_registers += phi->definitions[0].getTemp();
720 partial_spills.insert(phi->definitions[0].getTemp());
856 /* iterate the phi nodes for which operands to spill at the predecessor */
857 for (aco_ptr<Instruction>& phi : block->instructions) {
858 if (!is_phi(phi))
861 /* if the phi is not spilled, add to instructions */
862 if (!phi->definitions[0].isTemp() ||
863 !ctx.spills_entry[block_idx].count(phi->definitions[0].getTemp())) {
864 instructions.emplace_back(std::move(phi));
869 phi->opcode == aco_opcode::p_phi ? block->logical_preds : block->linear_preds;
870 uint32_t def_spill_id = ctx.spills_entry[block_idx][phi->definitions[0].getTemp()];
872 for (unsigned i = 0; i < phi->operands.size(); i++) {
873 if (phi->operands[i].isUndefined())
877 Operand spill_op = phi->operands[i];
880 assert(phi->operands[i].isKill());
881 Temp var = phi->operands[i].getTemp();
903 uint32_t spill_id = ctx.allocate_spill_id(phi->definitions[0].regClass());
919 } while (phi->opcode == aco_opcode::p_phi &&
926 ctx.spills_exit[pred_idx][phi->operands[i].getTemp()] = spill_id;
929 /* remove phi from instructions */
930 phi.reset();
948 /* variable is dead at predecessor, it must be from a phi: this works because of CSSA form */
986 for (aco_ptr<Instruction>& phi : instructions) {
987 assert(phi->opcode == aco_opcode::p_phi || phi->opcode == aco_opcode::p_linear_phi);
988 assert(!phi->definitions[0].isTemp() ||
989 !ctx.spills_entry[block_idx].count(phi->definitions[0].getTemp()));
992 phi->opcode == aco_opcode::p_phi ? block->logical_preds : block->linear_preds;
993 for (unsigned i = 0; i < phi->operands.size(); i++) {
994 if (!phi->operands[i].isTemp())
999 if (!ctx.spills_exit[pred_idx].count(phi->operands[i].getTemp())) {
1001 ctx.renames[pred_idx].find(phi->operands[i].getTemp());
1003 phi->operands[i].setTemp(it->second);
1006 auto remat_it = ctx.remat.find(phi->operands[i].getTemp());
1014 Temp tmp = phi->operands[i].getTemp();
1016 /* reload phi operand at end of predecessor block */
1023 } while (phi->opcode == aco_opcode::p_phi &&
1030 if (!phi->definitions[0].isTemp()) {
1031 assert(phi->definitions[0].isFixed() && phi->definitions[0].physReg() == exec);
1032 reload->definitions[0] = phi->definitions[0];
1033 phi->operands[i] = Operand(exec, ctx.program->lane_mask);
1037 phi->operands[i].setTemp(new_name);
1054 /* variable is dead at predecessor, it must be from a phi */
1086 /* check if we have to create a new phi for this variable */
1107 /* the variable was renamed differently in the predecessors: we have to create a phi */
1109 aco_ptr<Pseudo_instruction> phi{
1112 for (unsigned i = 0; i < phi->operands.size(); i++) {
1124 phi->operands[i] = Operand(tmp);
1126 phi->definitions[0] = Definition(rename);
1127 instructions.emplace_back(std::move(phi));
1342 aco_ptr<Instruction>& phi = *instr_it;
1343 if (phi->opcode != aco_opcode::p_phi && phi->opcode != aco_opcode::p_linear_phi)
1352 for (Operand& op : phi->operands) {