[GlobalISel] Importing isel patterns for instructions with LLT pointer operand type from td files

Hi,

In GlobalISel we let pointer G_ICMP and G_SELECT to be legal,
pointer operands get register bank that corresponds to integer type off pointer size during regbankselect,
and we manually select them as if pointer was an integer.

With the help of selectImpl
G_ICMP can be selected into integer compare and
G_SELECT is selected into appropriate instruction based or register bank of operands.
However this does not work for pointer LLT.

On some targets, SDAG converts pointers to appropriate integer type and uses instruction that is defined with integer type in td files.
Thus these instructions can't be imported for pointer type by GlobalISel since there is no such record.

Can/should we add something to td file to avoid manual selection for pointer type for G_ICMP and G_SELECT?
Using G_INTTOPTR/G_PTRTOINT when pointer operands appear in G_ICMP and G_SELECT in irtranslator could also be an option.

Regards,
Petar

Hi,

In GlobalISel we let pointer G_ICMP and G_SELECT to be legal,
pointer operands get register bank that corresponds to integer type off pointer size during regbankselect,
and we manually select them as if pointer was an integer.

With the help of selectImpl
G_ICMP can be selected into integer compare and
G_SELECT is selected into appropriate instruction based or register bank of operands.
However this does not work for pointer LLT.

On some targets, SDAG converts pointers to appropriate integer type and uses instruction that is defined with integer type in td files.
Thus these instructions can't be imported for pointer type by GlobalISel since there is no such record.

Can/should we add something to td file to avoid manual selection for pointer type for G_ICMP and G_SELECT?

That would be nice.

Using G_INTTOPTR/G_PTRTOINT when pointer operands appear in G_ICMP and G_SELECT in irtranslator could also be an option.

I would rather that we teach the importer to accept pointer type as the equivalent of iN in relevant places.