cppbackend support for indbr

llvm-svn: 85312
This commit is contained in:
Chris Lattner 2009-10-27 21:24:48 +00:00
parent 42c979e8d3
commit e8628a0206
1 changed files with 14 additions and 3 deletions

View File

@ -1118,13 +1118,13 @@ namespace {
break; break;
} }
case Instruction::Switch: { case Instruction::Switch: {
const SwitchInst* sw = cast<SwitchInst>(I); const SwitchInst *SI = cast<SwitchInst>(I);
Out << "SwitchInst* " << iName << " = SwitchInst::Create(" Out << "SwitchInst* " << iName << " = SwitchInst::Create("
<< opNames[0] << ", " << opNames[0] << ", "
<< opNames[1] << ", " << opNames[1] << ", "
<< sw->getNumCases() << ", " << bbname << ");"; << SI->getNumCases() << ", " << bbname << ");";
nl(Out); nl(Out);
for (unsigned i = 2; i < sw->getNumOperands(); i += 2 ) { for (unsigned i = 2; i != SI->getNumOperands(); i += 2) {
Out << iName << "->addCase(" Out << iName << "->addCase("
<< opNames[i] << ", " << opNames[i] << ", "
<< opNames[i+1] << ");"; << opNames[i+1] << ");";
@ -1132,6 +1132,17 @@ namespace {
} }
break; break;
} }
case Instruction::IndBr: {
const IndBrInst *IBI = cast<IndBrInst>(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: { case Instruction::Invoke: {
const InvokeInst* inv = cast<InvokeInst>(I); const InvokeInst* inv = cast<InvokeInst>(I);
Out << "std::vector<Value*> " << iName << "_params;"; Out << "std::vector<Value*> " << iName << "_params;";