Hello, in some operations there is a ty2 type, for example in truncate. What is the most right way to get it ? I have seen some EVT types, but this is connected to DAG... and I don't believe that there is no easy way to get ty2 with one call function. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170718/ecef7e10/attachment.html>
On 18 July 2017 at 03:09, Anastasiya Ruzhanskaya via llvm-dev <llvm-dev at lists.llvm.org> wrote:> in some operations there is a ty2 type, for example in truncate. What is the > most right way to get it ? I have seen some EVT types, but this is connected > to DAG... and I don't believe that there is no easy way to get ty2 with one > call function.For most operations you'll be looking at the type of the SDValue itself or one of its operands. This applies to trunc, where Op.getType() is the destination (small) type of the trunc and Op.getOperand(0).getType() is the source (big) type. The most common exception is sext_inreg nodes. They get created during legalization when it's realized that the source type doesn't have a valid register size; so both source and destination have the same type and there's a separate "this is the type you should extend from" operand. You'd access it with cast<VTSDnode>(Op.getOperand(1))->getVT(). Cheers. Tim.
Thank you for the answer, you helped a lot! 2017-07-18 15:38 GMT+02:00 Tim Northover <t.p.northover at gmail.com>:> On 18 July 2017 at 03:09, Anastasiya Ruzhanskaya via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > in some operations there is a ty2 type, for example in truncate. What is > the > > most right way to get it ? I have seen some EVT types, but this is > connected > > to DAG... and I don't believe that there is no easy way to get ty2 with > one > > call function. > > For most operations you'll be looking at the type of the SDValue > itself or one of its operands. This applies to trunc, where > Op.getType() is the destination (small) type of the trunc and > Op.getOperand(0).getType() is the source (big) type. > > The most common exception is sext_inreg nodes. They get created during > legalization when it's realized that the source type doesn't have a > valid register size; so both source and destination have the same type > and there's a separate "this is the type you should extend from" > operand. You'd access it with > cast<VTSDnode>(Op.getOperand(1))->getVT(). > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170718/387a8825/attachment.html>