llvm.org GIT mirror llvm / 77e85a1
Add saving and restoring of r30 to the prologue and epilogue, respectively Summary: The PIC additions didn't update the prologue and epilogue code to save and restore r30 (PIC base register). This does that. Test Plan: Tests updated. Reviewers: hfinkel Reviewed By: hfinkel Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6876 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225450 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Hibbits 5 years ago
4 changed file(s) with 23 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
641641 BuildMI(MBB, MBBI, dl, StoreInst)
642642 .addReg(FPReg)
643643 .addImm(FPOffset)
644 .addReg(SPReg);
645
646 if (isPIC && !isDarwinABI && !isPPC64 &&
647 MF.getInfo()->usesPICBase())
648 // FIXME: On PPC32 SVR4, we must not spill before claiming the stackframe.
649 BuildMI(MBB, MBBI, dl, StoreInst)
650 .addReg(PPC::R30)
651 .addImm(-8U)
644652 .addReg(SPReg);
645653
646654 if (HasBP)
10001008 if (HasFP)
10011009 BuildMI(MBB, MBBI, dl, LoadInst, FPReg)
10021010 .addImm(FPOffset)
1011 .addReg(SPReg);
1012
1013 if (isPIC && !isDarwinABI && !isPPC64 &&
1014 MF.getInfo()->usesPICBase())
1015 // FIXME: On PPC32 SVR4, we must not spill before claiming the stackframe.
1016 BuildMI(MBB, MBBI, dl, LoadInst)
1017 .addReg(PPC::R30)
1018 .addImm(-8U)
10031019 .addReg(SPReg);
10041020
10051021 if (HasBP)
306306 if (M->getPICLevel() == PICLevel::Small) {
307307 BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MoveGOTtoLR));
308308 BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR), GlobalBaseReg);
309 MF->getInfo()->setUsesPICBase(true);
309310 } else {
310311 BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MovePCtoLR));
311312 BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR), GlobalBaseReg);
1111 ; LARGE-BSS: [[POFF:\.L[0-9]+\$poff]]:
1212 ; LARGE-BSS-NEXT: .long .LTOC-[[PB:\.L[0-9]+\$pb]]
1313 ; LARGE-BSS-NEXT: foo:
14 ; LARGE-BSS: stw 30, -8(1)
1415 ; LARGE-BSS: bl [[PB]]
1516 ; LARGE-BSS-NEXT: [[PB]]:
1617 ; LARGE-BSS: mflr 30
1718 ; LARGE-BSS: lwz [[REG:[0-9]+]], [[POFF]]-[[PB]](30)
1819 ; LARGE-BSS-NEXT: add 30, [[REG]], 30
1920 ; LARGE-BSS: lwz [[VREG:[0-9]+]], [[VREF:\.LC[0-9]+]]-.LTOC(30)
20 ; LARGE-BSS: lwz {{[0-9]+}}, 0([[VREG]])
21 ; LARGE-BSS-DAG: lwz {{[0-9]+}}, 0([[VREG]])
22 ; LARGE-BSS-DAG: lwz 30, -8(1)
2123 ; LARGE-BSS: [[VREF]]:
2224 ; LARGE-BSS-NEXT: .long bar
99 !llvm.module.flags = !{!0}
1010 !0 = !{i32 1, !"PIC Level", i32 1}
1111 ; SMALL-BSS-LABEL:foo:
12 ; SMALL-BSS: stw 30, -8(1)
1213 ; SMALL-BSS: bl _GLOBAL_OFFSET_TABLE_@local-4
1314 ; SMALL-BSS: mflr 30
1415 ; SMALL-BSS: lwz [[VREG:[0-9]+]], bar@GOT(30)
15 ; SMALL-BSS: lwz {{[0-9]+}}, 0([[VREG]])
16 ; SMALL-BSS-DAG: lwz {{[0-9]+}}, 0([[VREG]])
17 ; SMALL-BSS-DAG: lwz 30, -8(1)