Add SlotIndexes::getMBBRange() to get the range of a basic block in a single
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 15 Dec 2010 20:40:22 +0000 (20:40 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 15 Dec 2010 20:40:22 +0000 (20:40 +0000)
lookup.

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

include/llvm/CodeGen/SlotIndexes.h

index fd965fc290b5ffe94bcfafb16bad934e7a9959a1..312ce0380fe45356662210600e0fd73849a15b59 100644 (file)
@@ -545,18 +545,22 @@ namespace llvm {
       return nextNonNull;
     }
 
-    /// Returns the first index in the given basic block.
-    SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const {
+    /// Return the (start,end) range of the given basic block.
+    const std::pair<SlotIndex, SlotIndex> &
+    getMBBRange(const MachineBasicBlock *mbb) const {
       MBB2IdxMap::const_iterator itr = mbb2IdxMap.find(mbb);
       assert(itr != mbb2IdxMap.end() && "MBB not found in maps.");
-      return itr->second.first;
+      return itr->second;
+    }
+
+    /// Returns the first index in the given basic block.
+    SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const {
+      return getMBBRange(mbb).first;
     }
 
     /// Returns the last index in the given basic block.
     SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const {
-      MBB2IdxMap::const_iterator itr = mbb2IdxMap.find(mbb);
-      assert(itr != mbb2IdxMap.end() && "MBB not found in maps.");
-      return itr->second.second;
+      return getMBBRange(mbb).second;
     }
 
     /// Returns the basic block which the given index falls in.