diff options
author | Sander de Smalen <sander.desmalen@arm.com> | 2018-09-03 09:15:58 +0000 |
---|---|---|
committer | Sander de Smalen <sander.desmalen@arm.com> | 2018-09-03 09:15:58 +0000 |
commit | 6cab60fa068f9127c02246b740aa9b75523a33d2 (patch) | |
tree | 31e2967f372016110cc07a01ee0a4ace3ea626da /llvm/lib/CodeGen/TargetInstrInfo.cpp | |
parent | d96d5e9046b448764587180403c85ec85553ddd6 (diff) | |
download | bcm5719-llvm-6cab60fa068f9127c02246b740aa9b75523a33d2.tar.gz bcm5719-llvm-6cab60fa068f9127c02246b740aa9b75523a33d2.zip |
Extend hasStoreToStackSlot with list of FI accesses.
For instructions that spill/fill to and from multiple frame-indices
in a single instruction, hasStoreToStackSlot and hasLoadFromStackSlot
should return an array of accesses, rather than just the first encounter
of such an access.
This better describes FI accesses for AArch64 (paired) LDP/STP
instructions.
Reviewers: t.p.northover, gberry, thegameg, rengolin, javed.absar, MatzeB
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D51537
llvm-svn: 341301
Diffstat (limited to 'llvm/lib/CodeGen/TargetInstrInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetInstrInfo.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp index 19670c24ae8..4d9aa830414 100644 --- a/llvm/lib/CodeGen/TargetInstrInfo.cpp +++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -339,42 +339,37 @@ bool TargetInstrInfo::PredicateInstruction( return MadeChange; } -bool TargetInstrInfo::hasLoadFromStackSlot(const MachineInstr &MI, - const MachineMemOperand *&MMO, - int &FrameIndex) const { +bool TargetInstrInfo::hasLoadFromStackSlot( + const MachineInstr &MI, SmallVectorImpl<FrameAccess> &Accesses) const { + + size_t StartSize = Accesses.size(); for (MachineInstr::mmo_iterator o = MI.memoperands_begin(), oe = MI.memoperands_end(); o != oe; ++o) { if ((*o)->isLoad()) { if (const FixedStackPseudoSourceValue *Value = dyn_cast_or_null<FixedStackPseudoSourceValue>( - (*o)->getPseudoValue())) { - FrameIndex = Value->getFrameIndex(); - MMO = *o; - return true; - } + (*o)->getPseudoValue())) + Accesses.emplace_back(*o, Value->getFrameIndex()); } } - return false; + return Accesses.size() != StartSize; } -bool TargetInstrInfo::hasStoreToStackSlot(const MachineInstr &MI, - const MachineMemOperand *&MMO, - int &FrameIndex) const { +bool TargetInstrInfo::hasStoreToStackSlot( + const MachineInstr &MI, SmallVectorImpl<FrameAccess> &Accesses) const { + size_t StartSize = Accesses.size(); for (MachineInstr::mmo_iterator o = MI.memoperands_begin(), oe = MI.memoperands_end(); o != oe; ++o) { if ((*o)->isStore()) { if (const FixedStackPseudoSourceValue *Value = dyn_cast_or_null<FixedStackPseudoSourceValue>( - (*o)->getPseudoValue())) { - FrameIndex = Value->getFrameIndex(); - MMO = *o; - return true; - } + (*o)->getPseudoValue())) + Accesses.emplace_back(*o, Value->getFrameIndex()); } } - return false; + return Accesses.size() != StartSize; } bool TargetInstrInfo::getStackSlotRange(const TargetRegisterClass *RC, |