[llvm-branch-commits] [llvm] [AArch64] Prepare for split ZPR and PPR area allocation (NFCI) (PR #142391)

Sander de Smalen via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 7 09:04:22 PDT 2025


================
@@ -4227,10 +4310,20 @@ static bool getSVECalleeSaveSlotRange(const MachineFrameInfo &MFI,
 // Fills in the first and last callee-saved frame indices into
 // Min/MaxCSFrameIndex, respectively.
 // Returns the size of the stack.
-static int64_t determineSVEStackObjectOffsets(MachineFrameInfo &MFI,
-                                              int &MinCSFrameIndex,
-                                              int &MaxCSFrameIndex,
-                                              bool AssignOffsets) {
+static SVEStackSizes
+determineSVEStackObjectOffsets(MachineFunction &MF, bool AssignOffsets,
+                               bool SplitSVEObjects = false) {
+  MachineFrameInfo &MFI = MF.getFrameInfo();
+
+  int64_t ZPRStack = 0;
+  int64_t PPRStack = 0;
+
+  auto [ZPROffset, PPROffset] = [&] {
+    if (SplitSVEObjects)
+      return std::tie(ZPRStack, PPRStack);
+    return std::tie(ZPRStack, ZPRStack);
+  }();
----------------
sdesmalen-arm wrote:

This seems a lot more readable:
```suggestion
  int64_t &ZPROffset = ZPRStack;                             
  int64_t &PPROffset = SplitSVEObjects ? PPRStack : ZPRStack;
```

Also, can you add a brief comment describing why you create two aliases?

https://github.com/llvm/llvm-project/pull/142391


More information about the llvm-branch-commits mailing list