aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/LiveInterval.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-08-22 18:19:46 +0000
committerChris Lattner <sabre@nondot.org>2006-08-22 18:19:46 +0000
commitbe4f88a8b8bb3311e0dc4cde8533763d7923c3ea (patch)
treedbd4225eda79a2d8255d7bbfdc476656d343e9d8 /include/llvm/CodeGen/LiveInterval.h
parentad6f758f8964bb091b5e443220ae3138d781b983 (diff)
Improve the LiveInterval class to keep track of which machine instruction
defines each value# tracked by the interval. This will be used to improve coallescing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/LiveInterval.h')
-rw-r--r--include/llvm/CodeGen/LiveInterval.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index 183cd9abc9..30a397b22f 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -79,6 +79,11 @@ namespace llvm {
Ranges ranges; // the ranges in which this register is live
private:
unsigned NumValues; // the number of distinct values in this interval.
+
+ /// InstDefiningValue - This tracks the def index of the instruction that
+ /// defines a particular value number in the interval. This may be ~0,
+ /// which is treated as unknown.
+ SmallVector<unsigned, 4> InstDefiningValue;
public:
LiveInterval(unsigned Reg, float Weight)
@@ -109,15 +114,31 @@ namespace llvm {
void swap(LiveInterval& other) {
std::swap(reg, other.reg);
std::swap(weight, other.weight);
- ranges.swap(other.ranges);
+ std::swap(ranges, other.ranges);
std::swap(NumValues, other.NumValues);
}
bool containsOneValue() const { return NumValues == 1; }
- unsigned getNextValue() {
+ /// getNextValue - Create a new value number and return it. MIIdx specifies
+ /// the instruction that defines the value number.
+ unsigned getNextValue(unsigned MIIdx) {
+ InstDefiningValue.push_back(MIIdx);
return NumValues++;
}
+
+ /// getInstForValNum - Return the machine instruction index that defines the
+ /// specified value number.
+ unsigned getInstForValNum(unsigned ValNo) const {
+ return InstDefiningValue[ValNo];
+ }
+
+ /// setInstDefiningValNum - Change the instruction defining the specified
+ /// value number to the specified instruction.
+ void setInstDefiningValNum(unsigned ValNo, unsigned MIIdx) {
+ InstDefiningValue[ValNo] = MIIdx;
+ }
+
bool empty() const { return ranges.empty(); }