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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 00:08:53 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:

This is usually how it gets used, but I'm not sure it was the original intended usage. There is an ISD::SRCVALUE opcode that holds Value*. I've never looked to see if they are related.

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


More information about the llvm-commits mailing list