diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-02 23:08:33 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-02 23:08:33 +0000 |
commit | 376809140794cf430c23f1054b9614073eec10b4 (patch) | |
tree | 9e94d619b8aca3362fc6b21f2fe37d6b5a1cbdee | |
parent | a8afb2a623b8644f9460be66d99c073579e23df0 (diff) | |
download | external_llvm-376809140794cf430c23f1054b9614073eec10b4.zip external_llvm-376809140794cf430c23f1054b9614073eec10b4.tar.gz external_llvm-376809140794cf430c23f1054b9614073eec10b4.tar.bz2 |
Add Verifier logic for indirectbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110075 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Verifier.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 49a51ba..ad10459 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -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)), |