diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-01-09 18:28:16 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2013-01-09 18:28:16 +0000 |
commit | 25377c8c6dafd094f17833f2c37daff0b77a16fc (patch) | |
tree | 16537db7545d72416dd1eefe77ed070120c73e3f /lib/CodeGen | |
parent | d9cc865787d673a8d1021d0b9659fd438feba845 (diff) | |
download | external_llvm-25377c8c6dafd094f17833f2c37daff0b77a16fc.zip external_llvm-25377c8c6dafd094f17833f2c37daff0b77a16fc.tar.gz external_llvm-25377c8c6dafd094f17833f2c37daff0b77a16fc.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index a4d9813..53dbf03 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/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; } |