diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-06-07 19:05:06 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-06-07 19:05:06 +0000 |
commit | a3bba3371aef2d05d3c14f959231fdcef7d482da (patch) | |
tree | 3d9831ecb6fada64a1d7cb37085085618aa92472 /llvm/lib/Target/CppBackend/CPPBackend.cpp | |
parent | a54062ef0ce083355c61fcf48afda49eb6cf7aed (diff) | |
download | bcm5719-llvm-a3bba3371aef2d05d3c14f959231fdcef7d482da.tar.gz bcm5719-llvm-a3bba3371aef2d05d3c14f959231fdcef7d482da.zip |
Create new accessors to get arguments for call/invoke instructions. It breaks
encapsulation to force the users of these classes to know about the internal
data structure of the Operands structure. It also can lead to errors, like in
the MSIL writer.
llvm-svn: 105539
Diffstat (limited to 'llvm/lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index 45a0c84a4f0..1bf021b2f31 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -1150,16 +1150,18 @@ 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 = 0; i < inv->getNumArgOperands(); ++i) { Out << iName << "_params.push_back(" - << opNames[i] << ");"; + << getOpName(inv->getArgOperand(i)) << ");"; nl(Out); } + // FIXME: This shouldn't use magic numbers -3, -2, and -1. Out << "InvokeInst *" << iName << " = InvokeInst::Create(" - << opNames[Ops - 3] << ", " - << opNames[Ops - 2] << ", " - << opNames[Ops - 1] << ", " - << iName << "_params.begin(), " << iName << "_params.end(), \""; + << getOpName(inv->getCalledFunction()) << ", " + << getOpName(inv->getNormalDest()) << ", " + << getOpName(inv->getUnwindDest()) << ", " + << iName << "_params.begin(), " + << iName << "_params.end(), \""; printEscapedString(inv->getName()); Out << "\", " << bbname << ");"; nl(Out) << iName << "->setCallingConv("; |