aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-12-04 22:38:46 +0000
committerDavid Greene <greened@obbligato.org>2009-12-04 22:38:46 +0000
commit29dbf50b180bb3342af84ff042a3ff06405c5071 (patch)
tree8287018ad4a6e1c7975ab105341507b19242233d /lib/Target
parent39fdd6947cb800a0db7f7012fe843c98b414602f (diff)
downloadexternal_llvm-29dbf50b180bb3342af84ff042a3ff06405c5071.zip
external_llvm-29dbf50b180bb3342af84ff042a3ff06405c5071.tar.gz
external_llvm-29dbf50b180bb3342af84ff042a3ff06405c5071.tar.bz2
Have hasLoad/StoreFrom/ToStackSlot return the relevant MachineMemOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp11
-rw-r--r--lib/Target/X86/X86InstrInfo.h19
2 files changed, 21 insertions, 9 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index d503da3..7c59054 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -34,6 +34,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include <limits>
+#include <cstring>
using namespace llvm;
@@ -783,12 +784,14 @@ unsigned X86InstrInfo::isLoadFromStackSlotPostFE(const MachineInstr *MI,
if ((Reg = isLoadFromStackSlot(MI, FrameIndex)))
return Reg;
// Check for post-frame index elimination operations
- return hasLoadFromStackSlot(MI, FrameIndex);
+ const MachineMemOperand *Dummy;
+ return hasLoadFromStackSlot(MI, Dummy, FrameIndex);
}
return 0;
}
bool X86InstrInfo::hasLoadFromStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
int &FrameIndex) const {
for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
oe = MI->memoperands_end();
@@ -798,6 +801,7 @@ bool X86InstrInfo::hasLoadFromStackSlot(const MachineInstr *MI,
if (const FixedStackPseudoSourceValue *Value =
dyn_cast<const FixedStackPseudoSourceValue>((*o)->getValue())) {
FrameIndex = Value->getFrameIndex();
+ MMO = *o;
return true;
}
}
@@ -819,12 +823,14 @@ unsigned X86InstrInfo::isStoreToStackSlotPostFE(const MachineInstr *MI,
if ((Reg = isStoreToStackSlot(MI, FrameIndex)))
return Reg;
// Check for post-frame index elimination operations
- return hasStoreToStackSlot(MI, FrameIndex);
+ const MachineMemOperand *Dummy;
+ return hasStoreToStackSlot(MI, Dummy, FrameIndex);
}
return 0;
}
bool X86InstrInfo::hasStoreToStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
int &FrameIndex) const {
for (MachineInstr::mmo_iterator o = MI->memoperands_begin(),
oe = MI->memoperands_end();
@@ -834,6 +840,7 @@ bool X86InstrInfo::hasStoreToStackSlot(const MachineInstr *MI,
if (const FixedStackPseudoSourceValue *Value =
dyn_cast<const FixedStackPseudoSourceValue>((*o)->getValue())) {
FrameIndex = Value->getFrameIndex();
+ MMO = *o;
return true;
}
}
diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h
index c6daa25..a76333d 100644
--- a/lib/Target/X86/X86InstrInfo.h
+++ b/lib/Target/X86/X86InstrInfo.h
@@ -457,11 +457,14 @@ public:
/// hasLoadFromStackSlot - If the specified machine instruction has
/// a load from a stack slot, return true along with the FrameIndex
- /// of the loaded stack slot. If not, return false. Unlike
+ /// of the loaded stack slot and the machine mem operand containing
+ /// the reference. If not, return false. Unlike
/// isLoadFromStackSlot, this returns true for any instructions that
/// loads from the stack. This is a hint only and may not catch all
/// cases.
- bool hasLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const;
+ bool hasLoadFromStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
+ int &FrameIndex) const;
unsigned isStoreToStackSlot(const MachineInstr *MI, int &FrameIndex) const;
/// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
@@ -472,11 +475,13 @@ public:
/// hasStoreToStackSlot - If the specified machine instruction has a
/// store to a stack slot, return true along with the FrameIndex of
- /// the loaded stack slot. If not, return false. Unlike
- /// isStoreToStackSlot, this returns true for any instructions that
- /// loads from the stack. This is a hint only and may not catch all
- /// cases.
- bool hasStoreToStackSlot(const MachineInstr *MI, int &FrameIndex) const;
+ /// the loaded stack slot and the machine mem operand containing the
+ /// reference. If not, return false. Unlike isStoreToStackSlot,
+ /// this returns true for any instructions that loads from the
+ /// stack. This is a hint only and may not catch all cases.
+ bool hasStoreToStackSlot(const MachineInstr *MI,
+ const MachineMemOperand *&MMO,
+ int &FrameIndex) const;
bool isReallyTriviallyReMaterializable(const MachineInstr *MI,
AliasAnalysis *AA) const;