[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervals.cpp LiveVariables.cpp PHIElimination.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Jul 19 00:05:06 PDT 2004
Changes in directory llvm/lib/CodeGen:
LiveIntervals.cpp updated: 1.93 -> 1.94
LiveVariables.cpp updated: 1.39 -> 1.40
PHIElimination.cpp updated: 1.29 -> 1.30
---
Log message:
There is no need to store the MBB along with the MI any more, we can now
ask instructions for their parent.
---
Diffs of the changes: (+16 -16)
Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.93 llvm/lib/CodeGen/LiveIntervals.cpp:1.94
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.93 Mon Jul 19 01:55:17 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp Mon Jul 19 02:04:55 2004
@@ -311,11 +311,11 @@
// two cases we have to handle here. The most common case is a vreg
// whose lifetime is contained within a basic block. In this case there
// will be a single kill, in MBB, which comes after the definition.
- if (vi.Kills.size() == 1 && vi.Kills[0].first == mbb) {
+ if (vi.Kills.size() == 1 && vi.Kills[0]->getParent() == mbb) {
// FIXME: what about dead vars?
unsigned killIdx;
- if (vi.Kills[0].second != mi)
- killIdx = getUseIndex(getInstructionIndex(vi.Kills[0].second))+1;
+ if (vi.Kills[0] != mi)
+ killIdx = getUseIndex(getInstructionIndex(vi.Kills[0]))+1;
else
killIdx = defIndex+1;
@@ -353,9 +353,9 @@
// Finally, this virtual register is live from the start of any killing
// block to the 'use' slot of the killing instruction.
for (unsigned i = 0, e = vi.Kills.size(); i != e; ++i) {
- std::pair<MachineBasicBlock*, MachineInstr*> &Kill = vi.Kills[i];
- interval.addRange(getInstructionIndex(Kill.first->begin()),
- getUseIndex(getInstructionIndex(Kill.second))+1);
+ MachineInstr *Kill = vi.Kills[i];
+ interval.addRange(getInstructionIndex(Kill->getParent()->begin()),
+ getUseIndex(getInstructionIndex(Kill))+1);
}
} else {
Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.39 llvm/lib/CodeGen/LiveVariables.cpp:1.40
--- llvm/lib/CodeGen/LiveVariables.cpp:1.39 Mon Jul 19 01:55:17 2004
+++ llvm/lib/CodeGen/LiveVariables.cpp Mon Jul 19 02:04:55 2004
@@ -59,7 +59,7 @@
// Check to see if this basic block is one of the killing blocks. If so,
// remove it...
for (unsigned i = 0, e = VRInfo.Kills.size(); i != e; ++i)
- if (VRInfo.Kills[i].first == MBB) {
+ if (VRInfo.Kills[i]->getParent() == MBB) {
VRInfo.Kills.erase(VRInfo.Kills.begin()+i); // Erase entry
break;
}
@@ -83,23 +83,23 @@
void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
MachineInstr *MI) {
// Check to see if this basic block is already a kill block...
- if (!VRInfo.Kills.empty() && VRInfo.Kills.back().first == MBB) {
+ if (!VRInfo.Kills.empty() && VRInfo.Kills.back()->getParent() == MBB) {
// Yes, this register is killed in this basic block already. Increase the
// live range by updating the kill instruction.
- VRInfo.Kills.back().second = MI;
+ VRInfo.Kills.back() = MI;
return;
}
#ifndef NDEBUG
for (unsigned i = 0, e = VRInfo.Kills.size(); i != e; ++i)
- assert(VRInfo.Kills[i].first != MBB && "entry should be at end!");
+ assert(VRInfo.Kills[i]->getParent() != MBB && "entry should be at end!");
#endif
assert(MBB != VRInfo.DefInst->getParent() &&
"Should have kill for defblock!");
// Add a new kill entry for this basic block.
- VRInfo.Kills.push_back(std::make_pair(MI->getParent(), MI));
+ VRInfo.Kills.push_back(MI);
// Update all dominating blocks to mark them known live.
const BasicBlock *BB = MBB->getBasicBlock();
@@ -234,7 +234,7 @@
assert(VRInfo.DefInst == 0 && "Variable multiply defined!");
VRInfo.DefInst = MI;
// Defaults to dead
- VRInfo.Kills.push_back(std::make_pair(MI->getParent(), MI));
+ VRInfo.Kills.push_back(MI);
} else if (MRegisterInfo::isPhysicalRegister(MO.getReg()) &&
AllocatablePhysicalRegisters[MO.getReg()]) {
HandlePhysRegDef(MO.getReg(), MI);
@@ -283,12 +283,12 @@
//
for (unsigned i = 0, e = VirtRegInfo.size(); i != e; ++i)
for (unsigned j = 0, e = VirtRegInfo[i].Kills.size(); j != e; ++j) {
- if (VirtRegInfo[i].Kills[j].second == VirtRegInfo[i].DefInst)
- RegistersDead.insert(std::make_pair(VirtRegInfo[i].Kills[j].second,
+ if (VirtRegInfo[i].Kills[j] == VirtRegInfo[i].DefInst)
+ RegistersDead.insert(std::make_pair(VirtRegInfo[i].Kills[j],
i + MRegisterInfo::FirstVirtualRegister));
else
- RegistersKilled.insert(std::make_pair(VirtRegInfo[i].Kills[j].second,
+ RegistersKilled.insert(std::make_pair(VirtRegInfo[i].Kills[j],
i + MRegisterInfo::FirstVirtualRegister));
}
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.29 llvm/lib/CodeGen/PHIElimination.cpp:1.30
--- llvm/lib/CodeGen/PHIElimination.cpp:1.29 Mon Jul 19 01:55:17 2004
+++ llvm/lib/CodeGen/PHIElimination.cpp Mon Jul 19 02:04:55 2004
@@ -235,7 +235,7 @@
// Is it killed in this successor?
for (unsigned i = 0, e = InRegVI.Kills.size(); i != e; ++i)
- if (InRegVI.Kills[i].first == SuccMBB) {
+ if (InRegVI.Kills[i]->getParent() == SuccMBB) {
ValueIsLive = true;
break;
}
More information about the llvm-commits
mailing list