summaryrefslogtreecommitdiffstats
path: root/llvm/include
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
commit3a184f903c4dbd134653d49219db9a7be12f211d (patch)
tree25784625d0b692e2ffadd47be27c1943ab0e320d /llvm/include
parent1df4b84db412a72dd43b473d1291baf21fd3f8d1 (diff)
downloadbcm5719-llvm-3a184f903c4dbd134653d49219db9a7be12f211d.tar.gz
bcm5719-llvm-3a184f903c4dbd134653d49219db9a7be12f211d.zip
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. llvm-svn: 151672
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/SlotIndexes.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/SlotIndexes.h b/llvm/include/llvm/CodeGen/SlotIndexes.h
index 05daddbcffb..6c09526b59d 100644
--- a/llvm/include/llvm/CodeGen/SlotIndexes.h
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud