PPC: Add base-pointer support to builtin setjmp/longjmp
authorHal Finkel <hfinkel@anl.gov>
Wed, 17 Jul 2013 23:50:51 +0000 (23:50 +0000)
committerHal Finkel <hfinkel@anl.gov>
Wed, 17 Jul 2013 23:50:51 +0000 (23:50 +0000)
commitf05d6c784373c30740eda1fb0f1ce5e6790e7f35
tree5ee848324f4c94eaf8fa54535753431a1afcdcfd
parent7ab2c3ecb22ca33bd68a69c0a1b4ac4826a7a0d8
PPC: Add base-pointer support to builtin setjmp/longjmp

First, this changes the base-pointer implementation to remove an unnecessary
complication (and one that is incompatible with how builtin SjLj is
implemented): instead of using r31 as the base pointer when it is not needed as
a frame pointer, now the base pointer will always be r30 when needed.

Second, we introduce another pseudo register, BP, which is used just like the FP
pseudo register to refer to the base register before we know for certain what
register it will be.

Third, we now save BP into the jmp_buf, and restore r30 from that slot in
longjmp.  If the function that called setjmp did not use a base pointer, then
r30 will be overwritten by the setjmp-calling-function's restore code. FP
restoration (which is restored into r31) works the same way.

llvm-svn: 186545
llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
llvm/lib/Target/PowerPC/PPCFrameLowering.h
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.td
llvm/test/CodeGen/PowerPC/sjlj.ll
llvm/test/CodeGen/PowerPC/stack-realign.ll