[llvm] [Docs] Improve Target TableGen Docs (PR #178518)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 08:46:40 PST 2026


================
@@ -371,11 +371,32 @@ class SDNode<string opcode, SDTypeProfile typeprof,
   bits<32> TSFlags = 0;
 }
 
-// Special TableGen-recognized dag nodes
+/// Special TableGen-recognized dag nodes
+
+// `set` is used to name outputs of a match pattern. For instance, in:
+//   `(set GPR:$out, (add GPR:$in1, GPR:$in2))`.
+//
+// `set` has to be used for patterns defined directly on Instructions, where the
+// `(outs)` have names which need to match something in the pattern.
+//
+// `set` can also be used for Nodes which create multiple values (though chain
+// and glue do not need to be handled with this, and are handled with node
+// properties). A pattern with multiple outputs might look like:
+//   `(set GPR:$RdLo, GPR:$RdHi, (smullohi GPR:$Rn, GPR:$Rm))`
 def set;
+
+// `node` is used when defining pattern fragments, to represent "holes" in the
+// fragment that should be instantiated with dags when the fragment is used. For
+// instance in the `def fmul_contract` below.
 def node;
+
+// `srcvalue` is used in patterns when an argument of the pattern is not needed
----------------
topperc wrote:

> Is it worth me documenting the history further?

I don't think so.

> 
> It does seem like `ISD::SRCVALUE` is used a lot less than `def srcvalue`, but it's maybe possible to update the `def srcvalue` to `def ignored` or something, and then define `def srcvalue` as the SDNode above. I'm not sure the real value of actually doing both steps, but maybe the first step would add clarity?

I don't think we should add a srcvalue SDNode. We'd need to be able to declare its operand, but I don't think the operand is something we'd want to match in an isel pattern.

I do think giving it a more meaningful name is useful.

https://github.com/llvm/llvm-project/pull/178518


More information about the llvm-commits mailing list