[llvm] [SPIRV] Emit NonSemantic DebugTypeComposite and DebugTypeMember. (PR #211638)

Manuel Carrasco via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 03:25:55 PDT 2026


================
@@ -891,6 +1027,25 @@ void SPIRVNonSemanticDebugHandler::emitNonSemanticGlobalDebugInfo(
       DebugFunctionDeclarationRegs[SP] = *DeclReg;
   }
 
+  // Emit DebugTypeMember and DebugTypeComposite for each struct, class, or
+  // union. Each member is emitted before the composite that lists it, so the
+  // Members operand references already-defined ids. A member whose type is not
+  // in DebugTypeRegs is skipped.
+  for (const DICompositeType *CT : CompositeTypes) {
+    SmallVector<MCRegister> MemberRegs;
+    for (const DINode *Element : CT->getElements()) {
+      const auto *M = dyn_cast<DIDerivedType>(Element);
+      if (!M || M->getTag() != dwarf::DW_TAG_member)
+        continue;
+      if (auto MemberReg = emitDebugTypeMember(M, VoidTypeReg, I32TypeReg,
+                                               ExtInstSetReg, MAI))
+        MemberRegs.push_back(*MemberReg);
+    }
+    if (auto CompReg = emitDebugTypeComposite(CT, MemberRegs, VoidTypeReg,
----------------
mgcarrasco wrote:

Is the scope of the PR to support composite types that may have as a member another composite type? What about circular references? 

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


More information about the llvm-commits mailing list