[llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h

Chris Lattner lattner at cs.uiuc.edu
Thu Sep 14 20:57:41 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

LiveIntervalAnalysis.h updated: 1.63 -> 1.64
---
Log message:

Keep track of the start of MBB's in a separate map from instructions.  This
is faster and is needed for future improvements.


---
Diffs of the changes:  (+17 -2)

 LiveIntervalAnalysis.h |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.63 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.64
--- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.63	Thu Sep 14 01:42:17 2006
+++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h	Thu Sep 14 22:57:23 2006
@@ -38,6 +38,10 @@
     const TargetInstrInfo* tii_;
     LiveVariables* lv_;
 
+    /// MBB2IdxMap - The index of the first instruction in the specified basic
+    /// block.
+    std::vector<unsigned> MBB2IdxMap;
+    
     typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;
     Mi2IndexMap mi2iMap_;
 
@@ -113,6 +117,17 @@
       return I->second;
     }
 
+    /// getMBBStartIdx - Return the base index of the first instruction in the
+    /// specified MachineBasicBlock.
+    unsigned getMBBStartIdx(MachineBasicBlock *MBB) const {
+      return getMBBStartIdx(MBB->getNumber());
+    }
+    
+    unsigned getMBBStartIdx(unsigned MBBNo) const {
+      assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!");
+      return MBB2IdxMap[MBBNo];
+    }
+
     /// getInstructionIndex - returns the base index of instr
     unsigned getInstructionIndex(MachineInstr* instr) const {
       Mi2IndexMap::const_iterator it = mi2iMap_.find(instr);
@@ -128,7 +143,7 @@
              "index does not correspond to an instruction");
       return i2miMap_[index];
     }
-
+    
     std::vector<LiveInterval*> addIntervalsForSpills(const LiveInterval& i,
                                                      VirtRegMap& vrm,
                                                      int slot);
@@ -155,7 +170,7 @@
       }
     }
       
-    /// computeIntervals - compute live intervals
+    /// computeIntervals - Compute live intervals.
     void computeIntervals();
 
     /// joinIntervals - join compatible live intervals






More information about the llvm-commits mailing list