diff options
author | Eric Christopher <echristo@apple.com> | 2010-04-16 23:37:20 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2010-04-16 23:37:20 +0000 |
commit | 7258dcd77f19bf5adb5f76d4c2bb5fc426ba75c2 (patch) | |
tree | c2f3cc1957d7ba72772b73e9f98ca4d55ab5cfdf /llvm/lib/Target/CppBackend/CPPBackend.cpp | |
parent | 4ebae65d6af71115de86273e6b27f67e2cde2be7 (diff) | |
download | llvm-7258dcd77f19bf5adb5f76d4c2bb5fc426ba75c2.zip llvm-7258dcd77f19bf5adb5f76d4c2bb5fc426ba75c2.tar.gz llvm-7258dcd77f19bf5adb5f76d4c2bb5fc426ba75c2.tar.bz2 |
Revert 101465, it broke internal OpenGL testing.
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.
llvm-svn: 101579
Diffstat (limited to 'llvm/lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index a4af391..51d9d75 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -1082,9 +1082,8 @@ 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 - const unsigned Ops(I->getNumOperands()); - std::string* opNames = new std::string[Ops]; - for (unsigned i = 0; i < Ops; i++) { + std::string* opNames = new std::string[I->getNumOperands()]; + for (unsigned i = 0; i < I->getNumOperands(); i++) { opNames[i] = getOpName(I->getOperand(i)); } @@ -1145,15 +1144,15 @@ namespace { const InvokeInst* inv = cast<InvokeInst>(I); Out << "std::vector<Value*> " << iName << "_params;"; nl(Out); - for (unsigned i = 0; i < inv->getNumOperands() - 3; ++i) { + for (unsigned i = 3; i < inv->getNumOperands(); ++i) { Out << iName << "_params.push_back(" << opNames[i] << ");"; nl(Out); } Out << "InvokeInst *" << iName << " = InvokeInst::Create(" - << opNames[Ops - 3] << ", " - << opNames[Ops - 2] << ", " - << opNames[Ops - 1] << ", " + << opNames[0] << ", " + << opNames[1] << ", " + << opNames[2] << ", " << iName << "_params.begin(), " << iName << "_params.end(), \""; printEscapedString(inv->getName()); Out << "\", " << bbname << ");"; @@ -1389,18 +1388,18 @@ namespace { if (call->getNumOperands() > 2) { Out << "std::vector<Value*> " << iName << "_params;"; nl(Out); - for (unsigned i = 0; i < call->getNumOperands() - 1; ++i) { + for (unsigned i = 1; i < call->getNumOperands(); ++i) { Out << iName << "_params.push_back(" << opNames[i] << ");"; nl(Out); } Out << "CallInst* " << iName << " = CallInst::Create(" - << opNames[Ops - 1] << ", " << iName << "_params.begin(), " + << opNames[0] << ", " << iName << "_params.begin(), " << iName << "_params.end(), \""; } else if (call->getNumOperands() == 2) { Out << "CallInst* " << iName << " = CallInst::Create(" - << opNames[Ops - 1] << ", " << opNames[0] << ", \""; + << opNames[0] << ", " << opNames[1] << ", \""; } else { - Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[Ops - 1] + Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0] << ", \""; } printEscapedString(call->getName()); |