From 627b470981a833f847005556bea04e71f94da260 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 27 Oct 2009 21:24:48 +0000 Subject: [PATCH] cppbackend support for indbr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85312 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CppBackend/CPPBackend.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 9a6aa6366c5..171c6429dc9 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1118,13 +1118,13 @@ namespace { break; } case Instruction::Switch: { - const SwitchInst* sw = cast(I); + const SwitchInst *SI = cast(I); Out << "SwitchInst* " << iName << " = SwitchInst::Create(" << opNames[0] << ", " << opNames[1] << ", " - << sw->getNumCases() << ", " << bbname << ");"; + << SI->getNumCases() << ", " << bbname << ");"; nl(Out); - for (unsigned i = 2; i < sw->getNumOperands(); i += 2 ) { + for (unsigned i = 2; i != SI->getNumOperands(); i += 2) { Out << iName << "->addCase(" << opNames[i] << ", " << opNames[i+1] << ");"; @@ -1132,6 +1132,17 @@ namespace { } break; } + case Instruction::IndBr: { + const IndBrInst *IBI = cast(I); + Out << "IndBrInst *" << iName << " = IndBrInst::Create(" + << opNames[0] << ", " << IBI->getNumDestinations() << ");"; + nl(Out); + for (unsigned i = 1; i != IBI->getNumOperands(); ++i) { + Out << iName << "->addDestination(" << opNames[i] << ");"; + nl(Out); + } + break; + } case Instruction::Invoke: { const InvokeInst* inv = cast(I); Out << "std::vector " << iName << "_params;"; -- 2.34.1