[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)
commitd433838adf2aaf4eb750d92a08cd4a9089fa67f2
treece2e1bc27a1cc946daa8ed0322f65cf8640fdce9
parent079aba733a5b03cc8d8a3da0f8969bc4767f48cc
[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.

llvm-svn: 223318
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/test/CodeGen/PowerPC/ia-mem-r0.ll [new file with mode: 0644]