Skip to content

Commit 5c4d35d

Browse files
ysyedaYusra Syeda
and
Yusra Syeda
authored
[SystemZ][z/OS] Update lowerCall (#68259)
This PR moves some calculation out of `LowerCall` and into `SystemZXPLINKFrameLowering::processFunctionBeforeFrameFinalized`. We need to make this change because LowerCall isn't invoked for functions that don't have function calls, and it is required for some tooling to work correctly. A function that does not make any calls is required to allocate 32 bytes for the parameter area required by the ABI. However, we allocate 64 bytes because this additional space is utilized by certain tools, like the debugger. Co-authored-by: Yusra Syeda <[email protected]>
1 parent 941c75a commit 5c4d35d

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,18 @@ void SystemZXPLINKFrameLowering::processFunctionBeforeFrameFinalized(
14231423

14241424
// Setup stack frame offset
14251425
MFFrame.setOffsetAdjustment(Regs.getStackPointerBias());
1426+
1427+
// Nothing to do for leaf functions.
1428+
uint64_t StackSize = MFFrame.estimateStackSize(MF);
1429+
if (StackSize == 0 && MFFrame.getCalleeSavedInfo().empty())
1430+
return;
1431+
1432+
// Although the XPLINK specifications for AMODE64 state that minimum size
1433+
// of the param area is minimum 32 bytes and no rounding is otherwise
1434+
// specified, we round this area in 64 bytes increments to be compatible
1435+
// with existing compilers.
1436+
MFFrame.setMaxCallFrameSize(
1437+
std::max(64U, (unsigned)alignTo(MFFrame.getMaxCallFrameSize(), 64)));
14261438
}
14271439

14281440
// Determines the size of the frame, and creates the deferred spill objects.

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -1816,13 +1816,6 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
18161816
// Get a count of how many bytes are to be pushed on the stack.
18171817
unsigned NumBytes = ArgCCInfo.getStackSize();
18181818

1819-
if (Subtarget.isTargetXPLINK64())
1820-
// Although the XPLINK specifications for AMODE64 state that minimum size
1821-
// of the param area is minimum 32 bytes and no rounding is otherwise
1822-
// specified, we round this area in 64 bytes increments to be compatible
1823-
// with existing compilers.
1824-
NumBytes = std::max(64U, (unsigned)alignTo(NumBytes, 64));
1825-
18261819
// Mark the start of the call.
18271820
if (!IsTailCall)
18281821
Chain = DAG.getCALLSEQ_START(Chain, NumBytes, 0, DL);

0 commit comments

Comments
 (0)