summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-06-23 23:25:37 +0000
committerOwen Anderson <resistor@mac.com>2008-06-23 23:25:37 +0000
commitba3e9de2799a31d7a2ba2fabc16c3abd4ee7c13c (patch)
tree4b61dc5d60a2d38fa84b813b28fa7f51264a895a
parentabd8f41c81b1358ee8e8a5e4d676b77d02d2fbdd (diff)
downloadbcm5719-llvm-ba3e9de2799a31d7a2ba2fabc16c3abd4ee7c13c.tar.gz
bcm5719-llvm-ba3e9de2799a31d7a2ba2fabc16c3abd4ee7c13c.zip
Add getScaledIntervalSize, which gives a measure of the size of an interval that is independent of the scaling of
the function due to empty index slots. This is suitable for use in backend heuristics that need to reason about the density of an interval. llvm-svn: 52652
-rw-r--r--llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h b/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 473cc8e0996..92c3b844c9c 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -169,6 +169,15 @@ namespace llvm {
return MBB2IdxMap[MBBNo].second;
}
+ /// getIntervalSize - get the size of an interval in "units,"
+ /// where every function is composed of one thousand units. This
+ /// measure scales properly with empty index slots in the function.
+ unsigned getScaledIntervalSize(LiveInterval& I) {
+ // Factor of 250 comes from 1000 units per function divided
+ // by four slots per instruction.
+ return (250 * I.getSize()) / i2miMap_.size();
+ }
+
/// getMBBFromIndex - given an index in any instruction of an
/// MBB return a pointer the MBB
MachineBasicBlock* getMBBFromIndex(unsigned index) const {
OpenPOWER on IntegriCloud