aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-07-24 11:44:15 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-07-24 11:44:15 +0000
commita1613db62fec94845aa8306232fb665273615bad (patch)
treed9b541005246a4308a815f53a347f5cbc3714c61 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent7d91e49ff7bcc0fd10a54d45a6185bb05adf3d20 (diff)
Change std::map<unsigned, LiveInterval*> into a std::map<unsigned,
LiveInterval>. This saves some space and removes the pointer indirection caused by following the pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 6021e9e56f..c21a9c0540 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -76,11 +76,7 @@ void LiveIntervals::releaseMemory()
{
mi2iMap_.clear();
i2miMap_.clear();
- for (std::map<unsigned, LiveInterval*>::iterator I = r2iMap_.begin(),
- E = r2iMap_.end(); I != E; ++I)
- delete I->second; // free all intervals.
r2iMap_.clear();
-
r2rMap_.clear();
}
@@ -112,7 +108,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
#if 1
DEBUG(std::cerr << "********** INTERVALS **********\n");
DEBUG(for (iterator I = begin(), E = end(); I != E; ++I)
- std::cerr << *I->second << "\n");
+ std::cerr << I->second << "\n");
#endif
// join intervals if requested
@@ -169,7 +165,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
DEBUG(std::cerr << "********** INTERVALS **********\n");
DEBUG (for (iterator I = begin(), E = end(); I != E; ++I)
- std::cerr << *I->second << "\n");
+ std::cerr << I->second << "\n");
DEBUG(std::cerr << "********** MACHINEINSTRS **********\n");
DEBUG(
for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();
@@ -561,7 +557,6 @@ void LiveIntervals::joinIntervalsInMachineBB(MachineBasicBlock *MBB) {
if ((TriviallyJoinable || !IntB.joinable(IntA, MIDefIdx)) &&
!overlapsAliases(&IntA, &IntB)) {
IntB.join(IntA, MIDefIdx);
- delete r2iMap_[regA]; // Delete the dead interval
if (!MRegisterInfo::isPhysicalRegister(regA)) {
r2iMap_.erase(regA);
@@ -571,7 +566,7 @@ void LiveIntervals::joinIntervalsInMachineBB(MachineBasicBlock *MBB) {
// the physreg information.
r2rMap_[regB] = regA;
IntB.reg = regA;
- r2iMap_[regA] = r2iMap_[regB];
+ IntA.swap(IntB);
r2iMap_.erase(regB);
}
DEBUG(std::cerr << "Joined. Result = " << IntB << "\n");
@@ -661,8 +656,8 @@ bool LiveIntervals::overlapsAliases(const LiveInterval *LHS,
return false;
}
-LiveInterval *LiveIntervals::createInterval(unsigned reg) const {
+LiveInterval LiveIntervals::createInterval(unsigned reg) {
float Weight = MRegisterInfo::isPhysicalRegister(reg) ? HUGE_VAL :0.0F;
- return new LiveInterval(reg, Weight);
+ return LiveInterval(reg, Weight);
}