Overhaul the TwoAddressInstructionPass to simplify the logic, especially
authorBob Wilson <bob.wilson@apple.com>
Thu, 3 Sep 2009 20:58:42 +0000 (20:58 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 3 Sep 2009 20:58:42 +0000 (20:58 +0000)
commitcc80df92c18c125ab31a273f1490ab99eb25f0d1
treec61a0a992de2f1020f7c82228f9ef77f28b48ed2
parent058db9287ab358dc609d0ed47f6027769ea72006
Overhaul the TwoAddressInstructionPass to simplify the logic, especially
for the complicated case where one register is tied to multiple destinations.
This avoids the extra scan of instruction operands that was introduced by
my recent change.  I also pulled some code out into a separate
TryInstructionTransform method, added more comments, and renamed some
variables.

Besides all those changes, this takes care of a FIXME in the code regarding
an assumption about there being a single tied use of a register when
converting to a 3-address form.  I'm not aware of cases where that assumption
is violated, but the code now only attempts to transform an instruction,
either by commuting its operands or by converting to a 3-address form,
for the simple case where there is a single pair of tied operands.

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