File tree Expand file tree Collapse file tree 4 files changed +50
-8
lines changed Expand file tree Collapse file tree 4 files changed +50
-8
lines changed Original file line number Diff line number Diff line change @@ -988,7 +988,7 @@ bool swift::irgen::shouldRemoveTargetFeature(StringRef feature) {
988
988
989
989
void IRGenModule::setHasFramePointer (llvm::AttrBuilder &Attrs,
990
990
bool HasFramePointer) {
991
- Attrs.addAttribute (" frame-pointer" , HasFramePointer ? " all " : " none" );
991
+ Attrs.addAttribute (" frame-pointer" , HasFramePointer ? " non-leaf " : " none" );
992
992
}
993
993
994
994
void IRGenModule::setHasFramePointer (llvm::Function *F,
Original file line number Diff line number Diff line change @@ -32,4 +32,4 @@ public func testCaptureGlobal() {
32
32
}
33
33
34
34
// CHECK-DAG: attributes [[CLANG_FUNC_ATTR]] = { noinline nounwind {{.*}}"frame-pointer"="all"{{.*}}
35
- // CHECK-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="all " {{.*}}"target-cpu"
35
+ // CHECK-DAG: attributes [[SWIFT_FUNC_ATTR]] = { {{.*}}"frame-pointer"="non-leaf " {{.*}}"target-cpu"
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s --check-prefix=CHECK
2
+ // RUN: %target-swift-frontend -primary-file %s -S | %FileCheck %s --check-prefix=CHECKASM --check-prefix=CHECKASM-%target-os-%target-cpu
3
+
4
+ sil_stage canonical
5
+
6
+ import Swift
7
+
8
+ sil @leaf_function_no_frame_pointer : $@convention(thin) (Int32) -> Int32 {
9
+ entry(%i : $Int32):
10
+ return %i : $Int32
11
+ }
12
+
13
+ sil @non_leaf_function_with_frame_pointer : $@convention(thin) (Int32) -> Int32 {
14
+ entry(%i : $Int32):
15
+ %f = function_ref @leaf_function_no_frame_pointer : $@convention(thin) (Int32) -> Int32
16
+ %r = apply %f(%i) : $@convention(thin) (Int32) -> Int32
17
+ return %r : $Int32
18
+ }
19
+
20
+ // CHECK: define{{.*}} swiftcc i32 @leaf_function_no_frame_pointer(i32 %0) [[ATTR:#.*]] {
21
+ // CHECK: entry:
22
+ // CHECK: ret i32 %0
23
+ // CHECK: }
24
+
25
+ // CHECK: define{{.*}} swiftcc i32 @non_leaf_function_with_frame_pointer(i32 %0) [[ATTR]] {
26
+ // CHECK: entry:
27
+ // CHECK: %1 = call swiftcc i32 @leaf_function_no_frame_pointer(i32 %0)
28
+ // CHECK: ret i32 %1
29
+ // CHECK: }
30
+
31
+ // CHECK: attributes [[ATTR]] = {{{.*}}"frame-pointer"="non-leaf"
32
+
33
+ // Silence other os-archs.
34
+ // CHECKASM: {{.*}}
35
+
36
+ // CHECKASM-macosx-x86_64-LABEL: _leaf_function_no_frame_pointer:
37
+ // CHECKASM-macosx-x86_64-NOT: push
38
+ // CHECKASM-macosx-x86_64: movl %edi, %eax
39
+ // CHECKASM-macosx-x86_64-NOT: pop
40
+ // CHECKASM-macosx-x86_64: ret
41
+
42
+
43
+ // CHECKASM-macosx-x86_64-LABEL: _non_leaf_function_with_frame_pointer:
44
+ // CHECKASM-macosx-x86_64: pushq %rbp
45
+ // CHECKASM-macosx-x86_64: movq %rsp, %rbp
46
+ // CHECKASM-macosx-x86_64: callq _leaf_function_no_frame_pointer
47
+ // CHECKASM-macosx-x86_64: popq %rbp
48
+ // CHECKASM-macosx-x86_64: ret
Original file line number Diff line number Diff line change 19
19
20
20
// NO_TBI-LABEL: .globl _testTBI
21
21
// NO_TBI: _testTBI
22
- // NO_TBI-NEXT: stp
23
- // NO_TBI-NEXT: mov
24
22
// NO_TBI-NEXT: and
25
23
// NO_TBI-NEXT: ldr
26
- // NO_TBI-NEXT: ldp
27
24
// NO_TBI-NEXT: ret
28
25
29
26
// TBI-LABEL: .globl _testTBI
30
27
// TBI: _testTBI:
31
- // TBI-NEXT: stp
32
- // TBI-NEXT: mov
33
28
// TBI-NEXT: ldr
34
- // TBI-NEXT: ldp
35
29
// TBI-NEXT: ret
36
30
37
31
sil_stage canonical
You can’t perform that action at this time.
0 commit comments