summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorSander de Smalen <sander.desmalen@arm.com>2018-09-05 08:59:50 +0000
committerSander de Smalen <sander.desmalen@arm.com>2018-09-05 08:59:50 +0000
commitc91b27d9ee6e3bc49525532680dd636f1d5a1eed (patch)
tree0e4b8c03217e0279369c309f26d80cd468b82c17 /llvm/lib/CodeGen
parent445bdd171ff4268157256923a1f143ec959d9366 (diff)
downloadbcm5719-llvm-c91b27d9ee6e3bc49525532680dd636f1d5a1eed.tar.gz
bcm5719-llvm-c91b27d9ee6e3bc49525532680dd636f1d5a1eed.zip
Remove FrameAccess struct from hasLoadFromStackSlot
This removes the FrameAccess struct that was added to the interface in D51537, since the PseudoValue from the MachineMemoryOperand can be safely casted to a FixedStackPseudoSourceValue. Reviewers: MatzeB, thegameg, javed.absar Reviewed By: thegameg Differential Revision: https://reviews.llvm.org/D51617 llvm-svn: 341454
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp20
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp8
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp17
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfo.cpp25
4 files changed, 34 insertions, 36 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index c8e564ea939..63c5b262edc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -750,19 +750,21 @@ static bool emitComments(const MachineInstr &MI, raw_ostream &CommentOS,
const MachineFrameInfo &MFI = MF->getFrameInfo();
bool Commented = false;
- auto getSize = [&MFI](
- const SmallVectorImpl<TargetInstrInfo::FrameAccess> &Accesses) {
- unsigned Size = 0;
- for (auto &A : Accesses)
- if (MFI.isSpillSlotObjectIndex(A.FI))
- Size += A.MMO->getSize();
- return Size;
- };
+ auto getSize =
+ [&MFI](const SmallVectorImpl<const MachineMemOperand *> &Accesses) {
+ unsigned Size = 0;
+ for (auto A : Accesses)
+ if (MFI.isSpillSlotObjectIndex(
+ cast<FixedStackPseudoSourceValue>(A->getPseudoValue())
+ ->getFrameIndex()))
+ Size += A->getSize();
+ return Size;
+ };
// We assume a single instruction only has a spill or reload, not
// both.
const MachineMemOperand *MMO;
- SmallVector<TargetInstrInfo::FrameAccess, 2> Accesses;
+ SmallVector<const MachineMemOperand *, 2> Accesses;
if (TII->isLoadFromStackSlotPostFE(MI, FI)) {
if (MFI.isSpillSlotObjectIndex(FI)) {
MMO = *MI.memoperands_begin();
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index 00f587228ef..fa2cb27d9cb 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -470,7 +470,7 @@ bool LiveDebugValues::isSpillInstruction(const MachineInstr &MI,
MachineFunction *MF, unsigned &Reg) {
const MachineFrameInfo &FrameInfo = MF->getFrameInfo();
int FI;
- SmallVector<TargetInstrInfo::FrameAccess, 1> Accesses;
+ SmallVector<const MachineMemOperand*, 1> Accesses;
// TODO: Handle multiple stores folded into one.
if (!MI.hasOneMemOperand())
@@ -480,8 +480,10 @@ bool LiveDebugValues::isSpillInstruction(const MachineInstr &MI,
if (!((TII->isStoreToStackSlotPostFE(MI, FI) &&
FrameInfo.isSpillSlotObjectIndex(FI)) ||
(TII->hasStoreToStackSlot(MI, Accesses) &&
- llvm::any_of(Accesses, [&FrameInfo](TargetInstrInfo::FrameAccess &FA) {
- return FrameInfo.isSpillSlotObjectIndex(FA.FI);
+ llvm::any_of(Accesses, [&FrameInfo](const MachineMemOperand *MMO) {
+ return FrameInfo.isSpillSlotObjectIndex(
+ cast<FixedStackPseudoSourceValue>(MMO->getPseudoValue())
+ ->getFrameIndex());
}))))
return false;
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index d48f37f1ca6..5f1f28ff1ad 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -3120,24 +3120,23 @@ void RAGreedy::reportNumberOfSplillsReloads(MachineLoop *L, unsigned &Reloads,
// Handle blocks that were not included in subloops.
if (Loops->getLoopFor(MBB) == L)
for (MachineInstr &MI : *MBB) {
- SmallVector<TargetInstrInfo::FrameAccess, 2> Accesses;
+ SmallVector<const MachineMemOperand *, 2> Accesses;
+ auto isSpillSlotAccess = [&MFI](const MachineMemOperand *A) {
+ return MFI.isSpillSlotObjectIndex(
+ cast<FixedStackPseudoSourceValue>(A->getPseudoValue())
+ ->getFrameIndex());
+ };
if (TII->isLoadFromStackSlot(MI, FI) && MFI.isSpillSlotObjectIndex(FI))
++Reloads;
else if (TII->hasLoadFromStackSlot(MI, Accesses) &&
- llvm::any_of(Accesses,
- [&MFI](const TargetInstrInfo::FrameAccess &A) {
- return MFI.isSpillSlotObjectIndex(A.FI);
- }))
+ llvm::any_of(Accesses, isSpillSlotAccess))
++FoldedReloads;
else if (TII->isStoreToStackSlot(MI, FI) &&
MFI.isSpillSlotObjectIndex(FI))
++Spills;
else if (TII->hasStoreToStackSlot(MI, Accesses) &&
- llvm::any_of(Accesses,
- [&MFI](const TargetInstrInfo::FrameAccess &A) {
- return MFI.isSpillSlotObjectIndex(A.FI);
- }))
+ llvm::any_of(Accesses, isSpillSlotAccess))
++FoldedSpills;
}
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index 4d9aa830414..2a17af39110 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -340,34 +340,29 @@ bool TargetInstrInfo::PredicateInstruction(
}
bool TargetInstrInfo::hasLoadFromStackSlot(
- const MachineInstr &MI, SmallVectorImpl<FrameAccess> &Accesses) const {
-
+ const MachineInstr &MI,
+ SmallVectorImpl<const MachineMemOperand *> &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()))
- Accesses.emplace_back(*o, Value->getFrameIndex());
- }
+ if ((*o)->isLoad() &&
+ dyn_cast_or_null<FixedStackPseudoSourceValue>((*o)->getPseudoValue()))
+ Accesses.push_back(*o);
}
return Accesses.size() != StartSize;
}
bool TargetInstrInfo::hasStoreToStackSlot(
- const MachineInstr &MI, SmallVectorImpl<FrameAccess> &Accesses) const {
+ const MachineInstr &MI,
+ SmallVectorImpl<const MachineMemOperand *> &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()))
- Accesses.emplace_back(*o, Value->getFrameIndex());
- }
+ if ((*o)->isStore() &&
+ dyn_cast_or_null<FixedStackPseudoSourceValue>((*o)->getPseudoValue()))
+ Accesses.push_back(*o);
}
return Accesses.size() != StartSize;
}
OpenPOWER on IntegriCloud