[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 12:55:01 PDT 2012


I received some offline comments from Roman.  Here's a new version that
addresses those, as well as fixing a bug encountered with the revised
test cases.  Summary of the changes:

 * The four test cases are merged into one file now.

 * CRSpillFrameIdx was changed from a static variable to a mutable class
variable so that reinitialization for each function can properly occur.

 * Removed bogus early return from spillCalleeSavedRegisters.

 * Minor stylistic clean-ups and commentary.

Thanks,
Bill

On Tue, 2012-09-11 at 09:46 -0500, William J. Schmidt wrote:
> 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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CRsave-2012-09-11.patch
Type: text/x-patch
Size: 20785 bytes
Desc: Revised patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120911/d289ee94/attachment.bin>


More information about the llvm-commits mailing list