summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-10-07 17:36:00 +0000
committerDan Gohman <gohman@apple.com>2009-10-07 17:36:00 +0000
commitdb9493ce6878f65d7abd4d2bf07b04f104bf3732 (patch)
treef839b785c08191472fc6b7c83022bed635299a53 /llvm/lib/CodeGen/MachineVerifier.cpp
parent40fb74484ee6502b1008d0af10034c1cc46a9186 (diff)
downloadbcm5719-llvm-db9493ce6878f65d7abd4d2bf07b04f104bf3732.tar.gz
bcm5719-llvm-db9493ce6878f65d7abd4d2bf07b04f104bf3732.zip
Add a few simple MachineVerifier checks for MachineMemOperands.
llvm-svn: 83474
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index f851dcf8881..18a3ead3bc1 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud