[llvm-commits] [PATCH, RFC] Fix PowerPC calling convention for saving nonvolatile condition register fields

William J. Schmidt wschmidt at linux.vnet.ibm.com
Tue Sep 11 07:46:03 PDT 2012


This patch corrects logic in PPCFrameLowering for save and restore of
nonvolatile condition register fields across calls under the SVR4 ABIs.

 * With the 64-bit ABI, the save location is at a fixed offset of 8 from
the stack pointer.  The frame pointer cannot be used to access this
portion of the stack frame since the distance from the frame pointer may
change with alloca calls.

 * With the 32-bit ABI, the save location is just below the general
register save area, and is accessed via the frame pointer like the rest
of the save areas.  This is an optional slot, so it must only be created
if any of CR2, CR3, and CR4 were modified.

 * For both ABIs, save/restore logic is generated only if one of the
nonvolatile CR fields were modified.

I added tests for both ABIs that demonstrate the code now works
correctly.  The extra call to "foo" in the tests is there to force
creation of a stack frame.

I also took this opportunity to clean up an extra FIXME in
PPCFrameLowering.h.  Save area offsets for 32-bit GPRs are meaningless
for the 64-bit ABI, so I removed them for correctness and efficiency.

I haven't yet requested commit authority, so I would appreciate it if
someone could please commit these changes following the review period.

Thanks!
Bill

-- 
Bill Schmidt, Ph.D.
IBM Advance Toolchain for PowerLinux
IBM Linux Technology Center
wschmidt at us.ibm.com
wschmidt at linux.vnet.ibm.com





-------------- next part --------------
A non-text attachment was scrubbed...
Name: CRsave-2012-09-10.patch
Type: text/x-patch
Size: 21748 bytes
Desc: Fix CR save calling convention
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120911/bf13506a/attachment.bin>


More information about the llvm-commits mailing list