Rewrite MachineInstr::addOperand() to avoid NumImplicitOps.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 29 Sep 2011 00:40:51 +0000 (00:40 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 29 Sep 2011 00:40:51 +0000 (00:40 +0000)
commit3627a462938c92c00053a24828b35da5195d0d68
tree71a5f1b55df01fb7c412ecc91f12037b601483bb
parentcaf191289365ba6f551969baf1dad22238820e75
Rewrite MachineInstr::addOperand() to avoid NumImplicitOps.

The function needs to scan the implicit operands anyway, so no
performance is won by caching the number of implicit operands added to
an instruction.

This also fixes a bug when adding operands after an implicit operand has
been added manually.  The NumImplicitOps count wasn't kept up to date.

MachineInstr::addOperand() will now consistently place all explicit
operands before all the implicit operands, regardless of the order they
are added.  It is possible to change an MI opcode and add additional
explicit operands.  They will be inserted before any existing implicit
operands.

The only exception is inline asm instructions where operands are never
reordered.  This is because of a hack that marks explicit clobber regs
on inline asm as <implicit-def> to please the fast register allocator.
This hack can go away when InstrEmitter and FastIsel can add exact
<dead> flags to physreg defs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140744 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineInstr.cpp