mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
Use a list instead of a vector to store intervals. This will be needed
when we join intervals and one of the two will need to be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10892 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cbbbdf768f
commit
f5f1689ed2
@ -24,6 +24,7 @@
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
namespace llvm {
|
||||
@ -83,7 +84,7 @@ namespace llvm {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<Interval> Intervals;
|
||||
typedef std::list<Interval> Intervals;
|
||||
typedef std::vector<MachineBasicBlock*> MachineBasicBlockPtrs;
|
||||
|
||||
private:
|
||||
@ -100,7 +101,7 @@ namespace llvm {
|
||||
typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;
|
||||
Mi2IndexMap mi2iMap_;
|
||||
|
||||
typedef std::map<unsigned, unsigned> Reg2IntervalMap;
|
||||
typedef std::map<unsigned, Intervals::iterator> Reg2IntervalMap;
|
||||
Reg2IntervalMap r2iMap_;
|
||||
|
||||
Intervals intervals_;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
namespace llvm {
|
||||
@ -83,7 +84,7 @@ namespace llvm {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<Interval> Intervals;
|
||||
typedef std::list<Interval> Intervals;
|
||||
typedef std::vector<MachineBasicBlock*> MachineBasicBlockPtrs;
|
||||
|
||||
private:
|
||||
@ -100,7 +101,7 @@ namespace llvm {
|
||||
typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;
|
||||
Mi2IndexMap mi2iMap_;
|
||||
|
||||
typedef std::map<unsigned, unsigned> Reg2IntervalMap;
|
||||
typedef std::map<unsigned, Intervals::iterator> Reg2IntervalMap;
|
||||
Reg2IntervalMap r2iMap_;
|
||||
|
||||
Intervals intervals_;
|
||||
|
@ -114,7 +114,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||
unsigned reg = mop.getAllocatedRegNum();
|
||||
Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg);
|
||||
assert(r2iit != r2iMap_.end());
|
||||
intervals_[r2iit->second].weight += pow(10.0F, loopDepth);
|
||||
r2iit->second->weight += pow(10.0F, loopDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,11 +148,11 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb,
|
||||
// add new interval
|
||||
intervals_.push_back(Interval(reg));
|
||||
// update interval index for this register
|
||||
r2iMap_[reg] = intervals_.size() - 1;
|
||||
r2iMap_.insert(std::make_pair(reg, --intervals_.end()));
|
||||
interval = &intervals_.back();
|
||||
}
|
||||
else {
|
||||
interval = &intervals_[r2iit->second];
|
||||
interval = &*r2iit->second;
|
||||
}
|
||||
|
||||
for (MbbIndex2MbbMap::iterator
|
||||
@ -241,15 +241,14 @@ exit:
|
||||
|
||||
Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg);
|
||||
if (r2iit != r2iMap_.end()) {
|
||||
unsigned ii = r2iit->second;
|
||||
Interval& interval = intervals_[ii];
|
||||
Interval& interval = *r2iit->second;
|
||||
interval.addRange(start, end);
|
||||
}
|
||||
else {
|
||||
intervals_.push_back(Interval(reg));
|
||||
Interval& interval = intervals_.back();
|
||||
// update interval index for this register
|
||||
r2iMap_[reg] = intervals_.size() - 1;
|
||||
r2iMap_.insert(std::make_pair(reg, --intervals_.end()));
|
||||
interval.addRange(start, end);
|
||||
}
|
||||
}
|
||||
@ -318,7 +317,7 @@ void LiveIntervals::computeIntervals()
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(intervals_.begin(), intervals_.end(), StartPointComp());
|
||||
intervals_.sort(StartPointComp());
|
||||
DEBUG(std::copy(intervals_.begin(), intervals_.end(),
|
||||
std::ostream_iterator<Interval>(std::cerr, "\n")));
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
namespace llvm {
|
||||
@ -83,7 +84,7 @@ namespace llvm {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<Interval> Intervals;
|
||||
typedef std::list<Interval> Intervals;
|
||||
typedef std::vector<MachineBasicBlock*> MachineBasicBlockPtrs;
|
||||
|
||||
private:
|
||||
@ -100,7 +101,7 @@ namespace llvm {
|
||||
typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;
|
||||
Mi2IndexMap mi2iMap_;
|
||||
|
||||
typedef std::map<unsigned, unsigned> Reg2IntervalMap;
|
||||
typedef std::map<unsigned, Intervals::iterator> Reg2IntervalMap;
|
||||
Reg2IntervalMap r2iMap_;
|
||||
|
||||
Intervals intervals_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user