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)
commit0541722de4beb2e53058dbf4ed1ebf0d96ddd6cb
tree0cd62c02de5584198c6fa57d8b5be01ef3dcaf49
parent36ee010b9d2ab6250d9c23d311510fcdcad646c3
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186545 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCFrameLowering.cpp
lib/Target/PowerPC/PPCFrameLowering.h
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCRegisterInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.td
test/CodeGen/PowerPC/sjlj.ll
test/CodeGen/PowerPC/stack-realign.ll