Add SplitKit API to query and select the current interval being worked on.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 12 Apr 2011 18:11:31 +0000 (18:11 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 12 Apr 2011 18:11:31 +0000 (18:11 +0000)
This makes it possible to target multiple registers in one pass.

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

lib/CodeGen/SplitKit.cpp
lib/CodeGen/SplitKit.h

index 6195ab0f2069e3ffe54df92bd4e932457400dc19..f85d5d358ab3d57be714e6c7b082969092daf40d 100644 (file)
@@ -557,7 +557,7 @@ VNInfo *SplitEditor::defFromParent(unsigned RegIdx,
 }
 
 /// Create a new virtual register and live interval.
-void SplitEditor::openIntv() {
+unsigned SplitEditor::openIntv() {
   assert(!OpenIdx && "Previous LI not closed before openIntv");
 
   // Create the complement as index 0.
@@ -567,6 +567,13 @@ void SplitEditor::openIntv() {
   // Create the open interval.
   OpenIdx = Edit->size();
   Edit->create(LIS, VRM);
+  return OpenIdx;
+}
+
+void SplitEditor::selectIntv(unsigned Idx) {
+  assert(Idx != 0 && "Cannot select the complement interval");
+  assert(Idx < Edit->size() && "Can only select previously opened interval");
+  OpenIdx = Idx;
 }
 
 SlotIndex SplitEditor::enterIntvBefore(SlotIndex Idx) {
index f1ff501fbdd02b695148483c7f232588c811995c..fab56f70d9bac15a3364c78cc0f2350f79fd9674 100644 (file)
@@ -283,7 +283,15 @@ public:
   void reset(LiveRangeEdit&);
 
   /// Create a new virtual register and live interval.
-  void openIntv();
+  /// Return the interval index, starting from 1. Interval index 0 is the
+  /// implicit complement interval.
+  unsigned openIntv();
+
+  /// currentIntv - Return the current interval index.
+  unsigned currentIntv() const { return OpenIdx; }
+
+  /// selectIntv - Select a previously opened interval index.
+  void selectIntv(unsigned Idx);
 
   /// enterIntvBefore - Enter the open interval before the instruction at Idx.
   /// If the parent interval is not live before Idx, a COPY is not inserted.