[llvm-commits] [regalloc_linearscan] CVS: llvm/include/llvm/CodeGen/LiveIntervals.h
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed Nov 5 01:28:02 PST 2003
Changes in directory llvm/include/llvm/CodeGen:
LiveIntervals.h updated: 1.1.2.5 -> 1.1.2.6
---
Log message:
Add and expose auxiliary data structures for use with the linear scan
register allocator.
---
Diffs of the changes: (+34 -4)
Index: llvm/include/llvm/CodeGen/LiveIntervals.h
diff -u llvm/include/llvm/CodeGen/LiveIntervals.h:1.1.2.5 llvm/include/llvm/CodeGen/LiveIntervals.h:1.1.2.6
--- llvm/include/llvm/CodeGen/LiveIntervals.h:1.1.2.5 Tue Nov 4 02:04:39 2003
+++ llvm/include/llvm/CodeGen/LiveIntervals.h Wed Nov 5 01:27:17 2003
@@ -43,6 +43,30 @@
}
+ unsigned start() const {
+ assert(!ranges.empty() && "empty interval for register");
+ return ranges.front().first;
+ }
+
+ unsigned end() const {
+ assert(!ranges.empty() && "empty interval for register");
+ return ranges.back().second;
+ }
+
+ bool expired(unsigned index) const {
+ return end() <= index;
+ }
+
+ bool overlaps(unsigned index) const {
+ for (Ranges::const_iterator i = ranges.begin(), e = ranges.end();
+ i != e; ++i) {
+ if (index >= i->first && index < i->second) {
+ return true;
+ }
+ }
+ return false;
+ }
+
void addRange(unsigned start, unsigned end) {
Range range = std::make_pair(start, end);
Ranges::iterator it =
@@ -97,6 +121,8 @@
};
typedef std::vector<Interval> Intervals;
+ typedef std::map<unsigned, MachineBasicBlock*> MiIndex2MbbMap;
+ typedef std::map<MachineBasicBlock*, unsigned> Mbb2MiIndexMap;
private:
MachineFunction* mf_;
@@ -106,20 +132,24 @@
MachineBasicBlock::iterator currentInstr_;
LiveVariables* lv_;
- typedef std::map<unsigned, MachineBasicBlock*> Index2MbbMap;
- Index2MbbMap i2mbbMap_;
+ typedef std::map<unsigned, MachineBasicBlock*> MbbIndex2MbbMap;
+ MbbIndex2MbbMap mbbi2mbbMap_;
typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;
Mi2IndexMap mi2iMap_;
- Intervals intervals_;
-
typedef std::map<unsigned, unsigned> Reg2IntervalMap;
Reg2IntervalMap r2iMap_;
+ Intervals intervals_;
+ MiIndex2MbbMap mii2mbbMap_;
+ Mbb2MiIndexMap mbb2miiMap_;
+
public:
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Intervals& getIntervals() { return intervals_; }
+ MiIndex2MbbMap& getMiIndex2MbbMap() { return mii2mbbMap_; }
+ Mbb2MiIndexMap& getMbb2MiIndexMap() { return mbb2miiMap_; }
private:
/// runOnMachineFunction - pass entry point
More information about the llvm-commits
mailing list