diff options
author | Dan Gohman <gohman@apple.com> | 2008-06-09 14:12:10 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-06-09 14:12:10 +0000 |
commit | 6e384fc28e62593bc931e6b4de48deb050e6b7bf (patch) | |
tree | 82da5b4d2aa3ad95863b16ccb30af4375e613322 /llvm/lib/Target/CppBackend/CPPBackend.cpp | |
parent | 7be3fc7c978afe09e7647216189997efa6703857 (diff) | |
download | bcm5719-llvm-6e384fc28e62593bc931e6b4de48deb050e6b7bf.tar.gz bcm5719-llvm-6e384fc28e62593bc931e6b4de48deb050e6b7bf.zip |
CPPBackend support for extractvalue and insertvalue.
llvm-svn: 52147
Diffstat (limited to 'llvm/lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index 8b450304d47..f11d43eafba 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -1442,6 +1442,40 @@ namespace { Out << "\", " << bbname << ");"; break; } + case Instruction::ExtractValue: { + const ExtractValueInst *evi = cast<ExtractValueInst>(I); + Out << "std::vector<unsigned> " << iName << "_indices;"; + nl(Out); + for (unsigned i = 0; i < evi->getNumIndices(); ++i) { + Out << iName << "_indices.push_back(" + << evi->idx_begin()[i] << ");"; + nl(Out); + } + Out << "ExtractValueInst* " << getCppName(evi) + << " = ExtractValueInst::Create(" << opNames[0] + << ", " + << iName << "_indices.begin(), " << iName << "_indices.end(), \""; + printEscapedString(evi->getName()); + Out << "\", " << bbname << ");"; + break; + } + case Instruction::InsertValue: { + const InsertValueInst *ivi = cast<InsertValueInst>(I); + Out << "std::vector<unsigned> " << iName << "_indices;"; + nl(Out); + for (unsigned i = 0; i < ivi->getNumIndices(); ++i) { + Out << iName << "_indices.push_back(" + << ivi->idx_begin()[i] << ");"; + nl(Out); + } + Out << "InsertValueInst* " << getCppName(ivi) + << " = InsertValueInst::Create(" << opNames[0] + << ", " << opNames[1] << ", " + << iName << "_indices.begin(), " << iName << "_indices.end(), \""; + printEscapedString(ivi->getName()); + Out << "\", " << bbname << ");"; + break; + } } DefinedValues.insert(I); nl(Out); |