[llvm] [SPIRV] Emit NonSemantic DebugTypeComposite and DebugTypeMember. (PR #211638)
Manuel Carrasco via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 27 01:56:31 PDT 2026
================
@@ -712,6 +751,81 @@ std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugTypeVector(
ExtInstSetReg, {BTIt->second, CountReg}, MAI);
}
+std::optional<MCRegister> SPIRVNonSemanticDebugHandler::emitDebugTypeMember(
+ const DIDerivedType *M, MCRegister VoidTypeReg, MCRegister I32TypeReg,
+ MCRegister ExtInstSetReg, SPIRV::ModuleAnalysisInfo &MAI) {
+ // The member type must already be in DebugTypeRegs.
+ auto TyRegOpt = lookupOptReg(DebugTypeRegs, M->getBaseType());
+ if (!TyRegOpt)
+ return std::nullopt;
+
+ MCRegister NameReg = getCachedOpStringReg(M->getName());
+ MCRegister FileStrReg = getCachedScopePathOpStringReg(
+ M->getFile(), /*UseEmptyPathIfNullScope=*/true);
+ MCRegister SrcReg = getOrEmitDebugSourceForFileStrReg(FileStrReg, VoidTypeReg,
+ ExtInstSetReg, MAI);
+ MCRegister LineReg =
+ emitOpConstantI32(static_cast<uint32_t>(M->getLine()), I32TypeReg, MAI);
+
+ // DIDerivedType members carry no column, so emit 0.
+ MCRegister ColReg = emitOpConstantI32(0, I32TypeReg, MAI);
+ MCRegister OffsetReg = emitOpConstantI32(
+ static_cast<uint32_t>(M->getOffsetInBits()), I32TypeReg, MAI);
+ MCRegister SizeReg = emitOpConstantI32(
+ static_cast<uint32_t>(M->getSizeInBits()), I32TypeReg, MAI);
+ MCRegister FlagsReg = emitOpConstantI32(transDebugFlags(M), I32TypeReg, MAI);
+
+ // NonSemantic DebugTypeMember has no Parent operand: the composite references
+ // its members, not the reverse.
+ //
+ // FIXME: Static members are not handled yet: their constant initializer is
----------------
mgcarrasco wrote:
Thanks
https://github.com/llvm/llvm-project/pull/211638
More information about the llvm-commits
mailing list