File tree Expand file tree Collapse file tree 5 files changed +38
-9
lines changed Expand file tree Collapse file tree 5 files changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -955,8 +955,8 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
955
955
OutContext),
956
956
MCConstantExpr::create (4 , OutContext), OutContext);
957
957
958
- // Emit the 'bl' .
959
- EmitToStreamer (*OutStreamer, MCInstBuilder (PPC::BL ).addExpr (OffsExpr));
958
+ // Emit 'bcl 20,31,.+4' so the link stack is not corrupted .
959
+ EmitToStreamer (*OutStreamer, MCInstBuilder (PPC::BCLalways ).addExpr (OffsExpr));
960
960
return ;
961
961
}
962
962
case PPC::MovePCtoLR:
@@ -967,9 +967,9 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
967
967
// L1$pb:
968
968
MCSymbol *PICBase = MF->getPICBaseSymbol ();
969
969
970
- // Emit the 'bl' .
970
+ // Emit 'bcl 20,31,.+4' so the link stack is not corrupted .
971
971
EmitToStreamer (*OutStreamer,
972
- MCInstBuilder (PPC::BL )
972
+ MCInstBuilder (PPC::BCLalways )
973
973
// FIXME: We would like an efficient form for this, so we
974
974
// don't have to do a lot of extra uniquing.
975
975
.addExpr (MCSymbolRefExpr::create (PICBase, OutContext)));
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ sw.epilog: ; preds = %sw.bb3, %sw.default
51
51
ret i32 %5
52
52
}
53
53
; CHECK-LABEL: test_jump_table:
54
- ; CHECK-NOT: bl .L0$pb
54
+ ; CHECK-NOT: bcl 20, 31, .L0$pb
55
55
56
56
; CHECK: addis [[REG1:[0-9]+]], 2, .LC[[TOCNUM:[0-9]+]]@toc@ha
57
57
; CHECK: ld [[REG2:[0-9]+]], .LC[[TOCNUM]]@toc@l([[REG1]])
@@ -64,7 +64,7 @@ sw.epilog: ; preds = %sw.bb3, %sw.default
64
64
; CHECK-NEXT: .long .LBB0_{{[0-9]+}}-.LJTI0_0
65
65
66
66
; LARGE-LABEL: test_jump_table:
67
- ; LARGE: bl .L0$pb
67
+ ; LARGE: bcl 20, 31, .L0$pb
68
68
; LARGE-NEXT: .L0$pb:
69
69
; LARGE: mflr [[REGBASE:[0-9]+]]
70
70
Original file line number Diff line number Diff line change
1
+ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2
+ ; RUN: llc < %s -mtriple=powerpc -relocation-model=pic | \
3
+ ; RUN: FileCheck -check-prefixes=SMALL %s
4
+
5
+ @val = global i8 0 , align 1
6
+
7
+ define zeroext i8 @testbcl () nounwind {
8
+ ; SMALL-LABEL: testbcl:
9
+ ; SMALL: # %bb.0: # %entry
10
+ ; SMALL-NEXT: mflr 0
11
+ ; SMALL-NEXT: stwu 1, -16(1)
12
+ ; SMALL-NEXT: stw 30, 8(1)
13
+ ; SMALL-NEXT: stw 0, 20(1)
14
+ ; SMALL-NEXT: bcl 20, 31, .L0$pb
15
+ ; SMALL-NEXT: .L0$pb:
16
+ ; SMALL-NEXT: mflr 30
17
+ ; SMALL-NEXT: lwz 3, .L0$poff-.L0$pb(30)
18
+ ; SMALL-NEXT: add 30, 3, 30
19
+ ; SMALL-NEXT: lwz 3, .LC0-.LTOC(30)
20
+ ; SMALL-NEXT: lbz 3, 0(3)
21
+ ; SMALL-NEXT: lwz 0, 20(1)
22
+ ; SMALL-NEXT: lwz 30, 8(1)
23
+ ; SMALL-NEXT: addi 1, 1, 16
24
+ ; SMALL-NEXT: mtlr 0
25
+ ; SMALL-NEXT: blr
26
+ entry:
27
+ %0 = load i8 , ptr @val , align 1
28
+ ret i8 %0
29
+ }
Original file line number Diff line number Diff line change 55
55
; LARGE-BSS-NEXT: foo:
56
56
; LARGE-BSS: stwu 1, -32(1)
57
57
; LARGE-BSS: stw 30, 24(1)
58
- ; LARGE-BSS: bl [[PB]]
58
+ ; LARGE-BSS: bcl 20, 31, [[PB]]
59
59
; LARGE-BSS-NEXT: [[PB]]:
60
60
; LARGE-BSS: mflr 30
61
61
; LARGE-BSS: lwz [[REG:[0-9]+]], [[POFF]]-[[PB]](30)
Original file line number Diff line number Diff line change 18
18
; SMALL-LABEL: foo:
19
19
; SMALL: stwu 1, -32(1)
20
20
; SMALL: stw 30, 24(1)
21
- ; SMALL-BSS: bl _GLOBAL_OFFSET_TABLE_@local-4
22
- ; SMALL-SECURE: bl .L0$pb
21
+ ; SMALL-BSS: bcl 20, 31, _GLOBAL_OFFSET_TABLE_@local-4
22
+ ; SMALL-SECURE: bcl 20, 31, .L0$pb
23
23
; SMALL: mflr 30
24
24
; SMALL-SECURE: addis 30, 30, _GLOBAL_OFFSET_TABLE_-.L0$pb@ha
25
25
; SMALL-SECURE: addi 30, 30, _GLOBAL_OFFSET_TABLE_-.L0$pb@l
You can’t perform that action at this time.
0 commit comments