aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-07-27 13:24:16 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-07-27 13:24:16 +0000
commite5a22f44b83a1802efe699590471126cc4206e12 (patch)
tree7f7891dfc02380a2b504c8229f9fa9fa0764c270 /llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
parent79a947c2336c9cf12a588844d39422c9aa0a5658 (diff)
downloadllvm-e5a22f44b83a1802efe699590471126cc4206e12.zip
llvm-e5a22f44b83a1802efe699590471126cc4206e12.tar.gz
llvm-e5a22f44b83a1802efe699590471126cc4206e12.tar.bz2
PowerPC: Avoid implicit iterator conversions, NFC
Avoid implicit conversions from MachineInstrBundleIterator to MachineInstr* in the PowerPC backend, mainly by preferring MachineInstr& over MachineInstr* when a pointer isn't nullable and using range-based for loops. There was one piece of questionable code in PPCInstrInfo::AnalyzeBranch, where a condition checked a pointer converted from an iterator for nullptr. Since this case is impossible (moreover, the code above guarantees that the iterator is valid), I removed the check when I changed the pointer to a reference. Despite that case, there should be no functionality change here. llvm-svn: 276864
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp b/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
index 61ce48e..0c1260a 100644
--- a/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
@@ -56,26 +56,26 @@ protected:
for (MachineBasicBlock::iterator I = MBB.begin(), IE = MBB.end();
I != IE;) {
- MachineInstr *MI = I;
+ MachineInstr &MI = *I;
- if (MI->getOpcode() != PPC::ADDItlsgdLADDR &&
- MI->getOpcode() != PPC::ADDItlsldLADDR &&
- MI->getOpcode() != PPC::ADDItlsgdLADDR32 &&
- MI->getOpcode() != PPC::ADDItlsldLADDR32) {
+ if (MI.getOpcode() != PPC::ADDItlsgdLADDR &&
+ MI.getOpcode() != PPC::ADDItlsldLADDR &&
+ MI.getOpcode() != PPC::ADDItlsgdLADDR32 &&
+ MI.getOpcode() != PPC::ADDItlsldLADDR32) {
++I;
continue;
}
- DEBUG(dbgs() << "TLS Dynamic Call Fixup:\n " << *MI;);
+ DEBUG(dbgs() << "TLS Dynamic Call Fixup:\n " << MI);
- unsigned OutReg = MI->getOperand(0).getReg();
- unsigned InReg = MI->getOperand(1).getReg();
- DebugLoc DL = MI->getDebugLoc();
+ unsigned OutReg = MI.getOperand(0).getReg();
+ unsigned InReg = MI.getOperand(1).getReg();
+ DebugLoc DL = MI.getDebugLoc();
unsigned GPR3 = Is64Bit ? PPC::X3 : PPC::R3;
unsigned Opc1, Opc2;
const unsigned OrigRegs[] = {OutReg, InReg, GPR3};
- switch (MI->getOpcode()) {
+ switch (MI.getOpcode()) {
default:
llvm_unreachable("Opcode inconsistency error");
case PPC::ADDItlsgdLADDR:
@@ -104,7 +104,7 @@ protected:
// Expand into two ops built prior to the existing instruction.
MachineInstr *Addi = BuildMI(MBB, I, DL, TII->get(Opc1), GPR3)
.addReg(InReg);
- Addi->addOperand(MI->getOperand(2));
+ Addi->addOperand(MI.getOperand(2));
// The ADDItls* instruction is the first instruction in the
// repair range.
@@ -113,7 +113,7 @@ protected:
MachineInstr *Call = (BuildMI(MBB, I, DL, TII->get(Opc2), GPR3)
.addReg(GPR3));
- Call->addOperand(MI->getOperand(3));
+ Call->addOperand(MI.getOperand(3));
BuildMI(MBB, I, DL, TII->get(PPC::ADJCALLSTACKUP)).addImm(0).addImm(0);
@@ -126,7 +126,7 @@ protected:
// Move past the original instruction and remove it.
++I;
- MI->removeFromParent();
+ MI.removeFromParent();
// Repair the live intervals.
LIS->repairIntervalsInRange(&MBB, First, Last, OrigRegs);