[PowerPC][NFC] Small cleanup to restore CR field code in PPCFrameLowering.
authorSean Fertile <sd.fertile@gmail.com>
Thu, 13 Feb 2020 14:22:47 +0000 (09:22 -0500)
committerSean Fertile <sd.fertile@gmail.com>
Thu, 13 Feb 2020 14:50:28 +0000 (09:50 -0500)
commitb2d1e002ca8a16acce7793324cdd155ef003d99f
tree76eac4adefe80235b4bb1af03a223bbdc156819e
parenta41550cff91b7fb2b56bf0e19ccb341bfd3e37b4
[PowerPC][NFC] Small cleanup to restore CR field code in PPCFrameLowering.

Skip the loop over the CalleSavedInfos in 'restoreCalleeSavedRegisters' when
the register is a CR field and we are not targeting 32-bit ELF. This is safe
because:
1) The helper function 'restoreCRs' returns if the target is not 32-bit ELF,
   making all the code in the loop related to CR fields dead for every other
   subtarget. This code is only called on ELF right now, but the patch
   to extend it for AIX also needs to skip 'restoreCRs'.
2) The loop will not otherwise modify the iterator, so the iterator
   manipulations at the bottom of the loop end up setting 'I' to its
   current value.

This simplifciation allows us to remove one argument from 'restoreCRs'.

Also add a helper function to determine if a register is one of the
callee saved condition register fields.
llvm/lib/Target/PowerPC/PPCFrameLowering.cpp