1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

There could be more than one DBG_VALUE instructions for variables where all of them have offset based on one register.

llvm-svn: 133560
This commit is contained in:
Devang Patel 2011-06-21 22:36:03 +00:00
parent 16b9bd4460
commit 42bd3da91f

View File

@ -86,7 +86,7 @@ namespace {
// that is currently available in a physical register. // that is currently available in a physical register.
LiveRegMap LiveVirtRegs; LiveRegMap LiveVirtRegs;
DenseMap<unsigned, MachineInstr *> LiveDbgValueMap; DenseMap<unsigned, SmallVector<MachineInstr *, 4> > LiveDbgValueMap;
// RegState - Track the state of a physical register. // RegState - Track the state of a physical register.
enum RegState { enum RegState {
@ -272,7 +272,9 @@ void RAFast::spillVirtReg(MachineBasicBlock::iterator MI,
// If this register is used by DBG_VALUE then insert new DBG_VALUE to // If this register is used by DBG_VALUE then insert new DBG_VALUE to
// identify spilled location as the place to find corresponding variable's // identify spilled location as the place to find corresponding variable's
// value. // value.
if (MachineInstr *DBG = LiveDbgValueMap.lookup(LRI->first)) { SmallVector<MachineInstr *, 4> &LRIDbgValues = LiveDbgValueMap[LRI->first];
for (unsigned li = 0, le = LRIDbgValues.size(); li != le; ++li) {
MachineInstr *DBG = LRIDbgValues[li];
const MDNode *MDPtr = const MDNode *MDPtr =
DBG->getOperand(DBG->getNumOperands()-1).getMetadata(); DBG->getOperand(DBG->getNumOperands()-1).getMetadata();
int64_t Offset = 0; int64_t Offset = 0;
@ -291,7 +293,7 @@ void RAFast::spillVirtReg(MachineBasicBlock::iterator MI,
MachineBasicBlock *MBB = DBG->getParent(); MachineBasicBlock *MBB = DBG->getParent();
MBB->insert(MI, NewDV); MBB->insert(MI, NewDV);
DEBUG(dbgs() << "Inserting debug info due to spill:" << "\n" << *NewDV); DEBUG(dbgs() << "Inserting debug info due to spill:" << "\n" << *NewDV);
LiveDbgValueMap[LRI->first] = NewDV; LRIDbgValues[li] = NewDV;
} }
} }
if (SpillKill) if (SpillKill)
@ -816,7 +818,7 @@ void RAFast::AllocateBasicBlock() {
if (!MO.isReg()) continue; if (!MO.isReg()) continue;
unsigned Reg = MO.getReg(); unsigned Reg = MO.getReg();
if (!TargetRegisterInfo::isVirtualRegister(Reg)) continue; if (!TargetRegisterInfo::isVirtualRegister(Reg)) continue;
LiveDbgValueMap[Reg] = MI; LiveDbgValueMap[Reg].push_back(MI);
LiveRegMap::iterator LRI = LiveVirtRegs.find(Reg); LiveRegMap::iterator LRI = LiveVirtRegs.find(Reg);
if (LRI != LiveVirtRegs.end()) if (LRI != LiveVirtRegs.end())
setPhysReg(MI, i, LRI->second.PhysReg); setPhysReg(MI, i, LRI->second.PhysReg);