[PATCH] D31643: ARMFrameLowering: Reserve emergency spill slot for large arguments

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 11:07:51 PDT 2017


MatzeB added inline comments.


================
Comment at: lib/Target/ARM/ARMFrameLowering.cpp:340
+  // r12?) saved to reach FP.
+  return -AFI.getArgRegsSaveSize() - 12;
+}
----------------
t.p.northover wrote:
> Should this be ArgumentStackSize too? I think ArgRegsSaveSize only accounts for when R0-R3 get pushed on function entry.
No, this is correct, but the getArgumentStackSize() above is an typo (an autocompleto).

The intention here is to capture the displacement between the location the stack pointer pointed to at function begin and the location the frame pointer points to.
The former is used as reference point for the offsets in MachineFrameInfo, the latter is what we actually have in the instructions and encode the immediate values against.

The stack arguments are already part of SP when the functions starts so they are not part of the displacement. It seems the new FP points to wherever the old FP was saved. This means we have to account for stuff before this place:
- Extra space to store register arguments on va_arg functions goes at the beginning.
- Some registers are saved first before saving the old FP. This is usually just LR, but depending on the calling convention may be more, hence this whole strange function giving you a maximum of how many other registers may be saved before.


Repository:
  rL LLVM

https://reviews.llvm.org/D31643





More information about the llvm-commits mailing list