Add Verifier logic for indirectbr.

llvm-svn: 110075
This commit is contained in:
Dan Gohman 2010-08-02 23:08:33 +00:00
parent d8968da2c5
commit d0a1e3de3f
1 changed files with 11 additions and 0 deletions

View File

@ -331,6 +331,7 @@ namespace {
void visitBranchInst(BranchInst &BI);
void visitReturnInst(ReturnInst &RI);
void visitSwitchInst(SwitchInst &SI);
void visitIndirectBrInst(IndirectBrInst &BI);
void visitSelectInst(SelectInst &SI);
void visitUserOp1(Instruction &I);
void visitUserOp2(Instruction &I) { visitUserOp1(I); }
@ -864,6 +865,16 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
visitTerminatorInst(SI);
}
void Verifier::visitIndirectBrInst(IndirectBrInst &BI) {
Assert1(BI.getAddress()->getType()->isPointerTy(),
"Indirectbr operand must have pointer type!", &BI);
for (unsigned i = 0, e = BI.getNumDestinations(); i != e; ++i)
Assert1(BI.getDestination(i)->getType()->isLabelTy(),
"Indirectbr destinations must all have pointer type!", &BI);
visitTerminatorInst(BI);
}
void Verifier::visitSelectInst(SelectInst &SI) {
Assert1(!SelectInst::areInvalidOperands(SI.getOperand(0), SI.getOperand(1),
SI.getOperand(2)),