mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-05 03:19:11 +00:00
Some code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47060 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b1f6f91393
commit
cdbcfccece
@ -293,7 +293,8 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commute def machine instr.
|
// At this point we have decided that it is legal to do this
|
||||||
|
// transformation. Start by commuting the instruction.
|
||||||
MachineBasicBlock *MBB = DefMI->getParent();
|
MachineBasicBlock *MBB = DefMI->getParent();
|
||||||
MachineInstr *NewMI = tii_->commuteInstruction(DefMI);
|
MachineInstr *NewMI = tii_->commuteInstruction(DefMI);
|
||||||
if (NewMI != DefMI) {
|
if (NewMI != DefMI) {
|
||||||
@ -312,10 +313,10 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
|||||||
for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(IntA.reg),
|
for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(IntA.reg),
|
||||||
UE = mri_->use_end(); UI != UE;) {
|
UE = mri_->use_end(); UI != UE;) {
|
||||||
MachineOperand &UseMO = UI.getOperand();
|
MachineOperand &UseMO = UI.getOperand();
|
||||||
|
MachineInstr *UseMI = &*UI;
|
||||||
++UI;
|
++UI;
|
||||||
MachineInstr *UseMI = UseMO.getParent();
|
if (JoinedCopies.count(UseMI))
|
||||||
if (JoinedCopies.count(UseMI))
|
continue;
|
||||||
continue;
|
|
||||||
unsigned UseIdx = li_->getInstructionIndex(UseMI);
|
unsigned UseIdx = li_->getInstructionIndex(UseMI);
|
||||||
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
|
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
|
||||||
if (ULR->valno != AValNo)
|
if (ULR->valno != AValNo)
|
||||||
@ -323,35 +324,35 @@ bool SimpleRegisterCoalescing::RemoveCopyByCommutingDef(LiveInterval &IntA,
|
|||||||
UseMO.setReg(NewReg);
|
UseMO.setReg(NewReg);
|
||||||
if (UseMO.isKill())
|
if (UseMO.isKill())
|
||||||
BKills.push_back(li_->getUseIndex(UseIdx)+1);
|
BKills.push_back(li_->getUseIndex(UseIdx)+1);
|
||||||
if (UseMI != CopyMI) {
|
if (UseMI == CopyMI)
|
||||||
unsigned SrcReg, DstReg;
|
continue;
|
||||||
if (!tii_->isMoveInstr(*UseMI, SrcReg, DstReg))
|
unsigned SrcReg, DstReg;
|
||||||
continue;
|
if (!tii_->isMoveInstr(*UseMI, SrcReg, DstReg))
|
||||||
unsigned repDstReg = rep(DstReg);
|
continue;
|
||||||
if (repDstReg != IntB.reg) {
|
unsigned repDstReg = rep(DstReg);
|
||||||
// Update dst register interval val# since its source register has
|
if (repDstReg != IntB.reg) {
|
||||||
// changed.
|
// Update dst register interval val# since its source register has
|
||||||
LiveInterval &DLI = li_->getInterval(repDstReg);
|
// changed.
|
||||||
LiveInterval::iterator DLR =
|
LiveInterval &DLI = li_->getInterval(repDstReg);
|
||||||
DLI.FindLiveRangeContaining(li_->getDefIndex(UseIdx));
|
LiveInterval::iterator DLR =
|
||||||
DLR->valno->reg = NewReg;
|
DLI.FindLiveRangeContaining(li_->getDefIndex(UseIdx));
|
||||||
ChangedCopies.insert(UseMI);
|
DLR->valno->reg = NewReg;
|
||||||
} else {
|
ChangedCopies.insert(UseMI);
|
||||||
// This copy will become a noop. If it's defining a new val#,
|
} else {
|
||||||
// remove that val# as well. However this live range is being
|
// This copy will become a noop. If it's defining a new val#,
|
||||||
// extended to the end of the existing live range defined by the copy.
|
// remove that val# as well. However this live range is being
|
||||||
unsigned DefIdx = li_->getDefIndex(UseIdx);
|
// extended to the end of the existing live range defined by the copy.
|
||||||
LiveInterval::iterator DLR = IntB.FindLiveRangeContaining(DefIdx);
|
unsigned DefIdx = li_->getDefIndex(UseIdx);
|
||||||
BHasPHIKill |= DLR->valno->hasPHIKill;
|
LiveInterval::iterator DLR = IntB.FindLiveRangeContaining(DefIdx);
|
||||||
assert(DLR->valno->def == DefIdx);
|
BHasPHIKill |= DLR->valno->hasPHIKill;
|
||||||
BDeadValNos.push_back(DLR->valno);
|
assert(DLR->valno->def == DefIdx);
|
||||||
BExtend[DLR->start] = DLR->end;
|
BDeadValNos.push_back(DLR->valno);
|
||||||
JoinedCopies.insert(UseMI);
|
BExtend[DLR->start] = DLR->end;
|
||||||
// If this is a kill but it's going to be removed, the last use
|
JoinedCopies.insert(UseMI);
|
||||||
// of the same val# is the new kill.
|
// If this is a kill but it's going to be removed, the last use
|
||||||
if (UseMO.isKill()) {
|
// of the same val# is the new kill.
|
||||||
BKills.pop_back();
|
if (UseMO.isKill()) {
|
||||||
}
|
BKills.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user