Cleanup PPCInstrInfo::DefinesPredicate

Implement suggestions made by Bill Schmidt in post-commit review. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hal Finkel 2013-04-10 07:17:47 +00:00
parent d03fdfb97c
commit 4e3172867d

View File

@ -1003,15 +1003,20 @@ bool PPCInstrInfo::DefinesPredicate(MachineInstr *MI,
bool Found = false; bool Found = false;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
const MachineOperand &MO = MI->getOperand(i); const MachineOperand &MO = MI->getOperand(i);
for (int c = 0; c < 2 && !Found; ++c) { for (unsigned c = 0; c < array_lengthof(RCs) && !Found; ++c) {
const TargetRegisterClass *RC = RCs[c]; const TargetRegisterClass *RC = RCs[c];
for (TargetRegisterClass::iterator I = RC->begin(), if (MO.isReg()) {
IE = RC->end(); I != IE; ++I) { if (MO.isDef() && RC->contains(MO.getReg())) {
if ((MO.isRegMask() && MO.clobbersPhysReg(*I)) ||
(MO.isReg() && MO.isDef() && MO.getReg() == *I)) {
Pred.push_back(MO); Pred.push_back(MO);
Found = true; Found = true;
} }
} else if (MO.isRegMask()) {
for (TargetRegisterClass::iterator I = RC->begin(),
IE = RC->end(); I != IE; ++I)
if (MO.clobbersPhysReg(*I)) {
Pred.push_back(MO);
Found = true;
}
} }
} }
} }