diff options
author | Hal Finkel <hfinkel@anl.gov> | 2013-04-10 07:17:47 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2013-04-10 07:17:47 +0000 |
commit | 4e3172867d0c1acfda9d2cc88dfad23634e649eb (patch) | |
tree | 910280d2d38acd6cbc06fd1c7f04c5ce004ea2ae /lib | |
parent | d03fdfb97c1a693101bfef5800c262237f5d382f (diff) |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/PowerPC/PPCInstrInfo.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index 773b62326f..8abe5ff2e3 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -1003,15 +1003,20 @@ bool PPCInstrInfo::DefinesPredicate(MachineInstr *MI, bool Found = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++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]; - for (TargetRegisterClass::iterator I = RC->begin(), - IE = RC->end(); I != IE; ++I) { - if ((MO.isRegMask() && MO.clobbersPhysReg(*I)) || - (MO.isReg() && MO.isDef() && MO.getReg() == *I)) { + 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(), + IE = RC->end(); I != IE; ++I) + if (MO.clobbersPhysReg(*I)) { + Pred.push_back(MO); + Found = true; + } } } } |