[PowerPC] Fix inline asm memory operands not to use r0
authorHal Finkel <hfinkel@anl.gov>
Wed, 3 Dec 2014 23:40:13 +0000 (23:40 +0000)
committerHal Finkel <hfinkel@anl.gov>
Wed, 3 Dec 2014 23:40:13 +0000 (23:40 +0000)
commitc48b3bf31875d515aa7bcd26c6182b0ce75777f7
treedb515a56af7b07607be55cb6be310b722f1c93ae
parent331ec379a087568ddbd06df22050d2f9233f638a
[PowerPC] Fix inline asm memory operands not to use r0

On PowerPC, inline asm memory operands might be expanded as 0($r), where $r is
a register containing the address. As a result, this register cannot be r0, and
we need to enforce this register subclass constraint to prevent miscompiling
the code (we'd get this constraint for free with the usual instruction
definitions, but that scheme has no knowledge of how we end up printing inline
asm memory operands, and so here we need to do it 'by hand'). We can accomplish
this within the current address-mode selection framework by introducing an
explicit COPY_TO_REGCLASS node.

Fixes PR21443.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223318 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
test/CodeGen/PowerPC/ia-mem-r0.ll [new file with mode: 0644]