mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Phase 1 of refactoring the MachineRegisterInfo iterators to make them suitable
for use with C++11 range-based for-loops. The gist of phase 1 is to remove the skipInstruction() and skipBundle() methods from these iterators, instead splitting each iterator into a version that walks operands, a version that walks instructions, and a version that walks bundles. This has the result of making some "clever" loops in lib/CodeGen more verbose, but also makes their iterator invalidation characteristics much more obvious to the casual reader. (Making them concise again in the future is a good motivating case for a pre-incrementing range adapter!) Phase 2 of this undertaking with consist of removing the getOperand() method, and changing operator*() of the operand-walker to return a MachineOperand&. At that point, it should be possible to add range views for them that work as one might expect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203757 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -326,8 +326,10 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
|
||||
SmallPtrSet<MachineBasicBlock*, 16> LiveOut;
|
||||
|
||||
// Visit all instructions reading li->reg.
|
||||
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(li->reg);
|
||||
MachineInstr *UseMI = I.skipInstruction();) {
|
||||
for (MachineRegisterInfo::reg_instr_iterator
|
||||
I = MRI->reg_instr_begin(li->reg), E = MRI->reg_instr_end();
|
||||
I != E; ) {
|
||||
MachineInstr *UseMI = &*(I++);
|
||||
if (UseMI->isDebugValue() || !UseMI->readsVirtualRegister(li->reg))
|
||||
continue;
|
||||
SlotIndex Idx = getInstructionIndex(UseMI).getRegSlot();
|
||||
@@ -980,10 +982,10 @@ private:
|
||||
|
||||
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
||||
SlotIndex LastUse = NewIdx;
|
||||
for (MachineRegisterInfo::use_nodbg_iterator
|
||||
UI = MRI.use_nodbg_begin(Reg),
|
||||
UE = MRI.use_nodbg_end();
|
||||
UI != UE; UI.skipInstruction()) {
|
||||
for (MachineRegisterInfo::use_instr_nodbg_iterator
|
||||
UI = MRI.use_instr_nodbg_begin(Reg),
|
||||
UE = MRI.use_instr_nodbg_end();
|
||||
UI != UE; ++UI) {
|
||||
const MachineInstr* MI = &*UI;
|
||||
SlotIndex InstSlot = LIS.getSlotIndexes()->getInstructionIndex(MI);
|
||||
if (InstSlot > LastUse && InstSlot < OldIdx)
|
||||
|
Reference in New Issue
Block a user