From b2b7ef1de8118095963e1c085467fc411bd7e56f Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 24 Aug 2015 22:59:52 +0000 Subject: MachineBasicBlock: Add liveins() method returning an iterator_range llvm-svn: 245895 --- llvm/lib/CodeGen/LiveVariables.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'llvm/lib/CodeGen/LiveVariables.cpp') diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index b355393e76f..1f5f3047e63 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -559,11 +559,10 @@ void LiveVariables::runOnInstr(MachineInstr *MI, void LiveVariables::runOnBlock(MachineBasicBlock *MBB, const unsigned NumRegs) { // Mark live-in registers as live-in. SmallVector Defs; - for (MachineBasicBlock::livein_iterator II = MBB->livein_begin(), - EE = MBB->livein_end(); II != EE; ++II) { - assert(TargetRegisterInfo::isPhysicalRegister(*II) && + for (unsigned LI : MBB->liveins()) { + assert(TargetRegisterInfo::isPhysicalRegister(LI) && "Cannot have a live-in virtual register!"); - HandlePhysRegDef(*II, nullptr, Defs); + HandlePhysRegDef(LI, nullptr, Defs); } // Loop over all of the instructions, processing them. @@ -601,12 +600,10 @@ void LiveVariables::runOnBlock(MachineBasicBlock *MBB, const unsigned NumRegs) { MachineBasicBlock *SuccMBB = *SI; if (SuccMBB->isLandingPad()) continue; - for (MachineBasicBlock::livein_iterator LI = SuccMBB->livein_begin(), - LE = SuccMBB->livein_end(); LI != LE; ++LI) { - unsigned LReg = *LI; - if (!TRI->isInAllocatableClass(LReg)) + for (unsigned LI : SuccMBB->liveins()) { + if (!TRI->isInAllocatableClass(LI)) // Ignore other live-ins, e.g. those that are live into landing pads. - LiveOuts.insert(LReg); + LiveOuts.insert(LI); } } -- cgit v1.2.3