[llvm-dev] Invalid number for the given node in SelectionDAG
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 24 07:16:31 PST 2016
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.
More information about the llvm-dev
mailing list