[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
Evan Cheng
evan.cheng at apple.com
Thu May 11 00:29:37 PDT 2006
Changes in directory llvm/lib/CodeGen:
LiveIntervalAnalysis.cpp updated: 1.158 -> 1.159
---
Log message:
Set weight of zero length intervals to infinite to prevent them from being
spilled.
---
Diffs of the changes: (+19 -0)
LiveIntervalAnalysis.cpp | 19 +++++++++++++++++++
1 files changed, 19 insertions(+)
Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.158 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.159
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.158 Tue May 9 01:37:47 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Thu May 11 02:29:24 2006
@@ -80,6 +80,15 @@
}
+static bool isZeroLengthInterval(LiveInterval *li) {
+ for (LiveInterval::Ranges::const_iterator
+ i = li->ranges.begin(), e = li->ranges.end(); i != e; ++i)
+ if (i->end - i->start > LiveIntervals::InstrSlots::NUM)
+ return false;
+ return true;
+}
+
+
/// runOnMachineFunction - Register allocate the whole function
///
bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
@@ -199,6 +208,16 @@
}
}
+ for (iterator I = begin(), E = end(); I != E; ++I) {
+ LiveInterval &li = I->second;
+ if (MRegisterInfo::isVirtualRegister(li.reg))
+ // If the live interval legnth is essentially zero, i.e. in every live
+ // range the use follows def immediately, it doesn't make sense to spill
+ // it and hope it will be easier to allocate for this li.
+ if (isZeroLengthInterval(&li))
+ li.weight = float(HUGE_VAL);
+ }
+
DEBUG(dump());
return true;
}
More information about the llvm-commits
mailing list