aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-19 07:04:55 +0000
committerChris Lattner <sabre@nondot.org>2004-07-19 07:04:55 +0000
commit74de8b1b26b12fda3364382946e519a2e37b6709 (patch)
tree5d6549f8b0dd6a5c83ede1f90e22fb86e152360f /lib
parent472405e0dc05f6fb8c09af00713ff893fff25b94 (diff)
downloadexternal_llvm-74de8b1b26b12fda3364382946e519a2e37b6709.zip
external_llvm-74de8b1b26b12fda3364382946e519a2e37b6709.tar.gz
external_llvm-74de8b1b26b12fda3364382946e519a2e37b6709.tar.bz2
There is no need to store the MBB along with the MI any more, we can now
ask instructions for their parent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp12
-rw-r--r--lib/CodeGen/LiveVariables.cpp18
-rw-r--r--lib/CodeGen/PHIElimination.cpp2
3 files changed, 16 insertions, 16 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index a20d23b..44f860c 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -311,11 +311,11 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb,
// 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 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb,
// 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 {
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp
index c82208a..0bdf864 100644
--- a/lib/CodeGen/LiveVariables.cpp
+++ b/lib/CodeGen/LiveVariables.cpp
@@ -59,7 +59,7 @@ void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
// 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::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
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 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
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 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
//
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));
}
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 4b67237..3c75f86 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/lib/CodeGen/PHIElimination.cpp
@@ -235,7 +235,7 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
// 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;
}