summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/SlotIndexes.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-03-01 01:26:01 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-03-01 01:26:01 +0000
commit741981adf3a2bc0c6652c9c4ec846250950f3e68 (patch)
treeff48140195f34e487c7ea9178a12a397e04b8c37 /include/llvm/CodeGen/SlotIndexes.h
parentb519a0fe0ee02804cc77cb9c40ded6604341b71c (diff)
downloadllvm-741981adf3a2bc0c6652c9c4ec846250950f3e68.tar.gz
llvm-741981adf3a2bc0c6652c9c4ec846250950f3e68.tar.bz2
llvm-741981adf3a2bc0c6652c9c4ec846250950f3e68.tar.xz
Move getBundleStart() into MachineInstrBundle.h.
This allows the function to be inlined, and makes it suitable for use in getInstructionIndex(). Also provide a const version. C++ is great for touch typing practice. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SlotIndexes.h')
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index 6c09526b59..d868cb8dad 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -19,7 +19,7 @@
#ifndef LLVM_CODEGEN_SLOTINDEXES_H
#define LLVM_CODEGEN_SLOTINDEXES_H
-#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/ADT/PointerIntPair.h"
@@ -495,10 +495,7 @@ namespace llvm {
/// Returns the base index for the given instruction.
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);
+ Mi2IndexMap::const_iterator itr = mi2iMap.find(getBundleStart(MI));
assert(itr != mi2iMap.end() && "Instruction not found in maps.");
return itr->second;
}