aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-09-24 00:36:09 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-09-24 00:36:09 +0000
commit17f013265f00b8df07438a648c02873888477e36 (patch)
tree4a6147dd0c59a6c8ac2b5d0022bebc67478327c3
parent3d2c90f6dd7bc86a320b96bace7ad3fda631bf17 (diff)
downloadexternal_llvm-17f013265f00b8df07438a648c02873888477e36.zip
external_llvm-17f013265f00b8df07438a648c02873888477e36.tar.gz
external_llvm-17f013265f00b8df07438a648c02873888477e36.tar.bz2
Misc fixes for cpp backend.
PR17317. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191258 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index 6f27af4..0eb15d3 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -1161,8 +1161,7 @@ void CppWriter::printInstruction(const Instruction *I,
break;
}
case Instruction::Resume: {
- Out << "ResumeInst::Create(mod->getContext(), " << opNames[0]
- << ", " << bbname << ");";
+ Out << "ResumeInst::Create(" << opNames[0] << ", " << bbname << ");";
break;
}
case Instruction::Invoke: {
@@ -1176,7 +1175,7 @@ void CppWriter::printInstruction(const Instruction *I,
}
// FIXME: This shouldn't use magic numbers -3, -2, and -1.
Out << "InvokeInst *" << iName << " = InvokeInst::Create("
- << getOpName(inv->getCalledFunction()) << ", "
+ << getOpName(inv->getCalledValue()) << ", "
<< getOpName(inv->getNormalDest()) << ", "
<< getOpName(inv->getUnwindDest()) << ", "
<< iName << "_params, \"";
@@ -1590,6 +1589,20 @@ void CppWriter::printInstruction(const Instruction *I,
Out << "\");";
break;
}
+ case Instruction::LandingPad: {
+ const LandingPadInst *lpi = cast<LandingPadInst>(I);
+ Out << "LandingPadInst* " << iName << " = LandingPadInst::Create(";
+ printCppName(lpi->getType());
+ Out << ", " << opNames[0] << ", " << lpi->getNumClauses() << ", \"";
+ printEscapedString(lpi->getName());
+ Out << "\", " << bbname << ");";
+ nl(Out) << iName << "->setCleanup("
+ << (lpi->isCleanup() ? "true" : "false")
+ << ");";
+ for (unsigned i = 0, e = lpi->getNumClauses(); i != e; ++i)
+ nl(Out) << iName << "->addClause(" << opNames[i+1] << ");";
+ break;
+ }
}
DefinedValues.insert(I);
nl(Out);