diff options
Diffstat (limited to 'llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp b/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp index 06673ae3f30..d693af4a0a2 100644 --- a/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp +++ b/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp @@ -87,7 +87,7 @@ void CriticalAntiDepBreaker::FinishBlock() { KeepRegs.reset(); } -void CriticalAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count, +void CriticalAntiDepBreaker::Observe(MachineInstr &MI, unsigned Count, unsigned InsertPosIndex) { // Kill instructions can define registers but are really nops, and there might // be a real definition earlier that needs to be paired with uses dominated by @@ -96,7 +96,7 @@ void CriticalAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count, // FIXME: It may be possible to remove the isKill() restriction once PR18663 // has been properly fixed. There can be value in processing kills as seen in // the AggressiveAntiDepBreaker class. - if (MI->isDebugValue() || MI->isKill()) + if (MI.isDebugValue() || MI.isKill()) return; assert(Count < InsertPosIndex && "Instruction index out of expected range!"); @@ -146,7 +146,7 @@ static const SDep *CriticalPathStep(const SUnit *SU) { return Next; } -void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr *MI) { +void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr &MI) { // It's not safe to change register allocation for source operands of // instructions that have special allocation requirements. Also assume all // registers used in a call must not be changed (ABI). @@ -164,19 +164,19 @@ void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr *MI) { // re-define R6 so it's not safe to change it since the last R6 use cannot be // changed. bool Special = - MI->isCall() || MI->hasExtraSrcRegAllocReq() || TII->isPredicated(*MI); + MI.isCall() || MI.hasExtraSrcRegAllocReq() || TII->isPredicated(MI); // Scan the register operands for this instruction and update // Classes and RegRefs. - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = MI->getOperand(i); + for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI.getOperand(i); if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) continue; const TargetRegisterClass *NewRC = nullptr; - if (i < MI->getDesc().getNumOperands()) - NewRC = TII->getRegClass(MI->getDesc(), i, TRI, MF); + if (i < MI.getDesc().getNumOperands()) + NewRC = TII->getRegClass(MI.getDesc(), i, TRI, MF); // For now, only allow the register to be changed if its register // class is consistent across all uses. @@ -211,7 +211,7 @@ void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr *MI) { // of a register? In the above 'xor' example, the uses of %eax are undef, so // earlier instructions could still replace %eax even though the 'xor' // itself can't be changed. - if (MI->isRegTiedToUseOperand(i) && + if (MI.isRegTiedToUseOperand(i) && Classes[Reg] == reinterpret_cast<TargetRegisterClass *>(-1)) { for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true); SubRegs.isValid(); ++SubRegs) { @@ -233,18 +233,17 @@ void CriticalAntiDepBreaker::PrescanInstruction(MachineInstr *MI) { } } -void CriticalAntiDepBreaker::ScanInstruction(MachineInstr *MI, - unsigned Count) { +void CriticalAntiDepBreaker::ScanInstruction(MachineInstr &MI, unsigned Count) { // Update liveness. // Proceeding upwards, registers that are defed but not used in this // instruction are now dead. - assert(!MI->isKill() && "Attempting to scan a kill instruction"); + assert(!MI.isKill() && "Attempting to scan a kill instruction"); - if (!TII->isPredicated(*MI)) { + if (!TII->isPredicated(MI)) { // Predicated defs are modeled as read + write, i.e. similar to two // address updates. - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = MI->getOperand(i); + for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI.getOperand(i); if (MO.isRegMask()) for (unsigned i = 0, e = TRI->getNumRegs(); i != e; ++i) @@ -265,7 +264,8 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr *MI, if (KeepRegs.test(Reg)) continue; // Ignore two-addr defs. - if (MI->isRegTiedToUseOperand(i)) continue; + if (MI.isRegTiedToUseOperand(i)) + continue; // For the reg itself and all subregs: update the def to current; // reset the kill state, any restrictions, and references. @@ -282,16 +282,16 @@ void CriticalAntiDepBreaker::ScanInstruction(MachineInstr *MI, Classes[*SR] = reinterpret_cast<TargetRegisterClass *>(-1); } } - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = MI->getOperand(i); + for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI.getOperand(i); if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) continue; if (!MO.isUse()) continue; const TargetRegisterClass *NewRC = nullptr; - if (i < MI->getDesc().getNumOperands()) - NewRC = TII->getRegClass(MI->getDesc(), i, TRI, MF); + if (i < MI.getDesc().getNumOperands()) + NewRC = TII->getRegClass(MI.getDesc(), i, TRI, MF); // For now, only allow the register to be changed if its register // class is consistent across all uses. @@ -509,7 +509,7 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits, unsigned Broken = 0; unsigned Count = InsertPosIndex - 1; for (MachineBasicBlock::iterator I = End, E = Begin; I != E; --Count) { - MachineInstr *MI = --I; + MachineInstr &MI = *--I; // Kill instructions can define registers but are really nops, and there // might be a real definition earlier that needs to be paired with uses // dominated by this kill. @@ -517,7 +517,7 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits, // FIXME: It may be possible to remove the isKill() restriction once PR18663 // has been properly fixed. There can be value in processing kills as seen // in the AggressiveAntiDepBreaker class. - if (MI->isDebugValue() || MI->isKill()) + if (MI.isDebugValue() || MI.isKill()) continue; // Check if this instruction has a dependence on the critical path that @@ -534,7 +534,7 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits, // edge per instruction. Note that we'd have to be able to break all of // the anti-dependencies in an instruction in order to be effective. unsigned AntiDepReg = 0; - if (MI == CriticalPathMI) { + if (&MI == CriticalPathMI) { if (const SDep *Edge = CriticalPathStep(CriticalPathSU)) { const SUnit *NextSU = Edge->getSUnit(); @@ -584,7 +584,7 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits, // If MI's defs have a special allocation requirement, don't allow // any def registers to be changed. Also assume all registers // defined in a call must not be changed (ABI). - if (MI->isCall() || MI->hasExtraDefRegAllocReq() || TII->isPredicated(*MI)) + if (MI.isCall() || MI.hasExtraDefRegAllocReq() || TII->isPredicated(MI)) // If this instruction's defs have special allocation requirement, don't // break this anti-dependency. AntiDepReg = 0; @@ -593,8 +593,8 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits, // is invalid. If the instruction defines other registers, // save a list of them so that we don't pick a new register // that overlaps any of them. - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = MI->getOperand(i); + for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI.getOperand(i); if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) continue; @@ -646,7 +646,7 @@ BreakAntiDependencies(const std::vector<SUnit>& SUnits, for (DbgValueVector::iterator DVI = DbgValues.begin(), DVE = DbgValues.end(); DVI != DVE; ++DVI) if (DVI->second == Q->second->getParent()) - UpdateDbgValue(DVI->first, AntiDepReg, NewReg); + UpdateDbgValue(*DVI->first, AntiDepReg, NewReg); } // We just went back in time and modified history; the |