I'm trying to 'lower' an operation that needs to create a node in the SD that is an intrinsic call.... what is the best way to do this? I see in the DAGBuilder it calls 'setValue' which adds to the map NodeMap[V] where V is the key and the passed in SDValue is the value but I'm not sure this is a good way to do it since these are local to SelectionDAGBuilder and the lowering needs to happen in XXXISelLowering.cpp. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160202/5cd67c89/attachment.html>
> On Feb 2, 2016, at 09:29, Ryan Taylor via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I'm trying to 'lower' an operation that needs to create a node in the SD that is an intrinsic call.... what is the best way to do this? > > I see in the DAGBuilder it calls 'setValue' which adds to the map NodeMap[V] where V is the key and the passed in SDValue is the value but I'm not sure this is a good way to do it since these are local to SelectionDAGBuilder and the lowering needs to happen in XXXISelLowering.cpp. > > Thanks. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-devSelectionDAGBuilder creates INTRINSIC_W_CHAIN, INTRINSIC_WO_CHAIN, or INTRINSIC_VOID nodes. You want to emit those with the intrinsic ID as a TargetConstant the first operand (or second with chains). I would recommend though for these cases, if you want to emit emit them in the backend, it’s a bit nicer to lower these to a custom node, and select on that. It’s a bit nicer than having to add the intrinsic ID everywhere. Most of the AMDGPU intrinsics are handled this way. -Matt
Matt, Thanks for the response. Is there an example in the code somewhere of doing the intrinsic ID method? I don't need to put it a lot of places so I'm not sure it warrants adding a node. Thanks. On Tue, Feb 2, 2016 at 12:35 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:> > > On Feb 2, 2016, at 09:29, Ryan Taylor via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > I'm trying to 'lower' an operation that needs to create a node in the SD > that is an intrinsic call.... what is the best way to do this? > > > > I see in the DAGBuilder it calls 'setValue' which adds to the map > NodeMap[V] where V is the key and the passed in SDValue is the value but > I'm not sure this is a good way to do it since these are local to > SelectionDAGBuilder and the lowering needs to happen in XXXISelLowering.cpp. > > > > Thanks. > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > SelectionDAGBuilder creates INTRINSIC_W_CHAIN, INTRINSIC_WO_CHAIN, or > INTRINSIC_VOID nodes. You want to emit those with the intrinsic ID as a > TargetConstant the first operand (or second with chains). I would recommend > though for these cases, if you want to emit emit them in the backend, it’s > a bit nicer to lower these to a custom node, and select on that. It’s a bit > nicer than having to add the intrinsic ID everywhere. Most of the AMDGPU > intrinsics are handled this way. > > -Matt-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160202/50109d1a/attachment.html>