This is an archive of the discontinued LLVM Phabricator instance.

AArch64: count call stack when working out if scavenging is needed
ClosedPublic

Authored by t.p.northover on Jan 27 2023, 5:48 AM.

Details

Reviewers
efriedma
Summary

We try to guess whether we'll need extra registers or slots to handle large stack offsets (bigger than a single [sp, #N] can handle). This calculation needs to take into account stack that's in the caller's frame, either our own args or involved in calls we make.

Bit of a messy test, but it needs to both have lots of args to actually use significant stack, and be opaque enough that it also uses many registers. So the usual [8 x i64] tricks to quickly use args don't work.

Diff Detail

Event Timeline

t.p.northover created this revision.Jan 27 2023, 5:48 AM
t.p.northover requested review of this revision.Jan 27 2023, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 5:48 AM
efriedma added inline comments.
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
3084

To be clear, this is looking at arguments passed on the stack by the caller of this function definition? If we use a frame index to access them, and we don't have a frame pointer, they need to count towards the stack limit, sure.

Referring to this as the "callee's stack" is a bit confusing.

t.p.northover added inline comments.Feb 10 2023, 4:52 AM
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
3084

It is confusing. It's both callee and caller stack space (i.e. used only for args, but might be incoming or outgoing). Regardless, I did word that badly. I'll try to improve it.

Reword comment to avoid confusion.

This revision is now accepted and ready to land.Feb 10 2023, 11:11 AM