[PATCH] D126088: [RISCV] Add clarifying asserts to getFrameIndexReference [NFC]
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 11:06:02 PDT 2022
reames updated this revision to Diff 431729.
reames added a comment.
Rebase, and drop frame register asserts. I'll move those into a separate commit, but they're slowing down the more useful part of the patch.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126088/new/
https://reviews.llvm.org/D126088
Files:
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
Index: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -664,63 +664,41 @@
Offset +=
StackOffset::getFixed(MFI.getStackSize() + RVFI->getRVVPadding());
} else if (RI->hasStackRealignment(MF) && !MFI.isFixedObjectIndex(FI)) {
+ // |--------------------------| -- <-- FP
+ // | callee-allocated save | | <----|
+ // | area for register varargs| | |
+ // |--------------------------| | |
+ // | callee-saved registers | | |
+ // |--------------------------| -- |
+ // | realignment (the size of | | |
+ // | this area is not counted | | |
+ // | in MFI.getStackSize()) | | |
+ // |--------------------------| -- |
+ // | Padding after RVV | | |
+ // | (not counted in | | |
+ // | MFI.getStackSize()) | | |
+ // |--------------------------| -- |-- MFI.getStackSize()
+ // | RVV objects | | |
+ // | (not counted in | | |
+ // | MFI.getStackSize()) | | |
+ // |--------------------------| -- |
+ // | Padding before RVV | | |
+ // | (not counted in | | |
+ // | MFI.getStackSize()) | | |
+ // |--------------------------| -- |
+ // | scalar local variables | | <----'
+ // |--------------------------| -- <-- BP (if var sized objects present)
+ // | VarSize objects | |
+ // |--------------------------| -- <-- SP
// If the stack was realigned, the frame pointer is set in order to allow
// SP to be restored, so we need another base register to record the stack
// after realignment.
if (hasBP(MF)) {
FrameReg = RISCVABI::getBPReg();
- // |--------------------------| -- <-- FP
- // | callee-allocated save | | <----|
- // | area for register varargs| | |
- // |--------------------------| | |
- // | callee-saved registers | | |
- // |--------------------------| -- |
- // | realignment (the size of | | |
- // | this area is not counted | | |
- // | in MFI.getStackSize()) | | |
- // |--------------------------| -- |
- // | Padding after RVV | | |
- // | (not counted in | | |
- // | MFI.getStackSize()) | | |
- // |--------------------------| -- |-- MFI.getStackSize()
- // | RVV objects | | |
- // | (not counted in | | |
- // | MFI.getStackSize()) | | |
- // |--------------------------| -- |
- // | Padding before RVV | | |
- // | (not counted in | | |
- // | MFI.getStackSize()) | | |
- // |--------------------------| -- |
- // | scalar local variables | | <----'
- // |--------------------------| -- <-- BP
- // | VarSize objects | |
- // |--------------------------| -- <-- SP
} else {
+ // VarSize objects must be empty in this case!
+ assert(!MFI.hasVarSizedObjects());
FrameReg = RISCV::X2;
- // |--------------------------| -- <-- FP
- // | callee-allocated save | | <----|
- // | area for register varargs| | |
- // |--------------------------| | |
- // | callee-saved registers | | |
- // |--------------------------| -- |
- // | realignment (the size of | | |
- // | this area is not counted | | |
- // | in MFI.getStackSize()) | | |
- // |--------------------------| -- |
- // | Padding after RVV | | |
- // | (not counted in | | |
- // | MFI.getStackSize()) | | |
- // |--------------------------| -- |-- MFI.getStackSize()
- // | RVV objects | | |
- // | (not counted in | | |
- // | MFI.getStackSize()) | | |
- // |--------------------------| -- |
- // | Padding before RVV | | |
- // | (not counted in | | |
- // | MFI.getStackSize()) | | |
- // |--------------------------| -- |
- // | scalar local variables | | <----'
- // |--------------------------| -- <-- SP
}
// The total amount of padding surrounding RVV objects is described by
// RVV->getRVVPadding() and it can be zero. It allows us to align the RVV
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126088.431729.patch
Type: text/x-patch
Size: 4644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220524/e73851a4/attachment.bin>
More information about the llvm-commits
mailing list