Page MenuHomePhabricator

[GlobalISel] Teach GlobalISelEmitter to treat used iPTRAny operands as pointer operands
ClosedPublic

Authored by paquette on Aug 5 2019, 9:47 AM.

Details

Summary

Overloaded intrinsics can use iPTRAny in used/input operands. The GlobalISelEmitter doesn't know that these are pointers, so it treats them as scalars. As a result, these intrinsics can't be imported.

This teaches the GlobalISelEmitter to recognize these as pointers rather than scalars.

Diff Detail

Repository
rL LLVM

Event Timeline

paquette created this revision.Aug 5 2019, 9:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2019, 9:47 AM
arsenm added a subscriber: arsenm.Aug 5 2019, 10:23 AM
arsenm added inline comments.
llvm/test/TableGen/GlobalISelEmitterOverloadedPtr.td
6 ↗(On Diff #213386)

A lot of tests have the same fake target boilerplate. Should these be merged into a template target to include?

llvm/utils/TableGen/GlobalISelEmitter.cpp
3499 ↗(On Diff #213386)

instrinsic

paquette marked an inline comment as done.Aug 5 2019, 11:10 AM
paquette added inline comments.
llvm/test/TableGen/GlobalISelEmitterOverloadedPtr.td
6 ↗(On Diff #213386)

I think that's a good idea, but I'm not quite sure how to get TableGen to do it.

arsenm added inline comments.Aug 5 2019, 11:31 AM
llvm/test/TableGen/GlobalISelEmitterOverloadedPtr.td
6 ↗(On Diff #213386)

I think just an include will work, although I'm not sure where to put it

paquette marked an inline comment as done.Aug 5 2019, 2:00 PM
paquette added inline comments.
llvm/test/TableGen/GlobalISelEmitterOverloadedPtr.td
6 ↗(On Diff #213386)

I managed to get it working locally, but it makes the patch kind of large. I think it would be better to do in a follow-up.

arsenm added inline comments.Aug 5 2019, 9:15 PM
llvm/utils/TableGen/GlobalISelEmitter.cpp
3523 ↗(On Diff #213412)

Why isn't this part of isOperandAPointer?

paquette marked an inline comment as done.Aug 6 2019, 9:28 AM
paquette added inline comments.
llvm/utils/TableGen/GlobalISelEmitter.cpp
3523 ↗(On Diff #213412)

Because to get at II, you need to use Src, which is a TreePatternNode. Since isOperandAPointer is a member function of CodeGenInstruction, it feels better to me personally to keep it concerned with things local to CodeGenInstruction.

Now that I'm looking at it again though, I think it could be moved to CodeGenIntrinsic.

paquette updated this revision to Diff 213659.Aug 6 2019, 10:37 AM

Move the check for iPTRAny into CodeGenIntrinsic.

paquette updated this revision to Diff 214946.Aug 13 2019, 3:22 PM

Rebase changes after rL368757

arsenm accepted this revision.Aug 18 2019, 11:26 AM

LGTM

llvm/utils/TableGen/GlobalISelEmitter.cpp
3486–3487 ↗(On Diff #214946)

startswith G_INTRINSIC?

This revision is now accepted and ready to land.Aug 18 2019, 11:26 AM
This revision was automatically updated to reflect the committed changes.