Petar Avramovic via llvm-dev
2019-Nov-15 14:56 UTC
[llvm-dev] [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
Quentin Colombet via llvm-dev
2019-Nov-19 23:47 UTC
[llvm-dev] [GlobalISel] Importing isel patterns for instructions with LLT pointer operand type from td files
> On Nov 15, 2019, at 6:56 AM, Petar Avramovic via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > 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.> > Regards, > Petar > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev