aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-06-30 08:01:55 +0100
committerGitHub <noreply@github.com>2025-06-30 08:01:55 +0100
commit140e1894f245896752d06a7f5c405a465b492e73 (patch)
treec822251b6651cca627b73698e566ae516ff3e33d /llvm/lib/IR/DIBuilder.cpp
parent629126ed44bd3ce5b6f476459c805be4e4e0c2ca (diff)
downloadllvm-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/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 6001ed4..a542695 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -975,14 +975,14 @@ DISubprogram *DIBuilder::createFunction(
unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
DINode::DIFlags Flags, DISubprogram::DISPFlags SPFlags,
DITemplateParameterArray TParams, DISubprogram *Decl,
- DITypeArray ThrownTypes, DINodeArray Annotations,
- StringRef TargetFuncName) {
+ DITypeArray ThrownTypes, DINodeArray Annotations, StringRef TargetFuncName,
+ bool UseKeyInstructions) {
bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
auto *Node = getSubprogram(
/*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl, nullptr,
- ThrownTypes, Annotations, TargetFuncName);
+ ThrownTypes, Annotations, TargetFuncName, UseKeyInstructions);
AllSubprograms.push_back(Node);
trackIfUnresolved(Node);
@@ -1009,7 +1009,7 @@ DISubprogram *DIBuilder::createMethod(
unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
DIType *VTableHolder, DINode::DIFlags Flags,
DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
- DITypeArray ThrownTypes) {
+ DITypeArray ThrownTypes, bool UseKeyInstructions) {
assert(getNonCompileUnitScope(Context) &&
"Methods should have both a Context and a context that isn't "
"the compile unit.");
@@ -1019,7 +1019,7 @@ DISubprogram *DIBuilder::createMethod(
/*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
- nullptr, ThrownTypes);
+ nullptr, ThrownTypes, nullptr, "", IsDefinition && UseKeyInstructions);
AllSubprograms.push_back(SP);
trackIfUnresolved(SP);