Add getScaledIntervalSize, which gives a measure of the size of an interval that...
authorOwen Anderson <resistor@mac.com>
Mon, 23 Jun 2008 23:25:37 +0000 (23:25 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 23 Jun 2008 23:25:37 +0000 (23:25 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52652 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveIntervalAnalysis.h

index 473cc8e099694acd35a1143580b46a2be7b7dd34..92c3b844c9cf53b3e67447da8dd2dd845a106151 100644 (file)
@@ -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 {