aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-07-27 23:34:35 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-12-01 12:32:12 +0000
commitfbc266465ed3585efdbd8e9ebf71e97ce7e8b464 (patch)
tree7560c2cbec09e542e5f2e2100ffc16ca742b1075 /contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
parentac8517f04c0fe31968ed43e36608ad02d72d3597 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp b/contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
index 5d3903ed84ce..940aecd1cb36 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp
@@ -62,11 +62,14 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass {
int Align;
int Offset;
SlotType SlotTy;
+ bool Scalable;
SlotData(const MachineFrameInfo &MFI, const int ValOffset, const int Idx)
: Slot(Idx), Size(MFI.getObjectSize(Idx)),
Align(MFI.getObjectAlign(Idx).value()),
- Offset(MFI.getObjectOffset(Idx) - ValOffset), SlotTy(Invalid) {
+ Offset(MFI.getObjectOffset(Idx) - ValOffset), SlotTy(Invalid),
+ Scalable(false) {
+ Scalable = MFI.getStackID(Idx) == TargetStackID::ScalableVector;
if (MFI.isSpillSlotObjectIndex(Idx))
SlotTy = SlotType::Spill;
else if (Idx == MFI.getStackProtectorIndex())
@@ -75,9 +78,12 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass {
SlotTy = SlotType::Variable;
}
- // we use this to sort in reverse order, so that the layout is displayed
- // correctly
- bool operator<(const SlotData &Rhs) const { return Offset > Rhs.Offset; }
+ // We use this to sort in reverse order, so that the layout is displayed
+ // correctly. Scalable slots are sorted to the end of the list.
+ bool operator<(const SlotData &Rhs) const {
+ return std::make_tuple(!Scalable, Offset) >
+ std::make_tuple(!Rhs.Scalable, Rhs.Offset);
+ }
};
StackFrameLayoutAnalysisPass() : MachineFunctionPass(ID) {}
@@ -153,7 +159,7 @@ struct StackFrameLayoutAnalysisPass : public MachineFunctionPass {
Rem << Prefix << ore::NV("Offset", D.Offset)
<< "], Type: " << ore::NV("Type", getTypeString(D.SlotTy))
<< ", Align: " << ore::NV("Align", D.Align)
- << ", Size: " << ore::NV("Size", D.Size);
+ << ", Size: " << ore::NV("Size", ElementCount::get(D.Size, D.Scalable));
}
void emitSourceLocRemark(const MachineFunction &MF, const DILocalVariable *N,