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
This commit is contained in:
Dan Gohman 2009-10-07 17:36:00 +00:00
parent ff8952e8a9
commit 2dbc4c84f6

View File

@ -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