Fix swapped BasePtr and Offset in pre-inc memory addresses.
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Fri, 22 Mar 2013 14:58:48 +0000 (14:58 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Fri, 22 Mar 2013 14:58:48 +0000 (14:58 +0000)
commit881a7154b9f9b85f6a8515e282cacdfc9df156cf
tree4e8a40c4c7f5d79e653e5fe6f4b4b8a5ab0b406b
parent0301e79a1af665422f205fd367cdbd8e6164f324
Fix swapped BasePtr and Offset in pre-inc memory addresses.

PPCTargetLowering::getPreIndexedAddressParts currently provides
the base part of a memory address in the offset result, and the
offset part in the base result.  That swap is then undone again
when an MI instruction is generated (in PPCDAGToDAGISel::Select
for loads, and using .md Pat patterns for stores).

This patch reverts this double swap, to make common code and
back-end be in sync as to which part of the address is base
and which is offset.

To avoid performance regressions in certain cases, target code
now checks whether the choice of base register would be rejected
for pre-inc accesses by common code, and attempts to swap base
and offset again in such cases.  (Overall, this means that now
pre-ice accesses are generated *more* frequently than before.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177733 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCInstr64Bit.td
lib/Target/PowerPC/PPCInstrInfo.td