summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-03-26 22:40:42 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-03-26 22:40:42 +0000
commit4a09b1b5be9ca92e47f54bb94570a53683f01180 (patch)
treeca33eeb8732a0ff025f8525d1675c6dd668c7539 /llvm/lib/CodeGen
parentf3200ef9acb63e528f5d268160321fb61e270d0d (diff)
downloadbcm5719-llvm-4a09b1b5be9ca92e47f54bb94570a53683f01180.tar.gz
bcm5719-llvm-4a09b1b5be9ca92e47f54bb94570a53683f01180.zip
Fix for PR1266. Don't mark a two address operand IsKill.
llvm-svn: 35365
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp6
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp49
2 files changed, 33 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index ab8a18d1dfb..38ada30ad74 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -854,9 +854,9 @@ bool LiveIntervals::AdjustCopiesBackFrom(LiveInterval &IntA, LiveInterval &IntB,
// If the source instruction was killing the source register before the
// merge, unset the isKill marker given the live range has been extended.
- MachineOperand *MOK = ValLREndInst->findRegisterUseOperand(IntB.reg, true);
- if (MOK)
- MOK->unsetIsKill();
+ int UIdx = ValLREndInst->findRegisterUseOperand(IntB.reg, true);
+ if (UIdx != -1)
+ ValLREndInst->getOperand(UIdx).unsetIsKill();
// Finally, delete the copy instruction.
RemoveMachineInstrFromMaps(CopyMI);
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index dfa5e4383d0..6fcbcf24fcb 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -754,10 +754,11 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
// necessary.
bool WasKill = false;
if (SSMI) {
- MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
- if (MOK) {
- WasKill = MOK->isKill();
- MOK->unsetIsKill();
+ int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
+ if (UIdx != -1) {
+ MachineOperand &MOK = SSMI->getOperand(UIdx);
+ WasKill = MOK.isKill();
+ MOK.unsetIsKill();
}
}
if (ti == -1) {
@@ -840,17 +841,20 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
// necessary.
bool WasKill = false;
if (SSMI) {
- MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
- if (MOK) {
- WasKill = MOK->isKill();
- MOK->unsetIsKill();
+ int UIdx = SSMI->findRegisterUseOperand(PhysReg, true);
+ if (UIdx != -1) {
+ MachineOperand &MOK = SSMI->getOperand(UIdx);
+ WasKill = MOK.isKill();
+ MOK.unsetIsKill();
}
}
MachineInstr *CopyMI = prior(MII);
if (WasKill) {
// Transfer kill to the next use.
- MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg);
- MOU->setIsKill();
+ int UIdx = CopyMI->findRegisterUseOperand(PhysReg);
+ assert(UIdx != -1);
+ MachineOperand &MOU = CopyMI->getOperand(UIdx);
+ MOU.setIsKill();
}
Spills.addLastUse(PhysReg, CopyMI);
@@ -945,18 +949,25 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM,
// extended. Remove its kill.
bool WasKill = false;
if (SSMI) {
- MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
- if (MOK) {
- WasKill = MOK->isKill();
- MOK->unsetIsKill();
+ int UIdx = SSMI->findRegisterUseOperand(InReg, true);
+ if (UIdx != -1) {
+ MachineOperand &MOK = SSMI->getOperand(UIdx);
+ WasKill = MOK.isKill();
+ MOK.unsetIsKill();
}
}
if (NextMII != MBB.end()) {
- // If NextMII uses InReg (must be the copy?), mark it killed.
- MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
- if (MOU) {
- if (WasKill)
- MOU->setIsKill();
+ // If NextMII uses InReg and the use is not a two address
+ // operand, mark it killed.
+ int UIdx = NextMII->findRegisterUseOperand(InReg);
+ if (UIdx != -1) {
+ MachineOperand &MOU = NextMII->getOperand(UIdx);
+ if (WasKill) {
+ const TargetInstrDescriptor *NTID =
+ NextMII->getInstrDescriptor();
+ if (NTID->getOperandConstraint(UIdx, TOI::TIED_TO) == -1)
+ MOU.setIsKill();
+ }
Spills.addLastUse(InReg, &(*NextMII));
}
}
OpenPOWER on IntegriCloud