Skip to content

Commit 75d18d0

Browse files
MacDuesvkeerthy
authored andcommitted
[AArch64][SVE] Share code across SVE prologue/epilogue implementations (NFCI) (#162253)
This patch refactors the SVE prologue and epilogue to use a common code path for both the "Default" and "Split" SVE layouts. This also factors some code into common helpers, such as: - `partitionSVECS()` (which returns the MI ranges of the PPR/ZPR callee-saves) - `getSVEStackFrameSizes()` (which returns the sizes of the PPR/ZPR locals/callee-saves) Since most split-SVE layout code is now shared with the default path, there should be much less code that is only tested when split-SVE is enabled.
1 parent 3a52bd7 commit 75d18d0

File tree

3 files changed

+251
-294
lines changed

3 files changed

+251
-294
lines changed

llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
315315
}
316316

317317
void setStackSizeSVE(uint64_t ZPR, uint64_t PPR) {
318+
assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
319+
"expected SVE stack sizes to be aligned to 16-bytes");
318320
StackSizeZPR = ZPR;
319321
StackSizePPR = PPR;
320322
HasCalculatedStackSizeSVE = true;
@@ -425,6 +427,8 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
425427

426428
// Saves the CalleeSavedStackSize for SVE vectors in 'scalable bytes'
427429
void setSVECalleeSavedStackSize(unsigned ZPR, unsigned PPR) {
430+
assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
431+
"expected SVE callee-save sizes to be aligned to 16-bytes");
428432
ZPRCalleeSavedStackSize = ZPR;
429433
PPRCalleeSavedStackSize = PPR;
430434
HasSVECalleeSavedStackSize = true;

0 commit comments

Comments
 (0)