llvm.org GIT mirror llvm / 3bdf5fe
Factor out code into HandleVirtRegDef, for consistency with Handle{Virt,Phys}Reg{Def,Use}. Remove a redundant check for register zero, and redundant checks for isPhysicalRegister. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56412 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 12 years ago
2 changed file(s) with 13 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
262262 void MarkVirtRegAliveInBlock(VarInfo& VRInfo, MachineBasicBlock* DefBlock,
263263 MachineBasicBlock *BB,
264264 std::vector &WorkList);
265 void HandleVirtRegDef(unsigned reg, MachineInstr *MI);
265266 void HandleVirtRegUse(unsigned reg, MachineBasicBlock *MBB,
266267 MachineInstr *MI);
267268 };
174174 for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(),
175175 E = MBB->pred_end(); PI != E; ++PI)
176176 MarkVirtRegAliveInBlock(VRInfo, MRI->getVRegDef(reg)->getParent(), *PI);
177 }
178
179 void LiveVariables::HandleVirtRegDef(unsigned Reg, MachineInstr *MI) {
180 VarInfo &VRInfo = getVarInfo(Reg);
181
182 if (VRInfo.AliveBlocks.none())
183 // If vr is not alive in any block, then defaults to dead.
184 VRInfo.Kills.push_back(MI);
177185 }
178186
179187 /// FindLastPartialDef - Return the last partial def of the specified register.
551559 const MachineOperand &MO = MI->getOperand(i);
552560 if (MO.isRegister() && MO.getReg()) {
553561 unsigned MOReg = MO.getReg();
554 if (!MOReg)
555 continue;
556562 if (MO.isUse())
557563 UseRegs.push_back(MOReg);
558564 if (MO.isDef())
565571 unsigned MOReg = UseRegs[i];
566572 if (TargetRegisterInfo::isVirtualRegister(MOReg))
567573 HandleVirtRegUse(MOReg, MBB, MI);
568 else if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
569 !ReservedRegisters[MOReg])
574 else if (!ReservedRegisters[MOReg])
570575 HandlePhysRegUse(MOReg, MI);
571576 }
572577
573578 // Process all defs.
574579 for (unsigned i = 0, e = DefRegs.size(); i != e; ++i) {
575580 unsigned MOReg = DefRegs[i];
576 if (TargetRegisterInfo::isVirtualRegister(MOReg)) {
577 VarInfo &VRInfo = getVarInfo(MOReg);
578
579 if (VRInfo.AliveBlocks.none())
580 // If vr is not alive in any block, then defaults to dead.
581 VRInfo.Kills.push_back(MI);
582 } else if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
583 !ReservedRegisters[MOReg]) {
581 if (TargetRegisterInfo::isVirtualRegister(MOReg))
582 HandleVirtRegDef(MOReg, MI);
583 else if (!ReservedRegisters[MOReg])
584584 HandlePhysRegDef(MOReg, MI);
585 }
586585 }
587586 }
588587