mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Simplify a few more uses of reg_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82812 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
29438d13e0
commit
2bf0649e05
@ -1087,11 +1087,9 @@ LiveIntervals::isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt
|
|||||||
SmallVector<MachineInstr*,16> &OtherCopies) {
|
SmallVector<MachineInstr*,16> &OtherCopies) {
|
||||||
bool HaveConflict = false;
|
bool HaveConflict = false;
|
||||||
unsigned NumIdent = 0;
|
unsigned NumIdent = 0;
|
||||||
for (MachineRegisterInfo::reg_iterator ri = mri_->reg_begin(SrcInt.reg),
|
for (MachineRegisterInfo::def_iterator ri = mri_->def_begin(SrcInt.reg),
|
||||||
re = mri_->reg_end(); ri != re; ++ri) {
|
re = mri_->def_end(); ri != re; ++ri) {
|
||||||
MachineOperand &O = ri.getOperand();
|
MachineOperand &O = ri.getOperand();
|
||||||
if (!O.isDef())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
MachineInstr *MI = &*ri;
|
MachineInstr *MI = &*ri;
|
||||||
unsigned SrcReg, DstReg, SrcSubReg, DstSubReg;
|
unsigned SrcReg, DstReg, SrcSubReg, DstSubReg;
|
||||||
|
@ -110,11 +110,9 @@ void MachineRegisterInfo::replaceRegWith(unsigned FromReg, unsigned ToReg) {
|
|||||||
MachineInstr *MachineRegisterInfo::getVRegDef(unsigned Reg) const {
|
MachineInstr *MachineRegisterInfo::getVRegDef(unsigned Reg) const {
|
||||||
assert(Reg-TargetRegisterInfo::FirstVirtualRegister < VRegInfo.size() &&
|
assert(Reg-TargetRegisterInfo::FirstVirtualRegister < VRegInfo.size() &&
|
||||||
"Invalid vreg!");
|
"Invalid vreg!");
|
||||||
for (reg_iterator I = reg_begin(Reg), E = reg_end(); I != E; ++I) {
|
// Since we are in SSA form, we can use the first definition.
|
||||||
// Since we are in SSA form, we can stop at the first definition.
|
if (!def_empty(Reg))
|
||||||
if (I.getOperand().isDef())
|
return &*def_begin(Reg);
|
||||||
return &*I;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,10 +397,10 @@ unsigned RALinScan::attemptTrivialCoalescing(LiveInterval &cur, unsigned Reg) {
|
|||||||
// Remove unnecessary kills since a copy does not clobber the register.
|
// Remove unnecessary kills since a copy does not clobber the register.
|
||||||
if (li_->hasInterval(SrcReg)) {
|
if (li_->hasInterval(SrcReg)) {
|
||||||
LiveInterval &SrcLI = li_->getInterval(SrcReg);
|
LiveInterval &SrcLI = li_->getInterval(SrcReg);
|
||||||
for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(cur.reg),
|
for (MachineRegisterInfo::use_iterator I = mri_->use_begin(cur.reg),
|
||||||
E = mri_->reg_end(); I != E; ++I) {
|
E = mri_->use_end(); I != E; ++I) {
|
||||||
MachineOperand &O = I.getOperand();
|
MachineOperand &O = I.getOperand();
|
||||||
if (!O.isUse() || !O.isKill())
|
if (!O.isKill())
|
||||||
continue;
|
continue;
|
||||||
MachineInstr *MI = &*I;
|
MachineInstr *MI = &*I;
|
||||||
if (SrcLI.liveAt(li_->getDefIndex(li_->getInstructionIndex(MI))))
|
if (SrcLI.liveAt(li_->getDefIndex(li_->getInstructionIndex(MI))))
|
||||||
|
Loading…
Reference in New Issue
Block a user