[llvm-branch-commits] [llvm] [WIP][SPIRV][Debug Info] Add support for emitting DebugFunction debug info instructions (PR #183122)
Marcos Maronas via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Feb 26 05:55:49 PST 2026
================
@@ -373,8 +439,160 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
return true;
}
+// Emits the SPIRV DebugFunction instruction for a given MachineFunction.
+bool SPIRVEmitNonSemanticDI::emitFunctionDI(MachineFunction &MF) {
+ const Function &F = MF.getFunction();
+
+ DISubprogram *SP = F.getSubprogram();
+ // DISubProgram is not available, don't translate
+ if (!SP) {
+ return false;
+ }
+
+ // TODO: Support declarations
+ // Only process function definitions, skip declarations.
+ // Function declarations require an optional operand in the DebugFunction
+ // instruction that is not yet supported.
+ if (!SP->isDefinition()) {
+ return false;
+ }
+
+ // We insert at the first basic block available
+ if (MF.begin() == MF.end()) {
+ return false;
+ }
+
+ // Get the scope from DISubProgram
----------------
maarquitos14 wrote:
```suggestion
// Get the scope from DISubProgram.
```
https://github.com/llvm/llvm-project/pull/183122
More information about the llvm-branch-commits
mailing list