mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-26 05:00:26 +00:00
Simplify logic now that r182490 is in place. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182531 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b018bab0b8
commit
62c320a755
@ -247,8 +247,8 @@ void AggressiveAntiDepBreaker::GetPassthruRegs(MachineInstr *MI,
|
||||
if ((MO.isDef() && MI->isRegTiedToUseOperand(i)) ||
|
||||
IsImplicitDefUse(MI, MO)) {
|
||||
const unsigned Reg = MO.getReg();
|
||||
PassthruRegs.insert(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
PassthruRegs.insert(*SubRegs);
|
||||
}
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ bool BranchFolder::OptimizeImpDefsBlock(MachineBasicBlock *MBB) {
|
||||
if (!I->isImplicitDef())
|
||||
break;
|
||||
unsigned Reg = I->getOperand(0).getReg();
|
||||
ImpDefRegs.insert(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
ImpDefRegs.insert(*SubRegs);
|
||||
++I;
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr *MI) {
|
||||
|
||||
if (MO.isUse() && Special) {
|
||||
if (!KeepRegs.test(Reg)) {
|
||||
KeepRegs.set(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
KeepRegs.set(*SubRegs);
|
||||
}
|
||||
}
|
||||
|
@ -154,11 +154,11 @@ bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (MO.isReg() && MO.isDef()) {
|
||||
unsigned Reg = MO.getReg();
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
|
||||
LivePhysRegs.reset(Reg);
|
||||
// Check the subreg set, not the alias set, because a def
|
||||
// of a super-register may still be partially live after
|
||||
// this def.
|
||||
for (MCSubRegIterator SR(Reg, TRI); SR.isValid(); ++SR)
|
||||
for (MCSubRegIterator SR(Reg, TRI,/*IncludeSelf=*/true);
|
||||
SR.isValid(); ++SR)
|
||||
LivePhysRegs.reset(*SR);
|
||||
}
|
||||
} else if (MO.isRegMask()) {
|
||||
|
@ -970,8 +970,8 @@ static void InitPredRedefs(MachineBasicBlock *BB, SmallSet<unsigned,4> &Redefs,
|
||||
for (MachineBasicBlock::livein_iterator I = BB->livein_begin(),
|
||||
E = BB->livein_end(); I != E; ++I) {
|
||||
unsigned Reg = *I;
|
||||
Redefs.insert(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
Redefs.insert(*SubRegs);
|
||||
}
|
||||
}
|
||||
@ -990,8 +990,8 @@ static void UpdatePredRedefs(MachineInstr *MI, SmallSet<unsigned,4> &Redefs,
|
||||
if (MO.isDef())
|
||||
Defs.push_back(Reg);
|
||||
else if (MO.isKill()) {
|
||||
Redefs.erase(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
Redefs.erase(*SubRegs);
|
||||
}
|
||||
}
|
||||
@ -1362,8 +1362,8 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
|
||||
} else if (!RedefsByFalse.count(Reg)) {
|
||||
// These are defined before ctrl flow reach the 'false' instructions.
|
||||
// They cannot be modified by the 'true' instructions.
|
||||
ExtUses.insert(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
ExtUses.insert(*SubRegs);
|
||||
}
|
||||
}
|
||||
@ -1371,8 +1371,8 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
|
||||
for (unsigned i = 0, e = Defs.size(); i != e; ++i) {
|
||||
unsigned Reg = Defs[i];
|
||||
if (!ExtUses.count(Reg)) {
|
||||
RedefsByFalse.insert(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
RedefsByFalse.insert(*SubRegs);
|
||||
}
|
||||
}
|
||||
|
@ -213,9 +213,8 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
|
||||
CopyMap.erase(*AI);
|
||||
AvailCopyMap.erase(*AI);
|
||||
}
|
||||
CopyMap[Def] = MI;
|
||||
AvailCopyMap[Def] = MI;
|
||||
for (MCSubRegIterator SR(Def, TRI); SR.isValid(); ++SR) {
|
||||
for (MCSubRegIterator SR(Def, TRI, /*IncludeSelf=*/true); SR.isValid();
|
||||
++SR) {
|
||||
CopyMap[*SR] = MI;
|
||||
AvailCopyMap[*SR] = MI;
|
||||
}
|
||||
|
@ -669,8 +669,8 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
||||
report("MBB live-in list contains non-physical register", MBB);
|
||||
continue;
|
||||
}
|
||||
regsLive.insert(*I);
|
||||
for (MCSubRegIterator SubRegs(*I, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(*I, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
regsLive.insert(*SubRegs);
|
||||
}
|
||||
regsLiveInButUnused = regsLive;
|
||||
@ -679,8 +679,8 @@ MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
||||
assert(MFI && "Function has no frame info");
|
||||
BitVector PR = MFI->getPristineRegs(MBB);
|
||||
for (int I = PR.find_first(); I>0; I = PR.find_next(I)) {
|
||||
regsLive.insert(I);
|
||||
for (MCSubRegIterator SubRegs(I, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(I, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
regsLive.insert(*SubRegs);
|
||||
}
|
||||
|
||||
|
@ -424,9 +424,9 @@ void SchedulePostRATDList::StartBlockForKills(MachineBasicBlock *BB) {
|
||||
for (MachineBasicBlock::livein_iterator I = (*SI)->livein_begin(),
|
||||
E = (*SI)->livein_end(); I != E; ++I) {
|
||||
unsigned Reg = *I;
|
||||
LiveRegs.set(Reg);
|
||||
// Repeat, for all subregs.
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
// Repeat, for reg and all subregs.
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
LiveRegs.set(*SubRegs);
|
||||
}
|
||||
}
|
||||
@ -496,10 +496,9 @@ void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
|
||||
// Ignore two-addr defs.
|
||||
if (MI->isRegTiedToUseOperand(i)) continue;
|
||||
|
||||
LiveRegs.reset(Reg);
|
||||
|
||||
// Repeat for all subregs.
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
// Repeat for reg and all subregs.
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
LiveRegs.reset(*SubRegs);
|
||||
}
|
||||
|
||||
@ -548,9 +547,8 @@ void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
|
||||
unsigned Reg = MO.getReg();
|
||||
if ((Reg == 0) || MRI.isReserved(Reg)) continue;
|
||||
|
||||
LiveRegs.set(Reg);
|
||||
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
LiveRegs.set(*SubRegs);
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,8 @@ using namespace llvm;
|
||||
|
||||
/// setUsed - Set the register and its sub-registers as being used.
|
||||
void RegScavenger::setUsed(unsigned Reg) {
|
||||
RegsAvailable.reset(Reg);
|
||||
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
RegsAvailable.reset(*SubRegs);
|
||||
}
|
||||
|
||||
@ -105,8 +104,8 @@ void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) {
|
||||
}
|
||||
|
||||
void RegScavenger::addRegWithSubRegs(BitVector &BV, unsigned Reg) {
|
||||
BV.set(Reg);
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs)
|
||||
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
|
||||
SubRegs.isValid(); ++SubRegs)
|
||||
BV.set(*SubRegs);
|
||||
}
|
||||
|
||||
|
@ -73,15 +73,15 @@ static void TrackDefUses(MachineInstr *MI,
|
||||
|
||||
for (unsigned i = 0, e = LocalUses.size(); i != e; ++i) {
|
||||
unsigned Reg = LocalUses[i];
|
||||
Uses.insert(Reg);
|
||||
for (MCSubRegIterator Subreg(Reg, TRI); Subreg.isValid(); ++Subreg)
|
||||
for (MCSubRegIterator Subreg(Reg, TRI, /*IncludeSelf=*/true);
|
||||
Subreg.isValid(); ++Subreg)
|
||||
Uses.insert(*Subreg);
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = LocalDefs.size(); i != e; ++i) {
|
||||
unsigned Reg = LocalDefs[i];
|
||||
Defs.insert(Reg);
|
||||
for (MCSubRegIterator Subreg(Reg, TRI); Subreg.isValid(); ++Subreg)
|
||||
for (MCSubRegIterator Subreg(Reg, TRI, /*IncludeSelf=*/true);
|
||||
Subreg.isValid(); ++Subreg)
|
||||
Defs.insert(*Subreg);
|
||||
if (Reg == ARM::CPSR)
|
||||
continue;
|
||||
|
@ -306,19 +306,19 @@ BitVector X86RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
||||
const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering();
|
||||
|
||||
// Set the stack-pointer register and its aliases as reserved.
|
||||
Reserved.set(X86::RSP);
|
||||
for (MCSubRegIterator I(X86::RSP, this); I.isValid(); ++I)
|
||||
for (MCSubRegIterator I(X86::RSP, this, /*IncludeSelf=*/true); I.isValid();
|
||||
++I)
|
||||
Reserved.set(*I);
|
||||
|
||||
// Set the instruction pointer register and its aliases as reserved.
|
||||
Reserved.set(X86::RIP);
|
||||
for (MCSubRegIterator I(X86::RIP, this); I.isValid(); ++I)
|
||||
for (MCSubRegIterator I(X86::RIP, this, /*IncludeSelf=*/true); I.isValid();
|
||||
++I)
|
||||
Reserved.set(*I);
|
||||
|
||||
// Set the frame-pointer register and its aliases as reserved if needed.
|
||||
if (TFI->hasFP(MF)) {
|
||||
Reserved.set(X86::RBP);
|
||||
for (MCSubRegIterator I(X86::RBP, this); I.isValid(); ++I)
|
||||
for (MCSubRegIterator I(X86::RBP, this, /*IncludeSelf=*/true); I.isValid();
|
||||
++I)
|
||||
Reserved.set(*I);
|
||||
}
|
||||
|
||||
@ -331,8 +331,8 @@ BitVector X86RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
||||
"Stack realignment in presence of dynamic allocas is not supported with"
|
||||
"this calling convention.");
|
||||
|
||||
Reserved.set(getBaseRegister());
|
||||
for (MCSubRegIterator I(getBaseRegister(), this); I.isValid(); ++I)
|
||||
for (MCSubRegIterator I(getBaseRegister(), this, /*IncludeSelf=*/true);
|
||||
I.isValid(); ++I)
|
||||
Reserved.set(*I);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user