Skip to content

Commit 4f9e110

Browse files
Migrate debug info emission in code modules to the push model (#3104)
This unifies the debug type info emission code to use the "push" model for both code and the final "debug" module.
1 parent 30d9075 commit 4f9e110

File tree

8 files changed

+581
-786
lines changed

8 files changed

+581
-786
lines changed

src/coreclr/jit/llvm.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -784,16 +784,6 @@ CORINFO_GENERIC_HANDLE Llvm::GetExternalMethodAccessor(
784784
m_pEECorInfo, methodHandle, sig, sigLength);
785785
}
786786

787-
CORINFO_LLVM_DEBUG_TYPE_HANDLE Llvm::GetDebugTypeForType(CORINFO_CLASS_HANDLE typeHandle)
788-
{
789-
return CallEEApi<EEAI_GetDebugTypeForType, CORINFO_LLVM_DEBUG_TYPE_HANDLE>(m_pEECorInfo, typeHandle);
790-
}
791-
792-
void Llvm::GetDebugInfoForDebugType(CORINFO_LLVM_DEBUG_TYPE_HANDLE debugTypeHandle, CORINFO_LLVM_TYPE_DEBUG_INFO* pInfo)
793-
{
794-
CallEEApi<EEAI_GetDebugInfoForDebugType, void>(m_pEECorInfo, debugTypeHandle, pInfo);
795-
}
796-
797787
void Llvm::GetDebugInfoForCurrentMethod(CORINFO_LLVM_METHOD_DEBUG_INFO* pInfo)
798788
{
799789
CallEEApi<EEAI_GetDebugInfoForCurrentMethod, void>(m_pEECorInfo, pInfo);
@@ -841,9 +831,12 @@ void Llvm::GetJitTestInfo(CorInfoLlvmJitTestKind kind, CORINFO_LLVM_JIT_TEST_INF
841831
}
842832

843833
static SingleThreadedCompilationContext* StartSingleThreadedCompilation(
844-
const char* path, const char* triple, const char* dataLayout)
834+
CorInfoLlvmSingleThreadedCompilationContextFlags flags,
835+
const char* path,
836+
const char* triple,
837+
const char* dataLayout)
845838
{
846-
SingleThreadedCompilationContext* context = new SingleThreadedCompilationContext(path);
839+
SingleThreadedCompilationContext* context = new SingleThreadedCompilationContext(flags, path);
847840
context->Module.setTargetTriple(triple);
848841
context->Module.setDataLayout(dataLayout);
849842

src/coreclr/jit/llvm.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,22 @@ class TypeDebugInfoModule;
280280
class SingleThreadedCompilationContext
281281
{
282282
public:
283+
CorInfoLlvmSingleThreadedCompilationContextFlags Flags;
283284
LLVMContext Context;
284285
Module Module;
285286
JitHashTable<CORINFO_CLASS_HANDLE, JitPtrKeyFuncs<CORINFO_CLASS_STRUCT_>, Type*, MallocAllocator> LlvmStructTypesMap = {{}};
286287
JitHashTable<CORINFO_CLASS_HANDLE, JitPtrKeyFuncs<CORINFO_CLASS_STRUCT_>, StructDesc*, MallocAllocator> StructDescMap = {{}};
287-
JitHashTable<CORINFO_LLVM_DEBUG_TYPE_HANDLE, JitSmallPrimitiveKeyFuncs<CORINFO_LLVM_DEBUG_TYPE_HANDLE>, llvm::DIType*, MallocAllocator> DebugTypesMap = {{}};
288288
TypeDebugInfoModule* DebugTypes = nullptr;
289289

290-
SingleThreadedCompilationContext(StringRef name) : Module(name, Context)
290+
SingleThreadedCompilationContext(CorInfoLlvmSingleThreadedCompilationContextFlags flags, StringRef name)
291+
: Flags(flags)
292+
, Module(name, Context)
291293
{
292294
}
293295

294296
static CORINFO_LLVM_DEBUG_TYPE_HANDLE EmitDebugTypeInfo(SingleThreadedCompilationContext* context, CORINFO_LLVM_TYPE_DEBUG_INFO* pInfo);
295297
static CORINFO_LLVM_DEBUG_METHOD_DECL_HANDLE EmitDebugMethodDecl(SingleThreadedCompilationContext* context, CORINFO_LLVM_METHOD_DECL_DEBUG_INFO* pInfo);
298+
TypeDebugInfoModule* GetDebugTypes();
296299
void FinishDebugInfo();
297300
};
298301

@@ -422,8 +425,6 @@ class Llvm
422425
const char* GetAlternativeFunctionName();
423426
CORINFO_GENERIC_HANDLE GetExternalMethodAccessor(
424427
CORINFO_METHOD_HANDLE methodHandle, const TargetAbiType* callSiteSig, int sigLength);
425-
CORINFO_LLVM_DEBUG_TYPE_HANDLE GetDebugTypeForType(CORINFO_CLASS_HANDLE typeHandle);
426-
void GetDebugInfoForDebugType(CORINFO_LLVM_DEBUG_TYPE_HANDLE debugTypeHandle, CORINFO_LLVM_TYPE_DEBUG_INFO* pInfo);
427428
void GetDebugInfoForCurrentMethod(CORINFO_LLVM_METHOD_DEBUG_INFO* pInfo);
428429
SingleThreadedCompilationContext* GetSingleThreadedCompilationContext();
429430
CorInfoLlvmEHModel GetExceptionHandlingModel();
@@ -725,7 +726,6 @@ class Llvm
725726
// ================================================================================================================
726727

727728
void initializeDebugInfo();
728-
void initializeDebugInfoBuilder();
729729
void initializeDebugVariables(CORINFO_LLVM_METHOD_DEBUG_INFO* pInfo);
730730

731731
void declareDebugVariables();
@@ -735,8 +735,5 @@ class Llvm
735735
llvm::DILocation* getDebugLocation(unsigned lineNo);
736736
llvm::DILocation* getArtificialDebugLocation();
737737
llvm::DILocation* getCurrentOrArtificialDebugLocation();
738-
739-
llvm::DIType* getOrCreateDebugType(CORINFO_LLVM_DEBUG_TYPE_HANDLE debugTypeHandle);
740-
llvm::DIType* createDebugType(CORINFO_LLVM_DEBUG_TYPE_HANDLE debugTypeHandle);
741738
};
742739
#endif /* End of _LLVM_H_ */

src/coreclr/jit/llvmcodegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void Llvm::Compile()
2828

2929
if (m_diFunction != nullptr)
3030
{
31-
m_diBuilder->finalize();
31+
m_diBuilder->finalizeSubprogram(m_diFunction);
3232
}
3333

3434
generateAuxiliaryArtifacts();

0 commit comments

Comments
 (0)