================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to