diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index efbcc83..6654e1d6 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -2354,29 +2354,35 @@ void MachineInstr::changeDebugValuesDefReg(Register Reg) { using MMOList = SmallVector<const MachineMemOperand *, 2>; -static unsigned getSpillSlotSize(const MMOList &Accesses, - const MachineFrameInfo &MFI) { - unsigned Size = 0; +static LocationSize getSpillSlotSize(const MMOList &Accesses, + const MachineFrameInfo &MFI) { + uint64_t Size = 0; for (const auto *A : Accesses) if (MFI.isSpillSlotObjectIndex( cast<FixedStackPseudoSourceValue>(A->getPseudoValue()) - ->getFrameIndex())) - Size += A->getSize(); + ->getFrameIndex())) { + uint64_t S = A->getSize(); + if (S == ~UINT64_C(0)) + return LocationSize::beforeOrAfterPointer(); + Size += S; + } return Size; } -std::optional<unsigned> +std::optional<LocationSize> MachineInstr::getSpillSize(const TargetInstrInfo *TII) const { int FI; if (TII->isStoreToStackSlotPostFE(*this, FI)) { const MachineFrameInfo &MFI = getMF()->getFrameInfo(); - if (MFI.isSpillSlotObjectIndex(FI)) - return (*memoperands_begin())->getSize(); + if (MFI.isSpillSlotObjectIndex(FI)) { + uint64_t Size = (*memoperands_begin())->getSize(); + return Size == ~UINT64_C(0) ? LocationSize::beforeOrAfterPointer() : Size; + } } return std::nullopt; } -std::optional<unsigned> +std::optional<LocationSize> MachineInstr::getFoldedSpillSize(const TargetInstrInfo *TII) const { MMOList Accesses; if (TII->hasStoreToStackSlot(*this, Accesses)) @@ -2384,18 +2390,20 @@ MachineInstr::getFoldedSpillSize(const TargetInstrInfo *TII) const { return std::nullopt; } -std::optional<unsigned> +std::optional<LocationSize> MachineInstr::getRestoreSize(const TargetInstrInfo *TII) const { int FI; if (TII->isLoadFromStackSlotPostFE(*this, FI)) { const MachineFrameInfo &MFI = getMF()->getFrameInfo(); - if (MFI.isSpillSlotObjectIndex(FI)) - return (*memoperands_begin())->getSize(); + if (MFI.isSpillSlotObjectIndex(FI)) { + uint64_t Size = (*memoperands_begin())->getSize(); + return Size == ~UINT64_C(0) ? LocationSize::beforeOrAfterPointer() : Size; + } } return std::nullopt; } -std::optional<unsigned> +std::optional<LocationSize> MachineInstr::getFoldedRestoreSize(const TargetInstrInfo *TII) const { MMOList Accesses; if (TII->hasLoadFromStackSlot(*this, Accesses)) |