summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-09 18:28:16 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-09 18:28:16 +0000
commit68d752bf6bf04beaf173e03a74380692757d5380 (patch)
tree6693a6dc0e706e7ba26748f24acf6863e68e7b7b /llvm/lib/CodeGen/MachineInstr.cpp
parent130fcde3e5541a64bcfbf35e2f8a6630a02645ed (diff)
downloadbcm5719-llvm-68d752bf6bf04beaf173e03a74380692757d5380.tar.gz
bcm5719-llvm-68d752bf6bf04beaf173e03a74380692757d5380.zip
Don't require BUNDLE headers in MachineInstr::getBundleSize().
It is possible to build MI bundles that don't begin with a BUNDLE header. Add support for such bundles, counting all instructions inside the bundle. llvm-svn: 171985
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index a4d9813e507..53dbf031633 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -982,18 +982,13 @@ MachineInstr::getRegClassConstraint(unsigned OpIdx,
return NULL;
}
-/// getBundleSize - Return the number of instructions inside the MI bundle.
+/// Return the number of instructions inside the MI bundle, not counting the
+/// header instruction.
unsigned MachineInstr::getBundleSize() const {
- assert(isBundle() && "Expecting a bundle");
-
- const MachineBasicBlock *MBB = getParent();
- MachineBasicBlock::const_instr_iterator I = *this, E = MBB->instr_end();
+ MachineBasicBlock::const_instr_iterator I = this;
unsigned Size = 0;
- while ((++I != E) && I->isInsideBundle()) {
- ++Size;
- }
- assert(Size > 1 && "Malformed bundle");
-
+ while (I->isBundledWithSucc())
+ ++Size, ++I;
return Size;
}
OpenPOWER on IntegriCloud