This is an archive of the discontinued LLVM Phabricator instance.

[MIPS GlobalISel] Lower pointer arguments
ClosedPublic

Authored by Petar.Avramovic on Jul 17 2018, 5:02 AM.

Details

Summary

Add support for lowering pointer arguments.
Changing type from pointer to integer is already done in MipsTargetLowering::getRegisterTypeForCallingConv.

Diff Detail

Event Timeline

Does anybody have any comment?

atanasyan added inline comments.Jul 24 2018, 2:33 AM
lib/Target/Mips/MipsCallLowering.cpp
189

Maybe a stupid question - why does this function return true for pointer types of any size (32/64) and the only size of integer type (32)?

lib/Target/Mips/MipsCallLowering.cpp
189

As MipsCallLowering class is incomplete, it can only lower i32 and pointer arguments at this moment.
isSupportedType is used for quick exit until we can lower arguments of any type.

atanasyan added inline comments.Jul 24 2018, 3:21 AM
lib/Target/Mips/MipsCallLowering.cpp
189

What happens if we try to generate 64-bit code with 64-bit pointers - will the isSupportedType be called or not?

lib/Target/Mips/MipsCallLowering.cpp
189

In that case isSupportedType will be called, later TLI.getRegisterTypeForCallingConv will change pointer type to appropriate integer type(i64 in this case) and forward it to the calling convention.
However attempt to generate code for MIPS 64 will fail elsewhere as globalisel for MIPS is incomplete. At first, we add code and test for MIPS 32.

atanasyan accepted this revision.Jul 24 2018, 6:22 AM

LGTM

lib/Target/Mips/MipsCallLowering.cpp
189

Thanks for the explanation. I just want to be sure that we cannot silently produce incorrect code.

This revision is now accepted and ready to land.Jul 24 2018, 6:22 AM
This revision was automatically updated to reflect the committed changes.