diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-07 17:36:00 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-07 17:36:00 +0000 |
commit | 2dbc4c84f6de55deeea6631201c5df943d5327c0 (patch) | |
tree | 67d7c057f6cd8e3d1c40c6e9967a45d1ae493ef4 /lib | |
parent | ff8952e8a9dc01bba9605e90bd3b823d3cf43619 (diff) |
Add a few simple MachineVerifier checks for MachineMemOperands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachineVerifier.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineVerifier.cpp b/lib/CodeGen/MachineVerifier.cpp index f851dcf888..18a3ead3bc 100644 --- a/lib/CodeGen/MachineVerifier.cpp +++ b/lib/CodeGen/MachineVerifier.cpp @@ -27,6 +27,7 @@ #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetMachine.h" @@ -457,6 +458,15 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) { *OS << TI.getNumOperands() << " operands expected, but " << MI->getNumExplicitOperands() << " given.\n"; } + + // Check the MachineMemOperands for basic consistency. + for (MachineInstr::mmo_iterator I = MI->memoperands_begin(), + E = MI->memoperands_end(); I != E; ++I) { + if ((*I)->isLoad() && !TI.mayLoad()) + report("Missing mayLoad flag", MI); + if ((*I)->isStore() && !TI.mayStore()) + report("Missing mayStore flag", MI); + } } void |