diff --git a/llvm/include/llvm/CodeGen/LiveVariables.h b/llvm/include/llvm/CodeGen/LiveVariables.h index 89d1b5edf3fa6..1a8c32b37d552 100644 --- a/llvm/include/llvm/CodeGen/LiveVariables.h +++ b/llvm/include/llvm/CodeGen/LiveVariables.h @@ -156,8 +156,8 @@ class LiveVariables { void HandlePhysRegUse(Register Reg, MachineInstr &MI); void HandlePhysRegDef(Register Reg, MachineInstr *MI, - SmallVectorImpl &Defs); - void UpdatePhysRegDefs(MachineInstr &MI, SmallVectorImpl &Defs); + SmallVectorImpl &Defs); + void UpdatePhysRegDefs(MachineInstr &MI, SmallVectorImpl &Defs); /// FindLastRefOrPartRef - Return the last reference or partial reference of /// the specified register. @@ -167,7 +167,7 @@ class LiveVariables { /// register. Also returns the sub-registers that're defined by the /// instruction. MachineInstr *FindLastPartialDef(Register Reg, - SmallSet &PartDefRegs); + SmallSet &PartDefRegs); /// analyzePHINodes - Gather information about the PHI nodes in here. In /// particular, we want to map the variable information of a virtual @@ -175,7 +175,7 @@ class LiveVariables { /// is coming from. void analyzePHINodes(const MachineFunction& Fn); - void runOnInstr(MachineInstr &MI, SmallVectorImpl &Defs, + void runOnInstr(MachineInstr &MI, SmallVectorImpl &Defs, unsigned NumRegs); void runOnBlock(MachineBasicBlock *MBB, unsigned NumRegs); diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index f17d60dc22dda..55428ab7832de 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -217,8 +217,8 @@ void LiveVariables::HandleVirtRegDef(Register Reg, MachineInstr &MI) { /// Also returns the sub-registers that're defined by the instruction. MachineInstr * LiveVariables::FindLastPartialDef(Register Reg, - SmallSet &PartDefRegs) { - unsigned LastDefReg = 0; + SmallSet &PartDefRegs) { + Register LastDefReg = 0; unsigned LastDefDist = 0; MachineInstr *LastDef = nullptr; for (MCPhysReg SubReg : TRI->subregs(Reg)) { @@ -264,14 +264,14 @@ void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) { // ... // = EAX // All of the sub-registers must have been defined before the use of Reg! - SmallSet PartDefRegs; + SmallSet PartDefRegs; MachineInstr *LastPartialDef = FindLastPartialDef(Reg, PartDefRegs); // If LastPartialDef is NULL, it must be using a livein register. if (LastPartialDef) { LastPartialDef->addOperand(MachineOperand::CreateReg(Reg, true/*IsDef*/, true/*IsImp*/)); PhysRegDef[Reg] = LastPartialDef; - SmallSet Processed; + SmallSet Processed; for (MCPhysReg SubReg : TRI->subregs(Reg)) { if (Processed.count(SubReg)) continue; @@ -460,7 +460,7 @@ void LiveVariables::HandleRegMask(const MachineOperand &MO, unsigned NumRegs) { } void LiveVariables::HandlePhysRegDef(Register Reg, MachineInstr *MI, - SmallVectorImpl &Defs) { + SmallVectorImpl &Defs) { // What parts of the register are previously defined? SmallSet Live; if (PhysRegDef[Reg] || PhysRegUse[Reg]) { @@ -499,7 +499,7 @@ void LiveVariables::HandlePhysRegDef(Register Reg, MachineInstr *MI, } void LiveVariables::UpdatePhysRegDefs(MachineInstr &MI, - SmallVectorImpl &Defs) { + SmallVectorImpl &Defs) { while (!Defs.empty()) { Register Reg = Defs.pop_back_val(); for (MCPhysReg SubReg : TRI->subregs_inclusive(Reg)) { @@ -510,7 +510,7 @@ void LiveVariables::UpdatePhysRegDefs(MachineInstr &MI, } void LiveVariables::runOnInstr(MachineInstr &MI, - SmallVectorImpl &Defs, + SmallVectorImpl &Defs, unsigned NumRegs) { assert(!MI.isDebugOrPseudoInstr()); // Process all of the operands of the instruction... @@ -522,8 +522,8 @@ void LiveVariables::runOnInstr(MachineInstr &MI, NumOperandsToProcess = 1; // Clear kill and dead markers. LV will recompute them. - SmallVector UseRegs; - SmallVector DefRegs; + SmallVector UseRegs; + SmallVector DefRegs; SmallVector RegMasks; for (unsigned i = 0; i != NumOperandsToProcess; ++i) { MachineOperand &MO = MI.getOperand(i); @@ -531,7 +531,7 @@ void LiveVariables::runOnInstr(MachineInstr &MI, RegMasks.push_back(i); continue; } - if (!MO.isReg() || MO.getReg() == 0) + if (!MO.isReg() || !MO.getReg()) continue; Register MOReg = MO.getReg(); if (MO.isUse()) { @@ -551,8 +551,8 @@ void LiveVariables::runOnInstr(MachineInstr &MI, MachineBasicBlock *MBB = MI.getParent(); // Process all uses. - for (unsigned MOReg : UseRegs) { - if (Register::isVirtualRegister(MOReg)) + for (Register MOReg : UseRegs) { + if (MOReg.isVirtual()) HandleVirtRegUse(MOReg, MBB, MI); else if (!MRI->isReserved(MOReg)) HandlePhysRegUse(MOReg, MI); @@ -563,8 +563,8 @@ void LiveVariables::runOnInstr(MachineInstr &MI, HandleRegMask(MI.getOperand(Mask), NumRegs); // Process all defs. - for (unsigned MOReg : DefRegs) { - if (Register::isVirtualRegister(MOReg)) + for (Register MOReg : DefRegs) { + if (MOReg.isVirtual()) HandleVirtRegDef(MOReg, MI); else if (!MRI->isReserved(MOReg)) HandlePhysRegDef(MOReg, &MI, Defs); @@ -574,7 +574,7 @@ void LiveVariables::runOnInstr(MachineInstr &MI, void LiveVariables::runOnBlock(MachineBasicBlock *MBB, unsigned NumRegs) { // Mark live-in registers as live-in. - SmallVector Defs; + SmallVector Defs; for (const auto &LI : MBB->liveins()) { assert(Register::isPhysicalRegister(LI.PhysReg) && "Cannot have a live-in virtual register!");