summaryrefslogtreecommitdiff
path: root/lib/Target/PIC16/PIC16MemSelOpt.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-05-12 04:30:38 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-05-12 04:30:38 +0000
commited4f4fbfba7d4eb2091480d9c0a4f00feb8af1db (patch)
treeda97463457c1b6c83d390b3e82074ff60da9753f /lib/Target/PIC16/PIC16MemSelOpt.cpp
parent74b0ccc577062a25b8b3ab99b13cd1efa6e3a75a (diff)
downloadllvm-ed4f4fbfba7d4eb2091480d9c0a4f00feb8af1db.tar.gz
llvm-ed4f4fbfba7d4eb2091480d9c0a4f00feb8af1db.tar.bz2
llvm-ed4f4fbfba7d4eb2091480d9c0a4f00feb8af1db.tar.xz
Mark mayLoad, mayStore for insns correctly and use them
to check if an insn is accessing memory during mem sel optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/PIC16MemSelOpt.cpp')
-rw-r--r--lib/Target/PIC16/PIC16MemSelOpt.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Target/PIC16/PIC16MemSelOpt.cpp b/lib/Target/PIC16/PIC16MemSelOpt.cpp
index d433e31fbe..20f926def3 100644
--- a/lib/Target/PIC16/PIC16MemSelOpt.cpp
+++ b/lib/Target/PIC16/PIC16MemSelOpt.cpp
@@ -104,9 +104,13 @@ bool MemSelOpt::processInstruction(MachineInstr *MI) {
bool Changed = false;
unsigned NumOperands = MI->getNumOperands();
- // If this insn has only one operand, probably it is not going to
- // access any data memory.
- if (PIC16InstrInfo::hasNoMemOperand(*MI)) return Changed;
+ if (NumOperands == 0) return false;
+
+
+ // If this insn is not going to access any memory, return.
+ const TargetInstrDesc &TID = TII->get(MI->getOpcode());
+ if (! (TID.isCall() || TID.mayLoad() || TID.mayStore()))
+ return false;
// Scan for the memory address operand.
// FIXME: Should we use standard interfaces like memoperands_iterator,