aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
diff options
context:
space:
mode:
authorSander de Smalen <sander.desmalen@arm.com>2021-01-06 10:54:41 +0000
committerSander de Smalen <sander.desmalen@arm.com>2021-01-06 11:30:13 +0000
commit84a1120943a651184bae507fed5d648fee381ae4 (patch)
treea97096094563d260ad2541524b9f27de15f37e8a /llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
parent63dce70b794eb99ebbfdeed3ca9aafca2b8fe5c4 (diff)
downloadllvm-84a1120943a651184bae507fed5d648fee381ae4.zip
llvm-84a1120943a651184bae507fed5d648fee381ae4.tar.gz
llvm-84a1120943a651184bae507fed5d648fee381ae4.tar.bz2
[LiveDebugValues] Handle spill locations with a fixed and scalable component.
This patch fixes the two LiveDebugValues implementations (InstrRef/VarLoc)Based to handle cases where the StackOffset contains both a fixed and scalable component. This depends on the `TargetRegisterInfo::prependOffsetExpression` being added in D90020. Feel free to leave comments on that patch if you have them. Reviewed By: djtodoro, jmorse Differential Revision: https://reviews.llvm.org/D90046
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 04ead18..b6f46da 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -182,6 +182,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/TypeSize.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
@@ -221,14 +222,16 @@ namespace {
// an offset.
struct SpillLoc {
unsigned SpillBase;
- int SpillOffset;
+ StackOffset SpillOffset;
bool operator==(const SpillLoc &Other) const {
- return std::tie(SpillBase, SpillOffset) ==
- std::tie(Other.SpillBase, Other.SpillOffset);
+ return std::make_pair(SpillBase, SpillOffset) ==
+ std::make_pair(Other.SpillBase, Other.SpillOffset);
}
bool operator<(const SpillLoc &Other) const {
- return std::tie(SpillBase, SpillOffset) <
- std::tie(Other.SpillBase, Other.SpillOffset);
+ return std::make_tuple(SpillBase, SpillOffset.getFixed(),
+ SpillOffset.getScalable()) <
+ std::make_tuple(Other.SpillBase, Other.SpillOffset.getFixed(),
+ Other.SpillOffset.getScalable());
}
};
@@ -769,8 +772,10 @@ public:
} else if (LocIdxToLocID[*MLoc] >= NumRegs) {
unsigned LocID = LocIdxToLocID[*MLoc];
const SpillLoc &Spill = SpillLocs[LocID - NumRegs + 1];
- Expr = DIExpression::prepend(Expr, DIExpression::ApplyOffset,
- Spill.SpillOffset);
+
+ auto *TRI = MF.getSubtarget().getRegisterInfo();
+ Expr = TRI->prependOffsetExpression(Expr, DIExpression::ApplyOffset,
+ Spill.SpillOffset);
unsigned Base = Spill.SpillBase;
MIB.addReg(Base, RegState::Debug);
MIB.addImm(0);
@@ -1579,9 +1584,7 @@ InstrRefBasedLDV::extractSpillBaseRegAndOffset(const MachineInstr &MI) {
const MachineBasicBlock *MBB = MI.getParent();
Register Reg;
StackOffset Offset = TFI->getFrameIndexReference(*MBB->getParent(), FI, Reg);
- assert(!Offset.getScalable() &&
- "Frame offsets with a scalable component are not supported");
- return {Reg, static_cast<int>(Offset.getFixed())};
+ return {Reg, Offset};
}
/// End all previous ranges related to @MI and start a new range from @MI