[llvm-dev] Invalid number for the given node in SelectionDAG

Ryan Taylor via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 24 07:18:06 PST 2016


Tim,

  Thanks for the reply. I found the merge values function and am trying
that route now.

Thanks.
On Feb 24, 2016 10:16 AM, "Tim Northover" <t.p.northover at gmail.com> wrote:

> Hi Ryan,
>
> On 24 February 2016 at 06:42, Ryan Taylor via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > Seems that it doesn't like returning one value but how do you return more
> > than one value?
>
> You create the node using a getNode call that takes either an
> ArrayRef<EVT> or an SDVTList instead of a single EVT result type. Then
> you almost always need to write C++ code in ISelDAGToDAG to select it
> properly.
>
> Alternatively, you could lower it to multiple instructions (e.g.
> division, multiplication and subtraction) and then recombine them at
> the end with a MERGE_VALUES node as above. Then since each actual
> instruction only has one value, normal TableGen could handle selection
> and the generic infrastructure will take care of the MERGE_VALUES.
>
> > I looked at some other cases, such as arm, and it generates a pair and
> then
> > returns the first of the pair, this does not work for me however.
>
> The pair in the ARM case is unrelated to the pair in the DIVREM
> itself. The second SDValue is the chain that any function call will
> produce for ordering purposes, which isn't needed because no
> load/store/side-effecty things can depend on a DIVREM.
>
> That first SDValue will be a node with two results as I described above.
>
> Cheers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160224/bb9f3858/attachment.html>


More information about the llvm-dev mailing list