[llvm-commits] [llvm] r121893 - /llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
Jakob Stoklund Olesen
stoklund at 2pi.dk
Wed Dec 15 12:40:23 PST 2010
Author: stoklund
Date: Wed Dec 15 14:40:22 2010
New Revision: 121893
URL: http://llvm.org/viewvc/llvm-project?rev=121893&view=rev
Log:
Add SlotIndexes::getMBBRange() to get the range of a basic block in a single
lookup.
Modified:
llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=121893&r1=121892&r2=121893&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Wed Dec 15 14:40:22 2010
@@ -545,18 +545,22 @@
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.
More information about the llvm-commits
mailing list