Mips/GlobalISel: Use more standard call lowering infrastructure
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 6 Jul 2021 16:02:07 +0000 (12:02 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 13 Jul 2021 15:04:10 +0000 (11:04 -0400)
commit121541fdcd5c9760ff242451d2b682c45a2a54df
tree4657fa4b91d038ca244b2479d5819359fb83bde3
parent6a3904f16e8e2095082f71e862a33266e10fa871
Mips/GlobalISel: Use more standard call lowering infrastructure

This also fixes some missing implicit uses on call instructions, adds
missing G_ASSERT_SEXT/ZEXT annotations, and some missing outgoing
sext/zexts. This also fixes not respecting tablegen requested type
promotions.

This starts treating f64 passed in i32 GPRs as a type of custom
assignment, which restores some previously XFAILed tests. This is due
to getNumRegistersForCallingConv returns a static value, but in this
case it is context dependent on other arguments.

Most of the ugliness is reproducing a hack CC_MipsO32 uses in
SelectionDAG. CC_MipsO32 depends on a bunch of vectors populated from
the original IR argument types in MipsCCState. The way this ends up
working in GlobalISel is it only ends up inspecting the most recently
added vector element. I'm pretty sure there are cleaner ways to do
this, but this seemed easier than fixing up the current DAG
handling. This is another case where it would be easier of the
CCAssignFns were passed the original type instead of only the
pre-legalized ones.

There's still a lot of junk here that shouldn't be necessary. This
also likely breaks big endian handling, but it wasn't complete/tested
anyway since the IRTranslator gives up on big endian targets.
llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
llvm/lib/Target/ARM/ARMCallLowering.cpp
llvm/lib/Target/Mips/MipsCCState.cpp
llvm/lib/Target/Mips/MipsCCState.h
llvm/lib/Target/Mips/MipsCallLowering.cpp
llvm/lib/Target/Mips/MipsCallLowering.h
llvm/test/CodeGen/Mips/GlobalISel/irtranslator/extend_args.ll
llvm/test/CodeGen/Mips/GlobalISel/irtranslator/float_args.ll
llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/float_args.ll