diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-05-04 09:23:54 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-05-04 09:23:54 +0000 |
commit | 4c0f8386377ad879058b2d1137b9ee4fea030229 (patch) | |
tree | 64003f562dfbf7e0580a1ad8b87a5782ed854fd1 /llvm/lib | |
parent | 075e9b5d668dac1f6dbf7f87035f238dfb5803fb (diff) | |
download | bcm5719-llvm-4c0f8386377ad879058b2d1137b9ee4fea030229.tar.gz bcm5719-llvm-4c0f8386377ad879058b2d1137b9ee4fea030229.zip |
fix operand indexes when outputting InvokeInsts
llvm-svn: 103003
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index 51d9d75fcef..e739b26bc5c 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -1082,8 +1082,9 @@ namespace { // Before we emit this instruction, we need to take care of generating any // forward references. So, we get the names of all the operands in advance - std::string* opNames = new std::string[I->getNumOperands()]; - for (unsigned i = 0; i < I->getNumOperands(); i++) { + const unsigned Ops(I->getNumOperands()); + std::string* opNames = new std::string[Ops]; + for (unsigned i = 0; i < Ops; i++) { opNames[i] = getOpName(I->getOperand(i)); } @@ -1144,15 +1145,15 @@ namespace { const InvokeInst* inv = cast<InvokeInst>(I); Out << "std::vector<Value*> " << iName << "_params;"; nl(Out); - for (unsigned i = 3; i < inv->getNumOperands(); ++i) { + for (unsigned i = 0; i < inv->getNumOperands() - 3; ++i) { Out << iName << "_params.push_back(" << opNames[i] << ");"; nl(Out); } Out << "InvokeInst *" << iName << " = InvokeInst::Create(" - << opNames[0] << ", " - << opNames[1] << ", " - << opNames[2] << ", " + << opNames[Ops - 3] << ", " + << opNames[Ops - 2] << ", " + << opNames[Ops - 1] << ", " << iName << "_params.begin(), " << iName << "_params.end(), \""; printEscapedString(inv->getName()); Out << "\", " << bbname << ");"; |