diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2025-06-30 08:01:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-30 08:01:55 +0100 |
commit | 140e1894f245896752d06a7f5c405a465b492e73 (patch) | |
tree | c822251b6651cca627b73698e566ae516ff3e33d /llvm/lib/IR/DebugInfoMetadata.cpp | |
parent | 629126ed44bd3ce5b6f476459c805be4e4e0c2ca (diff) | |
download | llvm-140e1894f245896752d06a7f5c405a465b492e73.zip llvm-140e1894f245896752d06a7f5c405a465b492e73.tar.gz llvm-140e1894f245896752d06a7f5c405a465b492e73.tar.bz2 |
[KeyInstr] Add DISubprogram::keyInstructions bit (#144107)
Patch 1/4 adding bitcode support.
Store whether or not a function is using Key Instructions in its DISubprogram so
that we don't need to rely on the -mllvm flag -dwarf-use-key-instructions to
determine whether or not to interpret Key Instructions metadata to decide
is_stmt placement at DWARF emission time. This makes bitcode support simple and
enables well defined mixing of non-key-instructions and key-instructions
functions in an LTO context.
This patch adds the bit (using DISubprogram::SubclassData1).
PR 144104 and 144103 use it during DWARF emission.
PR 44102 adds bitcode
support.
See pull request for overview of alternative attempts.
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 44b0f0d..8bfdb7d 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -1292,11 +1292,12 @@ const char *DICompileUnit::nameTableKindString(DebugNameTableKind NTK) { DISubprogram::DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line, unsigned ScopeLine, unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags, - ArrayRef<Metadata *> Ops) + bool UsesKeyInstructions, ArrayRef<Metadata *> Ops) : DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram, Ops), Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex), ThisAdjustment(ThisAdjustment), Flags(Flags), SPFlags(SPFlags) { static_assert(dwarf::DW_VIRTUALITY_max < 4, "Virtuality out of range"); + SubclassData1 = UsesKeyInstructions; } DISubprogram::DISPFlags DISubprogram::toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, @@ -1395,7 +1396,7 @@ DISubprogram *DISubprogram::getImpl( int ThisAdjustment, DIFlags Flags, DISPFlags SPFlags, Metadata *Unit, Metadata *TemplateParams, Metadata *Declaration, Metadata *RetainedNodes, Metadata *ThrownTypes, Metadata *Annotations, MDString *TargetFuncName, - StorageType Storage, bool ShouldCreate) { + bool UsesKeyInstructions, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); assert(isCanonical(LinkageName) && "Expected canonical MDString"); assert(isCanonical(TargetFuncName) && "Expected canonical MDString"); @@ -1404,7 +1405,7 @@ DISubprogram *DISubprogram::getImpl( ContainingType, VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams, Declaration, RetainedNodes, ThrownTypes, Annotations, - TargetFuncName)); + TargetFuncName, UsesKeyInstructions)); SmallVector<Metadata *, 13> Ops = { File, Scope, Name, LinkageName, Type, Unit, Declaration, RetainedNodes, @@ -1424,10 +1425,10 @@ DISubprogram *DISubprogram::getImpl( } } } - DEFINE_GETIMPL_STORE_N( - DISubprogram, - (Line, ScopeLine, VirtualIndex, ThisAdjustment, Flags, SPFlags), Ops, - Ops.size()); + DEFINE_GETIMPL_STORE_N(DISubprogram, + (Line, ScopeLine, VirtualIndex, ThisAdjustment, Flags, + SPFlags, UsesKeyInstructions), + Ops, Ops.size()); } bool DISubprogram::describes(const Function *F) const { |