Correct PPC FRAMEADDR lowering using a pseudo-register
authorHal Finkel <hfinkel@anl.gov>
Thu, 21 Mar 2013 19:03:19 +0000 (19:03 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 21 Mar 2013 19:03:19 +0000 (19:03 +0000)
commitaa03c03a2d7a38bc9f1361246c8d91033264b930
treefad42b91ab3495a909a9dc0d64fe89dcb907136e
parentb4dd6c5945db4f5e7b107a3c7f8c481b460dec25
Correct PPC FRAMEADDR lowering using a pseudo-register

The old code used to lower FRAMEADDR tried to replicate the logic in the real
frame-lowering code that determines whether or not the frame pointer (r31) will
be used. When it seemed as through the frame pointer would not be used, the
stack pointer (r1) was used instead. Unfortunately, because the stack size is
not yet known, this does not work. Instead, this change introduces new
always-reserved pseudo-registers (FP and FP8) that are replaced during prologue
insertion with the real frame-pointer register (either r1 or r31).

It is important that this intrinsic always return a valid frame address because
it is used by Clang to store the frame address as part of code generation for
__builtin_setjmp.

llvm-svn: 177653
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/frameaddr.ll [new file with mode: 0644]