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,12 +1003,17 @@ 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];
if (MO.isReg()) {
if (MO.isDef() && RC->contains(MO.getReg())) {
Pred.push_back(MO);
Found = true;
}
} else if (MO.isRegMask()) {
for (TargetRegisterClass::iterator I = RC->begin(), for (TargetRegisterClass::iterator I = RC->begin(),
IE = RC->end(); I != IE; ++I) { IE = RC->end(); I != IE; ++I)
if ((MO.isRegMask() && MO.clobbersPhysReg(*I)) || if (MO.clobbersPhysReg(*I)) {
(MO.isReg() && MO.isDef() && MO.getReg() == *I)) {
Pred.push_back(MO); Pred.push_back(MO);
Found = true; Found = true;
} }