Skip to content

Commit 2fb7c36

Browse files
authored
Merge pull request #66371 from al45tair/eng/PR-110260855-5.9
[Backtracing][IRGen] Add a semantic attribute to force frame pointer.
2 parents 73a25ed + bc05ee5 commit 2fb7c36

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/swift/AST/SemanticAttrs.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,8 @@ SEMANTICS_ATTR(NO_PERFORMANCE_ANALYSIS, "no_performance_analysis")
144144
// that may cause the user to think there is a bug in the compiler.
145145
SEMANTICS_ATTR(NO_MOVEONLY_DIAGNOSTICS, "sil.optimizer.moveonly.diagnostic.ignore")
146146

147+
// Force the use of the frame pointer for the specified function
148+
SEMANTICS_ATTR(USE_FRAME_POINTER, "use_frame_pointer")
149+
147150
#undef SEMANTICS_ATTR
148151

lib/IRGen/IRGenSIL.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "swift/AST/IRGenOptions.h"
2222
#include "swift/AST/ParameterList.h"
2323
#include "swift/AST/Pattern.h"
24+
#include "swift/AST/SemanticAttrs.h"
2425
#include "swift/AST/SubstitutionMap.h"
2526
#include "swift/AST/Types.h"
2627
#include "swift/Basic/ExternalUnion.h"
@@ -1867,6 +1868,11 @@ IRGenSILFunction::IRGenSILFunction(IRGenModule &IGM, SILFunction *f)
18671868
}
18681869
}
18691870

1871+
// If we have @_semantics("use_frame_pointer"), force the use of a
1872+
// frame pointer for this function.
1873+
if (f->hasSemanticsAttr(semantics::USE_FRAME_POINTER))
1874+
CurFn->addFnAttr("frame-pointer", "all");
1875+
18701876
// Disable inlining of coroutine functions until we split.
18711877
if (f->getLoweredFunctionType()->isCoroutine()) {
18721878
CurFn->addFnAttr(llvm::Attribute::NoInline);

0 commit comments

Comments
 (0)