diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-27 06:40:41 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-27 06:40:41 +0000 |
commit | 3ac9cc615694361653d51148995f1fead69f9487 (patch) | |
tree | 940feeaeb882518bc7728d0809085607793097c2 /llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp | |
parent | 0bed1eab3937cc9c78baaef88ae85da9f3f91402 (diff) | |
download | bcm5719-llvm-3ac9cc615694361653d51148995f1fead69f9487.tar.gz bcm5719-llvm-3ac9cc615694361653d51148995f1fead69f9487.zip |
CodeGen: Take MachineInstr& in SlotIndexes and LiveIntervals, NFC
Take MachineInstr by reference instead of by pointer in SlotIndexes and
the SlotIndex wrappers in LiveIntervals. The MachineInstrs here are
never null, so this cleans up the API a bit. It also incidentally
removes a few implicit conversions from MachineInstrBundleIterator to
MachineInstr* (see PR26753).
At a couple of call sites it was convenient to convert to a range-based
for loop over MachineBasicBlock::instr_begin/instr_end, so I added
MachineBasicBlock::instrs.
llvm-svn: 262115
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp index 1bdb1f0ee9f..1452d8173f0 100644 --- a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp @@ -268,19 +268,19 @@ MachineBasicBlock::iterator SILoadStoreOptimizer::mergeRead2Pair( .addOperand(*Dest1) .addReg(DestReg, RegState::Kill, SubRegIdx1); - LIS->InsertMachineInstrInMaps(Read2); + LIS->InsertMachineInstrInMaps(*Read2); // repairLiveintervalsInRange() doesn't handle physical register, so we have // to update the M0 range manually. - SlotIndex PairedIndex = LIS->getInstructionIndex(Paired); + SlotIndex PairedIndex = LIS->getInstructionIndex(*Paired); LiveRange &M0Range = LIS->getRegUnit(*MCRegUnitIterator(AMDGPU::M0, TRI)); LiveRange::Segment *M0Segment = M0Range.getSegmentContaining(PairedIndex); bool UpdateM0Range = M0Segment->end == PairedIndex.getRegSlot(); // The new write to the original destination register is now the copy. Steal // the old SlotIndex. - LIS->ReplaceMachineInstrInMaps(I, Copy0); - LIS->ReplaceMachineInstrInMaps(Paired, Copy1); + LIS->ReplaceMachineInstrInMaps(*I, *Copy0); + LIS->ReplaceMachineInstrInMaps(*Paired, *Copy1); I->eraseFromParent(); Paired->eraseFromParent(); @@ -291,7 +291,7 @@ MachineBasicBlock::iterator SILoadStoreOptimizer::mergeRead2Pair( LIS->createAndComputeVirtRegInterval(DestReg); if (UpdateM0Range) { - SlotIndex Read2Index = LIS->getInstructionIndex(Read2); + SlotIndex Read2Index = LIS->getInstructionIndex(*Read2); M0Segment->end = Read2Index.getRegSlot(); } @@ -340,7 +340,7 @@ MachineBasicBlock::iterator SILoadStoreOptimizer::mergeWrite2Pair( // repairLiveintervalsInRange() doesn't handle physical register, so we have // to update the M0 range manually. - SlotIndex PairedIndex = LIS->getInstructionIndex(Paired); + SlotIndex PairedIndex = LIS->getInstructionIndex(*Paired); LiveRange &M0Range = LIS->getRegUnit(*MCRegUnitIterator(AMDGPU::M0, TRI)); LiveRange::Segment *M0Segment = M0Range.getSegmentContaining(PairedIndex); bool UpdateM0Range = M0Segment->end == PairedIndex.getRegSlot(); @@ -359,8 +359,8 @@ MachineBasicBlock::iterator SILoadStoreOptimizer::mergeWrite2Pair( // XXX - How do we express subregisters here? unsigned OrigRegs[] = { Data0->getReg(), Data1->getReg(), Addr->getReg() }; - LIS->RemoveMachineInstrFromMaps(I); - LIS->RemoveMachineInstrFromMaps(Paired); + LIS->RemoveMachineInstrFromMaps(*I); + LIS->RemoveMachineInstrFromMaps(*Paired); I->eraseFromParent(); Paired->eraseFromParent(); @@ -368,7 +368,7 @@ MachineBasicBlock::iterator SILoadStoreOptimizer::mergeWrite2Pair( LIS->repairIntervalsInRange(MBB, Write2, Write2, OrigRegs); if (UpdateM0Range) { - SlotIndex Write2Index = LIS->getInstructionIndex(Write2); + SlotIndex Write2Index = LIS->getInstructionIndex(*Write2); M0Segment->end = Write2Index.getRegSlot(); } |