[PATCH] D17294: Fix for PR 26500

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 05:24:21 PST 2016


nemanjai updated this revision to Diff 48478.
nemanjai added a comment.

Cleaned up the code and added comments to make it a bit more clear as to what is happening. Made sure that we require two registers when we're emitting a prologue for a function that requires two registers.
I can add the following as a comment for findScratchRegister if the reviewers would like (since the semantics of that function are difficult to follow).

Just to enumerate all the possibilities for findScratchRegister:

- When querying whether a block is a valid candidate for the prologue/epilogue
  - The block is in a function where large stack frame realignment is required: we return true only if there are two available registers
  - The block is in a function where large stack frame realignment is not required: we return true if at least one register is available
  - The output parameters are not set in either case
- When requesting the actual scratch registers
  - We need to save the CR and realign a large stack frame:
    - If two registers are available, we'll set both
    - If only one register is available, we'll set both to that one (should be an impossible situation)*
    - If no registers are available, we'll set both to R0 (should be an impossible situation)*
  - We need to save the CR but do not need to realign a large stack frame:
    - If two registers are available, we'll set both
    - If only one is available, we'll set both to that one
    - If no registers are available, we'll set both to R0 (should be an impossible situation)*
  - We do not need to save the CR but need to realign a large stack frame:
    - If two registers are available, we'll set both
    - If only one register is available, we'll set both to that one (should be an impossible situation)*
    - If no registers are available, we'll set both to R0 (should be an impossible situation)*
  - We do not need to save the CR or realign a large stack frame:
    - If R0 is available, we'll set the first scratch register to R0 and the second one will default to R12
    - If two registers are available (other than R0), we'll set both
    - If one register is available, we'll set both to that one
    - If no register is available, we'll set both to R0 (should be an impossible situation)*

*The reason this situation should be impossible is if we have queried the basic block for the right number of available scratch registers, it would have returned true only if they are available. The only way we can get into this situation is if we are trying to insert the prologue/epilogue into a basic block that we have not queried with canUseAsPrologue/canUseAsEpilogue.


Repository:
  rL LLVM

http://reviews.llvm.org/D17294

Files:
  lib/Target/PowerPC/PPCFrameLowering.cpp
  lib/Target/PowerPC/PPCFrameLowering.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17294.48478.patch
Type: text/x-patch
Size: 16075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160219/83301de0/attachment.bin>


More information about the llvm-commits mailing list