Lines Matching defs:PhysReg

73       unsigned PhysReg;         // Currently held here.
78 : LastUse(nullptr), VirtReg(v), PhysReg(0), LastOpNum(0), Dirty(false){}
124 void markRegUsedInInstr(unsigned PhysReg) {
125 for (MCRegUnitIterator Units(PhysReg, TRI); Units.isValid(); ++Units)
130 bool isRegUsedInInstr(unsigned PhysReg) const {
131 for (MCRegUnitIterator Units(PhysReg, TRI); Units.isValid(); ++Units)
177 void definePhysReg(MachineInstr *MI, unsigned PhysReg, RegState NewState);
178 unsigned calcSpillCost(unsigned PhysReg) const;
179 void assignVirtToPhysReg(LiveReg&, unsigned PhysReg);
186 LiveRegMap::iterator assignVirtToPhysReg(unsigned VReg, unsigned PhysReg);
194 bool setPhysReg(MachineInstr *MI, unsigned OpNum, unsigned PhysReg);
237 if (MO.getReg() == LR.PhysReg)
240 LR.LastUse->addRegisterKilled(LR.PhysReg, TRI, true);
247 assert(PhysRegState[LRI->PhysReg] == LRI->VirtReg &&
249 PhysRegState[LRI->PhysReg] = regFree;
278 assert(PhysRegState[LR.PhysReg] == LRI->VirtReg && "Broken RegState mapping");
286 << " in " << PrintReg(LR.PhysReg, TRI));
290 TII->storeRegToStackSlot(*MBB, MI, LR.PhysReg, SpillKill, FI, RC, TRI);
345 unsigned PhysReg = MO.getReg();
346 assert(TargetRegisterInfo::isPhysicalRegister(PhysReg) &&
348 markRegUsedInInstr(PhysReg);
349 switch (PhysRegState[PhysReg]) {
353 PhysRegState[PhysReg] = regFree;
365 for (MCRegAliasIterator AI(PhysReg, TRI, false); AI.isValid(); ++AI) {
371 // Either PhysReg is a subregister of Alias and we mark the
372 // whole register as free, or PhysReg is the superregister of
374 // PhysReg.
375 // In the latter case, since PhysReg was disabled, this means that
380 assert((TRI->isSuperRegister(PhysReg, Alias) ||
381 TRI->isSuperRegister(Alias, PhysReg)) &&
385 if (TRI->isSuperRegister(PhysReg, Alias)) {
400 PhysRegState[PhysReg] = regFree;
404 /// definePhysReg - Mark PhysReg as reserved or free after spilling any
407 void RAFast::definePhysReg(MachineInstr *MI, unsigned PhysReg,
409 markRegUsedInInstr(PhysReg);
410 switch (unsigned VirtReg = PhysRegState[PhysReg]) {
418 PhysRegState[PhysReg] = NewState;
423 PhysRegState[PhysReg] = NewState;
424 for (MCRegAliasIterator AI(PhysReg, TRI, false); AI.isValid(); ++AI) {
435 if (TRI->isSuperRegister(PhysReg, Alias))
443 // calcSpillCost - Return the cost of spilling clearing out PhysReg and
445 // Returns 0 when PhysReg is free or disabled with all aliases disabled - it
447 // Returns spillImpossible when PhysReg or an alias can't be spilled.
448 unsigned RAFast::calcSpillCost(unsigned PhysReg) const {
449 if (isRegUsedInInstr(PhysReg)) {
450 DEBUG(dbgs() << PrintReg(PhysReg, TRI) << " is already used in instr.\n");
453 switch (unsigned VirtReg = PhysRegState[PhysReg]) {
460 << PrintReg(PhysReg, TRI) << " is reserved already.\n");
470 DEBUG(dbgs() << PrintReg(PhysReg, TRI) << " is disabled.\n");
472 for (MCRegAliasIterator AI(PhysReg, TRI, false); AI.isValid(); ++AI) {
495 /// that PhysReg is the proper container for VirtReg now. The physical
498 void RAFast::assignVirtToPhysReg(LiveReg &LR, unsigned PhysReg) {
500 << PrintReg(PhysReg, TRI) << "\n");
501 PhysRegState[PhysReg] = LR.VirtReg;
502 assert(!LR.PhysReg && "Already assigned a physreg");
503 LR.PhysReg = PhysReg;
507 RAFast::assignVirtToPhysReg(unsigned VirtReg, unsigned PhysReg) {
510 assignVirtToPhysReg(*LRI, PhysReg);
547 unsigned PhysReg = *I;
548 if (PhysRegState[PhysReg] == regFree && !isRegUsedInInstr(PhysReg)) {
549 assignVirtToPhysReg(*LRI, PhysReg);
613 assert(LRI->PhysReg && "Register not assigned");
617 markRegUsedInInstr(LRI->PhysReg);
636 << PrintReg(LRI->PhysReg, TRI) << "\n");
637 TII->loadRegFromStackSlot(*MBB, MI, LRI->PhysReg, FrameIndex, RC, TRI);
664 assert(LRI->PhysReg && "Register not assigned");
667 markRegUsedInInstr(LRI->PhysReg);
671 // setPhysReg - Change operand OpNum in MI the refer the PhysReg, considering
674 bool RAFast::setPhysReg(MachineInstr *MI, unsigned OpNum, unsigned PhysReg) {
678 MO.setReg(PhysReg);
683 MO.setReg(PhysReg ? TRI->getSubReg(PhysReg, MO.getSubReg()) : 0);
689 MI->addRegisterKilled(PhysReg, TRI, true);
696 MI->addRegisterDefined(PhysReg, TRI);
748 unsigned PhysReg = LRI->PhysReg;
749 setPhysReg(MI, i, PhysReg);
757 PartialDefs.push_back(LRI->PhysReg);
771 unsigned PhysReg = LRI->PhysReg;
772 if (setPhysReg(MI, i, PhysReg))
803 if (MRI->isAllocatable(LI.PhysReg))
804 definePhysReg(MII, LI.PhysReg, regReserved);
830 assert(I->PhysReg == Reg && "Bad inverse map");
841 assert(TargetRegisterInfo::isPhysicalRegister(i->PhysReg) &&
843 assert(PhysRegState[i->PhysReg] == i->VirtReg && "Bad inverse map");
859 setPhysReg(MI, i, LRI->PhysReg);
981 unsigned PhysReg = LRI->PhysReg;
982 CopySrc = (CopySrc == Reg || CopySrc == PhysReg) ? PhysReg : 0;
983 if (setPhysReg(MI, i, PhysReg))
1032 unsigned PhysReg = LRI->PhysReg;
1033 if (setPhysReg(MI, i, PhysReg)) {
1037 CopyDst = (CopyDst == Reg || CopyDst == PhysReg) ? PhysReg : 0;