This is an archive of the discontinued LLVM Phabricator instance.

ARMFrameLowering: Reserve emergency spill slot for large arguments
ClosedPublic

Authored by MatzeB on Apr 3 2017, 8:27 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB created this revision.Apr 3 2017, 8:27 PM
MatzeB updated this revision to Diff 93996.Apr 3 2017, 8:30 PM

Rename BigFrameIndexes => BigFrameOffsets

t.p.northover added inline comments.Apr 7 2017, 10:02 AM
lib/Target/ARM/ARMFrameLowering.cpp
340

Should this be ArgumentStackSize too? I think ArgRegsSaveSize only accounts for when R0-R3 get pushed on function entry.

MatzeB added inline comments.Apr 10 2017, 9:51 AM
lib/Target/ARM/ARMFrameLowering.cpp
340

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.
MatzeB updated this revision to Diff 94679.Apr 10 2017, 9:52 AM

Fix getArgRegsSaveSize() vs. getArgumentStackSize() mixup.

t.p.northover accepted this revision.Apr 18 2017, 3:08 PM

OK, sounds reasonable. LGTM.

This revision is now accepted and ready to land.Apr 18 2017, 3:08 PM
This revision was automatically updated to reflect the committed changes.