Skip to content

Commit

Permalink
llpc/dbginfo: streamline flags in DebugFunction
Browse files Browse the repository at this point in the history
DebugFunction is always a function definition, never a function
declaration -- those are represented using DebugFunctionDeclaration.

It's also unclear whether shader entry points should be considered "main
subprograms" or not. First of all, it's unclear what that flag means.
Second, entry points aren't exactly like C/C++ main() -- a better
analogy would be the "main" function of a thread created with
pthread_create or similar. Finally, the current test is simply incorrect
because NonSemantic.Shader.DebugInfo.100 doesn't actually reference the
OpFunction from the DebugFunction instruction.
  • Loading branch information
nhaehnle committed Nov 15, 2023
1 parent c6d8b8c commit 0efb9d7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions llpc/translator/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,11 @@ DINode *SPIRVToLLVMDbgTran::transFunction(const SPIRVExtInst *DebugInst) {

SPIRVWord SPIRVDebugFlags = getConstant(Ops[FlagsIdx]);
DINode::DIFlags Flags = mapToDIFlags(SPIRVDebugFlags);
// TODO: IsDefinition is always true for DebugFunction, but should be false
// for DebugFunctionDeclaration.
const bool IsDefinition = true;

bool IsOptimized = SPIRVDebugFlags & SPIRVDebug::FlagIsOptimized;
bool IsLocal = SPIRVDebugFlags & SPIRVDebug::FlagIsLocal;
bool IsMainSubprogram = BM->getEntryPoint(Ops[FunctionIdIdx]) != nullptr;
DISubprogram::DISPFlags SPFlags =
DISubprogram::toSPFlags(IsLocal, IsDefinition, IsOptimized, DISubprogram::SPFlagNonvirtual, IsMainSubprogram);
DISubprogram::toSPFlags(IsLocal, /*IsDefinition*/ true, IsOptimized, DISubprogram::SPFlagNonvirtual,
/*IsMainSubprogram*/ false);

unsigned ScopeLine = getConstant(Ops[ScopeLineIdx]);

Expand Down

0 comments on commit 0efb9d7

Please sign in to comment.