From f9ea88546fc1e0ce85de0fe7af899c27d461bcae Mon Sep 17 00:00:00 2001 From: Mark Lacey Date: Wed, 14 Aug 2013 23:50:04 +0000 Subject: Track new virtual registers by register number. Track new virtual registers by register number, rather than by the live interval created for them. This is the first step in separating the creation of new virtual registers and new live intervals. Eventually live intervals will be created and populated on demand after the virtual registers have been created and used in instructions. llvm-svn: 188434 --- llvm/lib/CodeGen/LiveDebugVariables.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp') diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 85bed465694..12164450825 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -131,7 +131,8 @@ class UserValue { /// splitLocation - Replace OldLocNo ranges with NewRegs ranges where NewRegs /// is live. Returns true if any changes were made. - bool splitLocation(unsigned OldLocNo, ArrayRef NewRegs); + bool splitLocation(unsigned OldLocNo, ArrayRef NewRegs, + LiveIntervals &LIS); public: /// UserValue - Create a new UserValue. @@ -251,7 +252,8 @@ public: /// splitRegister - Replace OldReg ranges with NewRegs ranges where NewRegs is /// live. Returns true if any changes were made. - bool splitRegister(unsigned OldLocNo, ArrayRef NewRegs); + bool splitRegister(unsigned OldLocNo, ArrayRef NewRegs, + LiveIntervals &LIS); /// rewriteLocations - Rewrite virtual register locations according to the /// provided virtual register map. @@ -345,7 +347,7 @@ public: void mapVirtReg(unsigned VirtReg, UserValue *EC); /// splitRegister - Replace all references to OldReg with NewRegs. - void splitRegister(unsigned OldReg, ArrayRef NewRegs); + void splitRegister(unsigned OldReg, ArrayRef NewRegs); /// emitDebugValues - Recreate DBG_VALUE instruction from data structures. void emitDebugValues(VirtRegMap *VRM); @@ -729,7 +731,8 @@ LiveDebugVariables::~LiveDebugVariables() { //===----------------------------------------------------------------------===// bool -UserValue::splitLocation(unsigned OldLocNo, ArrayRef NewRegs) { +UserValue::splitLocation(unsigned OldLocNo, ArrayRef NewRegs, + LiveIntervals& LIS) { DEBUG({ dbgs() << "Splitting Loc" << OldLocNo << '\t'; print(dbgs(), 0); @@ -738,7 +741,7 @@ UserValue::splitLocation(unsigned OldLocNo, ArrayRef NewRegs) { LocMap::iterator LocMapI; LocMapI.setMap(locInts); for (unsigned i = 0; i != NewRegs.size(); ++i) { - LiveInterval *LI = NewRegs[i]; + LiveInterval *LI = &LIS.getInterval(NewRegs[i]); if (LI->empty()) continue; @@ -827,7 +830,8 @@ UserValue::splitLocation(unsigned OldLocNo, ArrayRef NewRegs) { } bool -UserValue::splitRegister(unsigned OldReg, ArrayRef NewRegs) { +UserValue::splitRegister(unsigned OldReg, ArrayRef NewRegs, + LiveIntervals &LIS) { bool DidChange = false; // Split locations referring to OldReg. Iterate backwards so splitLocation can // safely erase unused locations. @@ -836,15 +840,15 @@ UserValue::splitRegister(unsigned OldReg, ArrayRef NewRegs) { const MachineOperand *Loc = &locations[LocNo]; if (!Loc->isReg() || Loc->getReg() != OldReg) continue; - DidChange |= splitLocation(LocNo, NewRegs); + DidChange |= splitLocation(LocNo, NewRegs, LIS); } return DidChange; } -void LDVImpl::splitRegister(unsigned OldReg, ArrayRef NewRegs) { +void LDVImpl::splitRegister(unsigned OldReg, ArrayRef NewRegs) { bool DidChange = false; for (UserValue *UV = lookupVirtReg(OldReg); UV; UV = UV->getNext()) - DidChange |= UV->splitRegister(OldReg, NewRegs); + DidChange |= UV->splitRegister(OldReg, NewRegs, *LIS); if (!DidChange) return; @@ -852,11 +856,11 @@ void LDVImpl::splitRegister(unsigned OldReg, ArrayRef NewRegs) { // Map all of the new virtual registers. UserValue *UV = lookupVirtReg(OldReg); for (unsigned i = 0; i != NewRegs.size(); ++i) - mapVirtReg(NewRegs[i]->reg, UV); + mapVirtReg(NewRegs[i], UV); } void LiveDebugVariables:: -splitRegister(unsigned OldReg, ArrayRef NewRegs) { +splitRegister(unsigned OldReg, ArrayRef NewRegs, LiveIntervals &LIS) { if (pImpl) static_cast(pImpl)->splitRegister(OldReg, NewRegs); } -- cgit v1.2.3