aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/CppBackend
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-06-09 14:12:10 +0000
committerDan Gohman <gohman@apple.com>2008-06-09 14:12:10 +0000
commit75146a6725739fe11ca183f1c4c5518eb164b2e5 (patch)
treecd1c81a08497caab80226a1d92fb69def4a8860c /lib/Target/CppBackend
parent26825a84e97790adaffc55c6101b9fe2524fe1b7 (diff)
downloadexternal_llvm-75146a6725739fe11ca183f1c4c5518eb164b2e5.zip
external_llvm-75146a6725739fe11ca183f1c4c5518eb164b2e5.tar.gz
external_llvm-75146a6725739fe11ca183f1c4c5518eb164b2e5.tar.bz2
CPPBackend support for extractvalue and insertvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CppBackend')
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index 8b45030..f11d43e 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/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);