summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/SlotIndexes.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-28 23:52:31 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-28 23:52:31 +0000
commitb62fbc5e469f532fd1747a3c24115fb1d0ba792f (patch)
tree6385c3a3cfe752fae2cfad1b529f82b8d5fdf166 /include/llvm/CodeGen/SlotIndexes.h
parentc46255a32ec92c427e621b6d7eabd887962ce4a4 (diff)
downloadllvm-b62fbc5e469f532fd1747a3c24115fb1d0ba792f.tar.gz
llvm-b62fbc5e469f532fd1747a3c24115fb1d0ba792f.tar.bz2
llvm-b62fbc5e469f532fd1747a3c24115fb1d0ba792f.tar.xz
Instructions inside a bundle have the same number as the bundle itself.
SlotIndexes are not assigned to instructions inside bundles, but it is still valid to look up the index of those instructions. The reverse getInstructionFromIndex() will return the first instruction in the bundle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SlotIndexes.h')
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index 05daddbcff..6c09526b59 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -493,8 +493,12 @@ namespace llvm {
}
/// Returns the base index for the given instruction.
- SlotIndex getInstructionIndex(const MachineInstr *instr) const {
- Mi2IndexMap::const_iterator itr = mi2iMap.find(instr);
+ SlotIndex getInstructionIndex(const MachineInstr *MI) const {
+ // Instructions inside a bundle have the same number as the bundle itself.
+ MachineBasicBlock::const_instr_iterator I = MI;
+ while (I->isInsideBundle())
+ --I;
+ Mi2IndexMap::const_iterator itr = mi2iMap.find(I);
assert(itr != mi2iMap.end() && "Instruction not found in maps.");
return itr->second;
}