diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-04-16 01:16:20 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-04-16 01:16:20 +0000 |
commit | 607a7ab3da72a2eb53553a520507cbb8068dd1d8 (patch) | |
tree | a24f057eee6bdd4edd74d509424b13bed1dda2de /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 5f0378251c4b682b51d194fce45da1587ed9c97b (diff) |
back out r101423 and r101397, they break llvm-gcc self-host on darwin10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index a4af3914f9..51d9d75fce 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/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()); |