llvm.org GIT mirror llvm / 52b488a
Merging r181800: ------------------------------------------------------------------------ r181800 | wschmidt | 2013-05-14 09:08:32 -0700 (Tue, 14 May 2013) | 15 lines PPC32: Fix stack collision between FP and CR save areas. The changes to CR spill handling missed a case for 32-bit PowerPC. The code in PPCFrameLowering::processFunctionBeforeFrameFinalized() checks whether CR spill has occurred using a flag in the function info. This flag is only set by storeRegToStackSlot and loadRegFromStackSlot. spillCalleeSavedRegisters does not call storeRegToStackSlot, but instead produces MI directly. Thus we don't see the CR is spilled when assigning frame offsets, and the CR spill ends up colliding with some other location (generally the FP slot). This patch sets the flag in spillCalleeSavedRegisters for PPC32 so that the CR spill is properly detected and gets its own slot in the stack frame. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@181815 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 9 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
11691169 FuncInfo->addMustSaveCR(Reg);
11701170 } else {
11711171 CRSpilled = true;
1172 FuncInfo->setSpillsCR();
11721173
11731174 // 32-bit: FP-relative. Note that we made sure CR2-CR4 all have
11741175 // the same frame index in PPCRegisterInfo::hasReservedSpillSlot.
1212 ret i32 %1
1313 }
1414
15 ; PPC32: stw 31, -4(1)
16 ; PPC32: stwu 1, -32(1)
1517 ; PPC32: mfcr 12
16 ; PPC32-NEXT: stw 12, {{[0-9]+}}(31)
17 ; PPC32: lwz 12, {{[0-9]+}}(31)
18 ; PPC32-NEXT: stw 12, 24(31)
19 ; PPC32: lwz 12, 24(31)
1820 ; PPC32-NEXT: mtcrf 32, 12
1921
2022 ; PPC64: mfcr 12
3436 ret i32 %1
3537 }
3638
39 ; PPC32: stw 31, -4(1)
40 ; PPC32: stwu 1, -32(1)
3741 ; PPC32: mfcr 12
38 ; PPC32-NEXT: stw 12, {{[0-9]+}}(31)
39 ; PPC32: lwz 12, {{[0-9]+}}(31)
42 ; PPC32-NEXT: stw 12, 24(31)
43 ; PPC32: lwz 12, 24(31)
4044 ; PPC32-NEXT: mtcrf 32, 12
4145 ; PPC32-NEXT: mtcrf 16, 12
4246 ; PPC32-NEXT: mtcrf 8, 12