]> granicus.if.org Git - llvm/commit
[GlobalISel] Accept multiple vregs in lowerFormalArgs
authorDiana Picus <diana.picus@linaro.org>
Thu, 27 Jun 2019 08:54:17 +0000 (08:54 +0000)
committerDiana Picus <diana.picus@linaro.org>
Thu, 27 Jun 2019 08:54:17 +0000 (08:54 +0000)
commit4776c1ff9754c848bc75c0892b583f67a05211ea
treedbc3b6598844362d68aaf14fd954fe99fd6f8424
parent43a431faf58197a3c54dd9d8e4929d88bfd110c0
[GlobalISel] Accept multiple vregs in lowerFormalArgs

Change the interface of CallLowering::lowerFormalArguments to accept
several virtual registers for each formal argument, instead of just one.
This is a follow-up to D46018.

CallLowering::lowerReturn was similarly refactored in D49660. lowerCall
will be refactored in the same way in follow-up patches.

With this change, we forward the virtual registers generated for
aggregates to CallLowering. Therefore, the target can decide itself
whether it wants to handle them as separate pieces or use one big
register. We also copy the pack/unpackRegs helpers to CallLowering to
facilitate this.

ARM and AArch64 have been updated to use the passed in virtual registers
directly, which means we no longer need to generate so many
merge/extract instructions.

AArch64 seems to have had a bug when lowering e.g. [1 x i8*], which was
put into a s64 instead of a p0. Added a test-case which illustrates the
problem more clearly (it crashes without this patch) and fixed the
existing test-case to expect p0.

AMDGPU has been updated to unpack into the virtual registers for
kernels. I think the other code paths fall back for aggregates, so this
should be NFC.

Mips doesn't support aggregates yet, so it's also NFC.

x86 seems to have code for dealing with aggregates, but I couldn't find
the tests for it, so I just added a fallback to DAGISel if we get more
than one virtual register for an argument.

Differential Revision: https://reviews.llvm.org/D63549

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364510 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
include/llvm/CodeGen/GlobalISel/CallLowering.h
lib/CodeGen/GlobalISel/CallLowering.cpp
lib/CodeGen/GlobalISel/IRTranslator.cpp
lib/Target/AArch64/AArch64CallLowering.cpp
lib/Target/AArch64/AArch64CallLowering.h
lib/Target/AMDGPU/AMDGPUCallLowering.cpp
lib/Target/AMDGPU/AMDGPUCallLowering.h
lib/Target/ARM/ARMCallLowering.cpp
lib/Target/ARM/ARMCallLowering.h
lib/Target/Mips/MipsCallLowering.cpp
lib/Target/Mips/MipsCallLowering.h
lib/Target/X86/X86CallLowering.cpp
lib/Target/X86/X86CallLowering.h
test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
test/CodeGen/AArch64/GlobalISel/call-translator.ll
test/CodeGen/AMDGPU/GlobalISel/irtranslator-amdgpu_kernel.ll
test/CodeGen/ARM/GlobalISel/arm-param-lowering.ll