[PATCH] D114457: [z/OS] Implement prologue and epilogue generation for z/OS target.

Kai Nacke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 13:27:15 PST 2021


Kai added a comment.

Reading the long comment, I guess that there is a systematic error in the calculation of the stack offsets.

First, the diagram looks correct to me. And obviously, the stack grows down.

The local area offset is used to "jump" over the 128 byte GPR save area. According to your description, the semantic of the local area is different, which indicates to me that this field should not be used for this purpose. I guess the different sign of the `LocalAreaOffset` is also the cause for the strange calculation in `getAllocatedStackSize()`.

For the frame reference, the idea seems to be to reach out into the caller's stack frame, as the formula ends up being: `stack bias + stack size of function + jump over GPR save area + object offset". While the offset of incoming arguments is relative to the GPR save area, the fixed spill offsets are relative to stack pointer =

Well, thinking about all this I guess the best way forward is:

- not using the LocalAreaOffset, because it has a different semantic
- get rid of `getAllocatedStackSize()`
- use "incoming SP + stackbias" as base for all stack offset calculations, because that is more obvious




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114457/new/

https://reviews.llvm.org/D114457



More information about the llvm-commits mailing list