diff options
author | Devang Patel <dpatel@apple.com> | 2008-02-23 00:35:18 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-02-23 00:35:18 +0000 |
commit | 1a932fc19e92c71efa83f478225b424a7346a05d (patch) | |
tree | f23b0db1085ced0c14bbdf11adaec0bea64a20d2 /lib/VMCore/Verifier.cpp | |
parent | c7666af8ae90f76b7e6de93a492500af3de6b5ed (diff) | |
download | external_llvm-1a932fc19e92c71efa83f478225b424a7346a05d.zip external_llvm-1a932fc19e92c71efa83f478225b424a7346a05d.tar.gz external_llvm-1a932fc19e92c71efa83f478225b424a7346a05d.tar.bz2 |
To support multiple return values, now ret instruction supports multiple operands instead of one aggregate operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 427b95b..1a7100e 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -576,14 +576,22 @@ void Verifier::visitTerminatorInst(TerminatorInst &I) { void Verifier::visitReturnInst(ReturnInst &RI) { Function *F = RI.getParent()->getParent(); - if (RI.getNumOperands() == 0) + unsigned N = RI.getNumOperands(); + if (N == 0) Assert2(F->getReturnType() == Type::VoidTy, "Found return instr that returns void in Function of non-void " "return type!", &RI, F->getReturnType()); - else + else if (N == 1) Assert2(F->getReturnType() == RI.getOperand(0)->getType(), "Function return type does not match operand " "type of return inst!", &RI, F->getReturnType()); + else { + const StructType *STy = cast<StructType>(F->getReturnType()); + for (unsigned i = 0; i < N; i++) + Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(), + "Function return type does not match operand " + "type of return inst!", &RI, F->getReturnType()); + } // Check to make sure that the return value has necessary properties for // terminators... |