GlobalISel/TableGen: Fix handling of EXTRACT_SUBREG constraints
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 6 Sep 2019 00:05:58 +0000 (00:05 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 6 Sep 2019 00:05:58 +0000 (00:05 +0000)
commit9ceb6edf1145fca5dc43dc486f9129d9b8e01b8e
tree7fe0bfee248028a941abb8db4ae3891e68969006
parent60c8b8bcf232cfb0537f3d6638d8f36c29ef7095
GlobalISel/TableGen: Fix handling of EXTRACT_SUBREG constraints

This was only using the correct register constraints if this was the
final result instruction. If the extract was a sub instruction of the
result, it would attempt to use GIR_ConstrainSelectedInstOperands on a
COPY, which won't work. Move the handling to
createAndImportSubInstructionRenderer so it works correctly.

I don't fully understand why runOnPattern and
createAndImportSubInstructionRenderer both need to handle these
special cases, and constrain them with slightly different methods. If
I remove the runOnPattern handling, it does break the constraint when
the final result instruction is EXTRACT_SUBREG.

llvm-svn: 371150
llvm/test/CodeGen/AArch64/GlobalISel/select-stlxr-intrin.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-stx.mir
llvm/test/TableGen/GlobalISelEmitterSubreg.td
llvm/utils/TableGen/GlobalISelEmitter.cpp