[llvm-commits] [llvm] r52652 - /llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h

Owen Anderson resistor at mac.com
Mon Jun 23 16:25:37 PDT 2008


Author: resistor
Date: Mon Jun 23 18:25:37 2008
New Revision: 52652

URL: http://llvm.org/viewvc/llvm-project?rev=52652&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h

Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52652&r1=52651&r2=52652&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Jun 23 18:25:37 2008
@@ -169,6 +169,15 @@
       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 {





More information about the llvm-commits mailing list