llvm.org GIT mirror llvm / 2f256f4
fix operand indexes when outputting InvokeInsts git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103003 91177308-0d34-0410-b5e6-96231b3b80d8 Gabor Greif 10 years ago
1 changed file(s) with 7 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
10811081
10821082 // Before we emit this instruction, we need to take care of generating any
10831083 // forward references. So, we get the names of all the operands in advance
1084 std::string* opNames = new std::string[I->getNumOperands()];
1085 for (unsigned i = 0; i < I->getNumOperands(); i++) {
1084 const unsigned Ops(I->getNumOperands());
1085 std::string* opNames = new std::string[Ops];
1086 for (unsigned i = 0; i < Ops; i++) {
10861087 opNames[i] = getOpName(I->getOperand(i));
10871088 }
10881089
11431144 const InvokeInst* inv = cast(I);
11441145 Out << "std::vector " << iName << "_params;";
11451146 nl(Out);
1146 for (unsigned i = 3; i < inv->getNumOperands(); ++i) {
1147 for (unsigned i = 0; i < inv->getNumOperands() - 3; ++i) {
11471148 Out << iName << "_params.push_back("
11481149 << opNames[i] << ");";
11491150 nl(Out);
11501151 }
11511152 Out << "InvokeInst *" << iName << " = InvokeInst::Create("
1152 << opNames[0] << ", "
1153 << opNames[1] << ", "
1154 << opNames[2] << ", "
1153 << opNames[Ops - 3] << ", "
1154 << opNames[Ops - 2] << ", "
1155 << opNames[Ops - 1] << ", "
11551156 << iName << "_params.begin(), " << iName << "_params.end(), \"";
11561157 printEscapedString(inv->getName());
11571158 Out << "\", " << bbname << ");";