[llvm] [X86] TableGen-erate SDNode descriptions (PR #168421)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 21:05:43 PST 2026


================
@@ -200,77 +250,130 @@ def X86vaargx32 :
                  SDNode<"X86ISD::VAARG_X32", SDT_X86VAARG,
                         [SDNPHasChain, SDNPMayLoad, SDNPMayStore,
                          SDNPMemOperand]>;
+
 def X86callseq_start :
                  SDNode<"ISD::CALLSEQ_START", SDT_X86CallSeqStart,
                         [SDNPHasChain, SDNPOutGlue]>;
 def X86callseq_end :
                  SDNode<"ISD::CALLSEQ_END",   SDT_X86CallSeqEnd,
                         [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
 
+// These operations represent an abstract X86 call
+// instruction, which includes a bunch of information.  In particular the
+// operands of these node are:
+//
+//     #0 - The incoming token chain
+//     #1 - The callee
+//     #2 - The number of arg bytes the caller pushes on the stack.
+//     #3 - The number of arg bytes the callee pops off the stack.
+//     #4 - The value to pass in AL/AX/EAX (optional)
+//     #5 - The value to pass in DL/DX/EDX (optional)
+//
+// The result values of these nodes are:
+//
+//     #0 - The outgoing token chain
+//     #1 - The first register result value (optional)
+//     #2 - The second register result value (optional)
+//
 def X86call    : SDNode<"X86ISD::CALL",     SDT_X86Call,
                         [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue,
                          SDNPVariadic]>;
 
+// Pseudo for a OBJC call that gets emitted together with a special
+// marker instruction.
 def X86call_rvmarker  : SDNode<"X86ISD::CALL_RVMARKER",     SDT_X86Call,
                         [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue,
                          SDNPVariadic]>;
 
+// Psuedo for a call to a global address that must be called via a memory
+// address (i.e., not loaded into a register then called).
 def X86call_globaladdr  : SDNode<"X86ISD::CALL_GLOBALADDR",     SDT_X86Call,
                         [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue,
                          SDNPVariadic]>;
 
+// Pseudo for a call to an imported function to ensure the correct machine
+// instruction is emitted for Import Call Optimization.
 def X86imp_call  : SDNode<"X86ISD::IMP_CALL",     SDT_X86Call,
                         [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue,
                          SDNPVariadic]>;
 
+// Same as call except it adds the NoTrack prefix.
 def X86NoTrackCall : SDNode<"X86ISD::NT_CALL", SDT_X86Call,
                             [SDNPHasChain, SDNPOutGlue, SDNPOptInGlue,
                              SDNPVariadic]>;
+
+// BRIND node with NoTrack prefix. Operand 0 is the chain operand and
+// operand 1 is the target address.
 def X86NoTrackBrind : SDNode<"X86ISD::NT_BRIND", SDT_X86NtBrind,
                              [SDNPHasChain]>;
 
+// Repeat fill, corresponds to X86::REP_STOSx.
 def X86rep_stos: SDNode<"X86ISD::REP_STOS", SDTX86RepStr,
                         [SDNPHasChain, SDNPInGlue, SDNPOutGlue, SDNPMayStore]>;
+
+// Repeat move, corresponds to X86::REP_MOVSx.
 def X86rep_movs: SDNode<"X86ISD::REP_MOVS", SDTX86RepStr,
                         [SDNPHasChain, SDNPInGlue, SDNPOutGlue, SDNPMayStore,
                          SDNPMayLoad]>;
 
+// A wrapper node for TargetConstantPool, TargetJumpTable,
+// TargetExternalSymbol, TargetGlobalAddress, TargetGlobalTLSAddress,
+// MCSymbol and TargetBlockAddress.
 def X86Wrapper    : SDNode<"X86ISD::Wrapper",     SDTX86Wrapper>;
+
+// Special wrapper used under X86-64 PIC mode for RIP
+// relative displacements.
 def X86WrapperRIP : SDNode<"X86ISD::WrapperRIP",  SDTX86Wrapper>;
 
 def X86RecoverFrameAlloc : SDNode<"ISD::LOCAL_RECOVER",
                                   SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>,
                                                        SDTCisInt<1>]>>;
 
+// Thread Local Storage.
 def X86tlsaddr : SDNode<"X86ISD::TLSADDR", SDT_X86TLSADDR,
                         [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
 
+// Thread Local Storage. A call to get the start address
+// of the TLS block for the current module.
 def X86tlsbaseaddr : SDNode<"X86ISD::TLSBASEADDR", SDT_X86TLSBASEADDR,
                         [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
 
+// Thread Local Storage. A descriptor containing pointer to
+// code and to argument to get the TLS offset for the symbol.
 def X86tlsdesc : SDNode<"X86ISD::TLSDESC", SDT_X86TLSADDR,
                         [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
 
+// Exception Handling helpers.
 def X86ehret : SDNode<"X86ISD::EH_RETURN", SDT_X86EHRET,
                         [SDNPHasChain]>;
 
+// SjLj exception handling setjmp.
 def X86eh_sjlj_setjmp  : SDNode<"X86ISD::EH_SJLJ_SETJMP",
                                 SDTypeProfile<1, 1, [SDTCisInt<0>,
                                                      SDTCisPtrTy<1>]>,
                                 [SDNPHasChain, SDNPSideEffect]>;
+
+// SjLj exception handling longjmp.
 def X86eh_sjlj_longjmp : SDNode<"X86ISD::EH_SJLJ_LONGJMP",
                                 SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>,
                                 [SDNPHasChain, SDNPSideEffect]>;
+
+// SjLj exception handling dispatch.
 def X86eh_sjlj_setup_dispatch : SDNode<"X86ISD::EH_SJLJ_SETUP_DISPATCH",
                                        SDTypeProfile<0, 0, []>,
                                        [SDNPHasChain, SDNPSideEffect]>;
 
+// Tail call return. See X86TargetLowering::LowerCall for
+// the list of operands.
 def X86tcret : SDNode<"X86ISD::TC_RETURN", SDT_X86TCRET,
                         [SDNPHasChain,  SDNPOptInGlue, SDNPVariadic]>;
 
+// Psuedo for a tail call return to a global address that must be called via
----------------
topperc wrote:

```suggestion
// Pseudo for a tail call return to a global address that must be called via
```

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


More information about the llvm-commits mailing list