[PATCH] D32280: TableGen: Add support of Intrinsics with multiple returns

Wenbo Sun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 18:24:44 PDT 2017


wenbos added reviewers: ab, stoklund, bogner.
wenbos added a comment.

In https://reviews.llvm.org/D32280#740713, @chenwj wrote:

> @wenbos Could you explain why moving `GetNumNodeResults` up ahead solves the problem?  I see one problem is `Operator` will be changed if it's SubClassOf("Intrinsic"), that might make `GetNumNodeResults` return the wrong result. I don't know if your patch is the right fix, although it works.


@chenwj Here is source code of how intrinsics SDNode for tablegen are defined. Intrinsics are hard-coded to have zero or one output. Check def for `SDTypeProfile`.
In `TargetSelectionDAG.td`:

  // Nodes for intrinsics, you should use the intrinsic itself and let tblgen use
  // these internally.  Don't reference these directly.
  def intrinsic_void : SDNode<"ISD::INTRINSIC_VOID",
                              SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>,
                              [SDNPHasChain]>;
  def intrinsic_w_chain : SDNode<"ISD::INTRINSIC_W_CHAIN",
                                 SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>,
                                 [SDNPHasChain]>;
  def intrinsic_wo_chain : SDNode<"ISD::INTRINSIC_WO_CHAIN",
                                  SDTypeProfile<1, -1, [SDTCisPtrTy<1>]>, []>;


Repository:
  rL LLVM

https://reviews.llvm.org/D32280





More information about the llvm-commits mailing list