aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineInstr.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-12 00:10:52 +0000
committerDan Gohman <gohman@apple.com>2008-07-12 00:10:52 +0000
commitcddc11e7570893233af8e84dfb8e7f0f9ab0090d (patch)
tree85c63075a9070e7cd0d818346341fdb13758d1f2 /include/llvm/CodeGen/MachineInstr.h
parente6acf36dca9864c6ead9113f0322f174469810cc (diff)
Add a utility function to MachineInstr for testing whether an instruction
has exactly one MachineMemOperand, and change some X86 lowering code to make use of it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineInstr.h')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 88116d2bb2..31f4974699 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -115,6 +115,13 @@ public:
{ return MemOperands.end(); }
bool memoperands_empty() const { return MemOperands.empty(); }
+ /// hasOneMemOperand - Return true if this instruction has exactly one
+ /// MachineMemOperand.
+ bool hasOneMemOperand() const {
+ return !memoperands_empty() &&
+ next(memoperands_begin()) == memoperands_end();
+ }
+
/// isIdenticalTo - Return true if this instruction is identical to (same
/// opcode and same operands as) the specified instruction.
bool isIdenticalTo(const MachineInstr *Other) const {